Smbios (OpenBSD): add support for legency BIOS

This commit is contained in:
李通洲
2025-03-23 10:36:15 +08:00
parent ab1bfffbd4
commit a3f50f32bf
3 changed files with 16 additions and 9 deletions
+1 -1
View File
@@ -89,7 +89,7 @@ const char* ffDetectBios(FFBiosResult* bios)
default: break;
}
}
#elif __HAIKU__
#elif __HAIKU__ || __OpenBSD__
// Currently SMBIOS detection is supported in legency BIOS only
ffStrbufSetStatic(&bios->type, "BIOS");
#endif
+9 -3
View File
@@ -50,7 +50,7 @@ const FFSmbiosHeader* ffSmbiosNextEntry(const FFSmbiosHeader* header)
return (const FFSmbiosHeader*) (p + 1);
}
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__sun) || defined(__HAIKU__)
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__sun) || defined(__HAIKU__) || defined(__OpenBSD__)
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mman.h>
@@ -139,7 +139,7 @@ const FFSmbiosHeaderTable* ffGetSmbiosHeaderTable()
if (buffer.chars == NULL)
{
ffStrbufInit(&buffer);
#ifndef __HAIKU__
#if !__HAIKU__ && !__OpenBSD__
#ifdef __linux__
if (!ffAppendFileBuffer("/sys/firmware/dmi/tables/DMI", &buffer))
#endif
@@ -233,7 +233,13 @@ const FFSmbiosHeaderTable* ffGetSmbiosHeaderTable()
{
uint32_t tableLength = 0;
off_t tableAddress = 0;
FF_AUTO_CLOSE_FD int fd = open("/dev/misc/mem", O_RDONLY);
FF_AUTO_CLOSE_FD int fd = open(
#if __HAIKU__
"/dev/misc/mem"
#else
"/dev/mem"
#endif
, O_RDONLY);
if (fd < 0)
return NULL;