Annotation of pkgsrc/sysutils/dmidecode/patches/patch-dmidecode.c, revision 1.4
1.4 ! msaitoh 1: $NetBSD: patch-dmidecode.c,v 1.3 2022/04/23 20:18:30 tnn Exp $
1.1 jmcneill 2:
1.2 triaxx 3: * Find SMBIOS table address on NetBSD ARM64.
4: * Add missing header for FreeBSD.
1.1 jmcneill 5:
1.4 ! msaitoh 6: --- dmidecode.c.orig 2022-06-28 00:06:32.000000000 +0900
! 7: +++ dmidecode.c 2022-10-11 18:08:14.158248758 +0900
1.3 tnn 8: @@ -71,6 +71,13 @@
1.2 triaxx 9: #ifdef __FreeBSD__
10: #include <errno.h>
1.1 jmcneill 11: #include <kenv.h>
1.2 triaxx 12: +#include <sys/socket.h>
1.3 tnn 13: +#endif
14: +
1.1 jmcneill 15: +#ifdef __NetBSD__
16: +#include <sys/param.h>
17: +#include <sys/sysctl.h>
18: +#include <errno.h>
1.3 tnn 19: #endif
20:
1.1 jmcneill 21: #include "version.h"
1.4 ! msaitoh 22: @@ -5837,6 +5844,9 @@ static int address_from_efi(off_t *addre
1.1 jmcneill 23: char linebuf[64];
24: #elif defined(__FreeBSD__)
25: char addrstr[KENV_MVALLEN + 1];
26: +#elif defined(__NetBSD__)
27: + uint64_t addr;
28: + size_t addrlen;
29: #endif
30: const char *eptype;
31: int ret;
1.4 ! msaitoh 32: @@ -5890,6 +5900,23 @@ static int address_from_efi(off_t *addre
1.1 jmcneill 33: *address = strtoull(addrstr, NULL, 0);
1.3 tnn 34: eptype = "SMBIOS";
35: ret = 0;
1.1 jmcneill 36: +#elif defined(__NetBSD__)
37: + /*
38: + * On NetBSD, SMBIOS anchor base address on non-x86 is exposed
39: + * via sysctl.
40: + */
41: + addrlen = sizeof(addr);
42: + ret = sysctlbyname("machdep.smbios", &addr, &addrlen, NULL, 0);
43: + if (ret == -1)
44: + {
45: + if (errno != ENOENT)
46: + perror("sysctlbyname");
47: + return EFI_NOT_FOUND;
48: + }
49: +
50: + *address = (off_t)addr;
1.3 tnn 51: + eptype = "SMBIOS";
52: + ret = 0;
1.1 jmcneill 53: #else
1.3 tnn 54: ret = EFI_NOT_FOUND;
55: #endif
CVSweb <webmaster@jp.NetBSD.org>