Change in coreboot[master]: lib/imd: Use uintptr_t over void *
Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/36561 ) Change subject: lib/imd: Use uintptr_t over void * ...................................................................... lib/imd: Use uintptr_t over void * This reduces the number of casts. Change-Id: I3c41963202e5912da7c96ed8236e80e8bc27a4ed Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> --- M src/include/cbmem.h M src/include/imd.h M src/lib/fit_payload.c M src/lib/imd.c M src/lib/imd_cbmem.c 5 files changed, 11 insertions(+), 11 deletions(-) git pull ssh://review.coreboot.org:29418/coreboot refs/changes/61/36561/1 diff --git a/src/include/cbmem.h b/src/include/cbmem.h index 4767c80..c5d8d58 100644 --- a/src/include/cbmem.h +++ b/src/include/cbmem.h @@ -110,7 +110,7 @@ /* Add the cbmem memory used to the memory map at boot. */ void cbmem_add_bootmem(void); /* Return the cbmem memory used */ -void cbmem_get_region(void **baseptr, size_t *size); +void cbmem_get_region(uintptr_t *baseptr, size_t *size); void cbmem_list(void); void cbmem_add_records_to_cbtable(struct lb_header *header); diff --git a/src/include/imd.h b/src/include/imd.h index cd2d297..09db1d9 100644 --- a/src/include/imd.h +++ b/src/include/imd.h @@ -101,7 +101,7 @@ int imd_lockdown(struct imd *imd); /* Fill in base address and size of region used by imd. */ -int imd_region_used(struct imd *imd, void **base, size_t *size); +int imd_region_used(struct imd *imd, uintptr_t *base, size_t *size); /* Add an entry to the imd. If id already exists NULL is returned. */ const struct imd_entry *imd_entry_add(const struct imd *imd, uint32_t id, diff --git a/src/lib/fit_payload.c b/src/lib/fit_payload.c index 1b6c986..f719352 100644 --- a/src/lib/fit_payload.c +++ b/src/lib/fit_payload.c @@ -127,7 +127,7 @@ { u32 addr_cells = 1, size_cells = 1; u64 reg_addrs[2], reg_sizes[2]; - void *baseptr = NULL; + uintptr_t baseptr = 0; size_t size = 0; static const char *firmware_path[] = {"firmware", NULL}; @@ -163,7 +163,7 @@ return; } - reg_addrs[1] = (uintptr_t)baseptr; + reg_addrs[1] = baseptr; reg_sizes[1] = size; dt_add_reg_prop(coreboot_node, reg_addrs, reg_sizes, 2, addr_cells, diff --git a/src/lib/imd.c b/src/lib/imd.c index bedcfa8..b24a6f5 100644 --- a/src/lib/imd.c +++ b/src/lib/imd.c @@ -524,11 +524,11 @@ return 0; } -int imd_region_used(struct imd *imd, void **base, size_t *size) +int imd_region_used(struct imd *imd, uintptr_t *base, size_t *size) { struct imd_root *r; struct imd_entry *e; - void *low_addr; + uintptr_t low_addr; size_t sz_used; if (!imd->lg.limit) @@ -542,10 +542,10 @@ /* Use last entry to obtain lowest address. */ e = root_last_entry(r); - low_addr = relative_pointer(r, e->start_offset); + low_addr = (uintptr_t)r + e->start_offset; /* Total size used is the last entry's base up to the limit. */ - sz_used = imd->lg.limit - (uintptr_t)low_addr; + sz_used = imd->lg.limit - low_addr; *base = low_addr; *size = sz_used; diff --git a/src/lib/imd_cbmem.c b/src/lib/imd_cbmem.c index be135c2..3d5f653 100644 --- a/src/lib/imd_cbmem.c +++ b/src/lib/imd_cbmem.c @@ -295,14 +295,14 @@ void cbmem_add_bootmem(void) { - void *baseptr = NULL; + uintptr_t baseptr = 0; size_t size = 0; cbmem_get_region(&baseptr, &size); - bootmem_add_range((uintptr_t)baseptr, size, BM_MEM_TABLE); + bootmem_add_range(baseptr, size, BM_MEM_TABLE); } -void cbmem_get_region(void **baseptr, size_t *size) +void cbmem_get_region(uintptr_t *baseptr, size_t *size) { imd_region_used(cbmem_get_imd(), baseptr, size); } -- To view, visit https://review.coreboot.org/c/coreboot/+/36561 To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings Gerrit-Project: coreboot Gerrit-Branch: master Gerrit-Change-Id: I3c41963202e5912da7c96ed8236e80e8bc27a4ed Gerrit-Change-Number: 36561 Gerrit-PatchSet: 1 Gerrit-Owner: Arthur Heymans <arthur@aheymans.xyz> Gerrit-MessageType: newchange
Hello build bot (Jenkins), I'd like you to reexamine a change. Please visit https://review.coreboot.org/c/coreboot/+/36561 to look at the new patch set (#6). Change subject: lib/imd: Use uintptr_t over void * ...................................................................... lib/imd: Use uintptr_t over void * This reduces the number of casts. Change-Id: I3c41963202e5912da7c96ed8236e80e8bc27a4ed Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> --- M src/include/cbmem.h M src/include/imd.h M src/lib/fit_payload.c M src/lib/imd.c M src/lib/imd_cbmem.c M src/security/memory/memory_clear.c 6 files changed, 12 insertions(+), 12 deletions(-) git pull ssh://review.coreboot.org:29418/coreboot refs/changes/61/36561/6 -- To view, visit https://review.coreboot.org/c/coreboot/+/36561 To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings Gerrit-Project: coreboot Gerrit-Branch: master Gerrit-Change-Id: I3c41963202e5912da7c96ed8236e80e8bc27a4ed Gerrit-Change-Number: 36561 Gerrit-PatchSet: 6 Gerrit-Owner: Arthur Heymans <arthur@aheymans.xyz> Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org> Gerrit-MessageType: newpatchset
Hello build bot (Jenkins), I'd like you to reexamine a change. Please visit https://review.coreboot.org/c/coreboot/+/36561 to look at the new patch set (#8). Change subject: lib/imd: Use uintptr_t over void * ...................................................................... lib/imd: Use uintptr_t over void * This reduces the number of casts. Change-Id: I3c41963202e5912da7c96ed8236e80e8bc27a4ed Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> --- M src/cpu/x86/smm/tseg_region.c M src/include/cbmem.h M src/include/imd.h M src/include/stage_cache.h M src/lib/ext_stage_cache.c M src/lib/fit_payload.c M src/lib/imd.c M src/lib/imd_cbmem.c M src/security/memory/memory_clear.c 9 files changed, 31 insertions(+), 32 deletions(-) git pull ssh://review.coreboot.org:29418/coreboot refs/changes/61/36561/8 -- To view, visit https://review.coreboot.org/c/coreboot/+/36561 To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings Gerrit-Project: coreboot Gerrit-Branch: master Gerrit-Change-Id: I3c41963202e5912da7c96ed8236e80e8bc27a4ed Gerrit-Change-Number: 36561 Gerrit-PatchSet: 8 Gerrit-Owner: Arthur Heymans <arthur@aheymans.xyz> Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org> Gerrit-MessageType: newpatchset
Aaron Durbin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36561 ) Change subject: lib/imd: Use uintptr_t over void * ...................................................................... Patch Set 8: (1 comment) https://review.coreboot.org/c/coreboot/+/36561/8/src/lib/imd.c File src/lib/imd.c: https://review.coreboot.org/c/coreboot/+/36561/8/src/lib/imd.c@545 PS8, Line 545: low_addr = (uintptr_t)r + e->start_offset; relative pointer was utilizing intptr_t where now you are making this a uinptr_t. It probably doesn't matter in many of our situations, but we should be consistent and cast to intptr_t in the expression? start_offset is signed so it should sign extend on the implicit conversion if the type sizes are different. -- To view, visit https://review.coreboot.org/c/coreboot/+/36561 To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings Gerrit-Project: coreboot Gerrit-Branch: master Gerrit-Change-Id: I3c41963202e5912da7c96ed8236e80e8bc27a4ed Gerrit-Change-Number: 36561 Gerrit-PatchSet: 8 Gerrit-Owner: Arthur Heymans <arthur@aheymans.xyz> Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org> Gerrit-CC: Aaron Durbin <adurbin@chromium.org> Gerrit-Comment-Date: Mon, 04 Nov 2019 15:52:13 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36561 ) Change subject: lib/imd: Use uintptr_t over void * ...................................................................... Patch Set 8: Code-Review+1 -- To view, visit https://review.coreboot.org/c/coreboot/+/36561 To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings Gerrit-Project: coreboot Gerrit-Branch: master Gerrit-Change-Id: I3c41963202e5912da7c96ed8236e80e8bc27a4ed Gerrit-Change-Number: 36561 Gerrit-PatchSet: 8 Gerrit-Owner: Arthur Heymans <arthur@aheymans.xyz> Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com> Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org> Gerrit-CC: Aaron Durbin <adurbin@chromium.org> Gerrit-CC: Paul Menzel <paulepanter@users.sourceforge.net> Gerrit-Comment-Date: Tue, 03 Nov 2020 23:30:45 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
Arthur Heymans has abandoned this change. ( https://review.coreboot.org/c/coreboot/+/36561 ) Change subject: lib/imd: Use uintptr_t over void * ...................................................................... Abandoned Not worth rebasing anymore. -- To view, visit https://review.coreboot.org/c/coreboot/+/36561 To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings Gerrit-Project: coreboot Gerrit-Branch: master Gerrit-Change-Id: I3c41963202e5912da7c96ed8236e80e8bc27a4ed Gerrit-Change-Number: 36561 Gerrit-PatchSet: 8 Gerrit-Owner: Arthur Heymans <arthur@aheymans.xyz> Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com> Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org> Gerrit-CC: Aaron Durbin <adurbin@chromium.org> Gerrit-CC: Paul Menzel <paulepanter@mailbox.org> Gerrit-MessageType: abandon
participants (3)
-
Aaron Durbin (Code Review) -
Angel Pons (Code Review) -
Arthur Heymans (Code Review)