2009-12-11 17:24:15 +08:00
|
|
|
/*
|
|
|
|
* Copyright 2007-2008 Nouveau Project
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
* Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
* DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __NOUVEAU_BIOS_H__
|
|
|
|
#define __NOUVEAU_BIOS_H__
|
|
|
|
|
|
|
|
#include "nvreg.h"
|
|
|
|
|
|
|
|
#define DCB_MAX_NUM_ENTRIES 16
|
|
|
|
#define DCB_MAX_NUM_I2C_ENTRIES 16
|
|
|
|
#define DCB_MAX_NUM_GPIO_ENTRIES 32
|
|
|
|
#define DCB_MAX_NUM_CONNECTOR_ENTRIES 16
|
|
|
|
|
|
|
|
#define DCB_LOC_ON_CHIP 0
|
|
|
|
|
2011-10-12 14:48:48 +08:00
|
|
|
#define ROM16(x) le16_to_cpu(*(u16 *)&(x))
|
|
|
|
#define ROM32(x) le32_to_cpu(*(u32 *)&(x))
|
|
|
|
#define ROM48(x) ({ u8 *p = &(x); (u64)ROM16(p[4]) << 32 | ROM32(p[0]); })
|
|
|
|
#define ROM64(x) le64_to_cpu(*(u64 *)&(x))
|
|
|
|
#define ROMPTR(d,x) ({ \
|
|
|
|
struct drm_nouveau_private *dev_priv = (d)->dev_private; \
|
|
|
|
ROM16(x) ? &dev_priv->vbios.data[ROM16(x)] : NULL; \
|
|
|
|
})
|
2010-09-13 13:18:40 +08:00
|
|
|
|
|
|
|
struct bit_entry {
|
|
|
|
uint8_t id;
|
|
|
|
uint8_t version;
|
|
|
|
uint16_t length;
|
|
|
|
uint16_t offset;
|
|
|
|
uint8_t *data;
|
|
|
|
};
|
|
|
|
|
|
|
|
int bit_table(struct drm_device *, u8 id, struct bit_entry *);
|
|
|
|
|
2010-02-24 08:31:39 +08:00
|
|
|
enum dcb_connector_type {
|
|
|
|
DCB_CONNECTOR_VGA = 0x00,
|
|
|
|
DCB_CONNECTOR_TV_0 = 0x10,
|
|
|
|
DCB_CONNECTOR_TV_1 = 0x11,
|
|
|
|
DCB_CONNECTOR_TV_3 = 0x13,
|
|
|
|
DCB_CONNECTOR_DVI_I = 0x30,
|
|
|
|
DCB_CONNECTOR_DVI_D = 0x31,
|
2012-03-22 09:27:15 +08:00
|
|
|
DCB_CONNECTOR_DMS59_0 = 0x38,
|
|
|
|
DCB_CONNECTOR_DMS59_1 = 0x39,
|
2010-02-24 08:31:39 +08:00
|
|
|
DCB_CONNECTOR_LVDS = 0x40,
|
2011-04-18 07:57:48 +08:00
|
|
|
DCB_CONNECTOR_LVDS_SPWG = 0x41,
|
2010-02-24 08:31:39 +08:00
|
|
|
DCB_CONNECTOR_DP = 0x46,
|
|
|
|
DCB_CONNECTOR_eDP = 0x47,
|
|
|
|
DCB_CONNECTOR_HDMI_0 = 0x60,
|
|
|
|
DCB_CONNECTOR_HDMI_1 = 0x61,
|
2012-01-12 14:17:16 +08:00
|
|
|
DCB_CONNECTOR_DMS59_DP0 = 0x64,
|
|
|
|
DCB_CONNECTOR_DMS59_DP1 = 0x65,
|
2010-02-24 09:09:20 +08:00
|
|
|
DCB_CONNECTOR_NONE = 0xff
|
2010-02-24 08:31:39 +08:00
|
|
|
};
|
|
|
|
|
2012-07-11 08:44:20 +08:00
|
|
|
#include <subdev/bios/dcb.h>
|
2009-12-11 17:24:15 +08:00
|
|
|
|
2010-02-24 07:56:18 +08:00
|
|
|
struct dcb_table {
|
2009-12-11 17:24:15 +08:00
|
|
|
uint8_t version;
|
2010-02-24 07:56:18 +08:00
|
|
|
int entries;
|
2012-07-11 08:44:20 +08:00
|
|
|
struct dcb_output entry[DCB_MAX_NUM_ENTRIES];
|
2009-12-11 17:24:15 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
enum nouveau_or {
|
2012-07-11 08:44:20 +08:00
|
|
|
DCB_OUTPUT_A = (1 << 0),
|
|
|
|
DCB_OUTPUT_B = (1 << 1),
|
|
|
|
DCB_OUTPUT_C = (1 << 2)
|
2009-12-11 17:24:15 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
enum LVDS_script {
|
|
|
|
/* Order *does* matter here */
|
|
|
|
LVDS_INIT = 1,
|
|
|
|
LVDS_RESET,
|
|
|
|
LVDS_BACKLIGHT_ON,
|
|
|
|
LVDS_BACKLIGHT_OFF,
|
|
|
|
LVDS_PANEL_ON,
|
|
|
|
LVDS_PANEL_OFF
|
|
|
|
};
|
|
|
|
|
2010-02-24 08:03:05 +08:00
|
|
|
struct nvbios {
|
|
|
|
struct drm_device *dev;
|
2010-09-13 13:18:40 +08:00
|
|
|
enum {
|
|
|
|
NVBIOS_BMP,
|
|
|
|
NVBIOS_BIT
|
|
|
|
} type;
|
|
|
|
uint16_t offset;
|
2012-03-07 11:22:50 +08:00
|
|
|
uint32_t length;
|
|
|
|
uint8_t *data;
|
2010-02-24 08:03:05 +08:00
|
|
|
|
2009-12-11 17:24:15 +08:00
|
|
|
uint8_t chip_version;
|
|
|
|
|
|
|
|
uint32_t dactestval;
|
|
|
|
uint32_t tvdactestval;
|
|
|
|
uint8_t digital_min_front_porch;
|
|
|
|
bool fp_no_ddc;
|
|
|
|
|
2011-02-03 18:10:49 +08:00
|
|
|
spinlock_t lock;
|
2010-02-09 08:22:29 +08:00
|
|
|
|
2009-12-11 17:24:15 +08:00
|
|
|
bool execute;
|
|
|
|
|
|
|
|
uint8_t major_version;
|
|
|
|
uint8_t feature_byte;
|
|
|
|
bool is_mobile;
|
|
|
|
|
|
|
|
uint32_t fmaxvco, fminvco;
|
|
|
|
|
|
|
|
bool old_style_init;
|
|
|
|
uint16_t init_script_tbls_ptr;
|
|
|
|
uint16_t extra_init_script_tbl_ptr;
|
|
|
|
uint16_t macro_index_tbl_ptr;
|
|
|
|
uint16_t macro_tbl_ptr;
|
|
|
|
uint16_t condition_tbl_ptr;
|
|
|
|
uint16_t io_condition_tbl_ptr;
|
|
|
|
uint16_t io_flag_condition_tbl_ptr;
|
|
|
|
uint16_t init_function_tbl_ptr;
|
|
|
|
|
|
|
|
uint16_t pll_limit_tbl_ptr;
|
|
|
|
uint16_t ram_restrict_tbl_ptr;
|
2009-12-15 08:37:31 +08:00
|
|
|
uint8_t ram_restrict_group_count;
|
2009-12-11 17:24:15 +08:00
|
|
|
|
|
|
|
uint16_t some_script_ptr; /* BIT I + 14 */
|
|
|
|
uint16_t init96_tbl_ptr; /* BIT I + 16 */
|
|
|
|
|
2010-02-24 07:56:18 +08:00
|
|
|
struct dcb_table dcb;
|
2009-12-11 17:24:15 +08:00
|
|
|
|
|
|
|
struct {
|
|
|
|
int crtchead;
|
|
|
|
} state;
|
|
|
|
|
|
|
|
struct {
|
2012-07-11 08:44:20 +08:00
|
|
|
struct dcb_output *output;
|
2011-07-06 19:21:42 +08:00
|
|
|
int crtc;
|
2009-12-11 17:24:15 +08:00
|
|
|
uint16_t script_table_ptr;
|
|
|
|
} display;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
uint16_t fptablepointer; /* also used by tmds */
|
|
|
|
uint16_t fpxlatetableptr;
|
|
|
|
int xlatwidth;
|
|
|
|
uint16_t lvdsmanufacturerpointer;
|
|
|
|
uint16_t fpxlatemanufacturertableptr;
|
|
|
|
uint16_t mode_ptr;
|
|
|
|
uint16_t xlated_entry;
|
|
|
|
bool power_off_for_reset;
|
|
|
|
bool reset_after_pclk_change;
|
|
|
|
bool dual_link;
|
|
|
|
bool link_c_increment;
|
|
|
|
bool if_is_24bit;
|
|
|
|
int duallink_transition_clk;
|
|
|
|
uint8_t strapless_is_24bit;
|
|
|
|
uint8_t *edid;
|
|
|
|
|
|
|
|
/* will need resetting after suspend */
|
|
|
|
int last_script_invoc;
|
|
|
|
bool lvds_init_run;
|
|
|
|
} fp;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
uint16_t output0_script_ptr;
|
|
|
|
uint16_t output1_script_ptr;
|
|
|
|
} tmds;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
uint16_t mem_init_tbl_ptr;
|
|
|
|
uint16_t sdr_seq_tbl_ptr;
|
|
|
|
uint16_t ddr_seq_tbl_ptr;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
uint8_t crt, tv, panel;
|
|
|
|
} i2c_indices;
|
|
|
|
|
|
|
|
uint16_t lvds_single_a_script_ptr;
|
|
|
|
} legacy;
|
|
|
|
};
|
|
|
|
|
2012-07-10 10:20:17 +08:00
|
|
|
void *olddcb_table(struct drm_device *);
|
|
|
|
void *olddcb_outp(struct drm_device *, u8 idx);
|
|
|
|
int olddcb_outp_foreach(struct drm_device *, void *data,
|
2011-11-10 13:42:55 +08:00
|
|
|
int (*)(struct drm_device *, void *, int idx, u8 *outp));
|
2012-07-11 08:44:20 +08:00
|
|
|
u8 *olddcb_conntab(struct drm_device *);
|
|
|
|
u8 *olddcb_conn(struct drm_device *, u8 idx);
|
2011-11-10 13:42:55 +08:00
|
|
|
|
2009-12-11 17:24:15 +08:00
|
|
|
#endif
|