aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nouveau_bios.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_bios.c')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_bios.c82
1 files changed, 39 insertions, 43 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c
index e3baa84df62c..ea71ce4267e1 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bios.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bios.c
@@ -311,11 +311,11 @@ valid_reg(struct nvbios *bios, uint32_t reg)
311 311
312 /* C51 has misaligned regs on purpose. Marvellous */ 312 /* C51 has misaligned regs on purpose. Marvellous */
313 if (reg & 0x2 || 313 if (reg & 0x2 ||
314 (reg & 0x1 && dev_priv->VBIOS.pub.chip_version != 0x51)) 314 (reg & 0x1 && dev_priv->vbios.chip_version != 0x51))
315 NV_ERROR(dev, "======= misaligned reg 0x%08X =======\n", reg); 315 NV_ERROR(dev, "======= misaligned reg 0x%08X =======\n", reg);
316 316
317 /* warn on C51 regs that haven't been verified accessible in tracing */ 317 /* warn on C51 regs that haven't been verified accessible in tracing */
318 if (reg & 0x1 && dev_priv->VBIOS.pub.chip_version == 0x51 && 318 if (reg & 0x1 && dev_priv->vbios.chip_version == 0x51 &&
319 reg != 0x130d && reg != 0x1311 && reg != 0x60081d) 319 reg != 0x130d && reg != 0x1311 && reg != 0x60081d)
320 NV_WARN(dev, "=== C51 misaligned reg 0x%08X not verified ===\n", 320 NV_WARN(dev, "=== C51 misaligned reg 0x%08X not verified ===\n",
321 reg); 321 reg);
@@ -420,7 +420,7 @@ bios_wr32(struct nvbios *bios, uint32_t reg, uint32_t data)
420 LOG_OLD_VALUE(bios_rd32(bios, reg)); 420 LOG_OLD_VALUE(bios_rd32(bios, reg));
421 BIOSLOG(bios, " Write: Reg: 0x%08X, Data: 0x%08X\n", reg, data); 421 BIOSLOG(bios, " Write: Reg: 0x%08X, Data: 0x%08X\n", reg, data);
422 422
423 if (dev_priv->VBIOS.execute) { 423 if (dev_priv->vbios.execute) {
424 still_alive(); 424 still_alive();
425 nv_wr32(bios->dev, reg, data); 425 nv_wr32(bios->dev, reg, data);
426 } 426 }
@@ -647,7 +647,7 @@ nv50_pll_set(struct drm_device *dev, uint32_t reg, uint32_t clk)
647 reg0 = (reg0 & 0xfff8ffff) | (pll.log2P << 16); 647 reg0 = (reg0 & 0xfff8ffff) | (pll.log2P << 16);
648 reg1 = (reg1 & 0xffff0000) | (pll.N1 << 8) | pll.M1; 648 reg1 = (reg1 & 0xffff0000) | (pll.N1 << 8) | pll.M1;
649 649
650 if (dev_priv->VBIOS.execute) { 650 if (dev_priv->vbios.execute) {
651 still_alive(); 651 still_alive();
652 nv_wr32(dev, reg + 4, reg1); 652 nv_wr32(dev, reg + 4, reg1);
653 nv_wr32(dev, reg + 0, reg0); 653 nv_wr32(dev, reg + 0, reg0);
@@ -689,7 +689,7 @@ setPLL(struct nvbios *bios, uint32_t reg, uint32_t clk)
689static int dcb_entry_idx_from_crtchead(struct drm_device *dev) 689static int dcb_entry_idx_from_crtchead(struct drm_device *dev)
690{ 690{
691 struct drm_nouveau_private *dev_priv = dev->dev_private; 691 struct drm_nouveau_private *dev_priv = dev->dev_private;
692 struct nvbios *bios = &dev_priv->VBIOS; 692 struct nvbios *bios = &dev_priv->vbios;
693 693
694 /* 694 /*
695 * For the results of this function to be correct, CR44 must have been 695 * For the results of this function to be correct, CR44 must have been
@@ -713,7 +713,7 @@ static struct nouveau_i2c_chan *
713init_i2c_device_find(struct drm_device *dev, int i2c_index) 713init_i2c_device_find(struct drm_device *dev, int i2c_index)
714{ 714{
715 struct drm_nouveau_private *dev_priv = dev->dev_private; 715 struct drm_nouveau_private *dev_priv = dev->dev_private;
716 struct dcb_table *dcb = &dev_priv->VBIOS.dcb; 716 struct dcb_table *dcb = &dev_priv->vbios.dcb;
717 717
718 if (i2c_index == 0xff) { 718 if (i2c_index == 0xff) {
719 /* note: dcb_entry_idx_from_crtchead needs pre-script set-up */ 719 /* 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 */ 745 */
746 746
747 struct drm_nouveau_private *dev_priv = dev->dev_private; 747 struct drm_nouveau_private *dev_priv = dev->dev_private;
748 struct nvbios *bios = &dev_priv->VBIOS; 748 struct nvbios *bios = &dev_priv->vbios;
749 const int pramdac_offset[13] = { 749 const int pramdac_offset[13] = {
750 0, 0, 0x8, 0, 0x2000, 0, 0, 0, 0x2008, 0, 0, 0, 0x2000 }; 750 0, 0, 0x8, 0, 0x2000, 0, 0, 0, 0x2008, 0, 0, 0, 0x2000 };
751 const uint32_t pramdac_table[4] = { 751 const uint32_t pramdac_table[4] = {
@@ -3124,7 +3124,7 @@ run_digital_op_script(struct drm_device *dev, uint16_t scriptptr,
3124 struct dcb_entry *dcbent, int head, bool dl) 3124 struct dcb_entry *dcbent, int head, bool dl)
3125{ 3125{
3126 struct drm_nouveau_private *dev_priv = dev->dev_private; 3126 struct drm_nouveau_private *dev_priv = dev->dev_private;
3127 struct nvbios *bios = &dev_priv->VBIOS; 3127 struct nvbios *bios = &dev_priv->vbios;
3128 struct init_exec iexec = {true, false}; 3128 struct init_exec iexec = {true, false};
3129 3129
3130 NV_TRACE(dev, "0x%04X: Parsing digital output script table\n", 3130 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,
3141static int call_lvds_manufacturer_script(struct drm_device *dev, struct dcb_entry *dcbent, int head, enum LVDS_script script) 3141static int call_lvds_manufacturer_script(struct drm_device *dev, struct dcb_entry *dcbent, int head, enum LVDS_script script)
3142{ 3142{
3143 struct drm_nouveau_private *dev_priv = dev->dev_private; 3143 struct drm_nouveau_private *dev_priv = dev->dev_private;
3144 struct nvbios *bios = &dev_priv->VBIOS; 3144 struct nvbios *bios = &dev_priv->vbios;
3145 uint8_t sub = bios->data[bios->fp.xlated_entry + script] + (bios->fp.link_c_increment && dcbent->or & OUTPUT_C ? 1 : 0); 3145 uint8_t sub = bios->data[bios->fp.xlated_entry + script] + (bios->fp.link_c_increment && dcbent->or & OUTPUT_C ? 1 : 0);
3146 uint16_t scriptofs = ROM16(bios->data[bios->init_script_tbls_ptr + sub * 2]); 3146 uint16_t scriptofs = ROM16(bios->data[bios->init_script_tbls_ptr + sub * 2]);
3147 3147
@@ -3195,7 +3195,7 @@ static int run_lvds_table(struct drm_device *dev, struct dcb_entry *dcbent, int
3195 * of a list of pxclks and script pointers. 3195 * of a list of pxclks and script pointers.
3196 */ 3196 */
3197 struct drm_nouveau_private *dev_priv = dev->dev_private; 3197 struct drm_nouveau_private *dev_priv = dev->dev_private;
3198 struct nvbios *bios = &dev_priv->VBIOS; 3198 struct nvbios *bios = &dev_priv->vbios;
3199 unsigned int outputset = (dcbent->or == 4) ? 1 : 0; 3199 unsigned int outputset = (dcbent->or == 4) ? 1 : 0;
3200 uint16_t scriptptr = 0, clktable; 3200 uint16_t scriptptr = 0, clktable;
3201 uint8_t clktableptr = 0; 3201 uint8_t clktableptr = 0;
@@ -3262,7 +3262,7 @@ int call_lvds_script(struct drm_device *dev, struct dcb_entry *dcbent, int head,
3262 */ 3262 */
3263 3263
3264 struct drm_nouveau_private *dev_priv = dev->dev_private; 3264 struct drm_nouveau_private *dev_priv = dev->dev_private;
3265 struct nvbios *bios = &dev_priv->VBIOS; 3265 struct nvbios *bios = &dev_priv->vbios;
3266 uint8_t lvds_ver = bios->data[bios->fp.lvdsmanufacturerpointer]; 3266 uint8_t lvds_ver = bios->data[bios->fp.lvdsmanufacturerpointer];
3267 uint32_t sel_clk_binding, sel_clk; 3267 uint32_t sel_clk_binding, sel_clk;
3268 int ret; 3268 int ret;
@@ -3396,7 +3396,7 @@ static int parse_fp_mode_table(struct drm_device *dev, struct nvbios *bios)
3396#ifndef __powerpc__ 3396#ifndef __powerpc__
3397 NV_ERROR(dev, "Pointer to flat panel table invalid\n"); 3397 NV_ERROR(dev, "Pointer to flat panel table invalid\n");
3398#endif 3398#endif
3399 bios->pub.digital_min_front_porch = 0x4b; 3399 bios->digital_min_front_porch = 0x4b;
3400 return 0; 3400 return 0;
3401 } 3401 }
3402 3402
@@ -3429,7 +3429,7 @@ static int parse_fp_mode_table(struct drm_device *dev, struct nvbios *bios)
3429 * fptable[4] is the minimum 3429 * fptable[4] is the minimum
3430 * RAMDAC_FP_HCRTC -> RAMDAC_FP_HSYNC_START gap 3430 * RAMDAC_FP_HCRTC -> RAMDAC_FP_HSYNC_START gap
3431 */ 3431 */
3432 bios->pub.digital_min_front_porch = fptable[4]; 3432 bios->digital_min_front_porch = fptable[4];
3433 ofs = -7; 3433 ofs = -7;
3434 break; 3434 break;
3435 default: 3435 default:
@@ -3468,7 +3468,7 @@ static int parse_fp_mode_table(struct drm_device *dev, struct nvbios *bios)
3468 3468
3469 /* nv4x cards need both a strap value and fpindex of 0xf to use DDC */ 3469 /* nv4x cards need both a strap value and fpindex of 0xf to use DDC */
3470 if (lth.lvds_ver > 0x10) 3470 if (lth.lvds_ver > 0x10)
3471 bios->pub.fp_no_ddc = fpstrapping != 0xf || fpindex != 0xf; 3471 bios->fp_no_ddc = fpstrapping != 0xf || fpindex != 0xf;
3472 3472
3473 /* 3473 /*
3474 * If either the strap or xlated fpindex value are 0xf there is no 3474 * 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)
3492bool nouveau_bios_fp_mode(struct drm_device *dev, struct drm_display_mode *mode) 3492bool nouveau_bios_fp_mode(struct drm_device *dev, struct drm_display_mode *mode)
3493{ 3493{
3494 struct drm_nouveau_private *dev_priv = dev->dev_private; 3494 struct drm_nouveau_private *dev_priv = dev->dev_private;
3495 struct nvbios *bios = &dev_priv->VBIOS; 3495 struct nvbios *bios = &dev_priv->vbios;
3496 uint8_t *mode_entry = &bios->data[bios->fp.mode_ptr]; 3496 uint8_t *mode_entry = &bios->data[bios->fp.mode_ptr];
3497 3497
3498 if (!mode) /* just checking whether we can produce a mode */ 3498 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 * until later, when this function should be called with non-zero pxclk 3563 * until later, when this function should be called with non-zero pxclk
3564 */ 3564 */
3565 struct drm_nouveau_private *dev_priv = dev->dev_private; 3565 struct drm_nouveau_private *dev_priv = dev->dev_private;
3566 struct nvbios *bios = &dev_priv->VBIOS; 3566 struct nvbios *bios = &dev_priv->vbios;
3567 int fpstrapping = get_fp_strap(dev, bios), lvdsmanufacturerindex = 0; 3567 int fpstrapping = get_fp_strap(dev, bios), lvdsmanufacturerindex = 0;
3568 struct lvdstableheader lth; 3568 struct lvdstableheader lth;
3569 uint16_t lvdsofs; 3569 uint16_t lvdsofs;
3570 int ret, chip_version = bios->pub.chip_version; 3570 int ret, chip_version = bios->chip_version;
3571 3571
3572 ret = parse_lvds_manufacturer_table_header(dev, bios, &lth); 3572 ret = parse_lvds_manufacturer_table_header(dev, bios, &lth);
3573 if (ret) 3573 if (ret)
@@ -3683,7 +3683,7 @@ bios_output_config_match(struct drm_device *dev, struct dcb_entry *dcbent,
3683 uint16_t record, int record_len, int record_nr) 3683 uint16_t record, int record_len, int record_nr)
3684{ 3684{
3685 struct drm_nouveau_private *dev_priv = dev->dev_private; 3685 struct drm_nouveau_private *dev_priv = dev->dev_private;
3686 struct nvbios *bios = &dev_priv->VBIOS; 3686 struct nvbios *bios = &dev_priv->vbios;
3687 uint32_t entry; 3687 uint32_t entry;
3688 uint16_t table; 3688 uint16_t table;
3689 int i, v; 3689 int i, v;
@@ -3717,7 +3717,7 @@ nouveau_bios_dp_table(struct drm_device *dev, struct dcb_entry *dcbent,
3717 int *length) 3717 int *length)
3718{ 3718{
3719 struct drm_nouveau_private *dev_priv = dev->dev_private; 3719 struct drm_nouveau_private *dev_priv = dev->dev_private;
3720 struct nvbios *bios = &dev_priv->VBIOS; 3720 struct nvbios *bios = &dev_priv->vbios;
3721 uint8_t *table; 3721 uint8_t *table;
3722 3722
3723 if (!bios->display.dp_table_ptr) { 3723 if (!bios->display.dp_table_ptr) {
@@ -3766,7 +3766,7 @@ nouveau_bios_run_display_table(struct drm_device *dev, struct dcb_entry *dcbent,
3766 */ 3766 */
3767 3767
3768 struct drm_nouveau_private *dev_priv = dev->dev_private; 3768 struct drm_nouveau_private *dev_priv = dev->dev_private;
3769 struct nvbios *bios = &dev_priv->VBIOS; 3769 struct nvbios *bios = &dev_priv->vbios;
3770 uint8_t *table = &bios->data[bios->display.script_table_ptr]; 3770 uint8_t *table = &bios->data[bios->display.script_table_ptr];
3771 uint8_t *otable = NULL; 3771 uint8_t *otable = NULL;
3772 uint16_t script; 3772 uint16_t script;
@@ -3919,8 +3919,8 @@ int run_tmds_table(struct drm_device *dev, struct dcb_entry *dcbent, int head, i
3919 */ 3919 */
3920 3920
3921 struct drm_nouveau_private *dev_priv = dev->dev_private; 3921 struct drm_nouveau_private *dev_priv = dev->dev_private;
3922 struct nvbios *bios = &dev_priv->VBIOS; 3922 struct nvbios *bios = &dev_priv->vbios;
3923 int cv = bios->pub.chip_version; 3923 int cv = bios->chip_version;
3924 uint16_t clktable = 0, scriptptr; 3924 uint16_t clktable = 0, scriptptr;
3925 uint32_t sel_clk_binding, sel_clk; 3925 uint32_t sel_clk_binding, sel_clk;
3926 3926
@@ -3979,8 +3979,8 @@ int get_pll_limits(struct drm_device *dev, uint32_t limit_match, struct pll_lims
3979 */ 3979 */
3980 3980
3981 struct drm_nouveau_private *dev_priv = dev->dev_private; 3981 struct drm_nouveau_private *dev_priv = dev->dev_private;
3982 struct nvbios *bios = &dev_priv->VBIOS; 3982 struct nvbios *bios = &dev_priv->vbios;
3983 int cv = bios->pub.chip_version, pllindex = 0; 3983 int cv = bios->chip_version, pllindex = 0;
3984 uint8_t pll_lim_ver = 0, headerlen = 0, recordlen = 0, entries = 0; 3984 uint8_t pll_lim_ver = 0, headerlen = 0, recordlen = 0, entries = 0;
3985 uint32_t crystal_strap_mask, crystal_straps; 3985 uint32_t crystal_strap_mask, crystal_straps;
3986 3986
@@ -4333,7 +4333,7 @@ static void parse_bios_version(struct drm_device *dev, struct nvbios *bios, uint
4333 */ 4333 */
4334 4334
4335 bios->major_version = bios->data[offset + 3]; 4335 bios->major_version = bios->data[offset + 3];
4336 bios->pub.chip_version = bios->data[offset + 2]; 4336 bios->chip_version = bios->data[offset + 2];
4337 NV_TRACE(dev, "Bios version %02x.%02x.%02x.%02x\n", 4337 NV_TRACE(dev, "Bios version %02x.%02x.%02x.%02x\n",
4338 bios->data[offset + 3], bios->data[offset + 2], 4338 bios->data[offset + 3], bios->data[offset + 2],
4339 bios->data[offset + 1], bios->data[offset]); 4339 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 } 4403 }
4404 4404
4405 /* First entry is normal dac, 2nd tv-out perhaps? */ 4405 /* First entry is normal dac, 2nd tv-out perhaps? */
4406 bios->pub.dactestval = ROM32(bios->data[load_table_ptr + headerlen]) & 0x3ff; 4406 bios->dactestval = ROM32(bios->data[load_table_ptr + headerlen]) & 0x3ff;
4407 4407
4408 return 0; 4408 return 0;
4409} 4409}
@@ -4527,8 +4527,8 @@ static int parse_bit_i_tbl_entry(struct drm_device *dev, struct nvbios *bios, st
4527 return -ENOSYS; 4527 return -ENOSYS;
4528 } 4528 }
4529 4529
4530 bios->pub.dactestval = ROM32(bios->data[daccmpoffset + dacheaderlen]); 4530 bios->dactestval = ROM32(bios->data[daccmpoffset + dacheaderlen]);
4531 bios->pub.tvdactestval = ROM32(bios->data[daccmpoffset + dacheaderlen + 4]); 4531 bios->tvdactestval = ROM32(bios->data[daccmpoffset + dacheaderlen + 4]);
4532 4532
4533 return 0; 4533 return 0;
4534} 4534}
@@ -4801,7 +4801,7 @@ static int parse_bmp_structure(struct drm_device *dev, struct nvbios *bios, unsi
4801 bios->dcb.i2c[0].read = NV_CIO_CRE_DDC_STATUS__INDEX; 4801 bios->dcb.i2c[0].read = NV_CIO_CRE_DDC_STATUS__INDEX;
4802 bios->dcb.i2c[1].write = NV_CIO_CRE_DDC0_WR__INDEX; 4802 bios->dcb.i2c[1].write = NV_CIO_CRE_DDC0_WR__INDEX;
4803 bios->dcb.i2c[1].read = NV_CIO_CRE_DDC0_STATUS__INDEX; 4803 bios->dcb.i2c[1].read = NV_CIO_CRE_DDC0_STATUS__INDEX;
4804 bios->pub.digital_min_front_porch = 0x4b; 4804 bios->digital_min_front_porch = 0x4b;
4805 bios->fmaxvco = 256000; 4805 bios->fmaxvco = 256000;
4806 bios->fminvco = 128000; 4806 bios->fminvco = 128000;
4807 bios->fp.duallink_transition_clk = 90000; 4807 bios->fp.duallink_transition_clk = 90000;
@@ -5047,7 +5047,7 @@ struct dcb_gpio_entry *
5047nouveau_bios_gpio_entry(struct drm_device *dev, enum dcb_gpio_tag tag) 5047nouveau_bios_gpio_entry(struct drm_device *dev, enum dcb_gpio_tag tag)
5048{ 5048{
5049 struct drm_nouveau_private *dev_priv = dev->dev_private; 5049 struct drm_nouveau_private *dev_priv = dev->dev_private;
5050 struct nvbios *bios = &dev_priv->VBIOS; 5050 struct nvbios *bios = &dev_priv->vbios;
5051 int i; 5051 int i;
5052 5052
5053 for (i = 0; i < bios->dcb.gpio.entries; i++) { 5053 for (i = 0; i < bios->dcb.gpio.entries; i++) {
@@ -5160,7 +5160,7 @@ struct dcb_connector_table_entry *
5160nouveau_bios_connector_entry(struct drm_device *dev, int index) 5160nouveau_bios_connector_entry(struct drm_device *dev, int index)
5161{ 5161{
5162 struct drm_nouveau_private *dev_priv = dev->dev_private; 5162 struct drm_nouveau_private *dev_priv = dev->dev_private;
5163 struct nvbios *bios = &dev_priv->VBIOS; 5163 struct nvbios *bios = &dev_priv->vbios;
5164 struct dcb_connector_table_entry *cte; 5164 struct dcb_connector_table_entry *cte;
5165 5165
5166 if (index >= bios->dcb.connector.entries) 5166 if (index >= bios->dcb.connector.entries)
@@ -5823,7 +5823,7 @@ static int load_nv17_hw_sequencer_ucode(struct drm_device *dev,
5823uint8_t *nouveau_bios_embedded_edid(struct drm_device *dev) 5823uint8_t *nouveau_bios_embedded_edid(struct drm_device *dev)
5824{ 5824{
5825 struct drm_nouveau_private *dev_priv = dev->dev_private; 5825 struct drm_nouveau_private *dev_priv = dev->dev_private;
5826 struct nvbios *bios = &dev_priv->VBIOS; 5826 struct nvbios *bios = &dev_priv->vbios;
5827 const uint8_t edid_sig[] = { 5827 const uint8_t edid_sig[] = {
5828 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 }; 5828 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 };
5829 uint16_t offset = 0; 5829 uint16_t offset = 0;
@@ -5856,7 +5856,7 @@ nouveau_bios_run_init_table(struct drm_device *dev, uint16_t table,
5856 struct dcb_entry *dcbent) 5856 struct dcb_entry *dcbent)
5857{ 5857{
5858 struct drm_nouveau_private *dev_priv = dev->dev_private; 5858 struct drm_nouveau_private *dev_priv = dev->dev_private;
5859 struct nvbios *bios = &dev_priv->VBIOS; 5859 struct nvbios *bios = &dev_priv->vbios;
5860 struct init_exec iexec = { true, false }; 5860 struct init_exec iexec = { true, false };
5861 5861
5862 mutex_lock(&bios->lock); 5862 mutex_lock(&bios->lock);
@@ -5869,7 +5869,7 @@ nouveau_bios_run_init_table(struct drm_device *dev, uint16_t table,
5869static bool NVInitVBIOS(struct drm_device *dev) 5869static bool NVInitVBIOS(struct drm_device *dev)
5870{ 5870{
5871 struct drm_nouveau_private *dev_priv = dev->dev_private; 5871 struct drm_nouveau_private *dev_priv = dev->dev_private;
5872 struct nvbios *bios = &dev_priv->VBIOS; 5872 struct nvbios *bios = &dev_priv->vbios;
5873 5873
5874 memset(bios, 0, sizeof(struct nvbios)); 5874 memset(bios, 0, sizeof(struct nvbios));
5875 mutex_init(&bios->lock); 5875 mutex_init(&bios->lock);
@@ -5885,7 +5885,7 @@ static bool NVInitVBIOS(struct drm_device *dev)
5885static int nouveau_parse_vbios_struct(struct drm_device *dev) 5885static int nouveau_parse_vbios_struct(struct drm_device *dev)
5886{ 5886{
5887 struct drm_nouveau_private *dev_priv = dev->dev_private; 5887 struct drm_nouveau_private *dev_priv = dev->dev_private;
5888 struct nvbios *bios = &dev_priv->VBIOS; 5888 struct nvbios *bios = &dev_priv->vbios;
5889 const uint8_t bit_signature[] = { 0xff, 0xb8, 'B', 'I', 'T' }; 5889 const uint8_t bit_signature[] = { 0xff, 0xb8, 'B', 'I', 'T' };
5890 const uint8_t bmp_signature[] = { 0xff, 0x7f, 'N', 'V', 0x0 }; 5890 const uint8_t bmp_signature[] = { 0xff, 0x7f, 'N', 'V', 0x0 };
5891 int offset; 5891 int offset;
@@ -5912,7 +5912,7 @@ int
5912nouveau_run_vbios_init(struct drm_device *dev) 5912nouveau_run_vbios_init(struct drm_device *dev)
5913{ 5913{
5914 struct drm_nouveau_private *dev_priv = dev->dev_private; 5914 struct drm_nouveau_private *dev_priv = dev->dev_private;
5915 struct nvbios *bios = &dev_priv->VBIOS; 5915 struct nvbios *bios = &dev_priv->vbios;
5916 int i, ret = 0; 5916 int i, ret = 0;
5917 5917
5918 NVLockVgaCrtcs(dev, false); 5918 NVLockVgaCrtcs(dev, false);
@@ -5959,7 +5959,7 @@ static void
5959nouveau_bios_i2c_devices_takedown(struct drm_device *dev) 5959nouveau_bios_i2c_devices_takedown(struct drm_device *dev)
5960{ 5960{
5961 struct drm_nouveau_private *dev_priv = dev->dev_private; 5961 struct drm_nouveau_private *dev_priv = dev->dev_private;
5962 struct nvbios *bios = &dev_priv->VBIOS; 5962 struct nvbios *bios = &dev_priv->vbios;
5963 struct dcb_i2c_entry *entry; 5963 struct dcb_i2c_entry *entry;
5964 int i; 5964 int i;
5965 5965
@@ -5972,13 +5972,11 @@ int
5972nouveau_bios_init(struct drm_device *dev) 5972nouveau_bios_init(struct drm_device *dev)
5973{ 5973{
5974 struct drm_nouveau_private *dev_priv = dev->dev_private; 5974 struct drm_nouveau_private *dev_priv = dev->dev_private;
5975 struct nvbios *bios = &dev_priv->VBIOS; 5975 struct nvbios *bios = &dev_priv->vbios;
5976 uint32_t saved_nv_pextdev_boot_0; 5976 uint32_t saved_nv_pextdev_boot_0;
5977 bool was_locked; 5977 bool was_locked;
5978 int ret; 5978 int ret;
5979 5979
5980 dev_priv->vbios = &bios->pub;
5981
5982 if (!NVInitVBIOS(dev)) 5980 if (!NVInitVBIOS(dev))
5983 return -ENODEV; 5981 return -ENODEV;
5984 5982
@@ -6020,10 +6018,8 @@ nouveau_bios_init(struct drm_device *dev)
6020 bios_wr32(bios, NV_PEXTDEV_BOOT_0, saved_nv_pextdev_boot_0); 6018 bios_wr32(bios, NV_PEXTDEV_BOOT_0, saved_nv_pextdev_boot_0);
6021 6019
6022 ret = nouveau_run_vbios_init(dev); 6020 ret = nouveau_run_vbios_init(dev);
6023 if (ret) { 6021 if (ret)
6024 dev_priv->vbios = NULL;
6025 return ret; 6022 return ret;
6026 }
6027 6023
6028 /* feature_byte on BMP is poor, but init always sets CR4B */ 6024 /* feature_byte on BMP is poor, but init always sets CR4B */
6029 was_locked = NVLockVgaCrtcs(dev, false); 6025 was_locked = NVLockVgaCrtcs(dev, false);