git: 9521266b82df - stable/13 - arm64/machdep: Add parameter to the EFI table walking code
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 24 Mar 2023 13:13:56 UTC
The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=9521266b82dfaa82ca4ac56276a049aee5f01ad9 commit 9521266b82dfaa82ca4ac56276a049aee5f01ad9 Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2022-11-30 23:28:01 +0000 Commit: Mitchell Horne <mhorne@FreeBSD.org> CommitDate: 2023-03-24 13:12:40 +0000 arm64/machdep: Add parameter to the EFI table walking code It would be nice to be able to pass an arbitrary pointer to the callback code. Add one, and pass NULL in all the places that we do that today. As noted by andrew@, we should likely refactor this into MI code and use it here and amd64, but for the future. Sponsored by: Netflix Reviewed by: rpokala Differential Revision: https://reviews.freebsd.org/D37439 (cherry picked from commit 6849950da7d770fa6531b915922799c20e960d42) --- sys/arm64/arm64/machdep.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index 768d02b510b2..283ca221d7f3 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -420,10 +420,10 @@ arm64_get_writable_addr(vm_offset_t addr, vm_offset_t *out) return (false); } -typedef void (*efi_map_entry_cb)(struct efi_md *); +typedef void (*efi_map_entry_cb)(struct efi_md *, void *argp); static void -foreach_efi_map_entry(struct efi_map_header *efihdr, efi_map_entry_cb cb) +foreach_efi_map_entry(struct efi_map_header *efihdr, efi_map_entry_cb cb, void *argp) { struct efi_md *map, *p; size_t efisz; @@ -442,12 +442,12 @@ foreach_efi_map_entry(struct efi_map_header *efihdr, efi_map_entry_cb cb) for (i = 0, p = map; i < ndesc; i++, p = efi_next_descriptor(p, efihdr->descriptor_size)) { - cb(p); + cb(p, argp); } } static void -exclude_efi_map_entry(struct efi_md *p) +exclude_efi_map_entry(struct efi_md *p, void *argp __unused) { switch (p->md_type) { @@ -470,11 +470,11 @@ static void exclude_efi_map_entries(struct efi_map_header *efihdr) { - foreach_efi_map_entry(efihdr, exclude_efi_map_entry); + foreach_efi_map_entry(efihdr, exclude_efi_map_entry, NULL); } static void -add_efi_map_entry(struct efi_md *p) +add_efi_map_entry(struct efi_md *p, void *argp __unused) { switch (p->md_type) { @@ -512,12 +512,11 @@ add_efi_map_entry(struct efi_md *p) static void add_efi_map_entries(struct efi_map_header *efihdr) { - - foreach_efi_map_entry(efihdr, add_efi_map_entry); + foreach_efi_map_entry(efihdr, add_efi_map_entry, NULL); } static void -print_efi_map_entry(struct efi_md *p) +print_efi_map_entry(struct efi_md *p, void *argp __unused) { const char *type; static const char *types[] = { @@ -577,7 +576,7 @@ print_efi_map_entries(struct efi_map_header *efihdr) printf("%23s %12s %12s %8s %4s\n", "Type", "Physical", "Virtual", "#Pages", "Attr"); - foreach_efi_map_entry(efihdr, print_efi_map_entry); + foreach_efi_map_entry(efihdr, print_efi_map_entry, NULL); } #ifdef FDT