drm/nouveau/bios: switch to subdev printk macros
authorBen Skeggs <bskeggs@redhat.com>
Thu, 20 Aug 2015 04:54:11 +0000 (14:54 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 28 Aug 2015 02:40:22 +0000 (12:40 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 files changed:
drivers/gpu/drm/nouveau/nvkm/subdev/bios/M0203.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/dcb.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/i2c.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/image.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/mxm.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/npde.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/pcir.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/pll.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowramin.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/therm.c

index 08eb03fbc203b33f1974ad7274a01ff152d9674e..941db974f897d0b35ae42484fd620b5c228dbdc0 100644 (file)
@@ -103,12 +103,13 @@ u32
 nvbios_M0203Em(struct nvkm_bios *bios, u8 ramcfg, u8 *ver, u8 *hdr,
               struct nvbios_M0203E *info)
 {
+       struct nvkm_subdev *subdev = &bios->subdev;
        struct nvbios_M0203T M0203T;
        u8  cnt, len, idx = 0xff;
        u32 data;
 
        if (!nvbios_M0203Tp(bios, ver, hdr, &cnt, &len, &M0203T)) {
-               nv_warn(bios, "M0203T not found\n");
+               nvkm_warn(subdev, "M0203T not found\n");
                return 0x00000000;
        }
 
@@ -119,7 +120,7 @@ nvbios_M0203Em(struct nvkm_bios *bios, u8 ramcfg, u8 *ver, u8 *hdr,
                                continue;
                        return data;
                default:
-                       nv_warn(bios, "M0203T type %02x\n", M0203T.type);
+                       nvkm_warn(subdev, "M0203T type %02x\n", M0203T.type);
                        return 0x00000000;
                }
        }
index 0cd9ab4ed8eecd2b166dbfe40e69729ea96815a5..3a01544200cd34435caa906e1b5617c5fb1892a6 100644 (file)
@@ -134,15 +134,15 @@ nvkm_bios_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
        bios->bmp_offset = nvbios_findstr(bios->data, bios->size,
                                          "\xff\x7f""NV\0", 5);
        if (bios->bmp_offset) {
-               nv_info(bios, "BMP version %x.%x\n",
-                       bmp_version(bios) >> 8,
-                       bmp_version(bios) & 0xff);
+               nvkm_debug(&bios->subdev, "BMP version %x.%x\n",
+                          bmp_version(bios) >> 8,
+                          bmp_version(bios) & 0xff);
        }
 
        bios->bit_offset = nvbios_findstr(bios->data, bios->size,
                                          "\xff\xb8""BIT", 5);
        if (bios->bit_offset)
-               nv_info(bios, "BIT signature found\n");
+               nvkm_debug(&bios->subdev, "BIT signature found\n");
 
        /* determine the vbios version number */
        if (!bit_entry(bios, 'i', &bit_i) && bit_i.length >= 4) {
@@ -159,10 +159,9 @@ nvkm_bios_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
                bios->version.micro = nv_ro08(bios, bios->bmp_offset + 10);
        }
 
-       nv_info(bios, "version %02x.%02x.%02x.%02x.%02x\n",
-               bios->version.major, bios->version.chip,
-               bios->version.minor, bios->version.micro, bios->version.patch);
-
+       nvkm_info(&bios->subdev, "version %02x.%02x.%02x.%02x.%02x\n",
+                 bios->version.major, bios->version.chip,
+                 bios->version.minor, bios->version.micro, bios->version.patch);
        return 0;
 }
 
index 1463571717574d6f264f0deff7a44306a93737a7..85976ebcb06ae1d0bb5b9be6aed5853e0eccbd73 100644 (file)
 u16
 dcb_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len)
 {
-       struct nvkm_device *device = nv_device(bios);
+       struct nvkm_subdev *subdev = &bios->subdev;
+       struct nvkm_device *device = subdev->device;
        u16 dcb = 0x0000;
 
        if (device->card_type > NV_04)
                dcb = nv_ro16(bios, 0x36);
        if (!dcb) {
-               nv_warn(bios, "DCB table not found\n");
+               nvkm_warn(subdev, "DCB table not found\n");
                return dcb;
        }
 
        *ver = nv_ro08(bios, dcb);
 
        if (*ver >= 0x42) {
-               nv_warn(bios, "DCB version 0x%02x unknown\n", *ver);
+               nvkm_warn(subdev, "DCB version 0x%02x unknown\n", *ver);
                return 0x0000;
        } else
        if (*ver >= 0x30) {
@@ -86,11 +87,11 @@ dcb_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len)
                 *
                 * v1.1 (NV5+, maybe some NV4) is entirely unhelpful
                 */
-               nv_warn(bios, "DCB contains no useful data\n");
+               nvkm_debug(subdev, "DCB contains no useful data\n");
                return 0x0000;
        }
 
