Lines Matching +full:reg +full:- +full:init

31 #include <subdev/bios/init.h>
42 nvkm_printk(init->subdev, lvl, info, "0x%08x[%c]: "fmt, \
43 init->offset, init_exec(init) ? \
44 '0' + (init->nested - 1) : ' ', ##args); \
47 if (init->subdev->debug >= NV_DBG_TRACE) \
55 * init parser control flow helpers
59 init_exec(struct nvbios_init *init) in init_exec() argument
61 return (init->execute == 1) || ((init->execute & 5) == 5); in init_exec()
65 init_exec_set(struct nvbios_init *init, bool exec) in init_exec_set() argument
67 if (exec) init->execute &= 0xfd; in init_exec_set()
68 else init->execute |= 0x02; in init_exec_set()
72 init_exec_inv(struct nvbios_init *init) in init_exec_inv() argument
74 init->execute ^= 0x02; in init_exec_inv()
78 init_exec_force(struct nvbios_init *init, bool exec) in init_exec_force() argument
80 if (exec) init->execute |= 0x04; in init_exec_force()
81 else init->execute &= 0xfb; in init_exec_force()
85 * init parser wrappers for normal register/i2c/whatever accessors
89 init_or(struct nvbios_init *init) in init_or() argument
91 if (init_exec(init)) { in init_or()
92 if (init->or >= 0) in init_or()
93 return init->or; in init_or()
100 init_link(struct nvbios_init *init) in init_link() argument
102 if (init_exec(init)) { in init_link()
103 if (init->link) in init_link()
104 return init->link == 2; in init_link()
111 init_head(struct nvbios_init *init) in init_head() argument
113 if (init_exec(init)) { in init_head()
114 if (init->head >= 0) in init_head()
115 return init->head; in init_head()
122 init_conn(struct nvbios_init *init) in init_conn() argument
124 struct nvkm_bios *bios = init->subdev->device->bios; in init_conn()
129 if (init_exec(init)) { in init_conn()
130 if (init->outp) { in init_conn()
131 conn = init->outp->connector; in init_conn()
144 init_nvreg(struct nvbios_init *init, u32 reg) in init_nvreg() argument
146 struct nvkm_devinit *devinit = init->subdev->device->devinit; in init_nvreg()
154 reg &= ~0x00000003; in init_nvreg()
159 if (init->subdev->device->card_type >= NV_50) { in init_nvreg()
160 if (reg & 0x80000000) { in init_nvreg()
161 reg += init_head(init) * 0x800; in init_nvreg()
162 reg &= ~0x80000000; in init_nvreg()
165 if (reg & 0x40000000) { in init_nvreg()
166 reg += init_or(init) * 0x800; in init_nvreg()
167 reg &= ~0x40000000; in init_nvreg()
168 if (reg & 0x20000000) { in init_nvreg()
169 reg += init_link(init) * 0x80; in init_nvreg()
170 reg &= ~0x20000000; in init_nvreg()
175 if (reg & ~0x00fffffc) in init_nvreg()
176 warn("unknown bits in register 0x%08x\n", reg); in init_nvreg()
178 return nvkm_devinit_mmio(devinit, reg); in init_nvreg()
182 init_rd32(struct nvbios_init *init, u32 reg) in init_rd32() argument
184 struct nvkm_device *device = init->subdev->device; in init_rd32()
185 reg = init_nvreg(init, reg); in init_rd32()
186 if (reg != ~0 && init_exec(init)) in init_rd32()
187 return nvkm_rd32(device, reg); in init_rd32()
192 init_wr32(struct nvbios_init *init, u32 reg, u32 val) in init_wr32() argument
194 struct nvkm_device *device = init->subdev->device; in init_wr32()
195 reg = init_nvreg(init, reg); in init_wr32()
196 if (reg != ~0 && init_exec(init)) in init_wr32()
197 nvkm_wr32(device, reg, val); in init_wr32()
201 init_mask(struct nvbios_init *init, u32 reg, u32 mask, u32 val) in init_mask() argument
203 struct nvkm_device *device = init->subdev->device; in init_mask()
204 reg = init_nvreg(init, reg); in init_mask()
205 if (reg != ~0 && init_exec(init)) { in init_mask()
206 u32 tmp = nvkm_rd32(device, reg); in init_mask()
207 nvkm_wr32(device, reg, (tmp & ~mask) | val); in init_mask()
214 init_rdport(struct nvbios_init *init, u16 port) in init_rdport() argument
216 if (init_exec(init)) in init_rdport()
217 return nvkm_rdport(init->subdev->device, init->head, port); in init_rdport()
222 init_wrport(struct nvbios_init *init, u16 port, u8 value) in init_wrport() argument
224 if (init_exec(init)) in init_wrport()
225 nvkm_wrport(init->subdev->device, init->head, port, value); in init_wrport()
229 init_rdvgai(struct nvbios_init *init, u16 port, u8 index) in init_rdvgai() argument
231 struct nvkm_subdev *subdev = init->subdev; in init_rdvgai()
232 if (init_exec(init)) { in init_rdvgai()
233 int head = init->head < 0 ? 0 : init->head; in init_rdvgai()
234 return nvkm_rdvgai(subdev->device, head, port, index); in init_rdvgai()
240 init_wrvgai(struct nvbios_init *init, u16 port, u8 index, u8 value) in init_wrvgai() argument
242 struct nvkm_device *device = init->subdev->device; in init_wrvgai()
245 if (device->card_type < NV_50) { in init_wrvgai()
247 init->head = 0; in init_wrvgai()
250 if (init_exec(init)) { in init_wrvgai()
251 int head = init->head < 0 ? 0 : init->head; in init_wrvgai()
256 if (device->card_type < NV_50) { in init_wrvgai()
258 init->head = 1; in init_wrvgai()
263 init_i2c(struct nvbios_init *init, int index) in init_i2c() argument
265 struct nvkm_i2c *i2c = init->subdev->device->i2c; in init_i2c()
270 if (init->outp && init->outp->i2c_upper_default) in init_i2c()
281 return bus ? &bus->i2c : NULL; in init_i2c()
285 init_rdi2cr(struct nvbios_init *init, u8 index, u8 addr, u8 reg) in init_rdi2cr() argument
287 struct i2c_adapter *adap = init_i2c(init, index); in init_rdi2cr()
288 if (adap && init_exec(init)) in init_rdi2cr()
289 return nvkm_rdi2cr(adap, addr, reg); in init_rdi2cr()
290 return -ENODEV; in init_rdi2cr()
294 init_wri2cr(struct nvbios_init *init, u8 index, u8 addr, u8 reg, u8 val) in init_wri2cr() argument
296 struct i2c_adapter *adap = init_i2c(init, index); in init_wri2cr()
297 if (adap && init_exec(init)) in init_wri2cr()
298 return nvkm_wri2cr(adap, addr, reg, val); in init_wri2cr()
299 return -ENODEV; in init_wri2cr()
303 init_aux(struct nvbios_init *init) in init_aux() argument
305 struct nvkm_i2c *i2c = init->subdev->device->i2c; in init_aux()
306 if (!init->outp) { in init_aux()
307 if (init_exec(init)) in init_aux()
311 return nvkm_i2c_aux_find(i2c, init->outp->i2c_index); in init_aux()
315 init_rdauxr(struct nvbios_init *init, u32 addr) in init_rdauxr() argument
317 struct nvkm_i2c_aux *aux = init_aux(init); in init_rdauxr()
320 if (aux && init_exec(init)) { in init_rdauxr()
331 init_wrauxr(struct nvbios_init *init, u32 addr, u8 data) in init_wrauxr() argument
333 struct nvkm_i2c_aux *aux = init_aux(init); in init_wrauxr()
334 if (aux && init_exec(init)) { in init_wrauxr()
340 return -ENODEV; in init_wrauxr()
344 init_prog_pll(struct nvbios_init *init, u32 id, u32 freq) in init_prog_pll() argument
346 struct nvkm_devinit *devinit = init->subdev->device->devinit; in init_prog_pll()
347 if (init_exec(init)) { in init_prog_pll()
355 * parsing of bios structures that are required to execute init tables
370 return bios->bmp_offset + 75; in init_table()
377 init_table_(struct nvbios_init *init, u16 offset, const char *name) in init_table_() argument
379 struct nvkm_bios *bios = init->subdev->device->bios; in init_table_()
391 warn("init data too short for %s pointer", name); in init_table_()
395 warn("init data not found\n"); in init_table_()
411 struct nvbios_init init = { .subdev = &bios->subdev }; in init_script() local
418 data = bios->bmp_offset + (bmp_ver < 0x0200 ? 14 : 18); in init_script()
422 data = init_script_table(&init); in init_script()
439 init_ram_restrict_group_count(struct nvbios_init *init) in init_ram_restrict_group_count() argument
441 return nvbios_ramcfg_count(init->subdev->device->bios); in init_ram_restrict_group_count()
445 init_ram_restrict(struct nvbios_init *init) in init_ram_restrict() argument
452 * Preserving the non-caching behaviour on earlier chipsets just in init_ram_restrict()
453 * in case *not* re-reading the strap causes similar breakage. in init_ram_restrict()
455 if (!init->ramcfg || init->subdev->device->bios->version.major < 0x70) in init_ram_restrict()
456 init->ramcfg = 0x80000000 | nvbios_ramcfg_index(init->subdev); in init_ram_restrict()
457 return (init->ramcfg & 0x7fffffff); in init_ram_restrict()
461 init_xlat_(struct nvbios_init *init, u8 index, u8 offset) in init_xlat_() argument
463 struct nvkm_bios *bios = init->subdev->device->bios; in init_xlat_()
464 u16 table = init_xlat_table(init); in init_xlat_()
475 * utility functions used by various init opcode handlers
479 init_condition_met(struct nvbios_init *init, u8 cond) in init_condition_met() argument
481 struct nvkm_bios *bios = init->subdev->device->bios; in init_condition_met()
482 u16 table = init_condition_table(init); in init_condition_met()
484 u32 reg = nvbios_rd32(bios, table + (cond * 12) + 0); in init_condition_met() local
488 cond, reg, msk, val); in init_condition_met()
489 return (init_rd32(init, reg) & msk) == val; in init_condition_met()
495 init_io_condition_met(struct nvbios_init *init, u8 cond) in init_io_condition_met() argument
497 struct nvkm_bios *bios = init->subdev->device->bios; in init_io_condition_met()
498 u16 table = init_io_condition_table(init); in init_io_condition_met()
506 return (init_rdvgai(init, port, index) & mask) == value; in init_io_condition_met()
512 init_io_flag_condition_met(struct nvbios_init *init, u8 cond) in init_io_flag_condition_met() argument
514 struct nvkm_bios *bios = init->subdev->device->bios; in init_io_flag_condition_met()
515 u16 table = init_io_flag_condition_table(init); in init_io_flag_condition_met()
524 u8 ioval = (init_rdvgai(init, port, index) & mask) >> shift; in init_io_flag_condition_met()
535 return data << (0x100 - shift); in init_shift()
539 init_tmds_reg(struct nvbios_init *init, u8 tmds) in init_tmds_reg() argument
555 if (init->outp) { in init_tmds_reg()
556 u32 dacoffset = pramdac_offset[init->outp->or]; in init_tmds_reg()
562 if (init_exec(init)) in init_tmds_reg()
575 * init opcode handlers
579 * init_reserved - stub for various unknown/unused single-byte opcodes
583 init_reserved(struct nvbios_init *init) in init_reserved() argument
585 struct nvkm_bios *bios = init->subdev->device->bios; in init_reserved()
586 u8 opcode = nvbios_rd08(bios, init->offset); in init_reserved()
600 cont(" 0x%02x", nvbios_rd08(bios, init->offset + i)); in init_reserved()
602 init->offset += length; in init_reserved()
606 * INIT_DONE - opcode 0x71
610 init_done(struct nvbios_init *init) in init_done() argument
613 init->offset = 0x0000; in init_done()
617 * INIT_IO_RESTRICT_PROG - opcode 0x32
621 init_io_restrict_prog(struct nvbios_init *init) in init_io_restrict_prog() argument
623 struct nvkm_bios *bios = init->subdev->device->bios; in init_io_restrict_prog()
624 u16 port = nvbios_rd16(bios, init->offset + 1); in init_io_restrict_prog()
625 u8 index = nvbios_rd08(bios, init->offset + 3); in init_io_restrict_prog()
626 u8 mask = nvbios_rd08(bios, init->offset + 4); in init_io_restrict_prog()
627 u8 shift = nvbios_rd08(bios, init->offset + 5); in init_io_restrict_prog()
628 u8 count = nvbios_rd08(bios, init->offset + 6); in init_io_restrict_prog()
629 u32 reg = nvbios_rd32(bios, init->offset + 7); in init_io_restrict_prog() local
634 reg, port, index, mask, shift); in init_io_restrict_prog()
635 init->offset += 11; in init_io_restrict_prog()
637 conf = (init_rdvgai(init, port, index) & mask) >> shift; in init_io_restrict_prog()
639 u32 data = nvbios_rd32(bios, init->offset); in init_io_restrict_prog()
643 init_wr32(init, reg, data); in init_io_restrict_prog()
648 init->offset += 4; in init_io_restrict_prog()
654 * INIT_REPEAT - opcode 0x33
658 init_repeat(struct nvbios_init *init) in init_repeat() argument
660 struct nvkm_bios *bios = init->subdev->device->bios; in init_repeat()
661 u8 count = nvbios_rd08(bios, init->offset + 1); in init_repeat()
662 u16 repeat = init->repeat; in init_repeat()
665 init->offset += 2; in init_repeat()
667 init->repeat = init->offset; in init_repeat()
668 init->repend = init->offset; in init_repeat()
669 while (count--) { in init_repeat()
670 init->offset = init->repeat; in init_repeat()
671 nvbios_exec(init); in init_repeat()
675 init->offset = init->repend; in init_repeat()
676 init->repeat = repeat; in init_repeat()
680 * INIT_IO_RESTRICT_PLL - opcode 0x34
684 init_io_restrict_pll(struct nvbios_init *init) in init_io_restrict_pll() argument
686 struct nvkm_bios *bios = init->subdev->device->bios; in init_io_restrict_pll()
687 u16 port = nvbios_rd16(bios, init->offset + 1); in init_io_restrict_pll()
688 u8 index = nvbios_rd08(bios, init->offset + 3); in init_io_restrict_pll()
689 u8 mask = nvbios_rd08(bios, init->offset + 4); in init_io_restrict_pll()
690 u8 shift = nvbios_rd08(bios, init->offset + 5); in init_io_restrict_pll()
691 s8 iofc = nvbios_rd08(bios, init->offset + 6); in init_io_restrict_pll()
692 u8 count = nvbios_rd08(bios, init->offset + 7); in init_io_restrict_pll()
693 u32 reg = nvbios_rd32(bios, init->offset + 8); in init_io_restrict_pll() local
698 reg, port, index, mask, shift, iofc); in init_io_restrict_pll()
699 init->offset += 12; in init_io_restrict_pll()
701 conf = (init_rdvgai(init, port, index) & mask) >> shift; in init_io_restrict_pll()
703 u32 freq = nvbios_rd16(bios, init->offset) * 10; in init_io_restrict_pll()
707 if (iofc > 0 && init_io_flag_condition_met(init, iofc)) in init_io_restrict_pll()
709 init_prog_pll(init, reg, freq); in init_io_restrict_pll()
714 init->offset += 2; in init_io_restrict_pll()
720 * INIT_END_REPEAT - opcode 0x36
724 init_end_repeat(struct nvbios_init *init) in init_end_repeat() argument
727 init->offset += 1; in init_end_repeat()
729 if (init->repeat) { in init_end_repeat()
730 init->repend = init->offset; in init_end_repeat()
731 init->offset = 0; in init_end_repeat()
736 * INIT_COPY - opcode 0x37
740 init_copy(struct nvbios_init *init) in init_copy() argument
742 struct nvkm_bios *bios = init->subdev->device->bios; in init_copy()
743 u32 reg = nvbios_rd32(bios, init->offset + 1); in init_copy() local
744 u8 shift = nvbios_rd08(bios, init->offset + 5); in init_copy()
745 u8 smask = nvbios_rd08(bios, init->offset + 6); in init_copy()
746 u16 port = nvbios_rd16(bios, init->offset + 7); in init_copy()
747 u8 index = nvbios_rd08(bios, init->offset + 9); in init_copy()
748 u8 mask = nvbios_rd08(bios, init->offset + 10); in init_copy()
753 port, index, mask, reg, (shift & 0x80) ? "<<" : ">>", in init_copy()
754 (shift & 0x80) ? (0x100 - shift) : shift, smask); in init_copy()
755 init->offset += 11; in init_copy()
757 data = init_rdvgai(init, port, index) & mask; in init_copy()
758 data |= init_shift(init_rd32(init, reg), shift) & smask; in init_copy()
759 init_wrvgai(init, port, index, data); in init_copy()
763 * INIT_NOT - opcode 0x38
767 init_not(struct nvbios_init *init) in init_not() argument
770 init->offset += 1; in init_not()
771 init_exec_inv(init); in init_not()
775 * INIT_IO_FLAG_CONDITION - opcode 0x39
779 init_io_flag_condition(struct nvbios_init *init) in init_io_flag_condition() argument
781 struct nvkm_bios *bios = init->subdev->device->bios; in init_io_flag_condition()
782 u8 cond = nvbios_rd08(bios, init->offset + 1); in init_io_flag_condition()
785 init->offset += 2; in init_io_flag_condition()
787 if (!init_io_flag_condition_met(init, cond)) in init_io_flag_condition()
788 init_exec_set(init, false); in init_io_flag_condition()
792 * INIT_GENERIC_CONDITION - opcode 0x3a
796 init_generic_condition(struct nvbios_init *init) in init_generic_condition() argument
798 struct nvkm_bios *bios = init->subdev->device->bios; in init_generic_condition()
800 u8 cond = nvbios_rd08(bios, init->offset + 1); in init_generic_condition()
801 u8 size = nvbios_rd08(bios, init->offset + 2); in init_generic_condition()
806 init->offset += 3; in init_generic_condition()
810 if (init_conn(init) != DCB_CONNECTOR_eDP) in init_generic_condition()
811 init_exec_set(init, false); in init_generic_condition()
815 if ( init->outp && in init_generic_condition()
817 (init->outp->or << 0) | in init_generic_condition()
818 (init->outp->sorconf.link << 6), in init_generic_condition()
822 init_exec_set(init, false); in init_generic_condition()
826 if (init_exec(init)) in init_generic_condition()
830 if (!(init_rdauxr(init, 0x0d) & 1)) in init_generic_condition()
831 init_exec_set(init, false); in init_generic_condition()
834 init_exec_set(init, false); in init_generic_condition()
838 init->offset += size; in init_generic_condition()
844 * INIT_IO_MASK_OR - opcode 0x3b
848 init_io_mask_or(struct nvbios_init *init) in init_io_mask_or() argument
850 struct nvkm_bios *bios = init->subdev->device->bios; in init_io_mask_or()
851 u8 index = nvbios_rd08(bios, init->offset + 1); in init_io_mask_or()
852 u8 or = init_or(init); in init_io_mask_or()
856 init->offset += 2; in init_io_mask_or()
858 data = init_rdvgai(init, 0x03d4, index); in init_io_mask_or()
859 init_wrvgai(init, 0x03d4, index, data &= ~(1 << or)); in init_io_mask_or()
863 * INIT_IO_OR - opcode 0x3c
867 init_io_or(struct nvbios_init *init) in init_io_or() argument
869 struct nvkm_bios *bios = init->subdev->device->bios; in init_io_or()
870 u8 index = nvbios_rd08(bios, init->offset + 1); in init_io_or()
871 u8 or = init_or(init); in init_io_or()
875 init->offset += 2; in init_io_or()
877 data = init_rdvgai(init, 0x03d4, index); in init_io_or()
878 init_wrvgai(init, 0x03d4, index, data | (1 << or)); in init_io_or()
882 * INIT_ANDN_REG - opcode 0x47
886 init_andn_reg(struct nvbios_init *init) in init_andn_reg() argument
888 struct nvkm_bios *bios = init->subdev->device->bios; in init_andn_reg()
889 u32 reg = nvbios_rd32(bios, init->offset + 1); in init_andn_reg() local
890 u32 mask = nvbios_rd32(bios, init->offset + 5); in init_andn_reg()
892 trace("ANDN_REG\tR[0x%06x] &= ~0x%08x\n", reg, mask); in init_andn_reg()
893 init->offset += 9; in init_andn_reg()
895 init_mask(init, reg, mask, 0); in init_andn_reg()
899 * INIT_OR_REG - opcode 0x48
903 init_or_reg(struct nvbios_init *init) in init_or_reg() argument
905 struct nvkm_bios *bios = init->subdev->device->bios; in init_or_reg()
906 u32 reg = nvbios_rd32(bios, init->offset + 1); in init_or_reg() local
907 u32 mask = nvbios_rd32(bios, init->offset + 5); in init_or_reg()
909 trace("OR_REG\tR[0x%06x] |= 0x%08x\n", reg, mask); in init_or_reg()
910 init->offset += 9; in init_or_reg()
912 init_mask(init, reg, 0, mask); in init_or_reg()
916 * INIT_INDEX_ADDRESS_LATCHED - opcode 0x49
920 init_idx_addr_latched(struct nvbios_init *init) in init_idx_addr_latched() argument
922 struct nvkm_bios *bios = init->subdev->device->bios; in init_idx_addr_latched()
923 u32 creg = nvbios_rd32(bios, init->offset + 1); in init_idx_addr_latched()
924 u32 dreg = nvbios_rd32(bios, init->offset + 5); in init_idx_addr_latched()
925 u32 mask = nvbios_rd32(bios, init->offset + 9); in init_idx_addr_latched()
926 u32 data = nvbios_rd32(bios, init->offset + 13); in init_idx_addr_latched()
927 u8 count = nvbios_rd08(bios, init->offset + 17); in init_idx_addr_latched()
931 init->offset += 18; in init_idx_addr_latched()
933 while (count--) { in init_idx_addr_latched()
934 u8 iaddr = nvbios_rd08(bios, init->offset + 0); in init_idx_addr_latched()
935 u8 idata = nvbios_rd08(bios, init->offset + 1); in init_idx_addr_latched()
938 init->offset += 2; in init_idx_addr_latched()
940 init_wr32(init, dreg, idata); in init_idx_addr_latched()
941 init_mask(init, creg, ~mask, data | iaddr); in init_idx_addr_latched()
946 * INIT_IO_RESTRICT_PLL2 - opcode 0x4a
950 init_io_restrict_pll2(struct nvbios_init *init) in init_io_restrict_pll2() argument
952 struct nvkm_bios *bios = init->subdev->device->bios; in init_io_restrict_pll2()
953 u16 port = nvbios_rd16(bios, init->offset + 1); in init_io_restrict_pll2()
954 u8 index = nvbios_rd08(bios, init->offset + 3); in init_io_restrict_pll2()
955 u8 mask = nvbios_rd08(bios, init->offset + 4); in init_io_restrict_pll2()
956 u8 shift = nvbios_rd08(bios, init->offset + 5); in init_io_restrict_pll2()
957 u8 count = nvbios_rd08(bios, init->offset + 6); in init_io_restrict_pll2()
958 u32 reg = nvbios_rd32(bios, init->offset + 7); in init_io_restrict_pll2() local
963 reg, port, index, mask, shift); in init_io_restrict_pll2()
964 init->offset += 11; in init_io_restrict_pll2()
966 conf = (init_rdvgai(init, port, index) & mask) >> shift; in init_io_restrict_pll2()
968 u32 freq = nvbios_rd32(bios, init->offset); in init_io_restrict_pll2()
971 init_prog_pll(init, reg, freq); in init_io_restrict_pll2()
975 init->offset += 4; in init_io_restrict_pll2()
981 * INIT_PLL2 - opcode 0x4b
985 init_pll2(struct nvbios_init *init) in init_pll2() argument
987 struct nvkm_bios *bios = init->subdev->device->bios; in init_pll2()
988 u32 reg = nvbios_rd32(bios, init->offset + 1); in init_pll2() local
989 u32 freq = nvbios_rd32(bios, init->offset + 5); in init_pll2()
991 trace("PLL2\tR[0x%06x] =PLL= %dkHz\n", reg, freq); in init_pll2()
992 init->offset += 9; in init_pll2()
994 init_prog_pll(init, reg, freq); in init_pll2()
998 * INIT_I2C_BYTE - opcode 0x4c
1002 init_i2c_byte(struct nvbios_init *init) in init_i2c_byte() argument
1004 struct nvkm_bios *bios = init->subdev->device->bios; in init_i2c_byte()
1005 u8 index = nvbios_rd08(bios, init->offset + 1); in init_i2c_byte()
1006 u8 addr = nvbios_rd08(bios, init->offset + 2) >> 1; in init_i2c_byte()
1007 u8 count = nvbios_rd08(bios, init->offset + 3); in init_i2c_byte()
1010 init->offset += 4; in init_i2c_byte()
1012 while (count--) { in init_i2c_byte()
1013 u8 reg = nvbios_rd08(bios, init->offset + 0); in init_i2c_byte() local
1014 u8 mask = nvbios_rd08(bios, init->offset + 1); in init_i2c_byte()
1015 u8 data = nvbios_rd08(bios, init->offset + 2); in init_i2c_byte()
1018 trace("\t[0x%02x] &= 0x%02x |= 0x%02x\n", reg, mask, data); in init_i2c_byte()
1019 init->offset += 3; in init_i2c_byte()
1021 val = init_rdi2cr(init, index, addr, reg); in init_i2c_byte()
1024 init_wri2cr(init, index, addr, reg, (val & mask) | data); in init_i2c_byte()
1029 * INIT_ZM_I2C_BYTE - opcode 0x4d
1033 init_zm_i2c_byte(struct nvbios_init *init) in init_zm_i2c_byte() argument
1035 struct nvkm_bios *bios = init->subdev->device->bios; in init_zm_i2c_byte()
1036 u8 index = nvbios_rd08(bios, init->offset + 1); in init_zm_i2c_byte()
1037 u8 addr = nvbios_rd08(bios, init->offset + 2) >> 1; in init_zm_i2c_byte()
1038 u8 count = nvbios_rd08(bios, init->offset + 3); in init_zm_i2c_byte()
1041 init->offset += 4; in init_zm_i2c_byte()
1043 while (count--) { in init_zm_i2c_byte()
1044 u8 reg = nvbios_rd08(bios, init->offset + 0); in init_zm_i2c_byte() local
1045 u8 data = nvbios_rd08(bios, init->offset + 1); in init_zm_i2c_byte()
1047 trace("\t[0x%02x] = 0x%02x\n", reg, data); in init_zm_i2c_byte()
1048 init->offset += 2; in init_zm_i2c_byte()
1050 init_wri2cr(init, index, addr, reg, data); in init_zm_i2c_byte()
1055 * INIT_ZM_I2C - opcode 0x4e
1059 init_zm_i2c(struct nvbios_init *init) in init_zm_i2c() argument
1061 struct nvkm_bios *bios = init->subdev->device->bios; in init_zm_i2c()
1062 u8 index = nvbios_rd08(bios, init->offset + 1); in init_zm_i2c()
1063 u8 addr = nvbios_rd08(bios, init->offset + 2) >> 1; in init_zm_i2c()
1064 u8 count = nvbios_rd08(bios, init->offset + 3); in init_zm_i2c()
1068 init->offset += 4; in init_zm_i2c()
1071 data[i] = nvbios_rd08(bios, init->offset); in init_zm_i2c()
1073 init->offset++; in init_zm_i2c()
1076 if (init_exec(init)) { in init_zm_i2c()
1077 struct i2c_adapter *adap = init_i2c(init, index); in init_zm_i2c()
1089 * INIT_TMDS - opcode 0x4f
1093 init_tmds(struct nvbios_init *init) in init_tmds() argument
1095 struct nvkm_bios *bios = init->subdev->device->bios; in init_tmds()
1096 u8 tmds = nvbios_rd08(bios, init->offset + 1); in init_tmds()
1097 u8 addr = nvbios_rd08(bios, init->offset + 2); in init_tmds()
1098 u8 mask = nvbios_rd08(bios, init->offset + 3); in init_tmds()
1099 u8 data = nvbios_rd08(bios, init->offset + 4); in init_tmds()
1100 u32 reg = init_tmds_reg(init, tmds); in init_tmds() local
1104 init->offset += 5; in init_tmds()
1106 if (reg == 0) in init_tmds()
1109 init_wr32(init, reg + 0, addr | 0x00010000); in init_tmds()
1110 init_wr32(init, reg + 4, data | (init_rd32(init, reg + 4) & mask)); in init_tmds()
1111 init_wr32(init, reg + 0, addr); in init_tmds()
1115 * INIT_ZM_TMDS_GROUP - opcode 0x50
1119 init_zm_tmds_group(struct nvbios_init *init) in init_zm_tmds_group() argument
1121 struct nvkm_bios *bios = init->subdev->device->bios; in init_zm_tmds_group()
1122 u8 tmds = nvbios_rd08(bios, init->offset + 1); in init_zm_tmds_group()
1123 u8 count = nvbios_rd08(bios, init->offset + 2); in init_zm_tmds_group()
1124 u32 reg = init_tmds_reg(init, tmds); in init_zm_tmds_group() local
1127 init->offset += 3; in init_zm_tmds_group()
1129 while (count--) { in init_zm_tmds_group()
1130 u8 addr = nvbios_rd08(bios, init->offset + 0); in init_zm_tmds_group()
1131 u8 data = nvbios_rd08(bios, init->offset + 1); in init_zm_tmds_group()
1134 init->offset += 2; in init_zm_tmds_group()
1136 init_wr32(init, reg + 4, data); in init_zm_tmds_group()
1137 init_wr32(init, reg + 0, addr); in init_zm_tmds_group()
1142 * INIT_CR_INDEX_ADDRESS_LATCHED - opcode 0x51
1146 init_cr_idx_adr_latch(struct nvbios_init *init) in init_cr_idx_adr_latch() argument
1148 struct nvkm_bios *bios = init->subdev->device->bios; in init_cr_idx_adr_latch()
1149 u8 addr0 = nvbios_rd08(bios, init->offset + 1); in init_cr_idx_adr_latch()
1150 u8 addr1 = nvbios_rd08(bios, init->offset + 2); in init_cr_idx_adr_latch()
1151 u8 base = nvbios_rd08(bios, init->offset + 3); in init_cr_idx_adr_latch()
1152 u8 count = nvbios_rd08(bios, init->offset + 4); in init_cr_idx_adr_latch()
1156 init->offset += 5; in init_cr_idx_adr_latch()
1158 save0 = init_rdvgai(init, 0x03d4, addr0); in init_cr_idx_adr_latch()
1159 while (count--) { in init_cr_idx_adr_latch()
1160 u8 data = nvbios_rd08(bios, init->offset); in init_cr_idx_adr_latch()
1163 init->offset += 1; in init_cr_idx_adr_latch()
1165 init_wrvgai(init, 0x03d4, addr0, base++); in init_cr_idx_adr_latch()
1166 init_wrvgai(init, 0x03d4, addr1, data); in init_cr_idx_adr_latch()
1168 init_wrvgai(init, 0x03d4, addr0, save0); in init_cr_idx_adr_latch()
1172 * INIT_CR - opcode 0x52
1176 init_cr(struct nvbios_init *init) in init_cr() argument
1178 struct nvkm_bios *bios = init->subdev->device->bios; in init_cr()
1179 u8 addr = nvbios_rd08(bios, init->offset + 1); in init_cr()
1180 u8 mask = nvbios_rd08(bios, init->offset + 2); in init_cr()
1181 u8 data = nvbios_rd08(bios, init->offset + 3); in init_cr()
1185 init->offset += 4; in init_cr()
1187 val = init_rdvgai(init, 0x03d4, addr) & mask; in init_cr()
1188 init_wrvgai(init, 0x03d4, addr, val | data); in init_cr()
1192 * INIT_ZM_CR - opcode 0x53
1196 init_zm_cr(struct nvbios_init *init) in init_zm_cr() argument
1198 struct nvkm_bios *bios = init->subdev->device->bios; in init_zm_cr()
1199 u8 addr = nvbios_rd08(bios, init->offset + 1); in init_zm_cr()
1200 u8 data = nvbios_rd08(bios, init->offset + 2); in init_zm_cr()
1203 init->offset += 3; in init_zm_cr()
1205 init_wrvgai(init, 0x03d4, addr, data); in init_zm_cr()
1209 * INIT_ZM_CR_GROUP - opcode 0x54
1213 init_zm_cr_group(struct nvbios_init *init) in init_zm_cr_group() argument
1215 struct nvkm_bios *bios = init->subdev->device->bios; in init_zm_cr_group()
1216 u8 count = nvbios_rd08(bios, init->offset + 1); in init_zm_cr_group()
1219 init->offset += 2; in init_zm_cr_group()
1221 while (count--) { in init_zm_cr_group()
1222 u8 addr = nvbios_rd08(bios, init->offset + 0); in init_zm_cr_group()
1223 u8 data = nvbios_rd08(bios, init->offset + 1); in init_zm_cr_group()
1226 init->offset += 2; in init_zm_cr_group()
1228 init_wrvgai(init, 0x03d4, addr, data); in init_zm_cr_group()
1233 * INIT_CONDITION_TIME - opcode 0x56
1237 init_condition_time(struct nvbios_init *init) in init_condition_time() argument
1239 struct nvkm_bios *bios = init->subdev->device->bios; in init_condition_time()
1240 u8 cond = nvbios_rd08(bios, init->offset + 1); in init_condition_time()
1241 u8 retry = nvbios_rd08(bios, init->offset + 2); in init_condition_time()
1245 init->offset += 3; in init_condition_time()
1247 if (!init_exec(init)) in init_condition_time()
1250 while (wait--) { in init_condition_time()
1251 if (init_condition_met(init, cond)) in init_condition_time()
1256 init_exec_set(init, false); in init_condition_time()
1260 * INIT_LTIME - opcode 0x57
1264 init_ltime(struct nvbios_init *init) in init_ltime() argument
1266 struct nvkm_bios *bios = init->subdev->device->bios; in init_ltime()
1267 u16 msec = nvbios_rd16(bios, init->offset + 1); in init_ltime()
1270 init->offset += 3; in init_ltime()
1272 if (init_exec(init)) in init_ltime()
1277 * INIT_ZM_REG_SEQUENCE - opcode 0x58
1281 init_zm_reg_sequence(struct nvbios_init *init) in init_zm_reg_sequence() argument
1283 struct nvkm_bios *bios = init->subdev->device->bios; in init_zm_reg_sequence()
1284 u32 base = nvbios_rd32(bios, init->offset + 1); in init_zm_reg_sequence()
1285 u8 count = nvbios_rd08(bios, init->offset + 5); in init_zm_reg_sequence()
1288 init->offset += 6; in init_zm_reg_sequence()
1290 while (count--) { in init_zm_reg_sequence()
1291 u32 data = nvbios_rd32(bios, init->offset); in init_zm_reg_sequence()
1294 init->offset += 4; in init_zm_reg_sequence()
1296 init_wr32(init, base, data); in init_zm_reg_sequence()
1302 * INIT_PLL_INDIRECT - opcode 0x59
1306 init_pll_indirect(struct nvbios_init *init) in init_pll_indirect() argument
1308 struct nvkm_bios *bios = init->subdev->device->bios; in init_pll_indirect()
1309 u32 reg = nvbios_rd32(bios, init->offset + 1); in init_pll_indirect() local
1310 u16 addr = nvbios_rd16(bios, init->offset + 5); in init_pll_indirect()
1314 reg, addr, freq); in init_pll_indirect()
1315 init->offset += 7; in init_pll_indirect()
1317 init_prog_pll(init, reg, freq); in init_pll_indirect()
1321 * INIT_ZM_REG_INDIRECT - opcode 0x5a
1325 init_zm_reg_indirect(struct nvbios_init *init) in init_zm_reg_indirect() argument
1327 struct nvkm_bios *bios = init->subdev->device->bios; in init_zm_reg_indirect()
1328 u32 reg = nvbios_rd32(bios, init->offset + 1); in init_zm_reg_indirect() local
1329 u16 addr = nvbios_rd16(bios, init->offset + 5); in init_zm_reg_indirect()
1333 reg, addr, data); in init_zm_reg_indirect()
1334 init->offset += 7; in init_zm_reg_indirect()
1336 init_wr32(init, addr, data); in init_zm_reg_indirect()
1340 * INIT_SUB_DIRECT - opcode 0x5b
1344 init_sub_direct(struct nvbios_init *init) in init_sub_direct() argument
1346 struct nvkm_bios *bios = init->subdev->device->bios; in init_sub_direct()
1347 u16 addr = nvbios_rd16(bios, init->offset + 1); in init_sub_direct()
1352 if (init_exec(init)) { in init_sub_direct()
1353 save = init->offset; in init_sub_direct()
1354 init->offset = addr; in init_sub_direct()
1355 if (nvbios_exec(init)) { in init_sub_direct()
1356 error("error parsing sub-table\n"); in init_sub_direct()
1359 init->offset = save; in init_sub_direct()
1362 init->offset += 3; in init_sub_direct()
1366 * INIT_JUMP - opcode 0x5c
1370 init_jump(struct nvbios_init *init) in init_jump() argument
1372 struct nvkm_bios *bios = init->subdev->device->bios; in init_jump()
1373 u16 offset = nvbios_rd16(bios, init->offset + 1); in init_jump()
1377 if (init_exec(init)) in init_jump()
1378 init->offset = offset; in init_jump()
1380 init->offset += 3; in init_jump()
1384 * INIT_I2C_IF - opcode 0x5e
1388 init_i2c_if(struct nvbios_init *init) in init_i2c_if() argument
1390 struct nvkm_bios *bios = init->subdev->device->bios; in init_i2c_if()
1391 u8 index = nvbios_rd08(bios, init->offset + 1); in init_i2c_if()
1392 u8 addr = nvbios_rd08(bios, init->offset + 2); in init_i2c_if()
1393 u8 reg = nvbios_rd08(bios, init->offset + 3); in init_i2c_if() local
1394 u8 mask = nvbios_rd08(bios, init->offset + 4); in init_i2c_if()
1395 u8 data = nvbios_rd08(bios, init->offset + 5); in init_i2c_if()
1399 index, addr, reg, mask, data); in init_i2c_if()
1400 init->offset += 6; in init_i2c_if()
1401 init_exec_force(init, true); in init_i2c_if()
1403 value = init_rdi2cr(init, index, addr, reg); in init_i2c_if()
1405 init_exec_set(init, false); in init_i2c_if()
1407 init_exec_force(init, false); in init_i2c_if()
1411 * INIT_COPY_NV_REG - opcode 0x5f
1415 init_copy_nv_reg(struct nvbios_init *init) in init_copy_nv_reg() argument
1417 struct nvkm_bios *bios = init->subdev->device->bios; in init_copy_nv_reg()
1418 u32 sreg = nvbios_rd32(bios, init->offset + 1); in init_copy_nv_reg()
1419 u8 shift = nvbios_rd08(bios, init->offset + 5); in init_copy_nv_reg()
1420 u32 smask = nvbios_rd32(bios, init->offset + 6); in init_copy_nv_reg()
1421 u32 sxor = nvbios_rd32(bios, init->offset + 10); in init_copy_nv_reg()
1422 u32 dreg = nvbios_rd32(bios, init->offset + 14); in init_copy_nv_reg()
1423 u32 dmask = nvbios_rd32(bios, init->offset + 18); in init_copy_nv_reg()
1429 (shift & 0x80) ? (0x100 - shift) : shift, smask, sxor); in init_copy_nv_reg()
1430 init->offset += 22; in init_copy_nv_reg()
1432 data = init_shift(init_rd32(init, sreg), shift); in init_copy_nv_reg()
1433 init_mask(init, dreg, ~dmask, (data & smask) ^ sxor); in init_copy_nv_reg()
1437 * INIT_ZM_INDEX_IO - opcode 0x62
1441 init_zm_index_io(struct nvbios_init *init) in init_zm_index_io() argument
1443 struct nvkm_bios *bios = init->subdev->device->bios; in init_zm_index_io()
1444 u16 port = nvbios_rd16(bios, init->offset + 1); in init_zm_index_io()
1445 u8 index = nvbios_rd08(bios, init->offset + 3); in init_zm_index_io()
1446 u8 data = nvbios_rd08(bios, init->offset + 4); in init_zm_index_io()
1449 init->offset += 5; in init_zm_index_io()
1451 init_wrvgai(init, port, index, data); in init_zm_index_io()
1455 * INIT_COMPUTE_MEM - opcode 0x63
1459 init_compute_mem(struct nvbios_init *init) in init_compute_mem() argument
1461 struct nvkm_devinit *devinit = init->subdev->device->devinit; in init_compute_mem()
1464 init->offset += 1; in init_compute_mem()
1466 init_exec_force(init, true); in init_compute_mem()
1467 if (init_exec(init)) in init_compute_mem()
1469 init_exec_force(init, false); in init_compute_mem()
1473 * INIT_RESET - opcode 0x65
1477 init_reset(struct nvbios_init *init) in init_reset() argument
1479 struct nvkm_bios *bios = init->subdev->device->bios; in init_reset()
1480 u32 reg = nvbios_rd32(bios, init->offset + 1); in init_reset() local
1481 u32 data1 = nvbios_rd32(bios, init->offset + 5); in init_reset()
1482 u32 data2 = nvbios_rd32(bios, init->offset + 9); in init_reset()
1485 trace("RESET\tR[0x%08x] = 0x%08x, 0x%08x", reg, data1, data2); in init_reset()
1486 init->offset += 13; in init_reset()
1487 init_exec_force(init, true); in init_reset()
1489 savepci19 = init_mask(init, 0x00184c, 0x00000f00, 0x00000000); in init_reset()
1490 init_wr32(init, reg, data1); in init_reset()
1492 init_wr32(init, reg, data2); in init_reset()
1493 init_wr32(init, 0x00184c, savepci19); in init_reset()
1494 init_mask(init, 0x001850, 0x00000001, 0x00000000); in init_reset()
1496 init_exec_force(init, false); in init_reset()
1500 * INIT_CONFIGURE_MEM - opcode 0x66
1504 init_configure_mem_clk(struct nvbios_init *init) in init_configure_mem_clk() argument
1506 u16 mdata = bmp_mem_init_table(init->subdev->device->bios); in init_configure_mem_clk()
1508 mdata += (init_rdvgai(init, 0x03d4, 0x3c) >> 4) * 66; in init_configure_mem_clk()
1513 init_configure_mem(struct nvbios_init *init) in init_configure_mem() argument
1515 struct nvkm_bios *bios = init->subdev->device->bios; in init_configure_mem()
1520 init->offset += 1; in init_configure_mem()
1522 if (bios->version.major > 2) { in init_configure_mem()
1523 init_done(init); in init_configure_mem()
1526 init_exec_force(init, true); in init_configure_mem()
1528 mdata = init_configure_mem_clk(init); in init_configure_mem()
1534 data = init_rdvgai(init, 0x03c4, 0x01); in init_configure_mem()
1535 init_wrvgai(init, 0x03c4, 0x01, data | 0x20); in init_configure_mem()
1552 init_wr32(init, addr, data); in init_configure_mem()
1555 init_exec_force(init, false); in init_configure_mem()
1559 * INIT_CONFIGURE_CLK - opcode 0x67
1563 init_configure_clk(struct nvbios_init *init) in init_configure_clk() argument
1565 struct nvkm_bios *bios = init->subdev->device->bios; in init_configure_clk()
1569 init->offset += 1; in init_configure_clk()
1571 if (bios->version.major > 2) { in init_configure_clk()
1572 init_done(init); in init_configure_clk()
1575 init_exec_force(init, true); in init_configure_clk()
1577 mdata = init_configure_mem_clk(init); in init_configure_clk()
1581 init_prog_pll(init, 0x680500, clock); in init_configure_clk()
1587 init_prog_pll(init, 0x680504, clock); in init_configure_clk()
1589 init_exec_force(init, false); in init_configure_clk()
1593 * INIT_CONFIGURE_PREINIT - opcode 0x68
1597 init_configure_preinit(struct nvbios_init *init) in init_configure_preinit() argument
1599 struct nvkm_bios *bios = init->subdev->device->bios; in init_configure_preinit()
1603 init->offset += 1; in init_configure_preinit()
1605 if (bios->version.major > 2) { in init_configure_preinit()
1606 init_done(init); in init_configure_preinit()
1609 init_exec_force(init, true); in init_configure_preinit()
1611 strap = init_rd32(init, 0x101000); in init_configure_preinit()
1613 init_wrvgai(init, 0x03d4, 0x3c, strap); in init_configure_preinit()
1615 init_exec_force(init, false); in init_configure_preinit()
1619 * INIT_IO - opcode 0x69
1623 init_io(struct nvbios_init *init) in init_io() argument
1625 struct nvkm_bios *bios = init->subdev->device->bios; in init_io()
1626 u16 port = nvbios_rd16(bios, init->offset + 1); in init_io()
1627 u8 mask = nvbios_rd16(bios, init->offset + 3); in init_io()
1628 u8 data = nvbios_rd16(bios, init->offset + 4); in init_io()
1632 init->offset += 5; in init_io()
1638 if (bios->subdev.device->card_type >= NV_50 && in init_io()
1640 init_mask(init, 0x614100, 0xf0800000, 0x00800000); in init_io()
1641 init_mask(init, 0x00e18c, 0x00020000, 0x00020000); in init_io()
1642 init_mask(init, 0x614900, 0xf0800000, 0x00800000); in init_io()
1643 init_mask(init, 0x000200, 0x40000000, 0x00000000); in init_io()
1645 init_mask(init, 0x00e18c, 0x00020000, 0x00000000); in init_io()
1646 init_mask(init, 0x000200, 0x40000000, 0x40000000); in init_io()
1647 init_wr32(init, 0x614100, 0x00800018); in init_io()
1648 init_wr32(init, 0x614900, 0x00800018); in init_io()
1650 init_wr32(init, 0x614100, 0x10000018); in init_io()
1651 init_wr32(init, 0x614900, 0x10000018); in init_io()
1654 value = init_rdport(init, port) & mask; in init_io()
1655 init_wrport(init, port, data | value); in init_io()
1659 * INIT_SUB - opcode 0x6b
1663 init_sub(struct nvbios_init *init) in init_sub() argument
1665 struct nvkm_bios *bios = init->subdev->device->bios; in init_sub()
1666 u8 index = nvbios_rd08(bios, init->offset + 1); in init_sub()
1672 if (addr && init_exec(init)) { in init_sub()
1673 save = init->offset; in init_sub()
1674 init->offset = addr; in init_sub()
1675 if (nvbios_exec(init)) { in init_sub()
1676 error("error parsing sub-table\n"); in init_sub()
1679 init->offset = save; in init_sub()
1682 init->offset += 2; in init_sub()
1686 * INIT_RAM_CONDITION - opcode 0x6d
1690 init_ram_condition(struct nvbios_init *init) in init_ram_condition() argument
1692 struct nvkm_bios *bios = init->subdev->device->bios; in init_ram_condition()
1693 u8 mask = nvbios_rd08(bios, init->offset + 1); in init_ram_condition()
1694 u8 value = nvbios_rd08(bios, init->offset + 2); in init_ram_condition()
1698 init->offset += 3; in init_ram_condition()
1700 if ((init_rd32(init, 0x100000) & mask) != value) in init_ram_condition()
1701 init_exec_set(init, false); in init_ram_condition()
1705 * INIT_NV_REG - opcode 0x6e
1709 init_nv_reg(struct nvbios_init *init) in init_nv_reg() argument
1711 struct nvkm_bios *bios = init->subdev->device->bios; in init_nv_reg()
1712 u32 reg = nvbios_rd32(bios, init->offset + 1); in init_nv_reg() local
1713 u32 mask = nvbios_rd32(bios, init->offset + 5); in init_nv_reg()
1714 u32 data = nvbios_rd32(bios, init->offset + 9); in init_nv_reg()
1716 trace("NV_REG\tR[0x%06x] &= 0x%08x |= 0x%08x\n", reg, mask, data); in init_nv_reg()
1717 init->offset += 13; in init_nv_reg()
1719 init_mask(init, reg, ~mask, data); in init_nv_reg()
1723 * INIT_MACRO - opcode 0x6f
1727 init_macro(struct nvbios_init *init) in init_macro() argument
1729 struct nvkm_bios *bios = init->subdev->device->bios; in init_macro()
1730 u8 macro = nvbios_rd08(bios, init->offset + 1); in init_macro()
1735 table = init_macro_table(init); in init_macro()
1740 init_wr32(init, addr, data); in init_macro()
1743 init->offset += 2; in init_macro()
1747 * INIT_RESUME - opcode 0x72
1751 init_resume(struct nvbios_init *init) in init_resume() argument
1754 init->offset += 1; in init_resume()
1755 init_exec_set(init, true); in init_resume()
1759 * INIT_STRAP_CONDITION - opcode 0x73
1763 init_strap_condition(struct nvbios_init *init) in init_strap_condition() argument
1765 struct nvkm_bios *bios = init->subdev->device->bios; in init_strap_condition()
1766 u32 mask = nvbios_rd32(bios, init->offset + 1); in init_strap_condition()
1767 u32 value = nvbios_rd32(bios, init->offset + 5); in init_strap_condition()
1770 init->offset += 9; in init_strap_condition()
1772 if ((init_rd32(init, 0x101000) & mask) != value) in init_strap_condition()
1773 init_exec_set(init, false); in init_strap_condition()
1777 * INIT_TIME - opcode 0x74
1781 init_time(struct nvbios_init *init) in init_time() argument
1783 struct nvkm_bios *bios = init->subdev->device->bios; in init_time()
1784 u16 usec = nvbios_rd16(bios, init->offset + 1); in init_time()
1787 init->offset += 3; in init_time()
1789 if (init_exec(init)) { in init_time()
1798 * INIT_CONDITION - opcode 0x75
1802 init_condition(struct nvbios_init *init) in init_condition() argument
1804 struct nvkm_bios *bios = init->subdev->device->bios; in init_condition()
1805 u8 cond = nvbios_rd08(bios, init->offset + 1); in init_condition()
1808 init->offset += 2; in init_condition()
1810 if (!init_condition_met(init, cond)) in init_condition()
1811 init_exec_set(init, false); in init_condition()
1815 * INIT_IO_CONDITION - opcode 0x76
1819 init_io_condition(struct nvbios_init *init) in init_io_condition() argument
1821 struct nvkm_bios *bios = init->subdev->device->bios; in init_io_condition()
1822 u8 cond = nvbios_rd08(bios, init->offset + 1); in init_io_condition()
1825 init->offset += 2; in init_io_condition()
1827 if (!init_io_condition_met(init, cond)) in init_io_condition()
1828 init_exec_set(init, false); in init_io_condition()
1832 * INIT_ZM_REG16 - opcode 0x77
1836 init_zm_reg16(struct nvbios_init *init) in init_zm_reg16() argument
1838 struct nvkm_bios *bios = init->subdev->device->bios; in init_zm_reg16()
1839 u32 addr = nvbios_rd32(bios, init->offset + 1); in init_zm_reg16()
1840 u16 data = nvbios_rd16(bios, init->offset + 5); in init_zm_reg16()
1843 init->offset += 7; in init_zm_reg16()
1845 init_wr32(init, addr, data); in init_zm_reg16()
1849 * INIT_INDEX_IO - opcode 0x78
1853 init_index_io(struct nvbios_init *init) in init_index_io() argument
1855 struct nvkm_bios *bios = init->subdev->device->bios; in init_index_io()
1856 u16 port = nvbios_rd16(bios, init->offset + 1); in init_index_io()
1857 u8 index = nvbios_rd16(bios, init->offset + 3); in init_index_io()
1858 u8 mask = nvbios_rd08(bios, init->offset + 4); in init_index_io()
1859 u8 data = nvbios_rd08(bios, init->offset + 5); in init_index_io()
1864 init->offset += 6; in init_index_io()
1866 value = init_rdvgai(init, port, index) & mask; in init_index_io()
1867 init_wrvgai(init, port, index, data | value); in init_index_io()
1871 * INIT_PLL - opcode 0x79
1875 init_pll(struct nvbios_init *init) in init_pll() argument
1877 struct nvkm_bios *bios = init->subdev->device->bios; in init_pll()
1878 u32 reg = nvbios_rd32(bios, init->offset + 1); in init_pll() local
1879 u32 freq = nvbios_rd16(bios, init->offset + 5) * 10; in init_pll()
1881 trace("PLL\tR[0x%06x] =PLL= %dkHz\n", reg, freq); in init_pll()
1882 init->offset += 7; in init_pll()
1884 init_prog_pll(init, reg, freq); in init_pll()
1888 * INIT_ZM_REG - opcode 0x7a
1892 init_zm_reg(struct nvbios_init *init) in init_zm_reg() argument
1894 struct nvkm_bios *bios = init->subdev->device->bios; in init_zm_reg()
1895 u32 addr = nvbios_rd32(bios, init->offset + 1); in init_zm_reg()
1896 u32 data = nvbios_rd32(bios, init->offset + 5); in init_zm_reg()
1899 init->offset += 9; in init_zm_reg()
1904 init_wr32(init, addr, data); in init_zm_reg()
1908 * INIT_RAM_RESTRICT_PLL - opcde 0x87
1912 init_ram_restrict_pll(struct nvbios_init *init) in init_ram_restrict_pll() argument
1914 struct nvkm_bios *bios = init->subdev->device->bios; in init_ram_restrict_pll()
1915 u8 type = nvbios_rd08(bios, init->offset + 1); in init_ram_restrict_pll()
1916 u8 count = init_ram_restrict_group_count(init); in init_ram_restrict_pll()
1917 u8 strap = init_ram_restrict(init); in init_ram_restrict_pll()
1921 init->offset += 2; in init_ram_restrict_pll()
1924 u32 freq = nvbios_rd32(bios, init->offset); in init_ram_restrict_pll()
1928 init_prog_pll(init, type, freq); in init_ram_restrict_pll()
1933 init->offset += 4; in init_ram_restrict_pll()
1938 * INIT_RESET_BEGUN - opcode 0x8c
1942 init_reset_begun(struct nvbios_init *init) in init_reset_begun() argument
1945 init->offset += 1; in init_reset_begun()
1949 * INIT_RESET_END - opcode 0x8d
1953 init_reset_end(struct nvbios_init *init) in init_reset_end() argument
1956 init->offset += 1; in init_reset_end()
1960 * INIT_GPIO - opcode 0x8e
1964 init_gpio(struct nvbios_init *init) in init_gpio() argument
1966 struct nvkm_gpio *gpio = init->subdev->device->gpio; in init_gpio()
1969 init->offset += 1; in init_gpio()
1971 if (init_exec(init)) in init_gpio()
1976 * INIT_RAM_RESTRICT_ZM_GROUP - opcode 0x8f
1980 init_ram_restrict_zm_reg_group(struct nvbios_init *init) in init_ram_restrict_zm_reg_group() argument
1982 struct nvkm_bios *bios = init->subdev->device->bios; in init_ram_restrict_zm_reg_group()
1983 u32 addr = nvbios_rd32(bios, init->offset + 1); in init_ram_restrict_zm_reg_group()
1984 u8 incr = nvbios_rd08(bios, init->offset + 5); in init_ram_restrict_zm_reg_group()
1985 u8 num = nvbios_rd08(bios, init->offset + 6); in init_ram_restrict_zm_reg_group()
1986 u8 count = init_ram_restrict_group_count(init); in init_ram_restrict_zm_reg_group()
1987 u8 index = init_ram_restrict(init); in init_ram_restrict_zm_reg_group()
1992 init->offset += 7; in init_ram_restrict_zm_reg_group()
1997 u32 data = nvbios_rd32(bios, init->offset); in init_ram_restrict_zm_reg_group()
2001 init_wr32(init, addr, data); in init_ram_restrict_zm_reg_group()
2006 init->offset += 4; in init_ram_restrict_zm_reg_group()
2014 * INIT_COPY_ZM_REG - opcode 0x90
2018 init_copy_zm_reg(struct nvbios_init *init) in init_copy_zm_reg() argument
2020 struct nvkm_bios *bios = init->subdev->device->bios; in init_copy_zm_reg()
2021 u32 sreg = nvbios_rd32(bios, init->offset + 1); in init_copy_zm_reg()
2022 u32 dreg = nvbios_rd32(bios, init->offset + 5); in init_copy_zm_reg()
2025 init->offset += 9; in init_copy_zm_reg()
2027 init_wr32(init, dreg, init_rd32(init, sreg)); in init_copy_zm_reg()
2031 * INIT_ZM_REG_GROUP - opcode 0x91
2035 init_zm_reg_group(struct nvbios_init *init) in init_zm_reg_group() argument
2037 struct nvkm_bios *bios = init->subdev->device->bios; in init_zm_reg_group()
2038 u32 addr = nvbios_rd32(bios, init->offset + 1); in init_zm_reg_group()
2039 u8 count = nvbios_rd08(bios, init->offset + 5); in init_zm_reg_group()
2042 init->offset += 6; in init_zm_reg_group()
2044 while (count--) { in init_zm_reg_group()
2045 u32 data = nvbios_rd32(bios, init->offset); in init_zm_reg_group()
2047 init_wr32(init, addr, data); in init_zm_reg_group()
2048 init->offset += 4; in init_zm_reg_group()
2053 * INIT_XLAT - opcode 0x96
2057 init_xlat(struct nvbios_init *init) in init_xlat() argument
2059 struct nvkm_bios *bios = init->subdev->device->bios; in init_xlat()
2060 u32 saddr = nvbios_rd32(bios, init->offset + 1); in init_xlat()
2061 u8 sshift = nvbios_rd08(bios, init->offset + 5); in init_xlat()
2062 u8 smask = nvbios_rd08(bios, init->offset + 6); in init_xlat()
2063 u8 index = nvbios_rd08(bios, init->offset + 7); in init_xlat()
2064 u32 daddr = nvbios_rd32(bios, init->offset + 8); in init_xlat()
2065 u32 dmask = nvbios_rd32(bios, init->offset + 12); in init_xlat()
2066 u8 shift = nvbios_rd08(bios, init->offset + 16); in init_xlat()
2072 (sshift & 0x80) ? (0x100 - sshift) : sshift, smask, shift); in init_xlat()
2073 init->offset += 17; in init_xlat()
2075 data = init_shift(init_rd32(init, saddr), sshift) & smask; in init_xlat()
2076 data = init_xlat_(init, index, data) << shift; in init_xlat()
2077 init_mask(init, daddr, ~dmask, data); in init_xlat()
2081 * INIT_ZM_MASK_ADD - opcode 0x97
2085 init_zm_mask_add(struct nvbios_init *init) in init_zm_mask_add() argument
2087 struct nvkm_bios *bios = init->subdev->device->bios; in init_zm_mask_add()
2088 u32 addr = nvbios_rd32(bios, init->offset + 1); in init_zm_mask_add()
2089 u32 mask = nvbios_rd32(bios, init->offset + 5); in init_zm_mask_add()
2090 u32 add = nvbios_rd32(bios, init->offset + 9); in init_zm_mask_add()
2094 init->offset += 13; in init_zm_mask_add()
2096 data = init_rd32(init, addr); in init_zm_mask_add()
2098 init_wr32(init, addr, data); in init_zm_mask_add()
2102 * INIT_AUXCH - opcode 0x98
2106 init_auxch(struct nvbios_init *init) in init_auxch() argument
2108 struct nvkm_bios *bios = init->subdev->device->bios; in init_auxch()
2109 u32 addr = nvbios_rd32(bios, init->offset + 1); in init_auxch()
2110 u8 count = nvbios_rd08(bios, init->offset + 5); in init_auxch()
2113 init->offset += 6; in init_auxch()
2115 while (count--) { in init_auxch()
2116 u8 mask = nvbios_rd08(bios, init->offset + 0); in init_auxch()
2117 u8 data = nvbios_rd08(bios, init->offset + 1); in init_auxch()
2119 mask = init_rdauxr(init, addr) & mask; in init_auxch()
2120 init_wrauxr(init, addr, mask | data); in init_auxch()
2121 init->offset += 2; in init_auxch()
2126 * INIT_AUXCH - opcode 0x99
2130 init_zm_auxch(struct nvbios_init *init) in init_zm_auxch() argument
2132 struct nvkm_bios *bios = init->subdev->device->bios; in init_zm_auxch()
2133 u32 addr = nvbios_rd32(bios, init->offset + 1); in init_zm_auxch()
2134 u8 count = nvbios_rd08(bios, init->offset + 5); in init_zm_auxch()
2137 init->offset += 6; in init_zm_auxch()
2139 while (count--) { in init_zm_auxch()
2140 u8 data = nvbios_rd08(bios, init->offset + 0); in init_zm_auxch()
2142 init_wrauxr(init, addr, data); in init_zm_auxch()
2143 init->offset += 1; in init_zm_auxch()
2148 * INIT_I2C_LONG_IF - opcode 0x9a
2152 init_i2c_long_if(struct nvbios_init *init) in init_i2c_long_if() argument
2154 struct nvkm_bios *bios = init->subdev->device->bios; in init_i2c_long_if()
2155 u8 index = nvbios_rd08(bios, init->offset + 1); in init_i2c_long_if()
2156 u8 addr = nvbios_rd08(bios, init->offset + 2) >> 1; in init_i2c_long_if()
2157 u8 reglo = nvbios_rd08(bios, init->offset + 3); in init_i2c_long_if()
2158 u8 reghi = nvbios_rd08(bios, init->offset + 4); in init_i2c_long_if()
2159 u8 mask = nvbios_rd08(bios, init->offset + 5); in init_i2c_long_if()
2160 u8 data = nvbios_rd08(bios, init->offset + 6); in init_i2c_long_if()
2166 init->offset += 7; in init_i2c_long_if()
2168 adap = init_i2c(init, index); in init_i2c_long_if()
2183 init_exec_set(init, false); in init_i2c_long_if()
2187 * INIT_GPIO_NE - opcode 0xa9
2191 init_gpio_ne(struct nvbios_init *init) in init_gpio_ne() argument
2193 struct nvkm_bios *bios = init->subdev->device->bios; in init_gpio_ne()
2194 struct nvkm_gpio *gpio = bios->subdev.device->gpio; in init_gpio_ne()
2196 u8 count = nvbios_rd08(bios, init->offset + 1); in init_gpio_ne()
2201 init->offset += 2; in init_gpio_ne()
2203 for (i = init->offset; i < init->offset + count; i++) in init_gpio_ne()
2209 for (i = init->offset; i < init->offset + count; i++) { in init_gpio_ne()
2215 if (i == (init->offset + count)) { in init_gpio_ne()
2217 if (init_exec(init)) in init_gpio_ne()
2224 init->offset += count; in init_gpio_ne()
2302 nvbios_exec(struct nvbios_init *init) in nvbios_exec() argument
2304 struct nvkm_bios *bios = init->subdev->device->bios; in nvbios_exec()
2306 init->nested++; in nvbios_exec()
2307 while (init->offset) { in nvbios_exec()
2308 u8 opcode = nvbios_rd08(bios, init->offset); in nvbios_exec()
2312 return -EINVAL; in nvbios_exec()
2315 init_opcode[opcode].exec(init); in nvbios_exec()
2317 init->nested--; in nvbios_exec()
2324 struct nvkm_bios *bios = subdev->device->bios; in nvbios_post()
2326 int i = -1; in nvbios_post()
2330 nvkm_debug(subdev, "running init tables\n"); in nvbios_post()
2333 init.execute = execute ? 1 : 0; in nvbios_post()
2337 /* the vbios parser will run this right after the normal init in nvbios_post()
2342 init.execute = execute ? 1 : 0; in nvbios_post()