diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2012-12-19 16:48:51 -0500 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2012-12-23 07:59:30 -0500 |
commit | 5ddf4d4a543dd3303b20d7e9a4b3549589c5f095 (patch) | |
tree | fb389fe146f844f6061670f651f20ff95613cb50 /drivers/gpu | |
parent | 3d8ec277394ee0cf9fdd5a411017c3b4f1b0aff2 (diff) |
drm/nouveau/bios: cache ramcfg strap on later chipsets
This fixes suspend/resume on at least Quadro 400.
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/nouveau/core/include/subdev/bios/init.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/core/subdev/bios/init.c | 18 |
2 files changed, 18 insertions, 1 deletions
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/bios/init.h b/drivers/gpu/drm/nouveau/core/include/subdev/bios/init.h index e69a8bdc6e97..ca2f6bf37f46 100644 --- a/drivers/gpu/drm/nouveau/core/include/subdev/bios/init.h +++ b/drivers/gpu/drm/nouveau/core/include/subdev/bios/init.h | |||
@@ -13,6 +13,7 @@ struct nvbios_init { | |||
13 | u32 nested; | 13 | u32 nested; |
14 | u16 repeat; | 14 | u16 repeat; |
15 | u16 repend; | 15 | u16 repend; |
16 | u32 ramcfg; | ||
16 | }; | 17 | }; |
17 | 18 | ||
18 | int nvbios_exec(struct nvbios_init *); | 19 | int nvbios_exec(struct nvbios_init *); |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/init.c b/drivers/gpu/drm/nouveau/core/subdev/bios/init.c index 98f78cf318b0..2917d552689b 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/bios/init.c +++ b/drivers/gpu/drm/nouveau/core/subdev/bios/init.c | |||
@@ -411,9 +411,25 @@ init_ram_restrict_group_count(struct nvbios_init *init) | |||
411 | } | 411 | } |
412 | 412 | ||
413 | static u8 | 413 | static u8 |
414 | init_ram_restrict_strap(struct nvbios_init *init) | ||
415 | { | ||
416 | /* This appears to be the behaviour of the VBIOS parser, and *is* | ||
417 | * important to cache the NV_PEXTDEV_BOOT0 on later chipsets to | ||
418 | * avoid fucking up the memory controller (somehow) by reading it | ||
419 | * on every INIT_RAM_RESTRICT_ZM_GROUP opcode. | ||
420 | * | ||
421 | * Preserving the non-caching behaviour on earlier chipsets just | ||
422 | * in case *not* re-reading the strap causes similar breakage. | ||
423 | */ | ||
424 | if (!init->ramcfg || init->bios->version.major < 0x70) | ||
425 | init->ramcfg = init_rd32(init, 0x101000); | ||
426 | return (init->ramcfg & 0x00000003c) >> 2; | ||
427 | } | ||
428 | |||
429 | static u8 | ||
414 | init_ram_restrict(struct nvbios_init *init) | 430 | init_ram_restrict(struct nvbios_init *init) |
415 | { | 431 | { |
416 | u32 strap = (init_rd32(init, 0x101000) & 0x0000003c) >> 2; | 432 | u8 strap = init_ram_restrict_strap(init); |
417 | u16 table = init_ram_restrict_table(init); | 433 | u16 table = init_ram_restrict_table(init); |
418 | if (table) | 434 | if (table) |
419 | return nv_ro08(init->bios, table + strap); | 435 | return nv_ro08(init->bios, table + strap); |