Annotation of pkgsrc/sysutils/dmidecode/patches/patch-dmidecode.c, revision 1.1
1.1 ! jmcneill 1: $NetBSD$
! 2:
! 3: Find SMBIOS table address on NetBSD ARM64.
! 4:
! 5: --- dmidecode.c.orig 2018-10-23 09:59:50.281527237 +0000
! 6: +++ dmidecode.c
! 7: @@ -72,6 +72,12 @@
! 8: #include <kenv.h>
! 9: #endif
! 10:
! 11: +#ifdef __NetBSD__
! 12: +#include <sys/param.h>
! 13: +#include <sys/sysctl.h>
! 14: +#include <errno.h>
! 15: +#endif
! 16: +
! 17: #include "version.h"
! 18: #include "config.h"
! 19: #include "types.h"
! 20: @@ -5463,6 +5469,9 @@ static int address_from_efi(off_t *addre
! 21: char linebuf[64];
! 22: #elif defined(__FreeBSD__)
! 23: char addrstr[KENV_MVALLEN + 1];
! 24: +#elif defined(__NetBSD__)
! 25: + uint64_t addr;
! 26: + size_t addrlen;
! 27: #endif
! 28: const char *eptype;
! 29: int ret;
! 30: @@ -5516,6 +5525,23 @@ static int address_from_efi(off_t *addre
! 31: *address = strtoull(addrstr, NULL, 0);
! 32: eptype = "SMBIOS";
! 33: ret = 0;
! 34: +#elif defined(__NetBSD__)
! 35: + /*
! 36: + * On NetBSD, SMBIOS anchor base address on non-x86 is exposed
! 37: + * via sysctl.
! 38: + */
! 39: + addrlen = sizeof(addr);
! 40: + ret = sysctlbyname("machdep.smbios", &addr, &addrlen, NULL, 0);
! 41: + if (ret == -1)
! 42: + {
! 43: + if (errno != ENOENT)
! 44: + perror("sysctlbyname");
! 45: + return EFI_NOT_FOUND;
! 46: + }
! 47: +
! 48: + *address = (off_t)addr;
! 49: + eptype = "SMBIOS";
! 50: + ret = 0;
! 51: #else
! 52: ret = EFI_NOT_FOUND;
! 53: #endif
CVSweb <webmaster@jp.NetBSD.org>