From 944e0bab867f9d270025f21f7f6f021fa0079e1f Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Sun, 18 Sep 2016 17:38:02 +0000 Subject: [PATCH] Consolidate four efi_next_descriptor() definitions. Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sbin/sysctl/sysctl.c | 3 --- sys/amd64/amd64/machdep.c | 3 --- sys/arm/arm/machdep.c | 3 --- sys/arm64/arm64/machdep.c | 3 --- sys/sys/efi.h | 3 +++ 5 files changed, 3 insertions(+), 12 deletions(-) diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index f2d42a86405d..d9bd94d28bab 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -637,9 +637,6 @@ S_vmtotal(size_t l2, void *p) } #ifdef __amd64__ -#define efi_next_descriptor(ptr, size) \ - ((struct efi_md *)(((uint8_t *) ptr) + size)) - static int S_efi_map(size_t l2, void *p) { diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 53833b706fcd..864af76962e8 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -1056,9 +1056,6 @@ bios_add_smap_entries(struct bios_smap *smapbase, u_int32_t smapsize, } } -#define efi_next_descriptor(ptr, size) \ - ((struct efi_md *)(((uint8_t *) ptr) + size)) - static void add_efi_map_entries(struct efi_map_header *efihdr, vm_paddr_t *physmap, int *physmap_idx) diff --git a/sys/arm/arm/machdep.c b/sys/arm/arm/machdep.c index 203568e6d2f8..4a9dd99dd85d 100644 --- a/sys/arm/arm/machdep.c +++ b/sys/arm/arm/machdep.c @@ -1398,9 +1398,6 @@ set_stackptrs(int cpu) #endif #ifdef EFI -#define efi_next_descriptor(ptr, size) \ - ((struct efi_md *)(((uint8_t *) ptr) + size)) - static void add_efi_map_entries(struct efi_map_header *efihdr, struct mem_region *mr, int *mrcnt) diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index 3d2e6fb81b9f..0826938436ca 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -699,9 +699,6 @@ add_fdt_mem_regions(struct mem_region *mr, int mrcnt, vm_paddr_t *physmap, } #endif -#define efi_next_descriptor(ptr, size) \ - ((struct efi_md *)(((uint8_t *) ptr) + size)) - static void add_efi_map_entries(struct efi_map_header *efihdr, vm_paddr_t *physmap, u_int *physmap_idxp) diff --git a/sys/sys/efi.h b/sys/sys/efi.h index 3bdcdc384dbe..5dc75d4d45fe 100644 --- a/sys/sys/efi.h +++ b/sys/sys/efi.h @@ -90,6 +90,9 @@ struct efi_md { #define EFI_MD_ATTR_RT 0x8000000000000000UL }; +#define efi_next_descriptor(ptr, size) \ + ((struct efi_md *)(((uint8_t *)(ptr)) + (size))) + struct efi_tm { uint16_t tm_year; /* 1998 - 20XX */ uint8_t tm_mon; /* 1 - 12 */