Skip to content

Commit 1f67a35

Browse files
committed
fix lacpi build
1 parent c3acea0 commit 1f67a35

File tree

6 files changed

+21
-20
lines changed

6 files changed

+21
-20
lines changed

stand/efi/Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ SUBDIR.${MK_LOADER_IA32}+= libefi32
77
SUBDIR.${MK_FDT}+= fdt
88
SUBDIR.yes+= libacpi
99
SUBDIR.${MK_LOADER_IA32}+= libacpi32
10+
SUBDIR.yes+= ../liblua
1011
SUBDIR.yes+= .WAIT
1112

1213
SUBDIR.yes+= boot1 gptboot
@@ -17,7 +18,9 @@ SUBDIR.${MK_LOADER_IA32}+= loader_ia32
1718
SUBDIR.yes+= loader_simp
1819

1920
.if !defined(MK_FORTH) && !defined(MK_LOADER_IA32) && defined(MK_LOADER_LUA)
20-
SUBDIR.yes+= liblua
21+
CFLAGS+= -DLACPI=1
22+
.else
23+
CFLAGS+= -DLACPI=0
2124
.endif
2225

2326
.include <bsd.subdir.mk>

stand/efi/loader/Makefile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,12 @@ LDFLAGS+= -Wl,--threads=1
128128

129129
CLEANFILES+= ${LOADER}.efi
130130

131+
.if ${__arch} == "amd64" && ${DO32:U0} == 0
132+
LACPI_COMPILE_SET= -j set_lua_acpi_modules
133+
.else
134+
LACPI_COMPILE_SET=
135+
.endif
136+
131137
${LOADER}.efi: ${PROG}
132138
@if ${NM} ${.ALLSRC} | grep ' U '; then \
133139
echo "Undefined symbols in ${.ALLSRC}"; \
@@ -138,6 +144,7 @@ ${LOADER}.efi: ${PROG}
138144
-j .dynamic -j .dynsym -j .rel.dyn \
139145
-j .rela.dyn -j .reloc -j .eh_frame -j set_Xcommand_set \
140146
-j set_X${LOADER_INTERP}_compile_set \
147+
${LACPI_COMPILE_SET} \
141148
--output-target=${EFI_TARGET} ${.ALLSRC} ${.TARGET}
142149

143150
LIBEFI= ${BOOTOBJ}/efi/libefi/libefi.a
@@ -155,9 +162,4 @@ LDADD= ${LDR_INTERP} ${LIBEFI} ${LIBSAFDT} ${LIBEFI_FDT} ${LIBSA} \
155162
${LIBACPI}
156163
.endif
157164

158-
.if ${__arch} == "amd64" && ${DO32:U0} == 0
159-
DPADD+= ${LIBLUA}
160-
LDADD+= ${LIBLUA}
161-
.endif
162-
163165
.include <bsd.prog.mk>

stand/efi/loader/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
#define ACPI_SYSTEM_XFACE
6969

7070
// If defined amd64 && loader_lua
71-
#if defined(__amd64__) && defined(MK_LOADER_LUA)
71+
#if defined(__amd64__) && LACPI
7272
#include <init_acpi.h>
7373
#include <lacpi.h>
7474
#else
@@ -1237,7 +1237,7 @@ main(int argc, CHAR16 *argv[])
12371237

12381238
devinit();
12391239

1240-
#if defined(__amd64__) && defined(MK_LOADER_LUA)
1240+
#if defined(__amd64__) && LACPI
12411241
/* Initialize ACPI Subsystem and Tables. */
12421242
if ((ret = init_acpi()) != 0) {
12431243
printf("Failed to initialize ACPI\n.");

stand/liblua/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,13 @@ SRCS+= lhash.c
3232
# ACPI
3333
.if ${MACHINE_CPUARCH} == "amd64" && ${DO32:U0} == 0
3434
.PATH: ${LIBLUASRC}/acpi
35+
3536
SRCS+= lacpi.c lacpi_object.c lacpi_utils.c lacpi_walk.c lacpi_data.c
37+
3638
CFLAGS+= -I${SYSDIR}/contrib/dev/acpica/include \
3739
-I${EFISRC}/libacpi/acpi/include -I${EFISRC}/include \
3840
-I${EFISRC}/include/amd64 -I${LIBLUASRC}/acpi/include
41+
3942
DPADD+= ${LIBACPI}
4043
LDADD+= ${LIBACPI}
4144
.endif

stand/liblua/acpi/lacpi.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ lua_acpi_bindings(lua_State *L)
4646
(*mod)->init(L);
4747
lua_setglobal(L, (*mod)->mod_name);
4848
}
49-
50-
luaopen_lacpi(L);
51-
lua_setglobal(L, "lacpi");
5249
}
5350

5451
/*
@@ -57,9 +54,7 @@ lua_acpi_bindings(lua_State *L)
5754
void
5855
lua_acpi_register_hook(void)
5956
{
60-
if (acpi_is_initialized()) {
61-
lua_acpi_register = lua_acpi_bindings;
62-
}
57+
lua_acpi_register = lua_acpi_bindings;
6358
}
6459

6560
LUA_ACPI_COMPILE_SET(lacpi, luaopen_lacpi);

stand/lua/walk.lua

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
local lacpi = require("lacpi")
2-
31
local function test_walk_namespace()
4-
local nodes = lacpi.walk.dump_namespace() -- returns table of tables
2+
local nodes = lacpi.walk.namespace() -- returns table of tables
53

64
-- Print them in Lua
75
for _, node in ipairs(nodes) do
8-
print(node.level, node.path, node.HID or "", node.UID or "")
6+
print(node.level, node.path, node.HID, node.UID)
97
end
108

11-
return "SUCCESS";
9+
return "SUCCESS"
1210
end
1311

14-
print("--- TEST BEGIN: WALK NS ---");
12+
print("--- TEST BEGIN: WALK NS ---")
1513

1614
status = test_walk_namespace()
1715

0 commit comments

Comments
 (0)