drm/nouveau/bios: have strap reads show on devinit spam debug level
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / drm / nouveau / core / subdev / bios / init.c
index df1b1b42309337cb14c79b503497e49bf80ee49b..a29c18617c57063aeeb536776c45464fa38d2a10 100644 (file)
@@ -9,6 +9,7 @@
 #include <subdev/bios/dp.h>
 #include <subdev/bios/gpio.h>
 #include <subdev/bios/init.h>
+#include <subdev/bios/ramcfg.h>
 #include <subdev/devinit.h>
 #include <subdev/i2c.h>
 #include <subdev/vga.h>
@@ -391,43 +392,14 @@ init_unknown_script(struct nouveau_bios *bios)
        return 0x0000;
 }
 
-static u16
-init_ram_restrict_table(struct nvbios_init *init)
-{
-       struct nouveau_bios *bios = init->bios;
-       struct bit_entry bit_M;
-       u16 data = 0x0000;
-
-       if (!bit_entry(bios, 'M', &bit_M)) {
-               if (bit_M.version == 1 && bit_M.length >= 5)
-                       data = nv_ro16(bios, bit_M.offset + 3);
-               if (bit_M.version == 2 && bit_M.length >= 3)
-                       data = nv_ro16(bios, bit_M.offset + 1);
-       }
-
-       if (data == 0x0000)
-               warn("ram restrict table not found\n");
-       return data;
-}
-
 static u8
 init_ram_restrict_group_count(struct nvbios_init *init)
 {
-       struct nouveau_bios *bios = init->bios;
-       struct bit_entry bit_M;
-
-       if (!bit_entry(bios, 'M', &bit_M)) {
-               if (bit_M.version == 1 && bit_M.length >= 5)
-                       return nv_ro08(bios, bit_M.offset + 2);
-               if (bit_M.version == 2 && bit_M.length >= 3)
-                       return nv_ro08(bios, bit_M.offset + 0);
-       }
-
-       return 0x00;
+       return nvbios_ramcfg_count(init->bios);
 }
 
 static u8
-init_ram_restrict_strap(struct nvbios_init *init)
+init_ram_restrict(struct nvbios_init *init)
 {
        /* This appears to be the behaviour of the VBIOS parser, and *is*
         * important to cache the NV_PEXTDEV_BOOT0 on later chipsets to
@@ -438,18 +410,8 @@ init_ram_restrict_strap(struct nvbios_init *init)
         * in case *not* re-reading the strap causes similar breakage.
         */
        if (!init->ramcfg || init->bios->version.major < 0x70)
-               init->ramcfg = init_rd32(init, 0x101000);
-       return (init->ramcfg & 0x00000003c) >> 2;
-}
-
-static u8
-init_ram_restrict(struct nvbios_init *init)
-{
-       u8  strap = init_ram_restrict_strap(init);
-       u16 table = init_ram_restrict_table(init);
-       if (table)
-               return nv_ro08(init->bios, table + strap);
-       return 0x00;
+               init->ramcfg = 0x80000000 | nvbios_ramcfg_index(init->subdev);
+       return (init->ramcfg & 0x7fffffff);
 }
 
 static u8
@@ -883,9 +845,8 @@ init_idx_addr_latched(struct nvbios_init *init)
        u32 data = nv_ro32(bios, init->offset + 13);
        u8 count = nv_ro08(bios, init->offset + 17);
 
-       trace("INDEX_ADDRESS_LATCHED\t"
-             "R[0x%06x] : R[0x%06x]\n\tCTRL &= 0x%08x |= 0x%08x\n",
-             creg, dreg, mask, data);
+       trace("INDEX_ADDRESS_LATCHED\tR[0x%06x] : R[0x%06x]\n", creg, dreg);
+       trace("\tCTRL &= 0x%08x |= 0x%08x\n", mask, data);
        init->offset += 18;
 
        while (count--) {