This source file includes following definitions.
- nvbios_pmuTe
- nvbios_pmuEe
- nvbios_pmuEp
- nvbios_pmuRm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 #include <subdev/bios.h>
25 #include <subdev/bios/bit.h>
26 #include <subdev/bios/image.h>
27 #include <subdev/bios/pmu.h>
28
29 u32
30 nvbios_pmuTe(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len)
31 {
32 struct bit_entry bit_p;
33 u32 data = 0;
34
35 if (!bit_entry(bios, 'p', &bit_p)) {
36 if (bit_p.version == 2 && bit_p.length >= 4)
37 data = nvbios_rd32(bios, bit_p.offset + 0x00);
38 if (data) {
39 *ver = nvbios_rd08(bios, data + 0x00);
40 *hdr = nvbios_rd08(bios, data + 0x01);
41 *len = nvbios_rd08(bios, data + 0x02);
42 *cnt = nvbios_rd08(bios, data + 0x03);
43 }
44 }
45
46 return data;
47 }
48
49 u32
50 nvbios_pmuEe(struct nvkm_bios *bios, int idx, u8 *ver, u8 *hdr)
51 {
52 u8 cnt, len;
53 u32 data = nvbios_pmuTe(bios, ver, hdr, &cnt, &len);
54 if (data && idx < cnt) {
55 data = data + *hdr + (idx * len);
56 *hdr = len;
57 return data;
58 }
59 return 0;
60 }
61
62 u32
63 nvbios_pmuEp(struct nvkm_bios *bios, int idx, u8 *ver, u8 *hdr,
64 struct nvbios_pmuE *info)
65 {
66 u32 data = nvbios_pmuEe(bios, idx, ver, hdr);
67 memset(info, 0x00, sizeof(*info));
68 switch (!!data * *ver) {
69 default:
70 info->type = nvbios_rd08(bios, data + 0x00);
71 info->data = nvbios_rd32(bios, data + 0x02);
72 break;
73 }
74 return data;
75 }
76
77 bool
78 nvbios_pmuRm(struct nvkm_bios *bios, u8 type, struct nvbios_pmuR *info)
79 {
80 struct nvbios_pmuE pmuE;
81 u8 ver, hdr, idx = 0;
82 u32 data;
83 memset(info, 0x00, sizeof(*info));
84 while ((data = nvbios_pmuEp(bios, idx++, &ver, &hdr, &pmuE))) {
85 if (pmuE.type == type && (data = pmuE.data)) {
86 info->init_addr_pmu = nvbios_rd32(bios, data + 0x08);
87 info->args_addr_pmu = nvbios_rd32(bios, data + 0x0c);
88 info->boot_addr = data + 0x30;
89 info->boot_addr_pmu = nvbios_rd32(bios, data + 0x10) +
90 nvbios_rd32(bios, data + 0x18);
91 info->boot_size = nvbios_rd32(bios, data + 0x1c) -
92 nvbios_rd32(bios, data + 0x18);
93 info->code_addr = info->boot_addr + info->boot_size;
94 info->code_addr_pmu = info->boot_addr_pmu +
95 info->boot_size;
96 info->code_size = nvbios_rd32(bios, data + 0x20);
97 info->data_addr = data + 0x30 +
98 nvbios_rd32(bios, data + 0x24);
99 info->data_addr_pmu = nvbios_rd32(bios, data + 0x28);
100 info->data_size = nvbios_rd32(bios, data + 0x2c);
101 return true;
102 }
103 }
104 return false;
105 }