-       nv_warn(bios, "DCB header validation failed\n");
+       nvkm_warn(subdev, "DCB header validation failed\n");
        return 0x0000;
 }
 
index c4e1f085ee10b810c07ef1557a9438ac6a1eaa77..d1dde7abfb24ac36edc98718a7809c6d37c93d0b 100644 (file)
@@ -38,7 +38,7 @@ dcb_i2c_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len)
        }
 
        if (i2c && *ver >= 0x42) {
-               nv_warn(bios, "ccb %02x not supported\n", *ver);
+               nvkm_warn(&bios->subdev, "ccb %02x not supported\n", *ver);
                return 0x0000;
        }
 
@@ -70,6 +70,7 @@ dcb_i2c_entry(struct nvkm_bios *bios, u8 idx, u8 *ver, u8 *len)
 int
 dcb_i2c_parse(struct nvkm_bios *bios, u8 idx, struct dcb_i2c_entry *info)
 {
+       struct nvkm_subdev *subdev = &bios->subdev;
        u8  ver, len;
        u16 ent = dcb_i2c_entry(bios, idx, &ver, &len);
        if (ent) {
@@ -126,7 +127,7 @@ dcb_i2c_parse(struct nvkm_bios *bios, u8 idx, struct dcb_i2c_entry *info)
                case DCB_I2C_UNUSED:
                        return 0;
                default:
-                       nv_warn(bios, "unknown i2c type %d\n", info->type);
+                       nvkm_warn(subdev, "unknown i2c type %d\n", info->type);
                        info->type = DCB_I2C_UNUSED;
                        return 0;
                }
index 1815540a0e8b31886ee64aef0cdeef0ff0960a98..4560bb3baa5c12dfac183226bcc7e3527c109be2 100644 (file)
@@ -29,6 +29,7 @@
 static bool
 nvbios_imagen(struct nvkm_bios *bios, struct nvbios_image *image)
 {
+       struct nvkm_subdev *subdev = &bios->subdev;
        struct nvbios_pcirT pcir;
        struct nvbios_npdeT npde;
        u8  ver;
@@ -41,8 +42,8 @@ nvbios_imagen(struct nvkm_bios *bios, struct nvbios_image *image)
        case 0x4e56: /* NV */
                break;
        default:
-               nv_debug(bios, "%08x: ROM signature (%04x) unknown\n",
-                        image->base, data);
+               nvkm_debug(subdev, "%08x: ROM signature (%04x) unknown\n",
+                          image->base, data);
                return false;
        }
 
index 64d7b482674d8a685a51448e63c9653f7d055865..b03076e9a0eff06b35f43431608e8606aa231b29 100644 (file)
 #include <subdev/vga.h>
 
 #define bioslog(lvl, fmt, args...) do {                                        \
-       nv_printk(init->bios, lvl, "0x%04x[%c]: "fmt, init->offset,            \
-                 init_exec(init) ? '0' + (init->nested - 1) : ' ', ##args);   \
+       nvkm_printk(init->subdev, lvl, info, "0x%04x[%c]: "fmt,                \
+                   init->offset, init_exec(init) ?                            \
+                   '0' + (init->nested - 1) : ' ', ##args);                   \
 } while(0)
 #define cont(fmt, args...) do {                                                \
-       if (nv_subdev(init->bios)->debug >= NV_DBG_TRACE)                      \
+       if (init->subdev->debug >= NV_DBG_TRACE)                               \
                printk(fmt, ##args);                                           \
 } while(0)
 #define trace(fmt, args...) bioslog(TRACE, fmt, ##args)
@@ -2292,7 +2293,7 @@ nvbios_init(struct nvkm_subdev *subdev, bool execute)
        u16 data;
 
        if (execute)
-               nv_info(bios, "running init tables\n");
+               nvkm_debug(subdev, "running init tables\n");
        while (!ret && (data = (init_script(bios, ++i)))) {
                struct nvbios_init init = {
                        .subdev = subdev,
index c4087df4f85ea5a9de5c91d9a74abfdc4eb1ab07..a0d7505eeed778185a3bc67d9e00c593cbc40c3d 100644 (file)
 u16
 mxm_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr)
 {
+       struct nvkm_subdev *subdev = &bios->subdev;
        struct bit_entry x;
 
        if (bit_entry(bios, 'x', &x)) {
-               nv_debug(bios, "BIT 'x' table not present\n");
+               nvkm_debug(subdev, "BIT 'x' table not present\n");
                return 0x0000;
        }
 
        *ver = x.version;
        *hdr = x.length;
        if (*ver != 1 || *hdr < 3) {
-               nv_warn(bios, "BIT 'x' table %d/%d unknown\n", *ver, *hdr);
+               nvkm_warn(subdev, "BIT 'x' table %d/%d unknown\n", *ver, *hdr);
                return 0x0000;
        }
 
@@ -73,6 +74,7 @@ static u8 g98_sor_map[16] = {
 u8
 mxm_sor_map(struct nvkm_bios *bios, u8 conn)
 {
+       struct nvkm_subdev *subdev = &bios->subdev;
        u8  ver, hdr;
        u16 mxm = mxm_table(bios, &ver, &hdr);
        if (mxm && hdr >= 6) {
@@ -89,7 +91,7 @@ mxm_sor_map(struct nvkm_bios *bios, u8 conn)
                                return 0x00;
                        }
 
-                       nv_warn(bios, "unknown sor map v%02x\n", ver);
+                       nvkm_warn(subdev, "unknown sor map v%02x\n", ver);
                }
        }
 
@@ -102,13 +104,14 @@ mxm_sor_map(struct nvkm_bios *bios, u8 conn)
        if (bios->version.chip == 0x98)
                return g98_sor_map[conn];
 
-       nv_warn(bios, "missing sor map\n");
+       nvkm_warn(subdev, "missing sor map\n");
        return 0x00;
 }
 
 u8
 mxm_ddc_map(struct nvkm_bios *bios, u8 port)
 {
+       struct nvkm_subdev *subdev = &bios->subdev;
        u8  ver, hdr;
        u16 mxm = mxm_table(bios, &ver, &hdr);
        if (mxm && hdr >= 8) {
@@ -125,7 +128,7 @@ mxm_ddc_map(struct nvkm_bios *bios, u8 port)
                                return 0x00;
                        }
 
-                       nv_warn(bios, "unknown ddc map v%02x\n", ver);
+                       nvkm_warn(subdev, "unknown ddc map v%02x\n", ver);
                }
        }
 
index fd7dd718b2bf1a1b10134a5eda1a7e3f3066cbac..040c03a8b4f36ac1ca5cdb0851b2701b5a3419a9 100644 (file)
@@ -36,8 +36,9 @@ nvbios_npdeTe(struct nvkm_bios *bios, u32 base)
                case 0x4544504e: /* NPDE */
                        break;
                default:
-                       nv_debug(bios, "%08x: NPDE signature (%08x) unknown\n",
-                                data, nv_ro32(bios, data + 0x00));
+                       nvkm_debug(&bios->subdev,
+                                  "%08x: NPDE signature (%08x) unknown\n",
+                                  data, nv_ro32(bios, data + 0x00));
                        data = 0;
                        break;
                }
index df5978753ae85e4bc12eb74b95ecf636c74a0a43..5e4979f98423da87070fb1bc6d6ecdc1b0b85170 100644 (file)
@@ -38,8 +38,9 @@ nvbios_pcirTe(struct nvkm_bios *bios, u32 base, u8 *ver, u16 *hdr)
                        *ver = nv_ro08(bios, data + 0x0c);
                        break;
                default:
-                       nv_debug(bios, "%08x: PCIR signature (%08x) unknown\n",
-                                data, nv_ro32(bios, data + 0x00));
+                       nvkm_debug(&bios->subdev,
+                                  "%08x: PCIR signature (%08x) unknown\n",
+                                  data, nv_ro32(bios, data + 0x00));
                        data = 0;
                        break;
                }
