Commit 04a39c57 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau: merge nvbios and nouveau_bios_info

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 7f245b20
...@@ -311,11 +311,11 @@ valid_reg(struct nvbios *bios, uint32_t reg) ...@@ -311,11 +311,11 @@ valid_reg(struct nvbios *bios, uint32_t reg)
/* C51 has misaligned regs on purpose. Marvellous */ /* C51 has misaligned regs on purpose. Marvellous */
if (reg & 0x2 || if (reg & 0x2 ||
(reg & 0x1 && dev_priv->VBIOS.pub.chip_version != 0x51)) (reg & 0x1 && dev_priv->vbios.chip_version != 0x51))
NV_ERROR(dev, "======= misaligned reg 0x%08X =======\n", reg); NV_ERROR(dev, "======= misaligned reg 0x%08X =======\n", reg);
/* warn on C51 regs that haven't been verified accessible in tracing */ /* warn on C51 regs that haven't been verified accessible in tracing */
if (reg & 0x1 && dev_priv->VBIOS.pub.chip_version == 0x51 && if (reg & 0x1 && dev_priv->vbios.chip_version == 0x51 &&
reg != 0x130d && reg != 0x1311 && reg != 0x60081d) reg != 0x130d && reg != 0x1311 && reg != 0x60081d)
NV_WARN(dev, "=== C51 misaligned reg 0x%08X not verified ===\n", NV_WARN(dev, "=== C51 misaligned reg 0x%08X not verified ===\n",
reg); reg);
...@@ -420,7 +420,7 @@ bios_wr32(struct nvbios *bios, uint32_t reg, uint32_t data) ...@@ -420,7 +420,7 @@ bios_wr32(struct nvbios *bios, uint32_t reg, uint32_t data)
LOG_OLD_VALUE(bios_rd32(bios, reg)); LOG_OLD_VALUE(bios_rd32(bios, reg));
BIOSLOG(bios, " Write: Reg: 0x%08X, Data: 0x%08X\n", reg, data); BIOSLOG(bios, " Write: Reg: 0x%08X, Data: 0x%08X\n", reg, data);
if (dev_priv->VBIOS.execute) { if (dev_priv->vbios.execute) {
still_alive(); still_alive();
nv_wr32(bios->dev, reg, data); nv_wr32(bios->dev, reg, data);
} }
...@@ -647,7 +647,7 @@ nv50_pll_set(struct drm_device *dev, uint32_t reg, uint32_t clk) ...@@ -647,7 +647,7 @@ nv50_pll_set(struct drm_device *dev, uint32_t reg, uint32_t clk)
reg0 = (reg0 & 0xfff8ffff) | (pll.log2P << 16); reg0 = (reg0 & 0xfff8ffff) | (pll.log2P << 16);
reg1 = (reg1 & 0xffff0000) | (pll.N1 << 8) | pll.M1; reg1 = (reg1 & 0xffff0000) | (pll.N1 << 8) | pll.M1;
if (dev_priv->VBIOS.execute) { if (dev_priv->vbios.execute) {
still_alive(); still_alive();
nv_wr32(dev, reg + 4, reg1); nv_wr32(dev, reg + 4, reg1);
nv_wr32(dev, reg + 0, reg0); nv_wr32(dev, reg + 0, reg0);
...@@ -689,7 +689,7 @@ setPLL(struct nvbios *bios, uint32_t reg, uint32_t clk) ...@@ -689,7 +689,7 @@ setPLL(struct nvbios *bios, uint32_t reg, uint32_t clk)
static int dcb_entry_idx_from_crtchead(struct drm_device *dev) static int dcb_entry_idx_from_crtchead(struct drm_device *dev)
{ {
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nvbios *bios = &dev_priv->VBIOS; struct nvbios *bios = &dev_priv->vbios;
/* /*
* For the results of this function to be correct, CR44 must have been * For the results of this function to be correct, CR44 must have been
...@@ -713,7 +713,7 @@ static struct nouveau_i2c_chan * ...@@ -713,7 +713,7 @@ static struct nouveau_i2c_chan *
init_i2c_device_find(struct drm_device *dev, int i2c_index) init_i2c_device_find(struct drm_device *dev, int i2c_index)
{ {
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
struct dcb_table *dcb = &dev_priv->VBIOS.dcb; struct dcb_table *dcb = &dev_priv->vbios.dcb;
if (i2c_index == 0xff) { if (i2c_index == 0xff) {
/* note: dcb_entry_idx_from_crtchead needs pre-script set-up */ /* note: dcb_entry_idx_from_crtchead needs pre-script set-up */
...@@ -745,7 +745,7 @@ get_tmds_index_reg(struct drm_device *dev, uint8_t mlv) ...@@ -745,7 +745,7 @@ get_tmds_index_reg(struct drm_device *dev, uint8_t mlv)
*/ */
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nvbios *bios = &dev_priv->VBIOS; struct nvbios *bios = &dev_priv->vbios;
const int pramdac_offset[13] = { const int pramdac_offset[13] = {
0, 0, 0x8, 0, 0x2000, 0, 0, 0, 0x2008, 0, 0, 0, 0x2000 }; 0, 0, 0x8, 0, 0x2000, 0, 0, 0, 0x2008, 0, 0, 0, 0x2000 };
const uint32_t pramdac_table[4] = { const uint32_t pramdac_table[4] = {
...@@ -3124,7 +3124,7 @@ run_digital_op_script(struct drm_device *dev, uint16_t scriptptr, ...@@ -3124,7 +3124,7 @@ run_digital_op_script(struct drm_device *dev, uint16_t scriptptr,
struct dcb_entry *dcbent, int head, bool dl) struct dcb_entry *dcbent, int head, bool dl)
{ {
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nvbios *bios = &dev_priv->VBIOS; struct nvbios *bios = &dev_priv->vbios;
struct init_exec iexec = {true, false}; struct init_exec iexec = {true, false};
NV_TRACE(dev, "0x%04X: Parsing digital output script table\n", NV_TRACE(dev, "0x%04X: Parsing digital output script table\n",
...@@ -3141,7 +3141,7 @@ run_digital_op_script(struct drm_device *dev, uint16_t scriptptr, ...@@ -3141,7 +3141,7 @@ run_digital_op_script(struct drm_device *dev, uint16_t scriptptr,
static int call_lvds_manufacturer_script(struct drm_device *dev, struct dcb_entry *dcbent, int head, enum LVDS_script script) static int call_lvds_manufacturer_script(struct drm_device *dev, struct dcb_entry *dcbent, int head, enum LVDS_script script)
{ {
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nvbios *bios = &dev_priv->VBIOS; struct nvbios *bios = &dev_priv->vbios;
uint8_t sub = bios->data[bios->fp.xlated_entry + script] + (bios->fp.link_c_increment && dcbent->or & OUTPUT_C ? 1 : 0); uint8_t sub = bios->data[bios->fp.xlated_entry + script] + (bios->fp.link_c_increment && dcbent->or & OUTPUT_C ? 1 : 0);
uint16_t scriptofs = ROM16(bios->data[bios->init_script_tbls_ptr + sub * 2]); uint16_t scriptofs = ROM16(bios->data[bios->init_script_tbls_ptr + sub * 2]);
...@@ -3195,7 +3195,7 @@ static int run_lvds_table(struct drm_device *dev, struct dcb_entry *dcbent, int ...@@ -3195,7 +3195,7 @@ static int run_lvds_table(struct drm_device *dev, struct dcb_entry *dcbent, int
* of a list of pxclks and script pointers. * of a list of pxclks and script pointers.
*/ */
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nvbios *bios = &dev_priv->VBIOS; struct nvbios *bios = &dev_priv->vbios;
unsigned int outputset = (dcbent->or == 4) ? 1 : 0; unsigned int outputset = (dcbent->or == 4) ? 1 : 0;
uint16_t scriptptr = 0, clktable; uint16_t scriptptr = 0, clktable;
uint8_t clktableptr = 0; uint8_t clktableptr = 0;
...@@ -3262,7 +3262,7 @@ int call_lvds_script(struct drm_device *dev, struct dcb_entry *dcbent, int head, ...@@ -3262,7 +3262,7 @@ int call_lvds_script(struct drm_device *dev, struct dcb_entry *dcbent, int head,
*/ */
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nvbios *bios = &dev_priv->VBIOS; struct nvbios *bios = &dev_priv->vbios;
uint8_t lvds_ver = bios->data[bios->fp.lvdsmanufacturerpointer]; uint8_t lvds_ver = bios->data[bios->fp.lvdsmanufacturerpointer];
uint32_t sel_clk_binding, sel_clk; uint32_t sel_clk_binding, sel_clk;
int ret; int ret;
...@@ -3396,7 +3396,7 @@ static int parse_fp_mode_table(struct drm_device *dev, struct nvbios *bios) ...@@ -3396,7 +3396,7 @@ static int parse_fp_mode_table(struct drm_device *dev, struct nvbios *bios)
#ifndef __powerpc__ #ifndef __powerpc__
NV_ERROR(dev, "Pointer to flat panel table invalid\n"); NV_ERROR(dev, "Pointer to flat panel table invalid\n");
#endif #endif
bios->pub.digital_min_front_porch = 0x4b; bios->digital_min_front_porch = 0x4b;
return 0; return 0;
} }
...@@ -3429,7 +3429,7 @@ static int parse_fp_mode_table(struct drm_device *dev, struct nvbios *bios) ...@@ -3429,7 +3429,7 @@ static int parse_fp_mode_table(struct drm_device *dev, struct nvbios *bios)
* fptable[4] is the minimum * fptable[4] is the minimum
* RAMDAC_FP_HCRTC -> RAMDAC_FP_HSYNC_START gap * RAMDAC_FP_HCRTC -> RAMDAC_FP_HSYNC_START gap
*/ */
bios->pub.digital_min_front_porch = fptable[4]; bios->digital_min_front_porch = fptable[4];
ofs = -7; ofs = -7;
break; break;
default: default:
...@@ -3468,7 +3468,7 @@ static int parse_fp_mode_table(struct drm_device *dev, struct nvbios *bios) ...@@ -3468,7 +3468,7 @@ static int parse_fp_mode_table(struct drm_device *dev, struct nvbios *bios)
/* nv4x cards need both a strap value and fpindex of 0xf to use DDC */ /* nv4x cards need both a strap value and fpindex of 0xf to use DDC */
if (lth.lvds_ver > 0x10) if (lth.lvds_ver > 0x10)
bios->pub.fp_no_ddc = fpstrapping != 0xf || fpindex != 0xf; bios->fp_no_ddc = fpstrapping != 0xf || fpindex != 0xf;
/* /*
* If either the strap or xlated fpindex value are 0xf there is no * If either the strap or xlated fpindex value are 0xf there is no
...@@ -3492,7 +3492,7 @@ static int parse_fp_mode_table(struct drm_device *dev, struct nvbios *bios) ...@@ -3492,7 +3492,7 @@ static int parse_fp_mode_table(struct drm_device *dev, struct nvbios *bios)
bool nouveau_bios_fp_mode(struct drm_device *dev, struct drm_display_mode *mode) bool nouveau_bios_fp_mode(struct drm_device *dev, struct drm_display_mode *mode)
{ {
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nvbios *bios = &dev_priv->VBIOS; struct nvbios *bios = &dev_priv->vbios;
uint8_t *mode_entry = &bios->data[bios->fp.mode_ptr]; uint8_t *mode_entry = &bios->data[bios->fp.mode_ptr];
if (!mode) /* just checking whether we can produce a mode */ if (!mode) /* just checking whether we can produce a mode */
...@@ -3563,11 +3563,11 @@ int nouveau_bios_parse_lvds_table(struct drm_device *dev, int pxclk, bool *dl, b ...@@ -3563,11 +3563,11 @@ int nouveau_bios_parse_lvds_table(struct drm_device *dev, int pxclk, bool *dl, b
* until later, when this function should be called with non-zero pxclk * until later, when this function should be called with non-zero pxclk
*/ */
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nvbios *bios = &dev_priv->VBIOS; struct nvbios *bios = &dev_priv->vbios;
int fpstrapping = get_fp_strap(dev, bios), lvdsmanufacturerindex = 0; int fpstrapping = get_fp_strap(dev, bios), lvdsmanufacturerindex = 0;
struct lvdstableheader lth; struct lvdstableheader lth;
uint16_t lvdsofs; uint16_t lvdsofs;
int ret, chip_version = bios->pub.chip_version; int ret, chip_version = bios->chip_version;
ret = parse_lvds_manufacturer_table_header(dev, bios, &lth); ret = parse_lvds_manufacturer_table_header(dev, bios, &lth);
if (ret) if (ret)
...@@ -3683,7 +3683,7 @@ bios_output_config_match(struct drm_device *dev, struct dcb_entry *dcbent, ...@@ -3683,7 +3683,7 @@ bios_output_config_match(struct drm_device *dev, struct dcb_entry *dcbent,
uint16_t record, int record_len, int record_nr) uint16_t record, int record_len, int record_nr)
{ {
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nvbios *bios = &dev_priv->VBIOS; struct nvbios *bios = &dev_priv->vbios;
uint32_t entry; uint32_t entry;
uint16_t table; uint16_t table;
int i, v; int i, v;
...@@ -3717,7 +3717,7 @@ nouveau_bios_dp_table(struct drm_device *dev, struct dcb_entry *dcbent, ...@@ -3717,7 +3717,7 @@ nouveau_bios_dp_table(struct drm_device *dev, struct dcb_entry *dcbent,
int *length) int *length)
{ {
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nvbios *bios = &dev_priv->VBIOS; struct nvbios *bios = &dev_priv->vbios;
uint8_t *table; uint8_t *table;
if (!bios->display.dp_table_ptr) { if (!bios->display.dp_table_ptr) {
...@@ -3766,7 +3766,7 @@ nouveau_bios_run_display_table(struct drm_device *dev, struct dcb_entry *dcbent, ...@@ -3766,7 +3766,7 @@ nouveau_bios_run_display_table(struct drm_device *dev, struct dcb_entry *dcbent,
*/ */
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nvbios *bios = &dev_priv->VBIOS; struct nvbios *bios = &dev_priv->vbios;
uint8_t *table = &bios->data[bios->display.script_table_ptr]; uint8_t *table = &bios->data[bios->display.script_table_ptr];
uint8_t *otable = NULL; uint8_t *otable = NULL;
uint16_t script; uint16_t script;
...@@ -3919,8 +3919,8 @@ int run_tmds_table(struct drm_device *dev, struct dcb_entry *dcbent, int head, i ...@@ -3919,8 +3919,8 @@ int run_tmds_table(struct drm_device *dev, struct dcb_entry *dcbent, int head, i
*/ */
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nvbios *bios = &dev_priv->VBIOS; struct nvbios *bios = &dev_priv->vbios;
int cv = bios->pub.chip_version; int cv = bios->chip_version;
uint16_t clktable = 0, scriptptr; uint16_t clktable = 0, scriptptr;
uint32_t sel_clk_binding, sel_clk; uint32_t sel_clk_binding, sel_clk;
...@@ -3979,8 +3979,8 @@ int get_pll_limits(struct drm_device *dev, uint32_t limit_match, struct pll_lims ...@@ -3979,8 +3979,8 @@ int get_pll_limits(struct drm_device *dev, uint32_t limit_match, struct pll_lims
*/ */
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nvbios *bios = &dev_priv->VBIOS; struct nvbios *bios = &dev_priv->vbios;
int cv = bios->pub.chip_version, pllindex = 0; int cv = bios->chip_version, pllindex = 0;
uint8_t pll_lim_ver = 0, headerlen = 0, recordlen = 0, entries = 0; uint8_t pll_lim_ver = 0, headerlen = 0, recordlen = 0, entries = 0;
uint32_t crystal_strap_mask, crystal_straps; uint32_t crystal_strap_mask, crystal_straps;
...@@ -4333,7 +4333,7 @@ static void parse_bios_version(struct drm_device *dev, struct nvbios *bios, uint ...@@ -4333,7 +4333,7 @@ static void parse_bios_version(struct drm_device *dev, struct nvbios *bios, uint
*/ */
bios->major_version = bios->data[offset + 3]; bios->major_version = bios->data[offset + 3];
bios->pub.chip_version = bios->data[offset + 2]; bios->chip_version = bios->data[offset + 2];
NV_TRACE(dev, "Bios version %02x.%02x.%02x.%02x\n", NV_TRACE(dev, "Bios version %02x.%02x.%02x.%02x\n",
bios->data[offset + 3], bios->data[offset + 2], bios->data[offset + 3], bios->data[offset + 2],
bios->data[offset + 1], bios->data[offset]); bios->data[offset + 1], bios->data[offset]);
...@@ -4403,7 +4403,7 @@ static int parse_bit_A_tbl_entry(struct drm_device *dev, struct nvbios *bios, st ...@@ -4403,7 +4403,7 @@ static int parse_bit_A_tbl_entry(struct drm_device *dev, struct nvbios *bios, st
} }
/* First entry is normal dac, 2nd tv-out perhaps? */ /* First entry is normal dac, 2nd tv-out perhaps? */
bios->pub.dactestval = ROM32(bios->data[load_table_ptr + headerlen]) & 0x3ff; bios->dactestval = ROM32(bios->data[load_table_ptr + headerlen]) & 0x3ff;
return 0; return 0;
} }
...@@ -4527,8 +4527,8 @@ static int parse_bit_i_tbl_entry(struct drm_device *dev, struct nvbios *bios, st ...@@ -4527,8 +4527,8 @@ static int parse_bit_i_tbl_entry(struct drm_device *dev, struct nvbios *bios, st
return -ENOSYS; return -ENOSYS;
} }
bios->pub.dactestval = ROM32(bios->data[daccmpoffset + dacheaderlen]); bios->dactestval = ROM32(bios->data[daccmpoffset + dacheaderlen]);
bios->pub.tvdactestval = ROM32(bios->data[daccmpoffset + dacheaderlen + 4]); bios->tvdactestval = ROM32(bios->data[daccmpoffset + dacheaderlen + 4]);
return 0; return 0;
} }
...@@ -4801,7 +4801,7 @@ static int parse_bmp_structure(struct drm_device *dev, struct nvbios *bios, unsi ...@@ -4801,7 +4801,7 @@ static int parse_bmp_structure(struct drm_device *dev, struct nvbios *bios, unsi
bios->dcb.i2c[0].read = NV_CIO_CRE_DDC_STATUS__INDEX; bios->dcb.i2c[0].read = NV_CIO_CRE_DDC_STATUS__INDEX;
bios->dcb.i2c[1].write = NV_CIO_CRE_DDC0_WR__INDEX; bios->dcb.i2c[1].write = NV_CIO_CRE_DDC0_WR__INDEX;
bios->dcb.i2c[1].read = NV_CIO_CRE_DDC0_STATUS__INDEX; bios->dcb.i2c[1].read = NV_CIO_CRE_DDC0_STATUS__INDEX;
bios->pub.digital_min_front_porch = 0x4b; bios->digital_min_front_porch = 0x4b;
bios->fmaxvco = 256000; bios->fmaxvco = 256000;
bios->fminvco = 128000; bios->fminvco = 128000;
bios->fp.duallink_transition_clk = 90000; bios->fp.duallink_transition_clk = 90000;
...@@ -5047,7 +5047,7 @@ struct dcb_gpio_entry * ...@@ -5047,7 +5047,7 @@ struct dcb_gpio_entry *
nouveau_bios_gpio_entry(struct drm_device *dev, enum dcb_gpio_tag tag) nouveau_bios_gpio_entry(struct drm_device *dev, enum dcb_gpio_tag tag)
{ {
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nvbios *bios = &dev_priv->VBIOS; struct nvbios *bios = &dev_priv->vbios;
int i; int i;
for (i = 0; i < bios->dcb.gpio.entries; i++) { for (i = 0; i < bios->dcb.gpio.entries; i++) {
...@@ -5160,7 +5160,7 @@ struct dcb_connector_table_entry * ...@@ -5160,7 +5160,7 @@ struct dcb_connector_table_entry *
nouveau_bios_connector_entry(struct drm_device *dev, int index) nouveau_bios_connector_entry(struct drm_device *dev, int index)
{ {
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nvbios *bios = &dev_priv->VBIOS; struct nvbios *bios = &dev_priv->vbios;
struct dcb_connector_table_entry *cte; struct dcb_connector_table_entry *cte;
if (index >= bios->dcb.connector.entries) if (index >= bios->dcb.connector.entries)
...@@ -5823,7 +5823,7 @@ static int load_nv17_hw_sequencer_ucode(struct drm_device *dev, ...@@ -5823,7 +5823,7 @@ static int load_nv17_hw_sequencer_ucode(struct drm_device *dev,
uint8_t *nouveau_bios_embedded_edid(struct drm_device *dev) uint8_t *nouveau_bios_embedded_edid(struct drm_device *dev)
{ {
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nvbios *bios = &dev_priv->VBIOS; struct nvbios *bios = &dev_priv->vbios;
const uint8_t edid_sig[] = { const uint8_t edid_sig[] = {
0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 }; 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 };
uint16_t offset = 0; uint16_t offset = 0;
...@@ -5856,7 +5856,7 @@ nouveau_bios_run_init_table(struct drm_device *dev, uint16_t table, ...@@ -5856,7 +5856,7 @@ nouveau_bios_run_init_table(struct drm_device *dev, uint16_t table,
struct dcb_entry *dcbent) struct dcb_entry *dcbent)
{ {
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nvbios *bios = &dev_priv->VBIOS; struct nvbios *bios = &dev_priv->vbios;
struct init_exec iexec = { true, false }; struct init_exec iexec = { true, false };
mutex_lock(&bios->lock); mutex_lock(&bios->lock);
...@@ -5869,7 +5869,7 @@ nouveau_bios_run_init_table(struct drm_device *dev, uint16_t table, ...@@ -5869,7 +5869,7 @@ nouveau_bios_run_init_table(struct drm_device *dev, uint16_t table,
static bool NVInitVBIOS(struct drm_device *dev) static bool NVInitVBIOS(struct drm_device *dev)
{ {
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nvbios *bios = &dev_priv->VBIOS; struct nvbios *bios = &dev_priv->vbios;
memset(bios, 0, sizeof(struct nvbios)); memset(bios, 0, sizeof(struct nvbios));
mutex_init(&bios->lock); mutex_init(&bios->lock);
...@@ -5885,7 +5885,7 @@ static bool NVInitVBIOS(struct drm_device *dev) ...@@ -5885,7 +5885,7 @@ static bool NVInitVBIOS(struct drm_device *dev)
static int nouveau_parse_vbios_struct(struct drm_device *dev) static int nouveau_parse_vbios_struct(struct drm_device *dev)
{ {
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nvbios *bios = &dev_priv->VBIOS; struct nvbios *bios = &dev_priv->vbios;
const uint8_t bit_signature[] = { 0xff, 0xb8, 'B', 'I', 'T' }; const uint8_t bit_signature[] = { 0xff, 0xb8, 'B', 'I', 'T' };
const uint8_t bmp_signature[] = { 0xff, 0x7f, 'N', 'V', 0x0 }; const uint8_t bmp_signature[] = { 0xff, 0x7f, 'N', 'V', 0x0 };
int offset; int offset;
...@@ -5912,7 +5912,7 @@ int ...@@ -5912,7 +5912,7 @@ int
nouveau_run_vbios_init(struct drm_device *dev) nouveau_run_vbios_init(struct drm_device *dev)
{ {
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nvbios *bios = &dev_priv->VBIOS; struct nvbios *bios = &dev_priv->vbios;
int i, ret = 0; int i, ret = 0;
NVLockVgaCrtcs(dev, false); NVLockVgaCrtcs(dev, false);
...@@ -5959,7 +5959,7 @@ static void ...@@ -5959,7 +5959,7 @@ static void
nouveau_bios_i2c_devices_takedown(struct drm_device *dev) nouveau_bios_i2c_devices_takedown(struct drm_device *dev)
{ {
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nvbios *bios = &dev_priv->VBIOS; struct nvbios *bios = &dev_priv->vbios;
struct dcb_i2c_entry *entry; struct dcb_i2c_entry *entry;
int i; int i;
...@@ -5972,13 +5972,11 @@ int ...@@ -5972,13 +5972,11 @@ int
nouveau_bios_init(struct drm_device *dev) nouveau_bios_init(struct drm_device *dev)
{ {
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nvbios *bios = &dev_priv->VBIOS; struct nvbios *bios = &dev_priv->vbios;
uint32_t saved_nv_pextdev_boot_0; uint32_t saved_nv_pextdev_boot_0;
bool was_locked; bool was_locked;
int ret; int ret;
dev_priv->vbios = &bios->pub;
if (!NVInitVBIOS(dev)) if (!NVInitVBIOS(dev))
return -ENODEV; return -ENODEV;
...@@ -6020,10 +6018,8 @@ nouveau_bios_init(struct drm_device *dev) ...@@ -6020,10 +6018,8 @@ nouveau_bios_init(struct drm_device *dev)
bios_wr32(bios, NV_PEXTDEV_BOOT_0, saved_nv_pextdev_boot_0); bios_wr32(bios, NV_PEXTDEV_BOOT_0, saved_nv_pextdev_boot_0);
ret = nouveau_run_vbios_init(dev); ret = nouveau_run_vbios_init(dev);
if (ret) { if (ret)
dev_priv->vbios = NULL;
return ret; return ret;
}
/* feature_byte on BMP is poor, but init always sets CR4B */ /* feature_byte on BMP is poor, but init always sets CR4B */
was_locked = NVLockVgaCrtcs(dev, false); was_locked = NVLockVgaCrtcs(dev, false);
......
...@@ -186,18 +186,15 @@ struct pll_lims { ...@@ -186,18 +186,15 @@ struct pll_lims {
int refclk; int refclk;
}; };
struct nouveau_bios_info { struct nvbios {
struct drm_device *dev;
uint8_t chip_version; uint8_t chip_version;
uint32_t dactestval; uint32_t dactestval;
uint32_t tvdactestval; uint32_t tvdactestval;
uint8_t digital_min_front_porch; uint8_t digital_min_front_porch;
bool fp_no_ddc; bool fp_no_ddc;
};
struct nvbios {
struct drm_device *dev;
struct nouveau_bios_info pub;
struct mutex lock; struct mutex lock;
......
...@@ -274,7 +274,7 @@ getMNP_single(struct drm_device *dev, struct pll_lims *pll_lim, int clk, ...@@ -274,7 +274,7 @@ getMNP_single(struct drm_device *dev, struct pll_lims *pll_lim, int clk,
* returns calculated clock * returns calculated clock
*/ */
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
int cv = dev_priv->vbios->chip_version; int cv = dev_priv->vbios.chip_version;
int minvco = pll_lim->vco1.minfreq, maxvco = pll_lim->vco1.maxfreq; int minvco = pll_lim->vco1.minfreq, maxvco = pll_lim->vco1.maxfreq;
int minM = pll_lim->vco1.min_m, maxM = pll_lim->vco1.max_m; int minM = pll_lim->vco1.min_m, maxM = pll_lim->vco1.max_m;
int minN = pll_lim->vco1.min_n, maxN = pll_lim->vco1.max_n; int minN = pll_lim->vco1.min_n, maxN = pll_lim->vco1.max_n;
...@@ -373,7 +373,7 @@ getMNP_double(struct drm_device *dev, struct pll_lims *pll_lim, int clk, ...@@ -373,7 +373,7 @@ getMNP_double(struct drm_device *dev, struct pll_lims *pll_lim, int clk,
* returns calculated clock * returns calculated clock
*/ */
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
int chip_version = dev_priv->vbios->chip_version; int chip_version = dev_priv->vbios.chip_version;
int minvco1 = pll_lim->vco1.minfreq, maxvco1 = pll_lim->vco1.maxfreq; int minvco1 = pll_lim->vco1.minfreq, maxvco1 = pll_lim->vco1.maxfreq;
int minvco2 = pll_lim->vco2.minfreq, maxvco2 = pll_lim->vco2.maxfreq; int minvco2 = pll_lim->vco2.minfreq, maxvco2 = pll_lim->vco2.maxfreq;
int minU1 = pll_lim->vco1.min_inputfreq, minU2 = pll_lim->vco2.min_inputfreq; int minU1 = pll_lim->vco1.min_inputfreq, minU2 = pll_lim->vco2.min_inputfreq;
......
...@@ -680,7 +680,7 @@ nouveau_connector_create_lvds(struct drm_device *dev, ...@@ -680,7 +680,7 @@ nouveau_connector_create_lvds(struct drm_device *dev,
/* Firstly try getting EDID over DDC, if allowed and I2C channel /* Firstly try getting EDID over DDC, if allowed and I2C channel
* is available. * is available.
*/ */
if (!dev_priv->VBIOS.pub.fp_no_ddc && nv_encoder->dcb->i2c_index < 0xf) if (!dev_priv->vbios.fp_no_ddc && nv_encoder->dcb->i2c_index < 0xf)
i2c = nouveau_i2c_find(dev, nv_encoder->dcb->i2c_index); i2c = nouveau_i2c_find(dev, nv_encoder->dcb->i2c_index);
if (i2c) { if (i2c) {
...@@ -695,7 +695,7 @@ nouveau_connector_create_lvds(struct drm_device *dev, ...@@ -695,7 +695,7 @@ nouveau_connector_create_lvds(struct drm_device *dev,
*/ */
if (!nv_connector->edid && nouveau_bios_fp_mode(dev, &native) && if (!nv_connector->edid && nouveau_bios_fp_mode(dev, &native) &&
(nv_encoder->dcb->lvdsconf.use_straps_for_mode || (nv_encoder->dcb->lvdsconf.use_straps_for_mode ||
dev_priv->VBIOS.pub.fp_no_ddc)) { dev_priv->vbios.fp_no_ddc)) {
nv_connector->native_mode = drm_mode_duplicate(dev, &native); nv_connector->native_mode = drm_mode_duplicate(dev, &native);
goto out; goto out;
} }
...@@ -704,7 +704,7 @@ nouveau_connector_create_lvds(struct drm_device *dev, ...@@ -704,7 +704,7 @@ nouveau_connector_create_lvds(struct drm_device *dev,
* stored for the panel stored in them. * stored for the panel stored in them.
*/ */
if (!nv_connector->edid && !nv_connector->native_mode && if (!nv_connector->edid && !nv_connector->native_mode &&
!dev_priv->VBIOS.pub.fp_no_ddc) { !dev_priv->vbios.fp_no_ddc) {
struct edid *edid = struct edid *edid =
(struct edid *)nouveau_bios_embedded_edid(dev); (struct edid *)nouveau_bios_embedded_edid(dev);
if (edid) { if (edid) {
......
...@@ -151,8 +151,8 @@ nouveau_debugfs_vbios_image(struct seq_file *m, void *data) ...@@ -151,8 +151,8 @@ nouveau_debugfs_vbios_image(struct seq_file *m, void *data)
struct drm_nouveau_private *dev_priv = node->minor->dev->dev_private; struct drm_nouveau_private *dev_priv = node->minor->dev->dev_private;
int i; int i;
for (i = 0; i < dev_priv->VBIOS.length; i++) for (i = 0; i < dev_priv->vbios.length; i++)
seq_printf(m, "%c", dev_priv->VBIOS.data[i]); seq_printf(m, "%c", dev_priv->vbios.data[i]);
return 0; return 0;
} }
......
...@@ -605,8 +605,7 @@ struct drm_nouveau_private { ...@@ -605,8 +605,7 @@ struct drm_nouveau_private {
struct list_head gpuobj_list; struct list_head gpuobj_list;
struct nvbios VBIOS; struct nvbios vbios;
struct nouveau_bios_info *vbios;
struct nv04_mode_state mode_reg; struct nv04_mode_state mode_reg;
struct nv04_mode_state saved_reg; struct nv04_mode_state saved_reg;
......
...@@ -160,7 +160,7 @@ static void ...@@ -160,7 +160,7 @@ static void
setPLL_single(struct drm_device *dev, uint32_t reg, struct nouveau_pll_vals *pv) setPLL_single(struct drm_device *dev, uint32_t reg, struct nouveau_pll_vals *pv)
{ {
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
int chip_version = dev_priv->vbios->chip_version; int chip_version = dev_priv->vbios.chip_version;
uint32_t oldpll = NVReadRAMDAC(dev, 0, reg); uint32_t oldpll = NVReadRAMDAC(dev, 0, reg);
int oldN = (oldpll >> 8) & 0xff, oldM = oldpll & 0xff; int oldN = (oldpll >> 8) & 0xff, oldM = oldpll & 0xff;
uint32_t pll = (oldpll & 0xfff80000) | pv->log2P << 16 | pv->NM1; uint32_t pll = (oldpll & 0xfff80000) | pv->log2P << 16 | pv->NM1;
...@@ -216,7 +216,7 @@ setPLL_double_highregs(struct drm_device *dev, uint32_t reg1, ...@@ -216,7 +216,7 @@ setPLL_double_highregs(struct drm_device *dev, uint32_t reg1,
struct nouveau_pll_vals *pv) struct nouveau_pll_vals *pv)
{ {
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
int chip_version = dev_priv->vbios->chip_version; int chip_version = dev_priv->vbios.chip_version;
bool nv3035 = chip_version == 0x30 || chip_version == 0x35; bool nv3035 = chip_version == 0x30 || chip_version == 0x35;
uint32_t reg2 = reg1 + ((reg1 == NV_RAMDAC_VPLL2) ? 0x5c : 0x70); uint32_t reg2 = reg1 + ((reg1 == NV_RAMDAC_VPLL2) ? 0x5c : 0x70);
uint32_t oldpll1 = NVReadRAMDAC(dev, 0, reg1); uint32_t oldpll1 = NVReadRAMDAC(dev, 0, reg1);
...@@ -374,7 +374,7 @@ nouveau_hw_setpll(struct drm_device *dev, uint32_t reg1, ...@@ -374,7 +374,7 @@ nouveau_hw_setpll(struct drm_device *dev, uint32_t reg1,
struct nouveau_pll_vals *pv) struct nouveau_pll_vals *pv)
{ {
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
int cv = dev_priv->vbios->chip_version; int cv = dev_priv->vbios.chip_version;
if (cv == 0x30 || cv == 0x31 || cv == 0x35 || cv == 0x36 || if (cv == 0x30 || cv == 0x31 || cv == 0x35 || cv == 0x36 ||
cv >= 0x40) { cv >= 0x40) {
......
...@@ -254,7 +254,7 @@ struct nouveau_i2c_chan * ...@@ -254,7 +254,7 @@ struct nouveau_i2c_chan *
nouveau_i2c_find(struct drm_device *dev, int index) nouveau_i2c_find(struct drm_device *dev, int index)
{ {
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nvbios *bios = &dev_priv->VBIOS; struct nvbios *bios = &dev_priv->vbios;
if (index >= DCB_MAX_NUM_I2C_ENTRIES) if (index >= DCB_MAX_NUM_I2C_ENTRIES)
return NULL; return NULL;
......
...@@ -230,13 +230,13 @@ uint32_t nv17_dac_sample_load(struct drm_encoder *encoder) ...@@ -230,13 +230,13 @@ uint32_t nv17_dac_sample_load(struct drm_encoder *encoder)
if (dcb->type == OUTPUT_TV) { if (dcb->type == OUTPUT_TV) {
testval = RGB_TEST_DATA(0xa0, 0xa0, 0xa0); testval = RGB_TEST_DATA(0xa0, 0xa0, 0xa0);
if (dev_priv->vbios->tvdactestval) if (dev_priv->vbios.tvdactestval)
testval = dev_priv->vbios->tvdactestval; testval = dev_priv->vbios.tvdactestval;
} else { } else {
testval = RGB_TEST_DATA(0x140, 0x140, 0x140); /* 0x94050140 */ testval = RGB_TEST_DATA(0x140, 0x140, 0x140); /* 0x94050140 */
if (dev_priv->vbios->dactestval) if (dev_priv->vbios.dactestval)
testval = dev_priv->vbios->dactestval; testval = dev_priv->vbios.dactestval;
} }
saved_rtest_ctrl = NVReadRAMDAC(dev, 0, NV_PRAMDAC_TEST_CONTROL + regoffset); saved_rtest_ctrl = NVReadRAMDAC(dev, 0, NV_PRAMDAC_TEST_CONTROL + regoffset);
......
...@@ -269,10 +269,10 @@ static void nv04_dfp_mode_set(struct drm_encoder *encoder, ...@@ -269,10 +269,10 @@ static void nv04_dfp_mode_set(struct drm_encoder *encoder,
regp->fp_horiz_regs[FP_TOTAL] = output_mode->htotal - 1; regp->fp_horiz_regs[FP_TOTAL] = output_mode->htotal - 1;
if (!nv_gf4_disp_arch(dev) || if (!nv_gf4_disp_arch(dev) ||
(output_mode->hsync_start - output_mode->hdisplay) >= (output_mode->hsync_start - output_mode->hdisplay) >=
dev_priv->vbios->digital_min_front_porch) dev_priv->vbios.digital_min_front_porch)
regp->fp_horiz_regs[FP_CRTC] = output_mode->hdisplay; regp->fp_horiz_regs[FP_CRTC] = output_mode->hdisplay;
else else
regp->fp_horiz_regs[FP_CRTC] = output_mode->hsync_start - dev_priv->vbios->digital_min_front_porch - 1; regp->fp_horiz_regs[FP_CRTC] = output_mode->hsync_start - dev_priv->vbios.digital_min_front_porch - 1;
regp->fp_horiz_regs[FP_SYNC_START] = output_mode->hsync_start - 1; regp->fp_horiz_regs[FP_SYNC_START] = output_mode->hsync_start - 1;
regp->fp_horiz_regs[FP_SYNC_END] = output_mode->hsync_end - 1; regp->fp_horiz_regs[FP_SYNC_END] = output_mode->hsync_end - 1;
regp->fp_horiz_regs[FP_VALID_START] = output_mode->hskew; regp->fp_horiz_regs[FP_VALID_START] = output_mode->hskew;
......
...@@ -93,7 +93,7 @@ int ...@@ -93,7 +93,7 @@ int
nv04_display_create(struct drm_device *dev) nv04_display_create(struct drm_device *dev)
{ {
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
struct dcb_table *dcb = &dev_priv->VBIOS.dcb; struct dcb_table *dcb = &dev_priv->vbios.dcb;
struct drm_encoder *encoder; struct drm_encoder *encoder;
struct drm_crtc *crtc; struct drm_crtc *crtc;
uint16_t connector[16] = { 0 }; uint16_t connector[16] = { 0 };
......
...@@ -262,7 +262,7 @@ int nv04_tv_create(struct drm_device *dev, struct dcb_entry *entry) ...@@ -262,7 +262,7 @@ int nv04_tv_create(struct drm_device *dev, struct dcb_entry *entry)
nv_encoder->or = ffs(entry->or) - 1; nv_encoder->or = ffs(entry->or) - 1;
/* Run the slave-specific initialization */ /* Run the slave-specific initialization */
adap = &dev_priv->VBIOS.dcb.i2c[i2c_index].chan->adapter; adap = &dev_priv->vbios.dcb.i2c[i2c_index].chan->adapter;
was_locked = NVLockVgaCrtcs(dev, false); was_locked = NVLockVgaCrtcs(dev, false);
......
...@@ -45,8 +45,8 @@ static uint32_t nv42_tv_sample_load(struct drm_encoder *encoder) ...@@ -45,8 +45,8 @@ static uint32_t nv42_tv_sample_load(struct drm_encoder *encoder)
#define RGB_TEST_DATA(r, g, b) (r << 0 | g << 10 | b << 20) #define RGB_TEST_DATA(r, g, b) (r << 0 | g << 10 | b << 20)
testval = RGB_TEST_DATA(0x82, 0xeb, 0x82); testval = RGB_TEST_DATA(0x82, 0xeb, 0x82);
if (dev_priv->vbios->tvdactestval) if (dev_priv->vbios.tvdactestval)
testval = dev_priv->vbios->tvdactestval; testval = dev_priv->vbios.tvdactestval;
dacclk = NVReadRAMDAC(dev, 0, NV_PRAMDAC_DACCLK + regoffset); dacclk = NVReadRAMDAC(dev, 0, NV_PRAMDAC_DACCLK + regoffset);
head = (dacclk & 0x100) >> 8; head = (dacclk & 0x100) >> 8;
...@@ -367,7 +367,7 @@ static void nv17_tv_prepare(struct drm_encoder *encoder) ...@@ -367,7 +367,7 @@ static void nv17_tv_prepare(struct drm_encoder *encoder)
!enc->crtc && !enc->crtc &&
nv04_dfp_get_bound_head(dev, dcb) == head) { nv04_dfp_get_bound_head(dev, dcb) == head) {
nv04_dfp_bind_head(dev, dcb, head ^ 1, nv04_dfp_bind_head(dev, dcb, head ^ 1,
dev_priv->VBIOS.fp.dual_link); dev_priv->vbios.fp.dual_link);
} }
} }
......
...@@ -79,8 +79,8 @@ nv50_dac_detect(struct drm_encoder *encoder, struct drm_connector *connector) ...@@ -79,8 +79,8 @@ nv50_dac_detect(struct drm_encoder *encoder, struct drm_connector *connector)
} }
/* Use bios provided value if possible. */ /* Use bios provided value if possible. */
if (dev_priv->vbios->dactestval) { if (dev_priv->vbios.dactestval) {
load_pattern = dev_priv->vbios->dactestval; load_pattern = dev_priv->vbios.dactestval;
NV_DEBUG_KMS(dev, "Using bios provided load_pattern of %d\n", NV_DEBUG_KMS(dev, "Using bios provided load_pattern of %d\n",
load_pattern); load_pattern);
} else { } else {
......
...@@ -465,7 +465,7 @@ static int nv50_display_disable(struct drm_device *dev) ...@@ -465,7 +465,7 @@ static int nv50_display_disable(struct drm_device *dev)
int nv50_display_create(struct drm_device *dev) int nv50_display_create(struct drm_device *dev)
{ {
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
struct dcb_table *dcb = &dev_priv->VBIOS.dcb; struct dcb_table *dcb = &dev_priv->vbios.dcb;
uint32_t connector[16] = {}; uint32_t connector[16] = {};
int ret, i; int ret, i;
...@@ -526,7 +526,7 @@ int nv50_display_create(struct drm_device *dev) ...@@ -526,7 +526,7 @@ int nv50_display_create(struct drm_device *dev)
connector[entry->connector] |= (1 << entry->type); connector[entry->connector] |= (1 << entry->type);
} }
/* It appears that DCB 3.0+ VBIOS has a connector table, however, /* It appears that DCB 3.0+ vbios has a connector table, however,
* I'm not 100% certain how to decode it correctly yet so just * I'm not 100% certain how to decode it correctly yet so just
* look at what encoders are present on each connector index and * look at what encoders are present on each connector index and
* attempt to derive the connector type from that. * attempt to derive the connector type from that.
...@@ -667,8 +667,8 @@ nv50_display_irq_head(struct drm_device *dev, int *phead, ...@@ -667,8 +667,8 @@ nv50_display_irq_head(struct drm_device *dev, int *phead,
return -1; return -1;
} }
for (i = 0; i < dev_priv->VBIOS.dcb.entries; i++) { for (i = 0; i < dev_priv->vbios.dcb.entries; i++) {
struct dcb_entry *dcbent = &dev_priv->VBIOS.dcb.entry[i]; struct dcb_entry *dcbent = &dev_priv->vbios.dcb.entry[i];
if (dcbent->type != type) if (dcbent->type != type)
continue; continue;
...@@ -692,7 +692,7 @@ nv50_display_script_select(struct drm_device *dev, struct dcb_entry *dcbent, ...@@ -692,7 +692,7 @@ nv50_display_script_select(struct drm_device *dev, struct dcb_entry *dcbent,
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nouveau_connector *nv_connector = NULL; struct nouveau_connector *nv_connector = NULL;
struct drm_encoder *encoder; struct drm_encoder *encoder;
struct nvbios *bios = &dev_priv->VBIOS; struct nvbios *bios = &dev_priv->vbios;
uint32_t mc, script = 0, or; uint32_t mc, script = 0, or;
list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
...@@ -710,7 +710,7 @@ nv50_display_script_select(struct drm_device *dev, struct dcb_entry *dcbent, ...@@ -710,7 +710,7 @@ nv50_display_script_select(struct drm_device *dev, struct dcb_entry *dcbent,
switch (dcbent->type) { switch (dcbent->type) {
case OUTPUT_LVDS: case OUTPUT_LVDS:
script = (mc >> 8) & 0xf; script = (mc >> 8) & 0xf;
if (bios->pub.fp_no_ddc) { if (bios->fp_no_ddc) {
if (bios->fp.dual_link) if (bios->fp.dual_link)
script |= 0x0100; script |= 0x0100;
if (bios->fp.if_is_24bit) if (bios->fp.if_is_24bit)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment