Commit 42fd8c19b58fe8f8fe7559ea53b1cef12fc06240
Committed by
Bin Meng
1 parent
0ec28e0266
Exists in
smarc_8mq_lf_v2020.04
and in
24 other branches
x86: Use unsigned long for address in table generation
We should use unsigned long rather than u32 for addresses. Update this so that the table-generation code builds correctly on 64-bit machines. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Showing 13 changed files with 29 additions and 36 deletions Side-by-side Diff
arch/x86/cpu/irq.c
arch/x86/include/asm/acpi_table.h
arch/x86/include/asm/mpspec.h
arch/x86/include/asm/sfi.h
arch/x86/include/asm/tables.h
arch/x86/lib/acpi_table.c
... | ... | @@ -327,7 +327,7 @@ |
327 | 327 | * QEMU's version of write_acpi_tables is defined in |
328 | 328 | * arch/x86/cpu/qemu/acpi_table.c |
329 | 329 | */ |
330 | -u32 write_acpi_tables(u32 start) | |
330 | +ulong write_acpi_tables(ulong start) | |
331 | 331 | { |
332 | 332 | u32 current; |
333 | 333 | struct acpi_rsdp *rsdp; |
... | ... | @@ -345,7 +345,7 @@ |
345 | 345 | /* Align ACPI tables to 16 byte */ |
346 | 346 | current = ALIGN(current, 16); |
347 | 347 | |
348 | - debug("ACPI: Writing ACPI tables at %x\n", start); | |
348 | + debug("ACPI: Writing ACPI tables at %lx\n", start); | |
349 | 349 | |
350 | 350 | /* We need at least an RSDP and an RSDT Table */ |
351 | 351 | rsdp = (struct acpi_rsdp *)current; |
arch/x86/lib/mpspec.c
arch/x86/lib/sfi.c
... | ... | @@ -38,14 +38,14 @@ |
38 | 38 | tab->table[tab->count] = tab->entry_start; |
39 | 39 | tab->entry_start += sizeof(struct sfi_table_header); |
40 | 40 | |
41 | - return (void *)tab->entry_start; | |
41 | + return (void *)(uintptr_t)tab->entry_start; | |
42 | 42 | } |
43 | 43 | |
44 | 44 | static void finish_table(struct table_info *tab, const char *sig, void *entry) |
45 | 45 | { |
46 | 46 | struct sfi_table_header *hdr; |
47 | 47 | |
48 | - hdr = (struct sfi_table_header *)(tab->base + tab->ptr); | |
48 | + hdr = (struct sfi_table_header *)(uintptr_t)(tab->base + tab->ptr); | |
49 | 49 | strcpy(hdr->sig, sig); |
50 | 50 | hdr->len = sizeof(*hdr) + ((ulong)entry - tab->entry_start); |
51 | 51 | hdr->rev = 1; |
... | ... | @@ -131,7 +131,7 @@ |
131 | 131 | return 0; |
132 | 132 | } |
133 | 133 | |
134 | -u32 write_sfi_table(u32 base) | |
134 | +ulong write_sfi_table(ulong base) | |
135 | 135 | { |
136 | 136 | struct table_info table; |
137 | 137 |
arch/x86/lib/tables.c
... | ... | @@ -12,20 +12,13 @@ |
12 | 12 | #include <asm/acpi_table.h> |
13 | 13 | #include <asm/coreboot_tables.h> |
14 | 14 | |
15 | -#ifdef CONFIG_GENERATE_SMBIOS_TABLE | |
16 | -static u32 write_smbios_table_wrapper(u32 addr) | |
17 | -{ | |
18 | - return write_smbios_table(addr); | |
19 | -} | |
20 | -#endif | |
21 | - | |
22 | 15 | /** |
23 | 16 | * Function prototype to write a specific configuration table |
24 | 17 | * |
25 | 18 | * @addr: start address to write the table |
26 | 19 | * @return: end address of the table |
27 | 20 | */ |
28 | -typedef u32 (*table_write)(u32 addr); | |
21 | +typedef ulong (*table_write)(ulong addr); | |
29 | 22 | |
30 | 23 | static table_write table_write_funcs[] = { |
31 | 24 | #ifdef CONFIG_GENERATE_PIRQ_TABLE |
... | ... | @@ -41,7 +34,7 @@ |
41 | 34 | write_acpi_tables, |
42 | 35 | #endif |
43 | 36 | #ifdef CONFIG_GENERATE_SMBIOS_TABLE |
44 | - write_smbios_table_wrapper, | |
37 | + write_smbios_table, | |
45 | 38 | #endif |
46 | 39 | }; |
47 | 40 |
arch/x86/lib/zimage.c
... | ... | @@ -165,7 +165,7 @@ |
165 | 165 | * A very old kernel MUST have its real-mode code |
166 | 166 | * loaded at 0x90000 |
167 | 167 | */ |
168 | - if ((u32)setup_base != 0x90000) { | |
168 | + if ((ulong)setup_base != 0x90000) { | |
169 | 169 | /* Copy the real-mode kernel */ |
170 | 170 | memmove((void *)0x90000, setup_base, setup_size); |
171 | 171 |
drivers/misc/qfw.c
... | ... | @@ -32,7 +32,7 @@ |
32 | 32 | * be ignored. |
33 | 33 | * @return: 0 on success, or negative value on failure |
34 | 34 | */ |
35 | -static int bios_linker_allocate(struct bios_linker_entry *entry, u32 *addr) | |
35 | +static int bios_linker_allocate(struct bios_linker_entry *entry, ulong *addr) | |
36 | 36 | { |
37 | 37 | uint32_t size, align; |
38 | 38 | struct fw_file *file; |
... | ... | @@ -147,7 +147,7 @@ |
147 | 147 | } |
148 | 148 | |
149 | 149 | /* This function loads and patches ACPI tables provided by QEMU */ |
150 | -u32 write_acpi_tables(u32 addr) | |
150 | +ulong write_acpi_tables(ulong addr) | |
151 | 151 | { |
152 | 152 | int i, ret = 0; |
153 | 153 | struct fw_file *file; |
include/smbios.h
... | ... | @@ -225,7 +225,7 @@ |
225 | 225 | * @handle: the structure's handle, a unique 16-bit number |
226 | 226 | * @return: size of the structure |
227 | 227 | */ |
228 | -typedef int (*smbios_write_type)(uintptr_t *addr, int handle); | |
228 | +typedef int (*smbios_write_type)(ulong *addr, int handle); | |
229 | 229 | |
230 | 230 | /** |
231 | 231 | * write_smbios_table() - Write SMBIOS table |
... | ... | @@ -235,7 +235,7 @@ |
235 | 235 | * @addr: start address to write SMBIOS table |
236 | 236 | * @return: end address of SMBIOS table |
237 | 237 | */ |
238 | -uintptr_t write_smbios_table(uintptr_t addr); | |
238 | +ulong write_smbios_table(ulong addr); | |
239 | 239 | |
240 | 240 | #endif /* _SMBIOS_H_ */ |
lib/smbios.c
... | ... | @@ -73,7 +73,7 @@ |
73 | 73 | return len + 1; |
74 | 74 | } |
75 | 75 | |
76 | -static int smbios_write_type0(uintptr_t *current, int handle) | |
76 | +static int smbios_write_type0(ulong *current, int handle) | |
77 | 77 | { |
78 | 78 | struct smbios_type0 *t = (struct smbios_type0 *)*current; |
79 | 79 | int len = sizeof(struct smbios_type0); |
... | ... | @@ -108,7 +108,7 @@ |
108 | 108 | return len; |
109 | 109 | } |
110 | 110 | |
111 | -static int smbios_write_type1(uintptr_t *current, int handle) | |
111 | +static int smbios_write_type1(ulong *current, int handle) | |
112 | 112 | { |
113 | 113 | struct smbios_type1 *t = (struct smbios_type1 *)*current; |
114 | 114 | int len = sizeof(struct smbios_type1); |
... | ... | @@ -129,7 +129,7 @@ |
129 | 129 | return len; |
130 | 130 | } |
131 | 131 | |
132 | -static int smbios_write_type2(uintptr_t *current, int handle) | |
132 | +static int smbios_write_type2(ulong *current, int handle) | |
133 | 133 | { |
134 | 134 | struct smbios_type2 *t = (struct smbios_type2 *)*current; |
135 | 135 | int len = sizeof(struct smbios_type2); |
... | ... | @@ -147,7 +147,7 @@ |
147 | 147 | return len; |
148 | 148 | } |
149 | 149 | |
150 | -static int smbios_write_type3(uintptr_t *current, int handle) | |
150 | +static int smbios_write_type3(ulong *current, int handle) | |
151 | 151 | { |
152 | 152 | struct smbios_type3 *t = (struct smbios_type3 *)*current; |
153 | 153 | int len = sizeof(struct smbios_type3); |
... | ... | @@ -199,7 +199,7 @@ |
199 | 199 | t->processor_version = smbios_add_string(t->eos, name); |
200 | 200 | } |
201 | 201 | |
202 | -static int smbios_write_type4(uintptr_t *current, int handle) | |
202 | +static int smbios_write_type4(ulong *current, int handle) | |
203 | 203 | { |
204 | 204 | struct smbios_type4 *t = (struct smbios_type4 *)*current; |
205 | 205 | int len = sizeof(struct smbios_type4); |
... | ... | @@ -221,7 +221,7 @@ |
221 | 221 | return len; |
222 | 222 | } |
223 | 223 | |
224 | -static int smbios_write_type32(uintptr_t *current, int handle) | |
224 | +static int smbios_write_type32(ulong *current, int handle) | |
225 | 225 | { |
226 | 226 | struct smbios_type32 *t = (struct smbios_type32 *)*current; |
227 | 227 | int len = sizeof(struct smbios_type32); |
... | ... | @@ -234,7 +234,7 @@ |
234 | 234 | return len; |
235 | 235 | } |
236 | 236 | |
237 | -static int smbios_write_type127(uintptr_t *current, int handle) | |
237 | +static int smbios_write_type127(ulong *current, int handle) | |
238 | 238 | { |
239 | 239 | struct smbios_type127 *t = (struct smbios_type127 *)*current; |
240 | 240 | int len = sizeof(struct smbios_type127); |
241 | 241 | |
... | ... | @@ -257,10 +257,10 @@ |
257 | 257 | smbios_write_type127 |
258 | 258 | }; |
259 | 259 | |
260 | -uintptr_t write_smbios_table(uintptr_t addr) | |
260 | +ulong write_smbios_table(ulong addr) | |
261 | 261 | { |
262 | 262 | struct smbios_entry *se; |
263 | - u32 tables; | |
263 | + ulong tables; | |
264 | 264 | int len = 0; |
265 | 265 | int max_struct_size = 0; |
266 | 266 | int handle = 0; |
... | ... | @@ -271,7 +271,7 @@ |
271 | 271 | /* 16 byte align the table address */ |
272 | 272 | addr = ALIGN(addr, 16); |
273 | 273 | |
274 | - se = (struct smbios_entry *)addr; | |
274 | + se = (struct smbios_entry *)(uintptr_t)addr; | |
275 | 275 | memset(se, 0, sizeof(struct smbios_entry)); |
276 | 276 | |
277 | 277 | addr += sizeof(struct smbios_entry); |
... | ... | @@ -280,7 +280,7 @@ |
280 | 280 | |
281 | 281 | /* populate minimum required tables */ |
282 | 282 | for (i = 0; i < ARRAY_SIZE(smbios_write_funcs); i++) { |
283 | - int tmp = smbios_write_funcs[i](&addr, handle++); | |
283 | + int tmp = smbios_write_funcs[i]((ulong *)&addr, handle++); | |
284 | 284 | max_struct_size = max(max_struct_size, tmp); |
285 | 285 | len += tmp; |
286 | 286 | } |