Skip to content

Commit 55249c2

Browse files
committed
BIOS (SunOS): detect BIOS type
1 parent c13da56 commit 55249c2

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1637,6 +1637,7 @@ elseif(SunOS)
16371637
PRIVATE "proc"
16381638
PRIVATE "zfs"
16391639
PRIVATE "nvpair"
1640+
PRIVATE "devinfo"
16401641
)
16411642
elseif(ANDROID)
16421643
CHECK_LIBRARY_EXISTS(-l:libandroid-wordexp.a wordexp "" HAVE_LIBANDROID_WORDEXP_STATIC)

src/detection/bios/bios_windows.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ typedef struct _SYSTEM_BOOT_ENVIRONMENT_INFORMATION
3232

3333
#include <fcntl.h>
3434
#include <unistd.h>
35+
36+
#elif __sun
37+
#include <libdevinfo.h>
38+
#include <sys/sunddi.h>
3539
#endif
3640

3741
typedef struct FFSmbiosBios
@@ -59,6 +63,7 @@ typedef struct FFSmbiosBios
5963
static_assert(offsetof(FFSmbiosBios, ExtendedBiosRomSize) == 0x18,
6064
"FFSmbiosBios: Wrong struct alignment");
6165

66+
6267
const char* ffDetectBios(FFBiosResult* bios)
6368
{
6469
const FFSmbiosHeaderTable* smbiosTable = ffGetSmbiosHeaderTable();
@@ -94,6 +99,17 @@ const char* ffDetectBios(FFBiosResult* bios)
9499
default: break;
95100
}
96101
}
102+
#elif __sun
103+
di_node_t rootNode = di_init("/", DINFOPROP);
104+
if (rootNode != DI_NODE_NIL)
105+
{
106+
char* efiVersion = NULL;
107+
if (di_prop_lookup_strings(DDI_DEV_T_ANY, rootNode, "efi-version", &efiVersion) > 0)
108+
ffStrbufSetStatic(&bios->type, "UEFI");
109+
else
110+
ffStrbufSetStatic(&bios->type, "BIOS");
111+
}
112+
di_fini(rootNode);
97113
#elif __HAIKU__ || __OpenBSD__
98114
// Currently SMBIOS detection is supported in legancy BIOS only
99115
ffStrbufSetStatic(&bios->type, "BIOS");

0 commit comments

Comments
 (0)