From 5b0e787ad599a8e6803daf743dfc4642018ba469 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Fri, 19 May 2017 23:59:34 +1000 Subject: [PATCH] drm/nouveau/bios/init: remove internal use of nvbios_init.bios We already have a subdev pointer, from which we can locate the device's BIOS subdev. No need for a separate pointer. Structure/callers not updated yet, as I want to batch more changes and only touch the callers once. Signed-off-by: Ben Skeggs --- .../gpu/drm/nouveau/nvkm/subdev/bios/init.c | 166 +++++++++--------- 1 file changed, 84 insertions(+), 82 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c index 1d5f29a5c07c..1894b2490651 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c @@ -119,7 +119,7 @@ init_crtc(struct nvbios_init *init) static u8 init_conn(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; struct nvbios_connE connE; u8 ver, hdr; u32 conn; @@ -141,7 +141,7 @@ init_conn(struct nvbios_init *init) static inline u32 init_nvreg(struct nvbios_init *init, u32 reg) { - struct nvkm_devinit *devinit = init->bios->subdev.device->devinit; + struct nvkm_devinit *devinit = init->subdev->device->devinit; /* C51 (at least) sometimes has the lower bits set which the VBIOS * interprets to mean that access needs to go through certain IO @@ -154,7 +154,7 @@ init_nvreg(struct nvbios_init *init, u32 reg) /* GF8+ display scripts need register addresses mangled a bit to * select a specific CRTC/OR */ - if (init->bios->subdev.device->card_type >= NV_50) { + if (init->subdev->device->card_type >= NV_50) { if (reg & 0x80000000) { reg += init_crtc(init) * 0x800; reg &= ~0x80000000; @@ -179,7 +179,7 @@ init_nvreg(struct nvbios_init *init, u32 reg) static u32 init_rd32(struct nvbios_init *init, u32 reg) { - struct nvkm_device *device = init->bios->subdev.device; + struct nvkm_device *device = init->subdev->device; reg = init_nvreg(init, reg); if (reg != ~0 && init_exec(init)) return nvkm_rd32(device, reg); @@ -189,7 +189,7 @@ init_rd32(struct nvbios_init *init, u32 reg) static void init_wr32(struct nvbios_init *init, u32 reg, u32 val) { - struct nvkm_device *device = init->bios->subdev.device; + struct nvkm_device *device = init->subdev->device; reg = init_nvreg(init, reg); if (reg != ~0 && init_exec(init)) nvkm_wr32(device, reg, val); @@ -198,7 +198,7 @@ init_wr32(struct nvbios_init *init, u32 reg, u32 val) static u32 init_mask(struct nvbios_init *init, u32 reg, u32 mask, u32 val) { - struct nvkm_device *device = init->bios->subdev.device; + struct nvkm_device *device = init->subdev->device; reg = init_nvreg(init, reg); if (reg != ~0 && init_exec(init)) { u32 tmp = nvkm_rd32(device, reg); @@ -260,7 +260,7 @@ init_wrvgai(struct nvbios_init *init, u16 port, u8 index, u8 value) static struct i2c_adapter * init_i2c(struct nvbios_init *init, int index) { - struct nvkm_i2c *i2c = init->bios->subdev.device->i2c; + struct nvkm_i2c *i2c = init->subdev->device->i2c; struct nvkm_i2c_bus *bus; if (index == 0xff) { @@ -300,7 +300,7 @@ init_wri2cr(struct nvbios_init *init, u8 index, u8 addr, u8 reg, u8 val) static struct nvkm_i2c_aux * init_aux(struct nvbios_init *init) { - struct nvkm_i2c *i2c = init->bios->subdev.device->i2c; + struct nvkm_i2c *i2c = init->subdev->device->i2c; if (!init->outp) { if (init_exec(init)) error("script needs output for aux\n"); @@ -341,7 +341,7 @@ init_wrauxr(struct nvbios_init *init, u32 addr, u8 data) static void init_prog_pll(struct nvbios_init *init, u32 id, u32 freq) { - struct nvkm_devinit *devinit = init->bios->subdev.device->devinit; + struct nvkm_devinit *devinit = init->subdev->device->devinit; if (init_exec(init)) { int ret = nvkm_devinit_pll_set(devinit, id, freq); if (ret) @@ -374,7 +374,7 @@ init_table(struct nvkm_bios *bios, u16 *len) static u16 init_table_(struct nvbios_init *init, u16 offset, const char *name) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u16 len, data = init_table(bios, &len); if (data) { if (len >= offset + 2) { @@ -406,7 +406,7 @@ init_table_(struct nvbios_init *init, u16 offset, const char *name) static u16 init_script(struct nvkm_bios *bios, int index) { - struct nvbios_init init = { .bios = bios }; + struct nvbios_init init = { .subdev = &bios->subdev }; u16 bmp_ver = bmp_version(bios), data; if (bmp_ver && bmp_ver < 0x0510) { @@ -436,7 +436,7 @@ init_unknown_script(struct nvkm_bios *bios) static u8 init_ram_restrict_group_count(struct nvbios_init *init) { - return nvbios_ramcfg_count(init->bios); + return nvbios_ramcfg_count(init->subdev->device->bios); } static u8 @@ -450,7 +450,7 @@ init_ram_restrict(struct nvbios_init *init) * Preserving the non-caching behaviour on earlier chipsets just * in case *not* re-reading the strap causes similar breakage. */ - if (!init->ramcfg || init->bios->version.major < 0x70) + if (!init->ramcfg || init->subdev->device->bios->version.major < 0x70) init->ramcfg = 0x80000000 | nvbios_ramcfg_index(init->subdev); return (init->ramcfg & 0x7fffffff); } @@ -458,7 +458,7 @@ init_ram_restrict(struct nvbios_init *init) static u8 init_xlat_(struct nvbios_init *init, u8 index, u8 offset) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u16 table = init_xlat_table(init); if (table) { u16 data = nvbios_rd16(bios, table + (index * 2)); @@ -476,7 +476,7 @@ init_xlat_(struct nvbios_init *init, u8 index, u8 offset) static bool init_condition_met(struct nvbios_init *init, u8 cond) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u16 table = init_condition_table(init); if (table) { u32 reg = nvbios_rd32(bios, table + (cond * 12) + 0); @@ -492,7 +492,7 @@ init_condition_met(struct nvbios_init *init, u8 cond) static bool init_io_condition_met(struct nvbios_init *init, u8 cond) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u16 table = init_io_condition_table(init); if (table) { u16 port = nvbios_rd16(bios, table + (cond * 5) + 0); @@ -509,7 +509,7 @@ init_io_condition_met(struct nvbios_init *init, u8 cond) static bool init_io_flag_condition_met(struct nvbios_init *init, u8 cond) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u16 table = init_io_flag_condition_table(init); if (table) { u16 port = nvbios_rd16(bios, table + (cond * 9) + 0); @@ -580,7 +580,8 @@ init_tmds_reg(struct nvbios_init *init, u8 tmds) static void init_reserved(struct nvbios_init *init) { - u8 opcode = nvbios_rd08(init->bios, init->offset); + struct nvkm_bios *bios = init->subdev->device->bios; + u8 opcode = nvbios_rd08(bios, init->offset); u8 length, i; switch (opcode) { @@ -594,7 +595,7 @@ init_reserved(struct nvbios_init *init) trace("RESERVED 0x%02x\t", opcode); for (i = 1; i < length; i++) - cont(" 0x%02x", nvbios_rd08(init->bios, init->offset + i)); + cont(" 0x%02x", nvbios_rd08(bios, init->offset + i)); cont("\n"); init->offset += length; } @@ -617,7 +618,7 @@ init_done(struct nvbios_init *init) static void init_io_restrict_prog(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u16 port = nvbios_rd16(bios, init->offset + 1); u8 index = nvbios_rd08(bios, init->offset + 3); u8 mask = nvbios_rd08(bios, init->offset + 4); @@ -654,7 +655,7 @@ init_io_restrict_prog(struct nvbios_init *init) static void init_repeat(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u8 count = nvbios_rd08(bios, init->offset + 1); u16 repeat = init->repeat; @@ -680,7 +681,7 @@ init_repeat(struct nvbios_init *init) static void init_io_restrict_pll(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u16 port = nvbios_rd16(bios, init->offset + 1); u8 index = nvbios_rd08(bios, init->offset + 3); u8 mask = nvbios_rd08(bios, init->offset + 4); @@ -736,7 +737,7 @@ init_end_repeat(struct nvbios_init *init) static void init_copy(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u32 reg = nvbios_rd32(bios, init->offset + 1); u8 shift = nvbios_rd08(bios, init->offset + 5); u8 smask = nvbios_rd08(bios, init->offset + 6); @@ -775,7 +776,7 @@ init_not(struct nvbios_init *init) static void init_io_flag_condition(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u8 cond = nvbios_rd08(bios, init->offset + 1); trace("IO_FLAG_CONDITION\t0x%02x\n", cond); @@ -792,7 +793,7 @@ init_io_flag_condition(struct nvbios_init *init) static void init_generic_condition(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; struct nvbios_dpout info; u8 cond = nvbios_rd08(bios, init->offset + 1); u8 size = nvbios_rd08(bios, init->offset + 2); @@ -841,7 +842,7 @@ init_generic_condition(struct nvbios_init *init) static void init_io_mask_or(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u8 index = nvbios_rd08(bios, init->offset + 1); u8 or = init_or(init); u8 data; @@ -860,7 +861,7 @@ init_io_mask_or(struct nvbios_init *init) static void init_io_or(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u8 index = nvbios_rd08(bios, init->offset + 1); u8 or = init_or(init); u8 data; @@ -879,7 +880,7 @@ init_io_or(struct nvbios_init *init) static void init_andn_reg(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u32 reg = nvbios_rd32(bios, init->offset + 1); u32 mask = nvbios_rd32(bios, init->offset + 5); @@ -896,7 +897,7 @@ init_andn_reg(struct nvbios_init *init) static void init_or_reg(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u32 reg = nvbios_rd32(bios, init->offset + 1); u32 mask = nvbios_rd32(bios, init->offset + 5); @@ -913,7 +914,7 @@ init_or_reg(struct nvbios_init *init) static void init_idx_addr_latched(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u32 creg = nvbios_rd32(bios, init->offset + 1); u32 dreg = nvbios_rd32(bios, init->offset + 5); u32 mask = nvbios_rd32(bios, init->offset + 9); @@ -943,7 +944,7 @@ init_idx_addr_latched(struct nvbios_init *init) static void init_io_restrict_pll2(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u16 port = nvbios_rd16(bios, init->offset + 1); u8 index = nvbios_rd08(bios, init->offset + 3); u8 mask = nvbios_rd08(bios, init->offset + 4); @@ -978,7 +979,7 @@ init_io_restrict_pll2(struct nvbios_init *init) static void init_pll2(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u32 reg = nvbios_rd32(bios, init->offset + 1); u32 freq = nvbios_rd32(bios, init->offset + 5); @@ -995,7 +996,7 @@ init_pll2(struct nvbios_init *init) static void init_i2c_byte(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u8 index = nvbios_rd08(bios, init->offset + 1); u8 addr = nvbios_rd08(bios, init->offset + 2) >> 1; u8 count = nvbios_rd08(bios, init->offset + 3); @@ -1026,7 +1027,7 @@ init_i2c_byte(struct nvbios_init *init) static void init_zm_i2c_byte(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u8 index = nvbios_rd08(bios, init->offset + 1); u8 addr = nvbios_rd08(bios, init->offset + 2) >> 1; u8 count = nvbios_rd08(bios, init->offset + 3); @@ -1052,7 +1053,7 @@ init_zm_i2c_byte(struct nvbios_init *init) static void init_zm_i2c(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u8 index = nvbios_rd08(bios, init->offset + 1); u8 addr = nvbios_rd08(bios, init->offset + 2) >> 1; u8 count = nvbios_rd08(bios, init->offset + 3); @@ -1086,7 +1087,7 @@ init_zm_i2c(struct nvbios_init *init) static void init_tmds(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u8 tmds = nvbios_rd08(bios, init->offset + 1); u8 addr = nvbios_rd08(bios, init->offset + 2); u8 mask = nvbios_rd08(bios, init->offset + 3); @@ -1112,7 +1113,7 @@ init_tmds(struct nvbios_init *init) static void init_zm_tmds_group(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u8 tmds = nvbios_rd08(bios, init->offset + 1); u8 count = nvbios_rd08(bios, init->offset + 2); u32 reg = init_tmds_reg(init, tmds); @@ -1139,7 +1140,7 @@ init_zm_tmds_group(struct nvbios_init *init) static void init_cr_idx_adr_latch(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u8 addr0 = nvbios_rd08(bios, init->offset + 1); u8 addr1 = nvbios_rd08(bios, init->offset + 2); u8 base = nvbios_rd08(bios, init->offset + 3); @@ -1169,7 +1170,7 @@ init_cr_idx_adr_latch(struct nvbios_init *init) static void init_cr(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u8 addr = nvbios_rd08(bios, init->offset + 1); u8 mask = nvbios_rd08(bios, init->offset + 2); u8 data = nvbios_rd08(bios, init->offset + 3); @@ -1189,7 +1190,7 @@ init_cr(struct nvbios_init *init) static void init_zm_cr(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u8 addr = nvbios_rd08(bios, init->offset + 1); u8 data = nvbios_rd08(bios, init->offset + 2); @@ -1206,7 +1207,7 @@ init_zm_cr(struct nvbios_init *init) static void init_zm_cr_group(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u8 count = nvbios_rd08(bios, init->offset + 1); trace("ZM_CR_GROUP\n"); @@ -1230,7 +1231,7 @@ init_zm_cr_group(struct nvbios_init *init) static void init_condition_time(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u8 cond = nvbios_rd08(bios, init->offset + 1); u8 retry = nvbios_rd08(bios, init->offset + 2); u8 wait = min((u16)retry * 50, 100); @@ -1257,7 +1258,7 @@ init_condition_time(struct nvbios_init *init) static void init_ltime(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u16 msec = nvbios_rd16(bios, init->offset + 1); trace("LTIME\t0x%04x\n", msec); @@ -1274,7 +1275,7 @@ init_ltime(struct nvbios_init *init) static void init_zm_reg_sequence(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u32 base = nvbios_rd32(bios, init->offset + 1); u8 count = nvbios_rd08(bios, init->offset + 5); @@ -1299,7 +1300,7 @@ init_zm_reg_sequence(struct nvbios_init *init) static void init_pll_indirect(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u32 reg = nvbios_rd32(bios, init->offset + 1); u16 addr = nvbios_rd16(bios, init->offset + 5); u32 freq = (u32)nvbios_rd16(bios, addr) * 1000; @@ -1318,7 +1319,7 @@ init_pll_indirect(struct nvbios_init *init) static void init_zm_reg_indirect(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u32 reg = nvbios_rd32(bios, init->offset + 1); u16 addr = nvbios_rd16(bios, init->offset + 5); u32 data = nvbios_rd32(bios, addr); @@ -1337,7 +1338,7 @@ init_zm_reg_indirect(struct nvbios_init *init) static void init_sub_direct(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u16 addr = nvbios_rd16(bios, init->offset + 1); u16 save; @@ -1363,7 +1364,7 @@ init_sub_direct(struct nvbios_init *init) static void init_jump(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u16 offset = nvbios_rd16(bios, init->offset + 1); trace("JUMP\t0x%04x\n", offset); @@ -1381,7 +1382,7 @@ init_jump(struct nvbios_init *init) static void init_i2c_if(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u8 index = nvbios_rd08(bios, init->offset + 1); u8 addr = nvbios_rd08(bios, init->offset + 2); u8 reg = nvbios_rd08(bios, init->offset + 3); @@ -1408,7 +1409,7 @@ init_i2c_if(struct nvbios_init *init) static void init_copy_nv_reg(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u32 sreg = nvbios_rd32(bios, init->offset + 1); u8 shift = nvbios_rd08(bios, init->offset + 5); u32 smask = nvbios_rd32(bios, init->offset + 6); @@ -1434,7 +1435,7 @@ init_copy_nv_reg(struct nvbios_init *init) static void init_zm_index_io(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u16 port = nvbios_rd16(bios, init->offset + 1); u8 index = nvbios_rd08(bios, init->offset + 3); u8 data = nvbios_rd08(bios, init->offset + 4); @@ -1452,7 +1453,7 @@ init_zm_index_io(struct nvbios_init *init) static void init_compute_mem(struct nvbios_init *init) { - struct nvkm_devinit *devinit = init->bios->subdev.device->devinit; + struct nvkm_devinit *devinit = init->subdev->device->devinit; trace("COMPUTE_MEM\n"); init->offset += 1; @@ -1470,7 +1471,7 @@ init_compute_mem(struct nvbios_init *init) static void init_reset(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u32 reg = nvbios_rd32(bios, init->offset + 1); u32 data1 = nvbios_rd32(bios, init->offset + 5); u32 data2 = nvbios_rd32(bios, init->offset + 9); @@ -1497,7 +1498,7 @@ init_reset(struct nvbios_init *init) static u16 init_configure_mem_clk(struct nvbios_init *init) { - u16 mdata = bmp_mem_init_table(init->bios); + u16 mdata = bmp_mem_init_table(init->subdev->device->bios); if (mdata) mdata += (init_rdvgai(init, 0x03d4, 0x3c) >> 4) * 66; return mdata; @@ -1506,7 +1507,7 @@ init_configure_mem_clk(struct nvbios_init *init) static void init_configure_mem(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u16 mdata, sdata; u32 addr, data; @@ -1556,7 +1557,7 @@ init_configure_mem(struct nvbios_init *init) static void init_configure_clk(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u16 mdata, clock; trace("CONFIGURE_CLK\n"); @@ -1590,7 +1591,7 @@ init_configure_clk(struct nvbios_init *init) static void init_configure_preinit(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u32 strap; trace("CONFIGURE_PREINIT\n"); @@ -1616,7 +1617,7 @@ init_configure_preinit(struct nvbios_init *init) static void init_io(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u16 port = nvbios_rd16(bios, init->offset + 1); u8 mask = nvbios_rd16(bios, init->offset + 3); u8 data = nvbios_rd16(bios, init->offset + 4); @@ -1656,7 +1657,7 @@ init_io(struct nvbios_init *init) static void init_sub(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u8 index = nvbios_rd08(bios, init->offset + 1); u16 addr, save; @@ -1683,7 +1684,7 @@ init_sub(struct nvbios_init *init) static void init_ram_condition(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u8 mask = nvbios_rd08(bios, init->offset + 1); u8 value = nvbios_rd08(bios, init->offset + 2); @@ -1702,7 +1703,7 @@ init_ram_condition(struct nvbios_init *init) static void init_nv_reg(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u32 reg = nvbios_rd32(bios, init->offset + 1); u32 mask = nvbios_rd32(bios, init->offset + 5); u32 data = nvbios_rd32(bios, init->offset + 9); @@ -1720,7 +1721,7 @@ init_nv_reg(struct nvbios_init *init) static void init_macro(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u8 macro = nvbios_rd08(bios, init->offset + 1); u16 table; @@ -1756,7 +1757,7 @@ init_resume(struct nvbios_init *init) static void init_strap_condition(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u32 mask = nvbios_rd32(bios, init->offset + 1); u32 value = nvbios_rd32(bios, init->offset + 5); @@ -1774,7 +1775,7 @@ init_strap_condition(struct nvbios_init *init) static void init_time(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u16 usec = nvbios_rd16(bios, init->offset + 1); trace("TIME\t0x%04x\n", usec); @@ -1795,7 +1796,7 @@ init_time(struct nvbios_init *init) static void init_condition(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u8 cond = nvbios_rd08(bios, init->offset + 1); trace("CONDITION\t0x%02x\n", cond); @@ -1812,7 +1813,7 @@ init_condition(struct nvbios_init *init) static void init_io_condition(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u8 cond = nvbios_rd08(bios, init->offset + 1); trace("IO_CONDITION\t0x%02x\n", cond); @@ -1829,7 +1830,7 @@ init_io_condition(struct nvbios_init *init) static void init_zm_reg16(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u32 addr = nvbios_rd32(bios, init->offset + 1); u16 data = nvbios_rd16(bios, init->offset + 5); @@ -1846,7 +1847,7 @@ init_zm_reg16(struct nvbios_init *init) static void init_index_io(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u16 port = nvbios_rd16(bios, init->offset + 1); u8 index = nvbios_rd16(bios, init->offset + 3); u8 mask = nvbios_rd08(bios, init->offset + 4); @@ -1868,7 +1869,7 @@ init_index_io(struct nvbios_init *init) static void init_pll(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u32 reg = nvbios_rd32(bios, init->offset + 1); u32 freq = nvbios_rd16(bios, init->offset + 5) * 10; @@ -1885,7 +1886,7 @@ init_pll(struct nvbios_init *init) static void init_zm_reg(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u32 addr = nvbios_rd32(bios, init->offset + 1); u32 data = nvbios_rd32(bios, init->offset + 5); @@ -1905,7 +1906,7 @@ init_zm_reg(struct nvbios_init *init) static void init_ram_restrict_pll(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u8 type = nvbios_rd08(bios, init->offset + 1); u8 count = init_ram_restrict_group_count(init); u8 strap = init_ram_restrict(init); @@ -1935,7 +1936,7 @@ init_ram_restrict_pll(struct nvbios_init *init) static void init_gpio(struct nvbios_init *init) { - struct nvkm_gpio *gpio = init->bios->subdev.device->gpio; + struct nvkm_gpio *gpio = init->subdev->device->gpio; trace("GPIO\n"); init->offset += 1; @@ -1951,7 +1952,7 @@ init_gpio(struct nvbios_init *init) static void init_ram_restrict_zm_reg_group(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u32 addr = nvbios_rd32(bios, init->offset + 1); u8 incr = nvbios_rd08(bios, init->offset + 5); u8 num = nvbios_rd08(bios, init->offset + 6); @@ -1989,7 +1990,7 @@ init_ram_restrict_zm_reg_group(struct nvbios_init *init) static void init_copy_zm_reg(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u32 sreg = nvbios_rd32(bios, init->offset + 1); u32 dreg = nvbios_rd32(bios, init->offset + 5); @@ -2006,7 +2007,7 @@ init_copy_zm_reg(struct nvbios_init *init) static void init_zm_reg_group(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u32 addr = nvbios_rd32(bios, init->offset + 1); u8 count = nvbios_rd08(bios, init->offset + 5); @@ -2028,7 +2029,7 @@ init_zm_reg_group(struct nvbios_init *init) static void init_xlat(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u32 saddr = nvbios_rd32(bios, init->offset + 1); u8 sshift = nvbios_rd08(bios, init->offset + 5); u8 smask = nvbios_rd08(bios, init->offset + 6); @@ -2056,7 +2057,7 @@ init_xlat(struct nvbios_init *init) static void init_zm_mask_add(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u32 addr = nvbios_rd32(bios, init->offset + 1); u32 mask = nvbios_rd32(bios, init->offset + 5); u32 add = nvbios_rd32(bios, init->offset + 9); @@ -2077,7 +2078,7 @@ init_zm_mask_add(struct nvbios_init *init) static void init_auxch(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u32 addr = nvbios_rd32(bios, init->offset + 1); u8 count = nvbios_rd08(bios, init->offset + 5); @@ -2101,7 +2102,7 @@ init_auxch(struct nvbios_init *init) static void init_zm_auxch(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u32 addr = nvbios_rd32(bios, init->offset + 1); u8 count = nvbios_rd08(bios, init->offset + 5); @@ -2123,7 +2124,7 @@ init_zm_auxch(struct nvbios_init *init) static void init_i2c_long_if(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; u8 index = nvbios_rd08(bios, init->offset + 1); u8 addr = nvbios_rd08(bios, init->offset + 2) >> 1; u8 reglo = nvbios_rd08(bios, init->offset + 3); @@ -2162,7 +2163,7 @@ init_i2c_long_if(struct nvbios_init *init) static void init_gpio_ne(struct nvbios_init *init) { - struct nvkm_bios *bios = init->bios; + struct nvkm_bios *bios = init->subdev->device->bios; struct nvkm_gpio *gpio = bios->subdev.device->gpio; struct dcb_gpio_func func; u8 count = nvbios_rd08(bios, init->offset + 1); @@ -2275,9 +2276,10 @@ static struct nvbios_init_opcode { int nvbios_exec(struct nvbios_init *init) { + struct nvkm_bios *bios = init->subdev->device->bios; init->nested++; while (init->offset) { - u8 opcode = nvbios_rd08(init->bios, init->offset); + u8 opcode = nvbios_rd08(bios, init->offset); if (opcode >= init_opcode_nr || !init_opcode[opcode].exec) { error("unknown opcode 0x%02x\n", opcode); return -EINVAL; -- 2.30.2