diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2011-10-12 02:48:48 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2011-12-21 04:01:39 -0500 |
commit | f9f9f536312d4c3ca39502ccf6a3af60cfe38ff4 (patch) | |
tree | 8dc47e17532e708f9bcea5bf307ce83f585ebe72 /drivers/gpu/drm | |
parent | 816af2f2d6bf3191988ecaf2340452ebc46025fc (diff) |
drm/nouveau/bios: pass drm_device to ROMPTR, rather than nvbios
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_bios.c | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_bios.h | 11 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_dp.c | 9 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_mem.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_perf.c | 11 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_temp.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_volt.c | 6 |
7 files changed, 28 insertions, 27 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c index 89747bebbfc7..dfa8e329c876 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bios.c +++ b/drivers/gpu/drm/nouveau/nouveau_bios.c | |||
@@ -4541,7 +4541,7 @@ nouveau_bios_run_display_table(struct drm_device *dev, u16 type, int pclk, | |||
4541 | NV_DEBUG_KMS(dev, "Searching for output entry for %d %d %d\n", | 4541 | NV_DEBUG_KMS(dev, "Searching for output entry for %d %d %d\n", |
4542 | dcbent->type, dcbent->location, dcbent->or); | 4542 | dcbent->type, dcbent->location, dcbent->or); |
4543 | for (i = 0; i < table[3]; i++) { | 4543 | for (i = 0; i < table[3]; i++) { |
4544 | otable = ROMPTR(bios, table[table[1] + (i * table[2])]); | 4544 | otable = ROMPTR(dev, table[table[1] + (i * table[2])]); |
4545 | if (otable && bios_encoder_match(dcbent, ROM32(otable[0]))) | 4545 | if (otable && bios_encoder_match(dcbent, ROM32(otable[0]))) |
4546 | break; | 4546 | break; |
4547 | } | 4547 | } |
@@ -5493,7 +5493,7 @@ bit_table(struct drm_device *dev, u8 id, struct bit_entry *bit) | |||
5493 | bit->version = entry[1]; | 5493 | bit->version = entry[1]; |
5494 | bit->length = ROM16(entry[2]); | 5494 | bit->length = ROM16(entry[2]); |
5495 | bit->offset = ROM16(entry[4]); | 5495 | bit->offset = ROM16(entry[4]); |
5496 | bit->data = ROMPTR(bios, entry[4]); | 5496 | bit->data = ROMPTR(dev, entry[4]); |
5497 | return 0; | 5497 | return 0; |
5498 | } | 5498 | } |
5499 | 5499 | ||
@@ -5807,9 +5807,9 @@ parse_dcb_gpio_table(struct nvbios *bios) | |||
5807 | u8 *dcb, *gpio = NULL, *entry; | 5807 | u8 *dcb, *gpio = NULL, *entry; |
5808 | int i; | 5808 | int i; |
5809 | 5809 | ||
5810 | dcb = ROMPTR(bios, bios->data[0x36]); | 5810 | dcb = ROMPTR(dev, bios->data[0x36]); |
5811 | if (dcb[0] >= 0x30) { | 5811 | if (dcb[0] >= 0x30) { |
5812 | gpio = ROMPTR(bios, dcb[10]); | 5812 | gpio = ROMPTR(dev, dcb[10]); |
5813 | if (!gpio) | 5813 | if (!gpio) |
5814 | goto no_table; | 5814 | goto no_table; |
5815 | 5815 | ||
@@ -5818,7 +5818,7 @@ parse_dcb_gpio_table(struct nvbios *bios) | |||
5818 | recordlen = gpio[3]; | 5818 | recordlen = gpio[3]; |
5819 | } else | 5819 | } else |
5820 | if (dcb[0] >= 0x22 && dcb[-1] >= 0x13) { | 5820 | if (dcb[0] >= 0x22 && dcb[-1] >= 0x13) { |
5821 | gpio = ROMPTR(bios, dcb[-15]); | 5821 | gpio = ROMPTR(dev, dcb[-15]); |
5822 | if (!gpio) | 5822 | if (!gpio) |
5823 | goto no_table; | 5823 | goto no_table; |
5824 | 5824 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.h b/drivers/gpu/drm/nouveau/nouveau_bios.h index dff121d8896f..5f1258834ec1 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bios.h +++ b/drivers/gpu/drm/nouveau/nouveau_bios.h | |||
@@ -34,9 +34,14 @@ | |||
34 | 34 | ||
35 | #define DCB_LOC_ON_CHIP 0 | 35 | #define DCB_LOC_ON_CHIP 0 |
36 | 36 | ||
37 | #define ROM16(x) le16_to_cpu(*(uint16_t *)&(x)) | 37 | #define ROM16(x) le16_to_cpu(*(u16 *)&(x)) |
38 | #define ROM32(x) le32_to_cpu(*(uint32_t *)&(x)) | 38 | #define ROM32(x) le32_to_cpu(*(u32 *)&(x)) |
39 | #define ROMPTR(bios, x) (ROM16(x) ? &(bios)->data[ROM16(x)] : NULL) | 39 | #define ROM48(x) ({ u8 *p = &(x); (u64)ROM16(p[4]) << 32 | ROM32(p[0]); }) |
40 | #define ROM64(x) le64_to_cpu(*(u64 *)&(x)) | ||
41 | #define ROMPTR(d,x) ({ \ | ||
42 | struct drm_nouveau_private *dev_priv = (d)->dev_private; \ | ||
43 | ROM16(x) ? &dev_priv->vbios.data[ROM16(x)] : NULL; \ | ||
44 | }) | ||
40 | 45 | ||
41 | struct bit_entry { | 46 | struct bit_entry { |
42 | uint8_t id; | 47 | uint8_t id; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_dp.c b/drivers/gpu/drm/nouveau/nouveau_dp.c index de5efe71fefd..5722fd55764b 100644 --- a/drivers/gpu/drm/nouveau/nouveau_dp.c +++ b/drivers/gpu/drm/nouveau/nouveau_dp.c | |||
@@ -273,8 +273,6 @@ nouveau_dp_tu_update(struct drm_device *dev, int or, int link, u32 clk, u32 bpp) | |||
273 | u8 * | 273 | u8 * |
274 | nouveau_dp_bios_data(struct drm_device *dev, struct dcb_entry *dcb, u8 **entry) | 274 | nouveau_dp_bios_data(struct drm_device *dev, struct dcb_entry *dcb, u8 **entry) |
275 | { | 275 | { |
276 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
277 | struct nvbios *bios = &dev_priv->vbios; | ||
278 | struct bit_entry d; | 276 | struct bit_entry d; |
279 | u8 *table; | 277 | u8 *table; |
280 | int i; | 278 | int i; |
@@ -289,7 +287,7 @@ nouveau_dp_bios_data(struct drm_device *dev, struct dcb_entry *dcb, u8 **entry) | |||
289 | return NULL; | 287 | return NULL; |
290 | } | 288 | } |
291 | 289 | ||
292 | table = ROMPTR(bios, d.data[0]); | 290 | table = ROMPTR(dev, d.data[0]); |
293 | if (!table) { | 291 | if (!table) { |
294 | NV_ERROR(dev, "displayport table pointer invalid\n"); | 292 | NV_ERROR(dev, "displayport table pointer invalid\n"); |
295 | return NULL; | 293 | return NULL; |
@@ -306,7 +304,7 @@ nouveau_dp_bios_data(struct drm_device *dev, struct dcb_entry *dcb, u8 **entry) | |||
306 | } | 304 | } |
307 | 305 | ||
308 | for (i = 0; i < table[3]; i++) { | 306 | for (i = 0; i < table[3]; i++) { |
309 | *entry = ROMPTR(bios, table[table[1] + (i * table[2])]); | 307 | *entry = ROMPTR(dev, table[table[1] + (i * table[2])]); |
310 | if (*entry && bios_encoder_match(dcb, ROM32((*entry)[0]))) | 308 | if (*entry && bios_encoder_match(dcb, ROM32((*entry)[0]))) |
311 | return table; | 309 | return table; |
312 | } | 310 | } |
@@ -336,7 +334,6 @@ struct dp_state { | |||
336 | static void | 334 | static void |
337 | dp_set_link_config(struct drm_device *dev, struct dp_state *dp) | 335 | dp_set_link_config(struct drm_device *dev, struct dp_state *dp) |
338 | { | 336 | { |
339 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
340 | int or = dp->or, link = dp->link; | 337 | int or = dp->or, link = dp->link; |
341 | u8 *entry, sink[2]; | 338 | u8 *entry, sink[2]; |
342 | u32 dp_ctrl; | 339 | u32 dp_ctrl; |
@@ -360,7 +357,7 @@ dp_set_link_config(struct drm_device *dev, struct dp_state *dp) | |||
360 | * table, that has (among other things) pointers to more scripts that | 357 | * table, that has (among other things) pointers to more scripts that |
361 | * need to be executed, this time depending on link speed. | 358 | * need to be executed, this time depending on link speed. |
362 | */ | 359 | */ |
363 | entry = ROMPTR(&dev_priv->vbios, dp->entry[10]); | 360 | entry = ROMPTR(dev, dp->entry[10]); |
364 | if (entry) { | 361 | if (entry) { |
365 | if (dp->table[0] < 0x30) { | 362 | if (dp->table[0] < 0x30) { |
366 | while (dp->link_bw < (ROM16(entry[0]) * 10)) | 363 | while (dp->link_bw < (ROM16(entry[0]) * 10)) |
diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c b/drivers/gpu/drm/nouveau/nouveau_mem.c index 37fcaa260e98..c3a5745e9c79 100644 --- a/drivers/gpu/drm/nouveau/nouveau_mem.c +++ b/drivers/gpu/drm/nouveau/nouveau_mem.c | |||
@@ -644,10 +644,10 @@ nouveau_mem_timing_init(struct drm_device *dev) | |||
644 | return; | 644 | return; |
645 | 645 | ||
646 | if (P.version == 1) | 646 | if (P.version == 1) |
647 | hdr = (struct nouveau_pm_tbl_header *) ROMPTR(bios, P.data[4]); | 647 | hdr = (struct nouveau_pm_tbl_header *) ROMPTR(dev, P.data[4]); |
648 | else | 648 | else |
649 | if (P.version == 2) | 649 | if (P.version == 2) |
650 | hdr = (struct nouveau_pm_tbl_header *) ROMPTR(bios, P.data[8]); | 650 | hdr = (struct nouveau_pm_tbl_header *) ROMPTR(dev, P.data[8]); |
651 | else { | 651 | else { |
652 | NV_WARN(dev, "unknown mem for BIT P %d\n", P.version); | 652 | NV_WARN(dev, "unknown mem for BIT P %d\n", P.version); |
653 | } | 653 | } |
diff --git a/drivers/gpu/drm/nouveau/nouveau_perf.c b/drivers/gpu/drm/nouveau/nouveau_perf.c index 6d49bdbf93d0..58f497343cec 100644 --- a/drivers/gpu/drm/nouveau/nouveau_perf.c +++ b/drivers/gpu/drm/nouveau/nouveau_perf.c | |||
@@ -41,7 +41,7 @@ legacy_perf_init(struct drm_device *dev) | |||
41 | return; | 41 | return; |
42 | } | 42 | } |
43 | 43 | ||
44 | perf = ROMPTR(bios, bmp[0x73]); | 44 | perf = ROMPTR(dev, bmp[0x73]); |
45 | if (!perf) { | 45 | if (!perf) { |
46 | NV_DEBUG(dev, "No memclock table pointer found.\n"); | 46 | NV_DEBUG(dev, "No memclock table pointer found.\n"); |
47 | return; | 47 | return; |
@@ -87,7 +87,7 @@ nouveau_perf_timing(struct drm_device *dev, struct bit_entry *P, | |||
87 | * ramcfg to select the correct subentry | 87 | * ramcfg to select the correct subentry |
88 | */ | 88 | */ |
89 | if (P->version == 2) { | 89 | if (P->version == 2) { |
90 | u8 *tmap = ROMPTR(bios, P->data[4]); | 90 | u8 *tmap = ROMPTR(dev, P->data[4]); |
91 | if (!tmap) { | 91 | if (!tmap) { |
92 | NV_DEBUG(dev, "no timing map pointer\n"); | 92 | NV_DEBUG(dev, "no timing map pointer\n"); |
93 | return NULL; | 93 | return NULL; |
@@ -140,7 +140,6 @@ nouveau_perf_voltage(struct drm_device *dev, struct bit_entry *P, | |||
140 | struct nouveau_pm_level *perflvl) | 140 | struct nouveau_pm_level *perflvl) |
141 | { | 141 | { |
142 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 142 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
143 | struct nvbios *bios = &dev_priv->vbios; | ||
144 | u8 *vmap; | 143 | u8 *vmap; |
145 | int id; | 144 | int id; |
146 | 145 | ||
@@ -165,7 +164,7 @@ nouveau_perf_voltage(struct drm_device *dev, struct bit_entry *P, | |||
165 | return; | 164 | return; |
166 | } | 165 | } |
167 | 166 | ||
168 | vmap = ROMPTR(bios, P->data[32]); | 167 | vmap = ROMPTR(dev, P->data[32]); |
169 | if (!vmap) { | 168 | if (!vmap) { |
170 | NV_DEBUG(dev, "volt map table pointer invalid\n"); | 169 | NV_DEBUG(dev, "volt map table pointer invalid\n"); |
171 | return; | 170 | return; |
@@ -200,7 +199,7 @@ nouveau_perf_init(struct drm_device *dev) | |||
200 | return; | 199 | return; |
201 | } | 200 | } |
202 | 201 | ||
203 | perf = ROMPTR(bios, P.data[0]); | 202 | perf = ROMPTR(dev, P.data[0]); |
204 | version = perf[0]; | 203 | version = perf[0]; |
205 | headerlen = perf[1]; | 204 | headerlen = perf[1]; |
206 | if (version < 0x40) { | 205 | if (version < 0x40) { |
@@ -218,7 +217,7 @@ nouveau_perf_init(struct drm_device *dev) | |||
218 | return; | 217 | return; |
219 | } | 218 | } |
220 | 219 | ||
221 | perf = ROMPTR(bios, bios->data[bios->offset + 0x94]); | 220 | perf = ROMPTR(dev, bios->data[bios->offset + 0x94]); |
222 | if (!perf) { | 221 | if (!perf) { |
223 | NV_DEBUG(dev, "perf table pointer invalid\n"); | 222 | NV_DEBUG(dev, "perf table pointer invalid\n"); |
224 | return; | 223 | return; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_temp.c b/drivers/gpu/drm/nouveau/nouveau_temp.c index 6364e4c46124..4c46adeb0715 100644 --- a/drivers/gpu/drm/nouveau/nouveau_temp.c +++ b/drivers/gpu/drm/nouveau/nouveau_temp.c | |||
@@ -316,9 +316,9 @@ nouveau_temp_init(struct drm_device *dev) | |||
316 | return; | 316 | return; |
317 | 317 | ||
318 | if (P.version == 1) | 318 | if (P.version == 1) |
319 | temp = ROMPTR(bios, P.data[12]); | 319 | temp = ROMPTR(dev, P.data[12]); |
320 | else if (P.version == 2) | 320 | else if (P.version == 2) |
321 | temp = ROMPTR(bios, P.data[16]); | 321 | temp = ROMPTR(dev, P.data[16]); |
322 | else | 322 | else |
323 | NV_WARN(dev, "unknown temp for BIT P %d\n", P.version); | 323 | NV_WARN(dev, "unknown temp for BIT P %d\n", P.version); |
324 | 324 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_volt.c b/drivers/gpu/drm/nouveau/nouveau_volt.c index 86d03e15735d..ac15b46ea3a0 100644 --- a/drivers/gpu/drm/nouveau/nouveau_volt.c +++ b/drivers/gpu/drm/nouveau/nouveau_volt.c | |||
@@ -117,10 +117,10 @@ nouveau_volt_init(struct drm_device *dev) | |||
117 | return; | 117 | return; |
118 | 118 | ||
119 | if (P.version == 1) | 119 | if (P.version == 1) |
120 | volt = ROMPTR(bios, P.data[16]); | 120 | volt = ROMPTR(dev, P.data[16]); |
121 | else | 121 | else |
122 | if (P.version == 2) | 122 | if (P.version == 2) |
123 | volt = ROMPTR(bios, P.data[12]); | 123 | volt = ROMPTR(dev, P.data[12]); |
124 | else { | 124 | else { |
125 | NV_WARN(dev, "unknown volt for BIT P %d\n", P.version); | 125 | NV_WARN(dev, "unknown volt for BIT P %d\n", P.version); |
126 | } | 126 | } |
@@ -130,7 +130,7 @@ nouveau_volt_init(struct drm_device *dev) | |||
130 | return; | 130 | return; |
131 | } | 131 | } |
132 | 132 | ||
133 | volt = ROMPTR(bios, bios->data[bios->offset + 0x98]); | 133 | volt = ROMPTR(dev, bios->data[bios->offset + 0x98]); |
134 | } | 134 | } |
135 | 135 | ||
136 | if (!volt) { | 136 | if (!volt) { |