File tree Expand file tree Collapse file tree 6 files changed +21
-20
lines changed Expand file tree Collapse file tree 6 files changed +21
-20
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ SUBDIR.${MK_LOADER_IA32}+= libefi32
77SUBDIR.${MK_FDT}+ = fdt
88SUBDIR.yes+ = libacpi
99SUBDIR.${MK_LOADER_IA32}+ = libacpi32
10+ SUBDIR.yes+ = ../liblua
1011SUBDIR.yes+ = .WAIT
1112
1213SUBDIR.yes+ = boot1 gptboot
@@ -17,7 +18,9 @@ SUBDIR.${MK_LOADER_IA32}+= loader_ia32
1718SUBDIR.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>
Original file line number Diff line number Diff line change @@ -128,6 +128,12 @@ LDFLAGS+= -Wl,--threads=1
128128
129129CLEANFILES+ = ${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
143150LIBEFI = ${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>
Original file line number Diff line number Diff line change 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." );
Original file line number Diff line number Diff line change @@ -32,10 +32,13 @@ SRCS+= lhash.c
3232# ACPI
3333.if ${MACHINE_CPUARCH} == "amd64" && ${DO32 :U0} == 0
3434.PATH : ${LIBLUASRC}/acpi
35+
3536SRCS+ = lacpi.c lacpi_object.c lacpi_utils.c lacpi_walk.c lacpi_data.c
37+
3638CFLAGS+ = -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+
3942DPADD+ = ${LIBACPI}
4043LDADD+ = ${LIBACPI}
4144.endif
Original file line number Diff line number Diff 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)
5754void
5855lua_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
6560LUA_ACPI_COMPILE_SET (lacpi , luaopen_lacpi );
Original file line number Diff line number Diff line change 1- local lacpi = require (" lacpi" )
2-
31local 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"
1210end
1311
14- print (" --- TEST BEGIN: WALK NS ---" );
12+ print (" --- TEST BEGIN: WALK NS ---" )
1513
1614status = test_walk_namespace ()
1715
You can’t perform that action at this time.
0 commit comments