index d26d89abf7eb040e93eecf14809ed5f675d09cd6..44088a809f6806e702add1a34f82723838f25ecb 100644 (file)
@@ -221,7 +221,8 @@ pll_map_type(struct nvkm_bios *bios, u8 type, u32 *reg, u8 *ver, u8 *len)
 int
 nvbios_pll_parse(struct nvkm_bios *bios, u32 type, struct nvbios_pll *info)
 {
-       struct nvkm_device *device = bios->subdev.device;
+       struct nvkm_subdev *subdev = &bios->subdev;
+       struct nvkm_device *device = subdev->device;
        u8  ver, len;
        u32 reg = type;
        u16 data;
@@ -356,7 +357,7 @@ nvbios_pll_parse(struct nvkm_bios *bios, u32 type, struct nvbios_pll *info)
                info->max_p = nv_ro08(bios, data + 13);
                break;
        default:
-               nv_error(bios, "unknown pll limits version 0x%02x\n", ver);
+               nvkm_error(subdev, "unknown pll limits version 0x%02x\n", ver);
                return -EINVAL;
        }
 
index c64a5484c9c8175259f7bcb0adc8603236dcea61..aad482fe7601c9e9cbc6349ff2f018f6572720be 100644 (file)
@@ -90,25 +90,27 @@ shadow_class = {
 static int
 shadow_image(struct nvkm_bios *bios, int idx, struct shadow *mthd)
 {
+       struct nvkm_subdev *subdev = &bios->subdev;
        struct nvbios_image image;
        int score = 1;
 
        if (!nvbios_image(bios, idx, &image)) {
-               nv_debug(bios, "image %d invalid\n", idx);
+               nvkm_debug(subdev, "image %d invalid\n", idx);
                return 0;
        }
-       nv_debug(bios, "%08x: type %02x, %d bytes\n",
-                image.base, image.type, image.size);
+       nvkm_debug(subdev, "%08x: type %02x, %d bytes\n",
+                  image.base, image.type, image.size);
 
        if (!shadow_fetch(bios, image.size)) {
-               nv_debug(bios, "%08x: fetch failed\n", image.base);
+               nvkm_debug(subdev, "%08x: fetch failed\n", image.base);
                return 0;
        }
 
        switch (image.type) {
        case 0x00:
                if (nvbios_checksum(&bios->data[image.base], image.size)) {
-                       nv_debug(bios, "%08x: checksum failed\n", image.base);
+                       nvkm_debug(subdev, "%08x: checksum failed\n",
+                                  image.base);
                        if (mthd->func->rw)
                                score += 1;
                        score += 1;
@@ -142,8 +144,9 @@ static int
 shadow_method(struct nvkm_bios *bios, struct shadow *mthd, const char *name)
 {
        const struct nvbios_source *func = mthd->func;
+       struct nvkm_subdev *subdev = &bios->subdev;
        if (func->name) {
-               nv_debug(bios, "trying %s...\n", name ? name : func->name);
+               nvkm_debug(subdev, "trying %s...\n", name ? name : func->name);
                if (func->init) {
                        mthd->data = func->init(bios, name);
                        if (IS_ERR(mthd->data)) {
@@ -154,7 +157,7 @@ shadow_method(struct nvkm_bios *bios, struct shadow *mthd, const char *name)
                mthd->score = shadow_score(bios, mthd);
                if (func->fini)
                        func->fini(mthd->data);
-               nv_debug(bios, "scored %d\n", mthd->score);
+               nvkm_debug(subdev, "scored %d\n", mthd->score);
                mthd->data = bios->data;
                mthd->size = bios->size;
                bios->data  = NULL;
@@ -197,6 +200,8 @@ shadow_fw = {
 int
 nvbios_shadow(struct nvkm_bios *bios)
 {
+       struct nvkm_subdev *subdev = &bios->subdev;
+       struct nvkm_device *device = subdev->device;
        struct shadow mthds[] = {
                { shadow_class, 0, &nvbios_of },
                { shadow_class, 0, &nvbios_ramin },
@@ -212,7 +217,7 @@ nvbios_shadow(struct nvkm_bios *bios)
        int optlen;
 
        /* handle user-specified bios source */
-       optarg = nvkm_stropt(nv_device(bios)->cfgopt, "NvBios", &optlen);
+       optarg = nvkm_stropt(device->cfgopt, "NvBios", &optlen);
        source = optarg ? kstrndup(optarg, optlen, GFP_KERNEL) : NULL;
        if (source) {
                /* try to match one of the built-in methods */
@@ -233,7 +238,7 @@ nvbios_shadow(struct nvkm_bios *bios)
                }
 
                if (!best->score) {
-                       nv_error(bios, "%s invalid\n", source);
+                       nvkm_error(subdev, "%s invalid\n", source);
                        kfree(source);
                        source = NULL;
                }
@@ -258,12 +263,12 @@ nvbios_shadow(struct nvkm_bios *bios)
        }
 
        if (!best->score) {
-               nv_fatal(bios, "unable to locate usable image\n");
+               nvkm_error(subdev, "unable to locate usable image\n");
                return -EINVAL;
        }
 
-       nv_info(bios, "using image from %s\n", best->func ?
-               best->func->name : source);
+       nvkm_debug(subdev, "using image from %s\n", best->func ?
+                  best->func->name : source);
        bios->data = best->data;
        bios->size = best->size;
        kfree(source);
index 9d0e206aef5e6d1fc43541bee288319d9e888acf..0f537c22804cf2bed0e88bdf4eb064c8a4c74a87 100644 (file)
@@ -54,7 +54,8 @@ pramin_fini(void *data)
 static void *
 pramin_init(struct nvkm_bios *bios, const char *name)
 {
-       struct nvkm_device *device = bios->subdev.device;
+       struct nvkm_subdev *subdev = &bios->subdev;
+       struct nvkm_device *device = subdev->device;
        struct priv *priv = NULL;
        u64 addr = 0;
 
@@ -69,7 +70,7 @@ pramin_init(struct nvkm_bios *bios, const char *name)
        if (device->card_type >= NV_C0)
                addr = nvkm_rd32(device, 0x022500);
        if (addr & 0x00000001) {
-               nv_debug(bios, "... display disabled\n");
+               nvkm_debug(subdev, "... display disabled\n");
                return ERR_PTR(-ENODEV);
        }
 
@@ -79,11 +80,11 @@ pramin_init(struct nvkm_bios *bios, const char *name)
         */
        addr = nvkm_rd32(device, 0x619f04);
        if (!(addr & 0x00000008)) {
-               nv_debug(bios, "... not enabled\n");
+               nvkm_debug(subdev, "... not enabled\n");
                return ERR_PTR(-ENODEV);
        }
        if ( (addr & 0x00000003) != 1) {
-               nv_debug(bios, "... not in vram\n");
+               nvkm_debug(subdev, "... not in vram\n");
                return ERR_PTR(-ENODEV);
        }
 
@@ -96,7 +97,7 @@ pramin_init(struct nvkm_bios *bios, const char *name)
 
        /* modify bar0 PRAMIN window to cover the bios image */
        if (!(priv = kmalloc(sizeof(*priv), GFP_KERNEL))) {
-               nv_error(bios, "... out of memory\n");
+               nvkm_error(subdev, "... out of memory\n");
                return ERR_PTR(-ENOMEM);
        }
 
index 8fbb8917b0e222a64ca8ce541b17ff15e1dcb225..5a21d01a27fed5640c6b3aa283e98e5ce614989d 100644 (file)
@@ -37,9 +37,9 @@ therm_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *len, u8 *cnt)
                else if (bit_P.version == 2)
                        therm = nv_ro16(bios, bit_P.offset + 16);
                else
-                       nv_error(bios,
-                               "unknown offset for thermal in BIT P %d\n",
-                               bit_P.version);
+                       nvkm_error(&bios->subdev,
+                                  "unknown offset for thermal in BIT P %d\n",
+                                  bit_P.version);
        }
 
        /* exit now if we haven't found the thermal table */