Index: usr.sbin/acpi/acpiconf/acpiconf.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/acpi/acpiconf/acpiconf.c,v retrieving revision 1.2 diff -u -r1.2 acpiconf.c --- usr.sbin/acpi/acpiconf/acpiconf.c 2000/09/30 20:13:55 1.2 +++ usr.sbin/acpi/acpiconf/acpiconf.c 2000/11/03 17:28:37 @@ -35,9 +35,11 @@ #include #include -#include -#include +#include +#include +#include + #define ACPIDEV "/dev/acpi" static int @@ -74,29 +76,57 @@ return (0); } +static void +usage(const char* prog) +{ + printf("usage: %s [-deh] [-s [1|2|3|4|4b|5]]\n", prog); + exit(0); +} + int main(int argc, char *argv[]) { - char c; + char c, *prog; int sleep_type; + prog = argv[0]; sleep_type = -1; - while ((c = getopt(argc, argv, "eds:")) != -1) { + while ((c = getopt(argc, argv, "dehs:")) != -1) { switch (c) { + case 'd': + acpi_enable_disable(ACPIIO_DISABLE); + break; + case 'e': acpi_enable_disable(ACPIIO_ENABLE); break; - case 'd': - acpi_enable_disable(ACPIIO_DISABLE); + case 'h': + usage(prog); break; case 's': - sleep_type = *optarg - '0'; - if (sleep_type < ACPI_S_STATE_S0 || sleep_type > ACPI_S_STATE_S5) { + sleep_type = optarg[0] - '0'; + if (sleep_type < 0 || sleep_type > 5) { fprintf(stderr, "%s: invalid sleep type (%d)\n", argv[0], sleep_type); return -1; + } + + /* convert sleep type value to ACPICA format */ + switch (sleep_type) { + case 4: + if (optarg[1] == 'b') { + sleep_type = ACPI_STATE_S4BIOS; + } + break; + + case 5: + sleep_type = ACPI_STATE_S5; + break; + + default: + break; } break; default: Index: usr.sbin/acpi/acpidump/acpi.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/acpi/acpidump/acpi.c,v retrieving revision 1.2 diff -u -r1.2 acpi.c --- usr.sbin/acpi/acpidump/acpi.c 2000/09/30 20:13:56 1.2 +++ usr.sbin/acpi/acpidump/acpi.c 2000/11/03 17:14:37 @@ -37,8 +37,6 @@ #include #include -#include - #include "acpidump.h" static void Index: usr.sbin/acpi/acpidump/acpi_user.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/acpi/acpidump/acpi_user.c,v retrieving revision 1.2 diff -u -r1.2 acpi_user.c --- usr.sbin/acpi/acpidump/acpi_user.c 2000/09/30 20:13:56 1.2 +++ usr.sbin/acpi/acpidump/acpi_user.c 2000/11/03 17:14:37 @@ -39,8 +39,6 @@ #include #include -#include - #include "acpidump.h" static int acpi_mem_fd = -1; Index: usr.sbin/acpi/acpidump/acpidump.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/acpi/acpidump/acpidump.c,v retrieving revision 1.2 diff -u -r1.2 acpidump.c --- usr.sbin/acpi/acpidump/acpidump.c 2000/09/30 20:13:56 1.2 +++ usr.sbin/acpi/acpidump/acpidump.c 2000/11/03 17:14:37 @@ -34,8 +34,6 @@ #include #include -#include - #include "acpidump.h" static void @@ -72,7 +70,8 @@ { printf("usage:\t%s [-o dsdt_file_for_output]\n", progname); - printf("or\t%s [-f dsdt_file_for_input]\n", progname); + printf("\t%s [-f dsdt_file_for_input]\n", progname); + printf("\t%s [-h]\n", progname); exit(1); } Index: usr.sbin/acpi/acpidump/acpidump.h =================================================================== RCS file: /home/ncvs/src/usr.sbin/acpi/acpidump/acpidump.h,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 acpidump.h --- usr.sbin/acpi/acpidump/acpidump.h 2000/08/31 14:42:32 1.1.1.1 +++ usr.sbin/acpi/acpidump/acpidump.h 2000/11/03 17:14:37 @@ -31,6 +31,141 @@ #ifndef _ACPIDUMP_H_ #define _ACPIDUMP_H_ +/* Generic Address structure */ +struct ACPIgas { + u_int8_t address_space_id; +#define ACPI_GAS_MEMORY 0 +#define ACPI_GAS_IO 1 +#define ACPI_GAS_PCI 2 +#define ACPI_GAS_EMBEDDED 3 +#define ACPI_GAS_SMBUS 4 +#define ACPI_GAS_FIXED 0x7f + u_int8_t register_bit_width; + u_int8_t register_bit_offset; + u_int8_t res; + u_int64_t address; +} __attribute__((packed)); + +/* Root System Description Pointer */ +struct ACPIrsdp { + u_char signature[8]; + u_char sum; + u_char oem[6]; + u_char res; + u_int32_t addr; +} __attribute__((packed)); + +/* System Description Table */ +struct ACPIsdt { + u_char signature[4]; + u_int32_t len; + u_char rev; + u_char check; + u_char oemid[6]; + u_char oemtblid[8]; + u_int32_t oemrev; + u_char creator[4]; + u_int32_t crerev; +#define SIZEOF_SDT_HDR 36 /* struct size except body */ + u_int32_t body[1];/* This member should be casted */ +} __attribute__((packed)); + +/* Fixed ACPI Description Table (body) */ +struct FACPbody { + u_int32_t facs_ptr; + u_int32_t dsdt_ptr; + u_int8_t int_model; +#define ACPI_FACP_INTMODEL_PIC 0 /* Standard PC-AT PIC */ +#define ACPI_FACP_INTMODEL_APIC 1 /* Multiple APIC */ + u_char reserved1; + u_int16_t sci_int; + u_int32_t smi_cmd; + u_int8_t acpi_enable; + u_int8_t acpi_disable; + u_int8_t s4biosreq; + u_int8_t reserved2; + u_int32_t pm1a_evt_blk; + u_int32_t pm1b_evt_blk; + u_int32_t pm1a_cnt_blk; + u_int32_t pm1b_cnt_blk; + u_int32_t pm2_cnt_blk; + u_int32_t pm_tmr_blk; + u_int32_t gpe0_blk; + u_int32_t gpe1_blk; + u_int8_t pm1_evt_len; + u_int8_t pm1_cnt_len; + u_int8_t pm2_cnt_len; + u_int8_t pm_tmr_len; + u_int8_t gpe0_len; + u_int8_t gpe1_len; + u_int8_t gpe1_base; + u_int8_t reserved3; + u_int16_t p_lvl2_lat; + u_int16_t p_lvl3_lat; + u_int16_t flush_size; + u_int16_t flush_stride; + u_int8_t duty_off; + u_int8_t duty_width; + u_int8_t day_alrm; + u_int8_t mon_alrm; + u_int8_t century; + u_int16_t iapc_boot_arch; + u_char reserved4[1]; + u_int32_t flags; +#define ACPI_FACP_FLAG_WBINVD 1 /* WBINVD is correctly supported */ +#define ACPI_FACP_FLAG_WBINVD_FLUSH 2 /* WBINVD flushes caches */ +#define ACPI_FACP_FLAG_PROC_C1 4 /* C1 power state supported */ +#define ACPI_FACP_FLAG_P_LVL2_UP 8 /* C2 power state works on SMP */ +#define ACPI_FACP_FLAG_PWR_BUTTON 16 /* Power button uses control method */ +#define ACPI_FACP_FLAG_SLP_BUTTON 32 /* Sleep button uses control method */ +#define ACPI_FACP_FLAG_FIX_RTC 64 /* RTC wakeup not supported */ +#define ACPI_FACP_FLAG_RTC_S4 128 /* RTC can wakeup from S4 state */ +#define ACPI_FACP_FLAG_TMR_VAL_EXT 256 /* TMR_VAL is 32bit */ +#define ACPI_FACP_FLAG_DCK_CAP 512 /* Can support docking */ + struct ACPIgas reset_reg; + u_int8_t reset_value; + u_int8_t reserved5[3]; + u_int64_t x_firmware_ctrl; + u_int64_t x_dsdt; + struct ACPIgas x_pm1a_evt_blk; + struct ACPIgas x_pm1b_evt_blk; + struct ACPIgas x_pm1a_cnt_blk; + struct ACPIgas x_pm1b_cnt_blk; + struct ACPIgas x_pm2_cnt_blk; + struct ACPIgas x_pm_tmr_blk; + struct ACPIgas x_gpe0_blk; + struct ACPIgas x_gpe1_blk; +} __attribute__((packed)); + +/* Firmware ACPI Control Structure */ +struct FACS { + u_char signature[4]; + u_int32_t len; + u_char hard_sig[4]; + /* + * NOTE This should be filled with physical address below 1MB!! + * sigh.... + */ + u_int32_t firm_wake_vec; + u_int32_t g_lock; /* bit field */ + /* 5.2.6.1 Global Lock */ +#define ACPI_GLOBAL_LOCK_PENDING 1 +#define ACPI_GLOBAL_LOCK_OWNED 2 + u_int32_t flags; /* bit field */ +#define ACPI_FACS_FLAG_S4BIOS_F 1 /* Supports S4BIOS_SEQ */ + char reserved[40]; +} __attribute__((packed)); + +void *acpi_map_physical(vm_offset_t, size_t); +struct ACPIrsdp *acpi_find_rsd_ptr(void); +int acpi_checksum(void *, size_t); +struct ACPIsdt *acpi_map_sdt(vm_offset_t); +void acpi_print_rsd_ptr(struct ACPIrsdp *); +void acpi_print_sdt(struct ACPIsdt *); +void acpi_print_rsdt(struct ACPIsdt *); +void acpi_print_facp(struct FACPbody *); +void acpi_print_dsdt(struct ACPIsdt *); + void asl_dump_termobj(u_int8_t **, int); void asl_dump_objectlist(u_int8_t **, u_int8_t *, int); Index: usr.sbin/acpi/acpidump/aml_dump.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/acpi/acpidump/aml_dump.c,v retrieving revision 1.2 diff -u -r1.2 aml_dump.c --- usr.sbin/acpi/acpidump/aml_dump.c 2000/09/30 20:13:56 1.2 +++ usr.sbin/acpi/acpidump/aml_dump.c 2000/11/03 17:14:37 @@ -34,8 +34,6 @@ #include #include -#include - #include "acpidump.h" char *aml_dumpfile = NULL; Index: usr.sbin/acpi/acpidump/asl_dump.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/acpi/acpidump/asl_dump.c,v retrieving revision 1.2 diff -u -r1.2 asl_dump.c --- usr.sbin/acpi/acpidump/asl_dump.c 2000/09/30 20:13:56 1.2 +++ usr.sbin/acpi/acpidump/asl_dump.c 2000/11/03 17:14:37 @@ -34,8 +34,6 @@ #include #include -#include - #include "acpidump.h" static u_int32_t Index: usr.sbin/acpi/amldb/Makefile =================================================================== RCS file: /home/ncvs/src/usr.sbin/acpi/amldb/Makefile,v retrieving revision 1.2 diff -u -r1.2 Makefile --- usr.sbin/acpi/amldb/Makefile 2000/09/14 22:48:39 1.2 +++ usr.sbin/acpi/amldb/Makefile 2000/11/03 17:14:37 @@ -6,7 +6,7 @@ SRCS+= aml_parse.c aml_name.c aml_amlmem.c aml_memman.c aml_store.c aml_obj.c aml_evalobj.c aml_common.c MAN8= amldb.8 #DEBUG_FLAGS= -g -CFLAGS+= -I${.CURDIR}/../../../sys -I${.CURDIR} +CFLAGS+= -I${.CURDIR} .include -.PATH: ${.CURDIR}/../../../sys/dev/acpi/aml +.PATH: ${.CURDIR}/aml Index: usr.sbin/acpi/amldb/amldb.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/acpi/amldb/amldb.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 amldb.c --- usr.sbin/acpi/amldb/amldb.c 2000/08/31 14:45:00 1.1.1.1 +++ usr.sbin/acpi/amldb/amldb.c 2000/11/03 17:14:37 @@ -31,11 +31,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include Index: usr.sbin/acpi/amldb/debug.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/acpi/amldb/debug.c,v retrieving revision 1.2 diff -u -r1.2 debug.c --- usr.sbin/acpi/amldb/debug.c 2000/09/30 20:13:57 1.2 +++ usr.sbin/acpi/amldb/debug.c 2000/11/03 17:14:37 @@ -30,16 +30,16 @@ #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include Index: usr.sbin/acpi/amldb/region.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/acpi/amldb/region.c,v retrieving revision 1.2 diff -u -r1.2 region.c --- usr.sbin/acpi/amldb/region.c 2000/09/20 01:01:32 1.2 +++ usr.sbin/acpi/amldb/region.c 2000/11/03 17:14:37 @@ -34,10 +34,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include