From 5d3d441811641842706c2613ff63d383dad2f447 Mon Sep 17 00:00:00 2001 From: Ebrahim Aleem Date: Sat, 11 Apr 2026 12:31:44 -0700 Subject: [PATCH 1/6] ext2 seek --- drivers/ext2/ext2.c | 23 ++++++++++++++++++++++- kernel/core/fs.c | 28 +++++++++++++++++++++++++++- kernel/include/core/fs.h | 8 +++++++- 3 files changed, 56 insertions(+), 3 deletions(-) diff --git a/drivers/ext2/ext2.c b/drivers/ext2/ext2.c index bc8e6b9..fb75fdc 100644 --- a/drivers/ext2/ext2.c +++ b/drivers/ext2/ext2.c @@ -597,6 +597,25 @@ static size_t ext2_read(struct file_handle_t* handle, void* buffer, size_t count return read; } +static uint64_t ext2_get_seek(struct file_handle_t* handle) { + struct ext2_inode_handle_t* inode_handle = (struct ext2_inode_handle_t*)handle; + const struct ext2_superblock_t* superblock = inode_handle->ext2->superblock; + const uint64_t block_size = 1024u << superblock->s_log_block_size; + + return inode_handle->seek_block * block_size + inode_handle->seek; +} + +static enum file_status_t ext2_seek(struct file_handle_t* handle, uint64_t seek) { + struct ext2_inode_handle_t* inode_handle = (struct ext2_inode_handle_t*)handle; + const struct ext2_superblock_t* superblock = inode_handle->ext2->superblock; + const uint64_t block_size = 1024u << superblock->s_log_block_size; + + inode_handle->seek_block = seek / block_size; + inode_handle->seek = seek % block_size; + + return FILE_OK; +} + uint8_t ext2_attempt_init(struct disk_t* disk, uint64_t start_lba, uint64_t end_lba) { struct ext2_superblock_t* superblock = kmalloc(sizeof(struct ext2_superblock_t)); struct ext2_bg_desc_t* bgdt; @@ -649,7 +668,9 @@ uint8_t ext2_attempt_init(struct disk_t* disk, uint64_t start_lba, uint64_t end_ ext2_open, ext2_close, ext2_stat, - ext2_read + ext2_read, + ext2_get_seek, + ext2_seek ) != FILE_OK) { logging_log_error("Failed to mount rootfs"); panic(PANIC_STATE); diff --git a/kernel/core/fs.c b/kernel/core/fs.c index dbbdddc..a78351e 100644 --- a/kernel/core/fs.c +++ b/kernel/core/fs.c @@ -38,6 +38,8 @@ struct vfs_mount_t { fs_close_t close; fs_stat_t stat; fs_read_t read; + fs_get_seek_t get_seek; + fs_seek_t seek; }; struct fs_handle_t { @@ -86,7 +88,9 @@ enum file_status_t fs_mount( fs_open_t open, fs_close_t close, fs_stat_t stat, - fs_read_t read + fs_read_t read, + fs_get_seek_t get_seek, + fs_seek_t seek ) { if (kstrcmp(mountpoint, "") && !vfs_root.mount) { @@ -102,6 +106,8 @@ enum file_status_t fs_mount( vfs_root.mount->close = close; vfs_root.mount->stat = stat; vfs_root.mount->read = read; + vfs_root.mount->get_seek = get_seek; + vfs_root.mount->seek = seek; return FILE_OK; } @@ -233,3 +239,23 @@ size_t fs_read(struct fs_handle_t* handle, void* buffer, size_t count) { return ret; } + +uint64_t fs_get_seek(struct fs_handle_t* handle) { + uint64_t seek; + + lock_acquire(&fs_lock); + seek = handle->mount->get_seek(handle->handle); + lock_release(&fs_lock); + + return seek; +} + +enum file_status_t fs_seek(struct fs_handle_t* handle, uint64_t seek) { + enum file_status_t sts; + + lock_acquire(&fs_lock); + sts = handle->mount->seek(handle->handle, seek); + lock_release(&fs_lock); + + return sts; +} diff --git a/kernel/include/core/fs.h b/kernel/include/core/fs.h index 7f05c67..14a4009 100644 --- a/kernel/include/core/fs.h +++ b/kernel/include/core/fs.h @@ -49,6 +49,8 @@ typedef void (*fs_close_t)(struct file_handle_t*); typedef enum file_status_t (*fs_stat_t)(struct file_handle_t*, struct file_info_t*); typedef size_t (*fs_read_t)(struct file_handle_t*, void*, size_t); +typedef uint64_t (*fs_get_seek_t)(struct file_handle_t*); +typedef enum file_status_t (*fs_seek_t)(struct file_handle_t*, uint64_t); void fs_init(void); @@ -58,7 +60,9 @@ enum file_status_t fs_mount( fs_open_t open, fs_close_t close, fs_stat_t stat, - fs_read_t read + fs_read_t read, + fs_get_seek_t get_seek, + fs_seek_t seek ); extern struct fs_handle_t* fs_open(const char* path); @@ -66,5 +70,7 @@ extern void fs_close(struct fs_handle_t* handle); extern enum file_status_t fs_stat(struct fs_handle_t* handle, struct file_info_t* info); extern size_t fs_read(struct fs_handle_t* handle, void* buffer, size_t count); +extern uint64_t fs_get_seek(struct fs_handle_t* handle); +extern enum file_status_t fs_seek(struct fs_handle_t* handle, uint64_t seek); #endif /* KERNEL_CORE_FS_H */ From 737583e07c0a074f31af1697fcbc60b906d45a48 Mon Sep 17 00:00:00 2001 From: Ebrahim Aleem Date: Sat, 11 Apr 2026 15:26:55 -0700 Subject: [PATCH 2/6] ELF header structs --- kernel/elf/elf.c | 132 +++++++++++++++++++++++++++++++++++++++ kernel/include/elf/elf.h | 28 +++++++++ 2 files changed, 160 insertions(+) create mode 100644 kernel/elf/elf.c create mode 100644 kernel/include/elf/elf.h diff --git a/kernel/elf/elf.c b/kernel/elf/elf.c new file mode 100644 index 0000000..152580d --- /dev/null +++ b/kernel/elf/elf.c @@ -0,0 +1,132 @@ +/* elf.h - Executable and Linking Format loading implementation */ +/* Copyright (C) 2026 Ebrahim Aleem +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see +*/ + +#include + +#include + +#include +#include +#include + +#include + +#define EI_MAG0 0 +#define EI_CLASS 4 +#define EI_DATA 5 +#define EI_VERSION 6 +#define EI_OSABI 7 +#define EI_ABIVERSION 8 + +#define EV_CURRENT 1 + +#define ELFCLASS64 2 + +#define ELFDATA2LSB 1 + +#define ELFOSABI_SYSV 0 + +#define ET_EXEC 2 + + +#define SHT_NULL 0 +#define SHT_PROGBITS 1 +#define SHT_STRTAB 3 +#define SHT_NOBITS 8 + +#define SHF_WRITE 1 +#define SHF_ALLOC 2 +#define SHF_EXECINSTR 4 + + +#define PT_NULL 0 +#define PT_LOAD 1 +#define PT_PHDR 6 + +#define PF_X 1 +#define PF_W 2 +#define PF_R 4 + +typedef uint64_t Elf64_Addr; +typedef uint64_t Elf64_Off; +typedef uint16_t Elf64_Half; +typedef uint32_t Elf64_Word; +typedef int32_t Elf64_Sword; +typedef uint64_t Elf64_Xword; +typedef int64_t Elf64_Sxword; + +typedef struct { + uint8_t e_ident[16]; + Elf64_Half e_type; + Elf64_Half e_machine; + Elf64_Word e_version; + Elf64_Addr e_entry; + Elf64_Off e_phoff; + Elf64_Off e_shoff; + Elf64_Word e_flags; + Elf64_Half e_ehsize; + Elf64_Half e_phentsize; + Elf64_Half e_phnum; + Elf64_Half e_shentsize; + Elf64_Half e_shnum; + Elf64_Half e_shstrndx; +} Elf64_Ehdr; + +_Static_assert(sizeof(Elf64_Ehdr) == 64, "Bad ELF elf header size"); + +typedef struct { + Elf64_Word sh_name; + Elf64_Word sh_type; + Elf64_Xword sh_flags; + Elf64_Addr sh_addr; + Elf64_Off sh_offset; + Elf64_Xword sh_size; + Elf64_Word sh_link; + Elf64_Word sh_info; + Elf64_Xword sh_addralign; + Elf64_Xword sh_entsize; +} Elf64_Shdr; + +_Static_assert(sizeof(Elf64_Shdr) == 64, "Bad ELF section header size"); + +typedef struct { + Elf64_Word p_type; + Elf64_Word p_flags; + Elf64_Off p_offset; + Elf64_Addr p_vaddr; + Elf64_Addr v_paddr; + Elf64_Xword p_filesz; + Elf64_Xword p_memsz; + Elf64_Xword p_align; +} Elf64_Phdr; + +_Static_assert(sizeof(Elf64_Phdr) == 56, "Bad ELF program header size"); + +static const uint8_t elf_magic[4] = {0x7f, 'E', 'L', 'F'}; + +uint8_t elf_is_elf(struct fs_handle_t* file) { + Elf64_Ehdr header; + + return + fs_seek(file, 0) == FILE_OK && /* file ok seek */ + fs_read(file, &header, sizeof(header)) == sizeof(header) && /* file ok read */ + !kmemcmp(elf_magic, &header.e_ident[EI_MAG0], sizeof(elf_magic)) && /* magic */ + header.e_ident[EI_CLASS] == ELFCLASS64 && /* 64 bit */ + header.e_ident[EI_DATA] == ELFDATA2LSB && /* little endian */ + header.e_ident[EI_OSABI] == ELFOSABI_SYSV && /* sys V */ + header.e_type == ET_EXEC; /* executable */ +} diff --git a/kernel/include/elf/elf.h b/kernel/include/elf/elf.h new file mode 100644 index 0000000..b68b276 --- /dev/null +++ b/kernel/include/elf/elf.h @@ -0,0 +1,28 @@ +/* elf.h - Executable and Linking Format loading interface */ +/* Copyright (C) 2026 Ebrahim Aleem +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see +*/ + +#ifndef KERNEL_ELF_ELF_H +#define KERNEL_ELF_ELF_H + +#include + +#include +#include + +extern uint8_t elf_is_elf(struct fs_handle_t* file); + +#endif /* KERNEL_ELF_ELF_H */ From 100538a7a40aea09f12d783cc73fbbf60b70b7e7 Mon Sep 17 00:00:00 2001 From: Ebrahim Aleem Date: Sat, 11 Apr 2026 21:34:28 -0700 Subject: [PATCH 3/6] refactored driver and kernel organization --- Makefile | 25 +- boot/multiboot2/init.c | 2 +- drivers/Makefile | 15 +- drivers/acpica/Makefile | 57 - drivers/acpica/dsargs.c | 548 --- drivers/acpica/dscontrol.c | 526 -- drivers/acpica/dsdebug.c | 365 -- drivers/acpica/dsfield.c | 1001 ---- drivers/acpica/dsinit.c | 382 -- drivers/acpica/dsmethod.c | 1055 ---- drivers/acpica/dsmthdat.c | 887 ---- drivers/acpica/dsobject.c | 698 --- drivers/acpica/dsopcode.c | 950 ---- drivers/acpica/dspkginit.c | 702 --- drivers/acpica/dsutils.c | 1055 ---- drivers/acpica/dswexec.c | 928 ---- drivers/acpica/dswload.c | 753 --- drivers/acpica/dswload2.c | 908 ---- drivers/acpica/dswscope.c | 341 -- drivers/acpica/dswstate.c | 955 ---- drivers/acpica/evevent.c | 449 -- drivers/acpica/evglock.c | 492 -- drivers/acpica/evgpe.c | 1070 ---- drivers/acpica/evgpeblk.c | 677 --- drivers/acpica/evgpeinit.c | 575 --- drivers/acpica/evgpeutil.c | 506 -- drivers/acpica/evhandler.c | 721 --- drivers/acpica/evmisc.c | 451 -- drivers/acpica/evregion.c | 1084 ---- drivers/acpica/evrgnini.c | 831 ---- drivers/acpica/evsci.c | 391 -- drivers/acpica/evxface.c | 1376 ------ drivers/acpica/evxfevnt.c | 559 --- drivers/acpica/evxfgpe.c | 1355 ----- drivers/acpica/evxfregn.c | 477 -- drivers/acpica/exconcat.c | 570 --- drivers/acpica/exconfig.c | 743 --- drivers/acpica/exconvrt.c | 924 ---- drivers/acpica/excreate.c | 660 --- drivers/acpica/exdebug.c | 461 -- drivers/acpica/exdump.c | 1420 ------ drivers/acpica/exfield.c | 561 --- drivers/acpica/exfldio.c | 1156 ----- drivers/acpica/exmisc.c | 643 --- drivers/acpica/exmutex.c | 693 --- drivers/acpica/exnames.c | 585 --- drivers/acpica/exoparg1.c | 1269 ----- drivers/acpica/exoparg2.c | 750 --- drivers/acpica/exoparg3.c | 409 -- drivers/acpica/exoparg6.c | 465 -- drivers/acpica/exprep.c | 775 --- drivers/acpica/exregion.c | 709 --- drivers/acpica/exresnte.c | 400 -- drivers/acpica/exresolv.c | 701 --- drivers/acpica/exresop.c | 840 ---- drivers/acpica/exserial.c | 531 -- drivers/acpica/exstore.c | 752 --- drivers/acpica/exstoren.c | 412 -- drivers/acpica/exstorob.c | 348 -- drivers/acpica/exsystem.c | 462 -- drivers/acpica/extrace.c | 569 --- drivers/acpica/exutils.c | 615 --- drivers/acpica/hwacpi.c | 329 -- drivers/acpica/hwesleep.c | 376 -- drivers/acpica/hwgpe.c | 797 --- drivers/acpica/hwpci.c | 571 --- drivers/acpica/hwregs.c | 1012 ---- drivers/acpica/hwsleep.c | 482 -- drivers/acpica/hwtimer.c | 348 -- drivers/acpica/hwvalid.c | 472 -- drivers/acpica/hwxface.c | 646 --- drivers/acpica/hwxfsleep.c | 623 --- drivers/acpica/nsaccess.c | 919 ---- drivers/acpica/nsalloc.c | 708 --- drivers/acpica/nsarguments.c | 429 -- drivers/acpica/nsconvert.c | 674 --- drivers/acpica/nsdump.c | 1058 ---- drivers/acpica/nsdumpdv.c | 265 - drivers/acpica/nseval.c | 460 -- drivers/acpica/nsinit.c | 877 ---- drivers/acpica/nsload.c | 466 -- drivers/acpica/nsnames.c | 678 --- drivers/acpica/nsobject.c | 628 --- drivers/acpica/nsparse.c | 439 -- drivers/acpica/nspredef.c | 544 --- drivers/acpica/nsprepkg.c | 900 ---- drivers/acpica/nsrepair.c | 739 --- drivers/acpica/nsrepair2.c | 1190 ----- drivers/acpica/nssearch.c | 561 --- drivers/acpica/nsutils.c | 994 ---- drivers/acpica/nswalk.c | 496 -- drivers/acpica/nsxfeval.c | 1213 ----- drivers/acpica/nsxfname.c | 812 --- drivers/acpica/nsxfobj.c | 389 -- drivers/acpica/psargs.c | 1159 ----- drivers/acpica/psloop.c | 696 --- drivers/acpica/psobject.c | 886 ---- drivers/acpica/psopcode.c | 452 -- drivers/acpica/psopinfo.c | 392 -- drivers/acpica/psparse.c | 843 ---- drivers/acpica/psscope.c | 408 -- drivers/acpica/pstree.c | 471 -- drivers/acpica/psutils.c | 402 -- drivers/acpica/pswalk.c | 254 - drivers/acpica/psxface.c | 518 -- drivers/acpica/rsaddr.c | 519 -- drivers/acpica/rscalc.c | 993 ---- drivers/acpica/rscreate.c | 618 --- drivers/acpica/rsdump.c | 833 ---- drivers/acpica/rsdumpinfo.c | 562 --- drivers/acpica/rsinfo.c | 404 -- drivers/acpica/rsio.c | 408 -- drivers/acpica/rsirq.c | 426 -- drivers/acpica/rslist.c | 396 -- drivers/acpica/rsmemory.c | 355 -- drivers/acpica/rsmisc.c | 943 ---- drivers/acpica/rsserial.c | 1008 ---- drivers/acpica/rsutils.c | 978 ---- drivers/acpica/rsxface.c | 852 ---- drivers/acpica/tbdata.c | 1378 ------ drivers/acpica/tbfadt.c | 893 ---- drivers/acpica/tbfind.c | 268 - drivers/acpica/tbinstal.c | 469 -- drivers/acpica/tbprint.c | 309 -- drivers/acpica/tbutils.c | 621 --- drivers/acpica/tbxface.c | 747 --- drivers/acpica/tbxfload.c | 652 --- drivers/acpica/tbxfroot.c | 445 -- drivers/acpica/utaddress.c | 423 -- drivers/acpica/utalloc.c | 517 -- drivers/acpica/utascii.c | 269 - drivers/acpica/utbuffer.c | 478 -- drivers/acpica/utcache.c | 462 -- drivers/acpica/utcksum.c | 335 -- drivers/acpica/utclib.c | 1168 ----- drivers/acpica/utcopy.c | 1184 ----- drivers/acpica/utdebug.c | 842 ---- drivers/acpica/utdecode.c | 801 --- drivers/acpica/utdelete.c | 934 ---- drivers/acpica/uterror.c | 510 -- drivers/acpica/uteval.c | 487 -- drivers/acpica/utexcep.c | 287 -- drivers/acpica/utglobal.c | 348 -- drivers/acpica/uthex.c | 264 - drivers/acpica/utids.c | 586 --- drivers/acpica/utinit.c | 459 -- drivers/acpica/utlock.c | 310 -- drivers/acpica/utmath.c | 724 --- drivers/acpica/utmisc.c | 573 --- drivers/acpica/utmutex.c | 518 -- drivers/acpica/utnonansi.c | 360 -- drivers/acpica/utobject.c | 892 ---- drivers/acpica/utosi.c | 671 --- drivers/acpica/utownerid.c | 353 -- drivers/acpica/utpredef.c | 558 --- drivers/acpica/utprint.c | 1016 ---- drivers/acpica/utresdecode.c | 483 -- drivers/acpica/utresrc.c | 771 --- drivers/acpica/utstate.c | 462 -- drivers/acpica/utstring.c | 385 -- drivers/acpica/utstrsuppt.c | 663 --- drivers/acpica/utstrtoul64.c | 502 -- drivers/acpica/uttrack.c | 909 ---- drivers/acpica/utuuid.c | 259 - drivers/acpica/utxface.c | 751 --- drivers/acpica/utxferror.c | 462 -- drivers/acpica/utxfinit.c | 430 -- drivers/acpica/utxfmutex.c | 323 -- drivers/acpica_osl/init.c | 59 - drivers/acpica_osl/namespace.c | 284 -- drivers/acpica_osl/osl.c | 386 -- drivers/hpet/hpet_init.c | 3 +- drivers/include/acpica/acapps.h | 343 -- drivers/include/acpica/acbuffer.h | 372 -- drivers/include/acpica/acclib.h | 431 -- drivers/include/acpica/accommon.h | 175 - drivers/include/acpica/acconfig.h | 377 -- drivers/include/acpica/acconvert.h | 311 -- drivers/include/acpica/acdebug.h | 626 --- drivers/include/acpica/acdisasm.h | 1612 ------ drivers/include/acpica/acdispat.h | 599 --- drivers/include/acpica/acevents.h | 507 -- drivers/include/acpica/acexcep.h | 486 -- drivers/include/acpica/acglobal.h | 530 -- drivers/include/acpica/achware.h | 339 -- drivers/include/acpica/acinterp.h | 896 ---- drivers/include/acpica/aclocal.h | 1663 ------- drivers/include/acpica/acmacros.h | 647 --- drivers/include/acpica/acnames.h | 206 - drivers/include/acpica/acnamesp.h | 693 --- drivers/include/acpica/acobject.h | 707 --- drivers/include/acpica/acopcode.h | 441 -- drivers/include/acpica/acoutput.h | 619 --- drivers/include/acpica/acparser.h | 476 -- drivers/include/acpica/acpi.h | 175 - drivers/include/acpica/acpiosxf.h | 705 --- drivers/include/acpica/acpixf.h | 1450 ------ drivers/include/acpica/acpredef.h | 1308 ----- drivers/include/acpica/acresrc.h | 569 --- drivers/include/acpica/acrestyp.h | 957 ---- drivers/include/acpica/acstruct.h | 393 -- drivers/include/acpica/actables.h | 383 -- drivers/include/acpica/actbinfo.h | 570 --- drivers/include/acpica/actbl.h | 579 --- drivers/include/acpica/actbl1.h | 2481 ---------- drivers/include/acpica/actbl2.h | 4351 ----------------- drivers/include/acpica/actbl3.h | 1044 ---- drivers/include/acpica/actypes.h | 1587 ------ drivers/include/acpica/acutils.h | 1305 ----- drivers/include/acpica/acuuid.h | 222 - drivers/include/acpica/amlcode.h | 618 --- drivers/include/acpica/amlresrc.h | 900 ---- drivers/include/acpica/platform/acenv.h | 472 -- drivers/include/acpica/platform/acenvex.h | 190 - drivers/include/acpica/platform/acgcc.h | 235 - drivers/include/acpica/platform/acgccex.h | 166 - drivers/include/acpica/platform/acmodulos.h | 234 - drivers/include/acpica_osl/acpica_include.h | 47 - drivers/include/acpica_osl/osl.h | 21 - drivers/pcie/pcie_init.c | 2 +- kernel/Makefile | 4 + {drivers => kernel}/acpi/sci.S | 0 {drivers => kernel}/acpi/sci_dispatch.c | 2 +- {drivers => kernel}/acpi/tables.c | 20 +- {drivers => kernel}/apic/apic_init.c | 34 +- {drivers => kernel}/apic/apic_regs.c | 0 {drivers => kernel}/apic/ipi.c | 12 +- {drivers => kernel}/apic/isr.S | 0 {drivers => kernel}/apic/isr_dispatch.c | 4 +- kernel/core/cpu_instr.S | 11 +- kernel/{elf => core}/elf.c | 101 +- kernel/core/kentry.c | 19 +- kernel/core/paging.c | 80 +- kernel/core/process.c | 97 +- kernel/core/scheduler.c | 4 +- kernel/{lib/kmemset.S => core/syscall.S} | 19 +- {drivers => kernel}/include/acpi/sci.h | 6 +- .../include/acpi/sci_dispatch.h | 6 +- {drivers => kernel}/include/acpi/tables.h | 6 +- {drivers => kernel}/include/apic/apic_init.h | 6 +- {drivers => kernel}/include/apic/apic_regs.h | 6 +- {drivers => kernel}/include/apic/ipi.h | 6 +- {drivers => kernel}/include/apic/isr.h | 6 +- .../include/apic/isr_dispatch.h | 6 +- kernel/include/core/cpu_instr.h | 4 + kernel/include/{elf => core}/elf.h | 8 +- kernel/include/core/kentry.h | 2 +- kernel/include/core/paging.h | 6 + kernel/include/core/process.h | 10 +- .../{lib/kmemcpy.S => include/core/syscall.h} | 17 +- .../include/ioapic/ioapic_init.h | 6 +- {drivers => kernel}/include/ioapic/routing.h | 6 +- kernel/include/lib/kmemcmp.h | 2 +- {drivers => kernel}/include/pic_8259/isr.h | 6 +- {drivers => kernel}/include/pic_8259/pic.h | 6 +- {drivers => kernel}/ioapic/ioapic_init.c | 12 +- {drivers => kernel}/ioapic/routing.c | 11 +- kernel/lib/kmemcmp.S | 31 - kernel/lib/kmemcmp.c | 42 + .../acpica_osl/init.h => kernel/lib/kmemcpy.c | 27 +- .../namespace.h => kernel/lib/kmemset.c | 23 +- {drivers => kernel}/pic_8259/isr.S | 0 {drivers => kernel}/pic_8259/pic.c | 6 +- 263 files changed, 478 insertions(+), 141926 deletions(-) delete mode 100644 drivers/acpica/Makefile delete mode 100644 drivers/acpica/dsargs.c delete mode 100644 drivers/acpica/dscontrol.c delete mode 100644 drivers/acpica/dsdebug.c delete mode 100644 drivers/acpica/dsfield.c delete mode 100644 drivers/acpica/dsinit.c delete mode 100644 drivers/acpica/dsmethod.c delete mode 100644 drivers/acpica/dsmthdat.c delete mode 100644 drivers/acpica/dsobject.c delete mode 100644 drivers/acpica/dsopcode.c delete mode 100644 drivers/acpica/dspkginit.c delete mode 100644 drivers/acpica/dsutils.c delete mode 100644 drivers/acpica/dswexec.c delete mode 100644 drivers/acpica/dswload.c delete mode 100644 drivers/acpica/dswload2.c delete mode 100644 drivers/acpica/dswscope.c delete mode 100644 drivers/acpica/dswstate.c delete mode 100644 drivers/acpica/evevent.c delete mode 100644 drivers/acpica/evglock.c delete mode 100644 drivers/acpica/evgpe.c delete mode 100644 drivers/acpica/evgpeblk.c delete mode 100644 drivers/acpica/evgpeinit.c delete mode 100644 drivers/acpica/evgpeutil.c delete mode 100644 drivers/acpica/evhandler.c delete mode 100644 drivers/acpica/evmisc.c delete mode 100644 drivers/acpica/evregion.c delete mode 100644 drivers/acpica/evrgnini.c delete mode 100644 drivers/acpica/evsci.c delete mode 100644 drivers/acpica/evxface.c delete mode 100644 drivers/acpica/evxfevnt.c delete mode 100644 drivers/acpica/evxfgpe.c delete mode 100644 drivers/acpica/evxfregn.c delete mode 100644 drivers/acpica/exconcat.c delete mode 100644 drivers/acpica/exconfig.c delete mode 100644 drivers/acpica/exconvrt.c delete mode 100644 drivers/acpica/excreate.c delete mode 100644 drivers/acpica/exdebug.c delete mode 100644 drivers/acpica/exdump.c delete mode 100644 drivers/acpica/exfield.c delete mode 100644 drivers/acpica/exfldio.c delete mode 100644 drivers/acpica/exmisc.c delete mode 100644 drivers/acpica/exmutex.c delete mode 100644 drivers/acpica/exnames.c delete mode 100644 drivers/acpica/exoparg1.c delete mode 100644 drivers/acpica/exoparg2.c delete mode 100644 drivers/acpica/exoparg3.c delete mode 100644 drivers/acpica/exoparg6.c delete mode 100644 drivers/acpica/exprep.c delete mode 100644 drivers/acpica/exregion.c delete mode 100644 drivers/acpica/exresnte.c delete mode 100644 drivers/acpica/exresolv.c delete mode 100644 drivers/acpica/exresop.c delete mode 100644 drivers/acpica/exserial.c delete mode 100644 drivers/acpica/exstore.c delete mode 100644 drivers/acpica/exstoren.c delete mode 100644 drivers/acpica/exstorob.c delete mode 100644 drivers/acpica/exsystem.c delete mode 100644 drivers/acpica/extrace.c delete mode 100644 drivers/acpica/exutils.c delete mode 100644 drivers/acpica/hwacpi.c delete mode 100644 drivers/acpica/hwesleep.c delete mode 100644 drivers/acpica/hwgpe.c delete mode 100644 drivers/acpica/hwpci.c delete mode 100644 drivers/acpica/hwregs.c delete mode 100644 drivers/acpica/hwsleep.c delete mode 100644 drivers/acpica/hwtimer.c delete mode 100644 drivers/acpica/hwvalid.c delete mode 100644 drivers/acpica/hwxface.c delete mode 100644 drivers/acpica/hwxfsleep.c delete mode 100644 drivers/acpica/nsaccess.c delete mode 100644 drivers/acpica/nsalloc.c delete mode 100644 drivers/acpica/nsarguments.c delete mode 100644 drivers/acpica/nsconvert.c delete mode 100644 drivers/acpica/nsdump.c delete mode 100644 drivers/acpica/nsdumpdv.c delete mode 100644 drivers/acpica/nseval.c delete mode 100644 drivers/acpica/nsinit.c delete mode 100644 drivers/acpica/nsload.c delete mode 100644 drivers/acpica/nsnames.c delete mode 100644 drivers/acpica/nsobject.c delete mode 100644 drivers/acpica/nsparse.c delete mode 100644 drivers/acpica/nspredef.c delete mode 100644 drivers/acpica/nsprepkg.c delete mode 100644 drivers/acpica/nsrepair.c delete mode 100644 drivers/acpica/nsrepair2.c delete mode 100644 drivers/acpica/nssearch.c delete mode 100644 drivers/acpica/nsutils.c delete mode 100644 drivers/acpica/nswalk.c delete mode 100644 drivers/acpica/nsxfeval.c delete mode 100644 drivers/acpica/nsxfname.c delete mode 100644 drivers/acpica/nsxfobj.c delete mode 100644 drivers/acpica/psargs.c delete mode 100644 drivers/acpica/psloop.c delete mode 100644 drivers/acpica/psobject.c delete mode 100644 drivers/acpica/psopcode.c delete mode 100644 drivers/acpica/psopinfo.c delete mode 100644 drivers/acpica/psparse.c delete mode 100644 drivers/acpica/psscope.c delete mode 100644 drivers/acpica/pstree.c delete mode 100644 drivers/acpica/psutils.c delete mode 100644 drivers/acpica/pswalk.c delete mode 100644 drivers/acpica/psxface.c delete mode 100644 drivers/acpica/rsaddr.c delete mode 100644 drivers/acpica/rscalc.c delete mode 100644 drivers/acpica/rscreate.c delete mode 100644 drivers/acpica/rsdump.c delete mode 100644 drivers/acpica/rsdumpinfo.c delete mode 100644 drivers/acpica/rsinfo.c delete mode 100644 drivers/acpica/rsio.c delete mode 100644 drivers/acpica/rsirq.c delete mode 100644 drivers/acpica/rslist.c delete mode 100644 drivers/acpica/rsmemory.c delete mode 100644 drivers/acpica/rsmisc.c delete mode 100644 drivers/acpica/rsserial.c delete mode 100644 drivers/acpica/rsutils.c delete mode 100644 drivers/acpica/rsxface.c delete mode 100644 drivers/acpica/tbdata.c delete mode 100644 drivers/acpica/tbfadt.c delete mode 100644 drivers/acpica/tbfind.c delete mode 100644 drivers/acpica/tbinstal.c delete mode 100644 drivers/acpica/tbprint.c delete mode 100644 drivers/acpica/tbutils.c delete mode 100644 drivers/acpica/tbxface.c delete mode 100644 drivers/acpica/tbxfload.c delete mode 100644 drivers/acpica/tbxfroot.c delete mode 100644 drivers/acpica/utaddress.c delete mode 100644 drivers/acpica/utalloc.c delete mode 100644 drivers/acpica/utascii.c delete mode 100644 drivers/acpica/utbuffer.c delete mode 100644 drivers/acpica/utcache.c delete mode 100644 drivers/acpica/utcksum.c delete mode 100644 drivers/acpica/utclib.c delete mode 100644 drivers/acpica/utcopy.c delete mode 100644 drivers/acpica/utdebug.c delete mode 100644 drivers/acpica/utdecode.c delete mode 100644 drivers/acpica/utdelete.c delete mode 100644 drivers/acpica/uterror.c delete mode 100644 drivers/acpica/uteval.c delete mode 100644 drivers/acpica/utexcep.c delete mode 100644 drivers/acpica/utglobal.c delete mode 100644 drivers/acpica/uthex.c delete mode 100644 drivers/acpica/utids.c delete mode 100644 drivers/acpica/utinit.c delete mode 100644 drivers/acpica/utlock.c delete mode 100644 drivers/acpica/utmath.c delete mode 100644 drivers/acpica/utmisc.c delete mode 100644 drivers/acpica/utmutex.c delete mode 100644 drivers/acpica/utnonansi.c delete mode 100644 drivers/acpica/utobject.c delete mode 100644 drivers/acpica/utosi.c delete mode 100644 drivers/acpica/utownerid.c delete mode 100644 drivers/acpica/utpredef.c delete mode 100644 drivers/acpica/utprint.c delete mode 100644 drivers/acpica/utresdecode.c delete mode 100644 drivers/acpica/utresrc.c delete mode 100644 drivers/acpica/utstate.c delete mode 100644 drivers/acpica/utstring.c delete mode 100644 drivers/acpica/utstrsuppt.c delete mode 100644 drivers/acpica/utstrtoul64.c delete mode 100644 drivers/acpica/uttrack.c delete mode 100644 drivers/acpica/utuuid.c delete mode 100644 drivers/acpica/utxface.c delete mode 100644 drivers/acpica/utxferror.c delete mode 100644 drivers/acpica/utxfinit.c delete mode 100644 drivers/acpica/utxfmutex.c delete mode 100644 drivers/acpica_osl/init.c delete mode 100644 drivers/acpica_osl/namespace.c delete mode 100644 drivers/acpica_osl/osl.c delete mode 100644 drivers/include/acpica/acapps.h delete mode 100644 drivers/include/acpica/acbuffer.h delete mode 100644 drivers/include/acpica/acclib.h delete mode 100644 drivers/include/acpica/accommon.h delete mode 100644 drivers/include/acpica/acconfig.h delete mode 100644 drivers/include/acpica/acconvert.h delete mode 100644 drivers/include/acpica/acdebug.h delete mode 100644 drivers/include/acpica/acdisasm.h delete mode 100644 drivers/include/acpica/acdispat.h delete mode 100644 drivers/include/acpica/acevents.h delete mode 100644 drivers/include/acpica/acexcep.h delete mode 100644 drivers/include/acpica/acglobal.h delete mode 100644 drivers/include/acpica/achware.h delete mode 100644 drivers/include/acpica/acinterp.h delete mode 100644 drivers/include/acpica/aclocal.h delete mode 100644 drivers/include/acpica/acmacros.h delete mode 100644 drivers/include/acpica/acnames.h delete mode 100644 drivers/include/acpica/acnamesp.h delete mode 100644 drivers/include/acpica/acobject.h delete mode 100644 drivers/include/acpica/acopcode.h delete mode 100644 drivers/include/acpica/acoutput.h delete mode 100644 drivers/include/acpica/acparser.h delete mode 100644 drivers/include/acpica/acpi.h delete mode 100644 drivers/include/acpica/acpiosxf.h delete mode 100644 drivers/include/acpica/acpixf.h delete mode 100644 drivers/include/acpica/acpredef.h delete mode 100644 drivers/include/acpica/acresrc.h delete mode 100644 drivers/include/acpica/acrestyp.h delete mode 100644 drivers/include/acpica/acstruct.h delete mode 100644 drivers/include/acpica/actables.h delete mode 100644 drivers/include/acpica/actbinfo.h delete mode 100644 drivers/include/acpica/actbl.h delete mode 100644 drivers/include/acpica/actbl1.h delete mode 100644 drivers/include/acpica/actbl2.h delete mode 100644 drivers/include/acpica/actbl3.h delete mode 100644 drivers/include/acpica/actypes.h delete mode 100644 drivers/include/acpica/acutils.h delete mode 100644 drivers/include/acpica/acuuid.h delete mode 100644 drivers/include/acpica/amlcode.h delete mode 100644 drivers/include/acpica/amlresrc.h delete mode 100644 drivers/include/acpica/platform/acenv.h delete mode 100644 drivers/include/acpica/platform/acenvex.h delete mode 100644 drivers/include/acpica/platform/acgcc.h delete mode 100644 drivers/include/acpica/platform/acgccex.h delete mode 100644 drivers/include/acpica/platform/acmodulos.h delete mode 100644 drivers/include/acpica_osl/acpica_include.h delete mode 100644 drivers/include/acpica_osl/osl.h rename {drivers => kernel}/acpi/sci.S (100%) rename {drivers => kernel}/acpi/sci_dispatch.c (96%) rename {drivers => kernel}/acpi/tables.c (97%) rename {drivers => kernel}/apic/apic_init.c (95%) rename {drivers => kernel}/apic/apic_regs.c (100%) rename {drivers => kernel}/apic/ipi.c (95%) rename {drivers => kernel}/apic/isr.S (100%) rename {drivers => kernel}/apic/isr_dispatch.c (96%) rename kernel/{elf => core}/elf.c (55%) rename kernel/{lib/kmemset.S => core/syscall.S} (77%) rename {drivers => kernel}/include/acpi/sci.h (89%) rename {drivers => kernel}/include/acpi/sci_dispatch.h (87%) rename {drivers => kernel}/include/acpi/tables.h (97%) rename {drivers => kernel}/include/apic/apic_init.h (90%) rename {drivers => kernel}/include/apic/apic_regs.h (95%) rename {drivers => kernel}/include/apic/ipi.h (93%) rename {drivers => kernel}/include/apic/isr.h (90%) rename {drivers => kernel}/include/apic/isr_dispatch.h (87%) rename kernel/include/{elf => core}/elf.h (84%) rename kernel/{lib/kmemcpy.S => include/core/syscall.h} (70%) rename {drivers => kernel}/include/ioapic/ioapic_init.h (90%) rename {drivers => kernel}/include/ioapic/routing.h (89%) rename {drivers => kernel}/include/pic_8259/isr.h (89%) rename {drivers => kernel}/include/pic_8259/pic.h (88%) rename {drivers => kernel}/ioapic/ioapic_init.c (95%) rename {drivers => kernel}/ioapic/routing.c (97%) delete mode 100644 kernel/lib/kmemcmp.S create mode 100644 kernel/lib/kmemcmp.c rename drivers/include/acpica_osl/init.h => kernel/lib/kmemcpy.c (56%) rename drivers/include/acpica_osl/namespace.h => kernel/lib/kmemset.c (59%) rename {drivers => kernel}/pic_8259/isr.S (100%) rename {drivers => kernel}/pic_8259/pic.c (95%) diff --git a/Makefile b/Makefile index 8336179..47577aa 100644 --- a/Makefile +++ b/Makefile @@ -17,11 +17,9 @@ # Debug options -#export DEBUG = 1 +export DEBUG = 1 export DEBUG_LOGGING = 1 -export SUPPRESS_ACPICA_BUILD_OUTPUT = 1 - # Global options # Optional boot modules @@ -65,17 +63,21 @@ BOOT_TARGETS := \ $(OBJ_DIR)/boot.a \ $(OBJ_DIR)/esp.img DRIVERS_TARGETS := \ - $(OBJ_DIR)/drivers.a \ - $(OBJ_DIR)/acpica.a + $(OBJ_DIR)/drivers.a TEST_TARGETS := \ $(OBJ_DIR)/test_lib.a \ $(OBJ_DIR)/test_testsuite.a +export RUNTIME_DRIVERS_TARGETS := \ + $(OBJ_DIR)/drivers/driver_list.txt + TEST_CANIDATES := $(patsubst $(OBJ_DIR)/test_%.a,test-%,$(TEST_TARGETS)) TEST_EXEC := $(basename $(TEST_TARGETS)) COPY_DOC_TO := $(OBJ_DIR)/rootfs/usr/share/doc/ModulOS/ +COPY_DRIVERS_TO := $(OBJ_DIR)/rootfs/lib/drivers/ + SRC := $(shell find . -type f \( -name "*.c" -o -name "*.S" -o -name "*.h" \)) include $(SRC_TREE_ROOT)/scripts/Makefile.kcflags @@ -115,6 +117,7 @@ cscope.files: $(SRC) $(KERNEL_TARGETS): kernel $(BOOT_TARGETS): boot $(DRIVERS_TARGETS): drivers +$(RUNTIME_DRIVERS_TARGETS): drivers $(TEST_TARGETS): test @@ -123,7 +126,12 @@ $(TEST_EXEC): %: %.a $(OBJ_DIR)/boot.a $(OBJ_DIR)/kernel.a $(OBJ_DIR)/drivers.a .PHONY: copy-doc copy-doc: COPYING LICENSES | $(COPY_DOC_TO) - cp -r COPYING LICENSES $(COPY_DOC_TO) + cp -r $^ $| + +.PHONY: copy-runtime-drivers +copy-runtime-drivers: $(RUNTIME_DRIVERS_TARGETS) | $(COPY_DRIVERS_TO) + cp -r $^ $| + $(OBJ_DIR)/stub.img: | $(OBJ_DIR)/ truncate -s 4G $@ @@ -139,7 +147,7 @@ $(OBJ_DIR)/stub-esp.dummy: $(OBJ_DIR)/stub.img $(OBJ_DIR)/modulos $(OBJ_DIR)/esp # 54525952 is for 52MiB offset (512 * 1024 * 1024) # 1034240 is for 52MiB initial (4MiB align + 48MiB ESP) and 4MiB tail for gpt -$(OBJ_DIR)/stub-fs.dummy: $(OBJ_DIR)/stub.img copy-doc +$(OBJ_DIR)/stub-fs.dummy: $(OBJ_DIR)/stub.img copy-runtime-drivers copy-doc yes | mke2fs -L rootfs -E offset=54525952 -d $(OBJ_DIR)/rootfs/ -t ext2 \ -b 4096 $< 1034240 touch $@ @@ -159,6 +167,5 @@ $(OBJ_DIR)/modulos: $(OBJ_DIR)/modulos-dbg $(OBJ_DIR)/modulos-dbg: $(OBJ_DIR)/modulos.ld \ $(OBJ_DIR)/boot.a \ $(OBJ_DIR)/kernel.a \ - $(OBJ_DIR)/drivers.a \ - $(OBJ_DIR)/acpica.a + $(OBJ_DIR)/drivers.a $(CC) -o $@ $(LTO) $(LD_FLAGS) -fuse-ld=lld -T $^ diff --git a/boot/multiboot2/init.c b/boot/multiboot2/init.c index fc1f7b6..2a762bf 100644 --- a/boot/multiboot2/init.c +++ b/boot/multiboot2/init.c @@ -26,7 +26,7 @@ #include #include -#include +#include #ifdef SERIAL #include diff --git a/drivers/Makefile b/drivers/Makefile index 8b886e4..cb0851d 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -19,11 +19,6 @@ include $(SRC_TREE_ROOT)/scripts/Makefile.header export OBJ_DIR := $(OBJ_DIR)/drivers -$(call add_directory,pic_8259,PIC_8259) -$(call add_directory,apic,APIC) -$(call add_directory,ioapic,IOAPIC) -$(call add_directory,acpi,ACPI) -$(call add_directory,acpica_osl,ACPICA_OSL) $(call add_directory,pcie,PCIE) $(call add_directory,disk,DISK) @@ -58,12 +53,12 @@ include $(SRC_TREE_ROOT)/scripts/Makefile.targets all: build .PHONY: build -build: $(OBJ_DIR)/../drivers.a $(OBJ_DIR)/../acpica.a $(LDS) - -.PHONY: $(OBJ_DIR)/acpica.a -$(OBJ_DIR)/acpica.a: - $(MAKE) -C acpica/ build +build: $(OBJ_DIR)/../drivers.a $(LDS) \ + $(OBJ_DIR)/driver_list.txt $(OBJ_DIR)/drivers.a: $(TARGETS) | $(BUILD_DIRS) rm -f $@ $(AR) rcs $@ $(TARGETS) + +$(OBJ_DIR)/driver_list.txt: + echo drivers > $@ diff --git a/drivers/acpica/Makefile b/drivers/acpica/Makefile deleted file mode 100644 index 144968c..0000000 --- a/drivers/acpica/Makefile +++ /dev/null @@ -1,57 +0,0 @@ -# Makefile - acpica build makefile -# Copyright (C) 2025-2026 Ebrahim Aleem -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see - -SRC_TREE_ROOT := ../$(SRC_TREE_ROOT) -include $(SRC_TREE_ROOT)/scripts/Makefile.header - -OBJ_DIR := $(OBJ_DIR)/acpica - -include $(SRC_TREE_ROOT)/scripts/Makefile.kcflags - -SRC_DIRS := . - -DEP_DIR := $(OBJ_DIR)/deps - -SRC := $(shell find $(SRC_DIRS) -type f \( -name "*.c" -o -name "*.S" \)) - -SRC := $(filter-out %/rsdump.c,$(SRC)) - -TARGETS_C := $(filter %.o, $(patsubst %.c,$(OBJ_DIR)/%.o,$(SRC))) -TARGETS := $(TARGETS_C) - - -%/: - -mkdir -p $@ - -.PHONY: all -all: build - -.PHONY: build -build: $(OBJ_DIR)/../acpica.a - -$(OBJ_DIR)/../acpica.a: $(OBJ_DIR)/acpica.a - ln $< $@ - -$(TARGETS): $(OBJ_DIR)/%.o: %.c | $(OBJ_DIR)/ -ifdef SUPPRESS_ACPICA_BUILD_OUTPUT - $(CC) $(CFLAGS) -I $(SRC_TREE_ROOT)/include/drivers/acpica/ -Wno-error -o $@ $< 2> /dev/null -else - $(CC) $(CFLAGS) -I $(SRC_TREE_ROOT)/include/drivers/acpica/ -Wno-error -o $@ $< -endif - -$(OBJ_DIR)/acpica.a: $(TARGETS) - rm -f $@ - $(AR) rcs $@ $^ diff --git a/drivers/acpica/dsargs.c b/drivers/acpica/dsargs.c deleted file mode 100644 index 7fe605f..0000000 --- a/drivers/acpica/dsargs.c +++ /dev/null @@ -1,548 +0,0 @@ -/****************************************************************************** - * - * Module Name: dsargs - Support for execution of dynamic arguments for static - * objects (regions, fields, buffer fields, etc.) - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acparser.h" -#include "amlcode.h" -#include "acdispat.h" -#include "acnamesp.h" - -#define _COMPONENT ACPI_DISPATCHER - ACPI_MODULE_NAME ("dsargs") - -/* Local prototypes */ - -static ACPI_STATUS -AcpiDsExecuteArguments ( - ACPI_NAMESPACE_NODE *Node, - ACPI_NAMESPACE_NODE *ScopeNode, - UINT32 AmlLength, - UINT8 *AmlStart); - - -/******************************************************************************* - * - * FUNCTION: AcpiDsExecuteArguments - * - * PARAMETERS: Node - Object NS node - * ScopeNode - Parent NS node - * AmlLength - Length of executable AML - * AmlStart - Pointer to the AML - * - * RETURN: Status. - * - * DESCRIPTION: Late (deferred) execution of region or field arguments - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDsExecuteArguments ( - ACPI_NAMESPACE_NODE *Node, - ACPI_NAMESPACE_NODE *ScopeNode, - UINT32 AmlLength, - UINT8 *AmlStart) -{ - ACPI_STATUS Status; - ACPI_PARSE_OBJECT *Op; - ACPI_WALK_STATE *WalkState; - - - ACPI_FUNCTION_TRACE_PTR (DsExecuteArguments, AmlStart); - - - /* Allocate a new parser op to be the root of the parsed tree */ - - Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP, AmlStart); - if (!Op) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Save the Node for use in AcpiPsParseAml */ - - Op->Common.Node = ScopeNode; - - /* Create and initialize a new parser state */ - - WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL); - if (!WalkState) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart, - AmlLength, NULL, ACPI_IMODE_LOAD_PASS1); - if (ACPI_FAILURE (Status)) - { - AcpiDsDeleteWalkState (WalkState); - goto Cleanup; - } - - /* Mark this parse as a deferred opcode */ - - WalkState->ParseFlags = ACPI_PARSE_DEFERRED_OP; - WalkState->DeferredNode = Node; - - /* Pass1: Parse the entire declaration */ - - Status = AcpiPsParseAml (WalkState); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - /* Get and init the Op created above */ - - Op->Common.Node = Node; - AcpiPsDeleteParseTree (Op); - - /* Evaluate the deferred arguments */ - - Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP, AmlStart); - if (!Op) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - Op->Common.Node = ScopeNode; - - /* Create and initialize a new parser state */ - - WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL); - if (!WalkState) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - /* Execute the opcode and arguments */ - - Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart, - AmlLength, NULL, ACPI_IMODE_EXECUTE); - if (ACPI_FAILURE (Status)) - { - AcpiDsDeleteWalkState (WalkState); - goto Cleanup; - } - - /* Mark this execution as a deferred opcode */ - - WalkState->DeferredNode = Node; - Status = AcpiPsParseAml (WalkState); - -Cleanup: - AcpiPsDeleteParseTree (Op); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsGetBufferFieldArguments - * - * PARAMETERS: ObjDesc - A valid BufferField object - * - * RETURN: Status. - * - * DESCRIPTION: Get BufferField Buffer and Index. This implements the late - * evaluation of these field attributes. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsGetBufferFieldArguments ( - ACPI_OPERAND_OBJECT *ObjDesc) -{ - ACPI_OPERAND_OBJECT *ExtraDesc; - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE_PTR (DsGetBufferFieldArguments, ObjDesc); - - - if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) - { - return_ACPI_STATUS (AE_OK); - } - - /* Get the AML pointer (method object) and BufferField node */ - - ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc); - Node = ObjDesc->BufferField.Node; - - ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname ( - ACPI_TYPE_BUFFER_FIELD, Node, NULL)); - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BufferField Arg Init\n", - AcpiUtGetNodeName (Node))); - - /* Execute the AML code for the TermArg arguments */ - - Status = AcpiDsExecuteArguments (Node, Node->Parent, - ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsGetBankFieldArguments - * - * PARAMETERS: ObjDesc - A valid BankField object - * - * RETURN: Status. - * - * DESCRIPTION: Get BankField BankValue. This implements the late - * evaluation of these field attributes. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsGetBankFieldArguments ( - ACPI_OPERAND_OBJECT *ObjDesc) -{ - ACPI_OPERAND_OBJECT *ExtraDesc; - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE_PTR (DsGetBankFieldArguments, ObjDesc); - - - if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) - { - return_ACPI_STATUS (AE_OK); - } - - /* Get the AML pointer (method object) and BankField node */ - - ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc); - Node = ObjDesc->BankField.Node; - - ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname ( - ACPI_TYPE_LOCAL_BANK_FIELD, Node, NULL)); - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BankField Arg Init\n", - AcpiUtGetNodeName (Node))); - - /* Execute the AML code for the TermArg arguments */ - - Status = AcpiDsExecuteArguments (Node, Node->Parent, - ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsGetBufferArguments - * - * PARAMETERS: ObjDesc - A valid Buffer object - * - * RETURN: Status. - * - * DESCRIPTION: Get Buffer length and initializer byte list. This implements - * the late evaluation of these attributes. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsGetBufferArguments ( - ACPI_OPERAND_OBJECT *ObjDesc) -{ - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE_PTR (DsGetBufferArguments, ObjDesc); - - - if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) - { - return_ACPI_STATUS (AE_OK); - } - - /* Get the Buffer node */ - - Node = ObjDesc->Buffer.Node; - if (!Node) - { - ACPI_ERROR ((AE_INFO, - "No pointer back to namespace node in buffer object %p", - ObjDesc)); - return_ACPI_STATUS (AE_AML_INTERNAL); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Buffer Arg Init\n")); - - /* Execute the AML code for the TermArg arguments */ - - Status = AcpiDsExecuteArguments (Node, Node, - ObjDesc->Buffer.AmlLength, ObjDesc->Buffer.AmlStart); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsGetPackageArguments - * - * PARAMETERS: ObjDesc - A valid Package object - * - * RETURN: Status. - * - * DESCRIPTION: Get Package length and initializer byte list. This implements - * the late evaluation of these attributes. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsGetPackageArguments ( - ACPI_OPERAND_OBJECT *ObjDesc) -{ - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE_PTR (DsGetPackageArguments, ObjDesc); - - - if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) - { - return_ACPI_STATUS (AE_OK); - } - - /* Get the Package node */ - - Node = ObjDesc->Package.Node; - if (!Node) - { - ACPI_ERROR ((AE_INFO, - "No pointer back to namespace node in package %p", ObjDesc)); - return_ACPI_STATUS (AE_AML_INTERNAL); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Package Argument Init, AML Ptr: %p\n", - ObjDesc->Package.AmlStart)); - - /* Execute the AML code for the TermArg arguments */ - - Status = AcpiDsExecuteArguments (Node, Node, - ObjDesc->Package.AmlLength, ObjDesc->Package.AmlStart); - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsGetRegionArguments - * - * PARAMETERS: ObjDesc - A valid region object - * - * RETURN: Status. - * - * DESCRIPTION: Get region address and length. This implements the late - * evaluation of these region attributes. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsGetRegionArguments ( - ACPI_OPERAND_OBJECT *ObjDesc) -{ - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - ACPI_OPERAND_OBJECT *ExtraDesc; - - - ACPI_FUNCTION_TRACE_PTR (DsGetRegionArguments, ObjDesc); - - - if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID) - { - return_ACPI_STATUS (AE_OK); - } - - ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc); - if (!ExtraDesc) - { - return_ACPI_STATUS (AE_NOT_EXIST); - } - - /* Get the Region node */ - - Node = ObjDesc->Region.Node; - - ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname ( - ACPI_TYPE_REGION, Node, NULL)); - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "[%4.4s] OpRegion Arg Init at AML %p\n", - AcpiUtGetNodeName (Node), ExtraDesc->Extra.AmlStart)); - - /* Execute the argument AML */ - - Status = AcpiDsExecuteArguments (Node, ExtraDesc->Extra.ScopeNode, - ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Status = AcpiUtAddAddressRange (ObjDesc->Region.SpaceId, - ObjDesc->Region.Address, ObjDesc->Region.Length, Node); - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/dscontrol.c b/drivers/acpica/dscontrol.c deleted file mode 100644 index 3eaa6f3..0000000 --- a/drivers/acpica/dscontrol.c +++ /dev/null @@ -1,526 +0,0 @@ -/****************************************************************************** - * - * Module Name: dscontrol - Support for execution control opcodes - - * if/else/while/return - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "amlcode.h" -#include "acdispat.h" -#include "acinterp.h" -#include "acdebug.h" - -#define _COMPONENT ACPI_DISPATCHER - ACPI_MODULE_NAME ("dscontrol") - - -/******************************************************************************* - * - * FUNCTION: AcpiDsExecBeginControlOp - * - * PARAMETERS: WalkList - The list that owns the walk stack - * Op - The control Op - * - * RETURN: Status - * - * DESCRIPTION: Handles all control ops encountered during control method - * execution. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsExecBeginControlOp ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op) -{ - ACPI_STATUS Status = AE_OK; - ACPI_GENERIC_STATE *ControlState; - - - ACPI_FUNCTION_NAME (DsExecBeginControlOp); - - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", - Op, Op->Common.AmlOpcode, WalkState)); - - switch (Op->Common.AmlOpcode) - { - case AML_WHILE_OP: - /* - * If this is an additional iteration of a while loop, continue. - * There is no need to allocate a new control state. - */ - if (WalkState->ControlState) - { - if (WalkState->ControlState->Control.AmlPredicateStart == - (WalkState->ParserState.Aml - 1)) - { - /* Reset the state to start-of-loop */ - - WalkState->ControlState->Common.State = - ACPI_CONTROL_CONDITIONAL_EXECUTING; - break; - } - } - - ACPI_FALLTHROUGH; - - case AML_IF_OP: - /* - * IF/WHILE: Create a new control state to manage these - * constructs. We need to manage these as a stack, in order - * to handle nesting. - */ - ControlState = AcpiUtCreateControlState (); - if (!ControlState) - { - Status = AE_NO_MEMORY; - break; - } - /* - * Save a pointer to the predicate for multiple executions - * of a loop - */ - ControlState->Control.AmlPredicateStart = - WalkState->ParserState.Aml - 1; - ControlState->Control.PackageEnd = - WalkState->ParserState.PkgEnd; - ControlState->Control.Opcode = - Op->Common.AmlOpcode; - ControlState->Control.LoopTimeout = AcpiOsGetTimer () + - ((UINT64) AcpiGbl_MaxLoopIterations * ACPI_100NSEC_PER_SEC); - - /* Push the control state on this walk's control stack */ - - AcpiUtPushGenericState (&WalkState->ControlState, ControlState); - break; - - case AML_ELSE_OP: - - /* Predicate is in the state object */ - /* If predicate is true, the IF was executed, ignore ELSE part */ - - if (WalkState->LastPredicate) - { - Status = AE_CTRL_TRUE; - } - - break; - - case AML_RETURN_OP: - - break; - - default: - - break; - } - - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsExecEndControlOp - * - * PARAMETERS: WalkList - The list that owns the walk stack - * Op - The control Op - * - * RETURN: Status - * - * DESCRIPTION: Handles all control ops encountered during control method - * execution. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsExecEndControlOp ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op) -{ - ACPI_STATUS Status = AE_OK; - ACPI_GENERIC_STATE *ControlState; - - - ACPI_FUNCTION_NAME (DsExecEndControlOp); - - - switch (Op->Common.AmlOpcode) - { - case AML_IF_OP: - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[IF_OP] Op=%p\n", Op)); - - /* - * Save the result of the predicate in case there is an - * ELSE to come - */ - WalkState->LastPredicate = - (BOOLEAN) WalkState->ControlState->Common.Value; - - /* - * Pop the control state that was created at the start - * of the IF and free it - */ - ControlState = AcpiUtPopGenericState (&WalkState->ControlState); - AcpiUtDeleteGenericState (ControlState); - break; - - case AML_ELSE_OP: - - break; - - case AML_WHILE_OP: - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", Op)); - - ControlState = WalkState->ControlState; - if (ControlState->Common.Value) - { - /* Predicate was true, the body of the loop was just executed */ - - /* - * This infinite loop detection mechanism allows the interpreter - * to escape possibly infinite loops. This can occur in poorly - * written AML when the hardware does not respond within a while - * loop and the loop does not implement a timeout. - */ - if (ACPI_TIME_AFTER (AcpiOsGetTimer (), - ControlState->Control.LoopTimeout)) - { - Status = AE_AML_LOOP_TIMEOUT; - break; - } - - /* - * Go back and evaluate the predicate and maybe execute the loop - * another time - */ - Status = AE_CTRL_PENDING; - WalkState->AmlLastWhile = - ControlState->Control.AmlPredicateStart; - break; - } - - /* Predicate was false, terminate this while loop */ - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "[WHILE_OP] termination! Op=%p\n",Op)); - - /* Pop this control state and free it */ - - ControlState = AcpiUtPopGenericState (&WalkState->ControlState); - AcpiUtDeleteGenericState (ControlState); - break; - - case AML_RETURN_OP: - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "[RETURN_OP] Op=%p Arg=%p\n",Op, Op->Common.Value.Arg)); - - /* - * One optional operand -- the return value - * It can be either an immediate operand or a result that - * has been bubbled up the tree - */ - if (Op->Common.Value.Arg) - { - /* Since we have a real Return(), delete any implicit return */ - - AcpiDsClearImplicitReturn (WalkState); - - /* Return statement has an immediate operand */ - - Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* - * If value being returned is a Reference (such as - * an arg or local), resolve it now because it may - * cease to exist at the end of the method. - */ - Status = AcpiExResolveToValue ( - &WalkState->Operands [0], WalkState); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* - * Get the return value and save as the last result - * value. This is the only place where WalkState->ReturnDesc - * is set to anything other than zero! - */ - WalkState->ReturnDesc = WalkState->Operands[0]; - } - else if (WalkState->ResultCount) - { - /* Since we have a real Return(), delete any implicit return */ - - AcpiDsClearImplicitReturn (WalkState); - - /* - * The return value has come from a previous calculation. - * - * If value being returned is a Reference (such as - * an arg or local), resolve it now because it may - * cease to exist at the end of the method. - * - * Allow references created by the Index operator to return - * unchanged. - */ - if ((ACPI_GET_DESCRIPTOR_TYPE (WalkState->Results->Results.ObjDesc[0]) == - ACPI_DESC_TYPE_OPERAND) && - ((WalkState->Results->Results.ObjDesc [0])->Common.Type == - ACPI_TYPE_LOCAL_REFERENCE) && - ((WalkState->Results->Results.ObjDesc [0])->Reference.Class != - ACPI_REFCLASS_INDEX)) - { - Status = AcpiExResolveToValue ( - &WalkState->Results->Results.ObjDesc [0], WalkState); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - - WalkState->ReturnDesc = WalkState->Results->Results.ObjDesc [0]; - } - else - { - /* No return operand */ - - if (WalkState->NumOperands) - { - AcpiUtRemoveReference (WalkState->Operands [0]); - } - - WalkState->Operands[0] = NULL; - WalkState->NumOperands = 0; - WalkState->ReturnDesc = NULL; - } - - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Completed RETURN_OP State=%p, RetVal=%p\n", - WalkState, WalkState->ReturnDesc)); - - /* End the control method execution right now */ - - Status = AE_CTRL_TERMINATE; - break; - - case AML_NOOP_OP: - - /* Just do nothing! */ - - break; - - case AML_BREAKPOINT_OP: - - AcpiDbSignalBreakPoint (WalkState); - - /* Call to the OSL in case OS wants a piece of the action */ - - Status = AcpiOsSignal (ACPI_SIGNAL_BREAKPOINT, - "Executed AML Breakpoint opcode"); - break; - - case AML_BREAK_OP: - case AML_CONTINUE_OP: /* ACPI 2.0 */ - - /* Pop and delete control states until we find a while */ - - while (WalkState->ControlState && - (WalkState->ControlState->Control.Opcode != AML_WHILE_OP)) - { - ControlState = AcpiUtPopGenericState (&WalkState->ControlState); - AcpiUtDeleteGenericState (ControlState); - } - - /* No while found? */ - - if (!WalkState->ControlState) - { - return (AE_AML_NO_WHILE); - } - - /* Was: WalkState->AmlLastWhile = WalkState->ControlState->Control.AmlPredicateStart; */ - - WalkState->AmlLastWhile = - WalkState->ControlState->Control.PackageEnd; - - /* Return status depending on opcode */ - - if (Op->Common.AmlOpcode == AML_BREAK_OP) - { - Status = AE_CTRL_BREAK; - } - else - { - Status = AE_CTRL_CONTINUE; - } - break; - - default: - - ACPI_ERROR ((AE_INFO, "Unknown control opcode=0x%X Op=%p", - Op->Common.AmlOpcode, Op)); - - Status = AE_AML_BAD_OPCODE; - break; - } - - return (Status); -} diff --git a/drivers/acpica/dsdebug.c b/drivers/acpica/dsdebug.c deleted file mode 100644 index 2bc7dc0..0000000 --- a/drivers/acpica/dsdebug.c +++ /dev/null @@ -1,365 +0,0 @@ -/****************************************************************************** - * - * Module Name: dsdebug - Parser/Interpreter interface - debugging - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acdispat.h" -#include "acnamesp.h" -#include "acdisasm.h" -#include "acinterp.h" - - -#define _COMPONENT ACPI_DISPATCHER - ACPI_MODULE_NAME ("dsdebug") - - -#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) - -/* Local prototypes */ - -static void -AcpiDsPrintNodePathname ( - ACPI_NAMESPACE_NODE *Node, - const char *Message); - - -/******************************************************************************* - * - * FUNCTION: AcpiDsPrintNodePathname - * - * PARAMETERS: Node - Object - * Message - Prefix message - * - * DESCRIPTION: Print an object's full namespace pathname - * Manages allocation/freeing of a pathname buffer - * - ******************************************************************************/ - -static void -AcpiDsPrintNodePathname ( - ACPI_NAMESPACE_NODE *Node, - const char *Message) -{ - ACPI_BUFFER Buffer; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (DsPrintNodePathname); - - if (!Node) - { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "[NULL NAME]")); - return_VOID; - } - - /* Convert handle to full pathname and print it (with supplied message) */ - - Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - - Status = AcpiNsHandleToPathname (Node, &Buffer, TRUE); - if (ACPI_SUCCESS (Status)) - { - if (Message) - { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "%s ", Message)); - } - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "[%s] (Node %p)", - (char *) Buffer.Pointer, Node)); - ACPI_FREE (Buffer.Pointer); - } - - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsDumpMethodStack - * - * PARAMETERS: Status - Method execution status - * WalkState - Current state of the parse tree walk - * Op - Executing parse op - * - * RETURN: None - * - * DESCRIPTION: Called when a method has been aborted because of an error. - * Dumps the method execution stack. - * - ******************************************************************************/ - -void -AcpiDsDumpMethodStack ( - ACPI_STATUS Status, - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Next; - ACPI_THREAD_STATE *Thread; - ACPI_WALK_STATE *NextWalkState; - ACPI_NAMESPACE_NODE *PreviousMethod = NULL; - ACPI_OPERAND_OBJECT *MethodDesc; - - - ACPI_FUNCTION_TRACE (DsDumpMethodStack); - - - /* Ignore control codes, they are not errors */ - - if (ACPI_CNTL_EXCEPTION (Status)) - { - return_VOID; - } - - /* We may be executing a deferred opcode */ - - if (WalkState->DeferredNode) - { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Executing subtree for Buffer/Package/Region\n")); - return_VOID; - } - - /* - * If there is no Thread, we are not actually executing a method. - * This can happen when the iASL compiler calls the interpreter - * to perform constant folding. - */ - Thread = WalkState->Thread; - if (!Thread) - { - return_VOID; - } - - /* Display exception and method name */ - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "\n**** Exception %s during execution of method ", - AcpiFormatException (Status))); - - AcpiDsPrintNodePathname (WalkState->MethodNode, NULL); - - /* Display stack of executing methods */ - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, - "\n\nMethod Execution Stack:\n")); - NextWalkState = Thread->WalkStateList; - - /* Walk list of linked walk states */ - - while (NextWalkState) - { - MethodDesc = NextWalkState->MethodDesc; - if (MethodDesc) - { - AcpiExStopTraceMethod ( - (ACPI_NAMESPACE_NODE *) MethodDesc->Method.Node, - MethodDesc, WalkState); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - " Method [%4.4s] executing: ", - AcpiUtGetNodeName (NextWalkState->MethodNode))); - - /* First method is the currently executing method */ - - if (NextWalkState == WalkState) - { - if (Op) - { - /* Display currently executing ASL statement */ - - Next = Op->Common.Next; - Op->Common.Next = NULL; - -#ifdef ACPI_DISASSEMBLER - if (WalkState->MethodNode != AcpiGbl_RootNode) - { - /* More verbose if not module-level code */ - - AcpiOsPrintf ("Failed at "); - AcpiDmDisassemble (NextWalkState, Op, ACPI_UINT32_MAX); - } -#endif - Op->Common.Next = Next; - } - } - else - { - /* - * This method has called another method - * NOTE: the method call parse subtree is already deleted at - * this point, so we cannot disassemble the method invocation. - */ - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "Call to method ")); - AcpiDsPrintNodePathname (PreviousMethod, NULL); - } - - PreviousMethod = NextWalkState->MethodNode; - NextWalkState = NextWalkState->Next; - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "\n")); - } - - return_VOID; -} - -#else - -void -AcpiDsDumpMethodStack ( - ACPI_STATUS Status, - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op) -{ - return; -} - -#endif diff --git a/drivers/acpica/dsfield.c b/drivers/acpica/dsfield.c deleted file mode 100644 index 15e35fd..0000000 --- a/drivers/acpica/dsfield.c +++ /dev/null @@ -1,1001 +0,0 @@ -/****************************************************************************** - * - * Module Name: dsfield - Dispatcher field routines - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "amlcode.h" -#include "acdispat.h" -#include "acinterp.h" -#include "acnamesp.h" -#include "acparser.h" - -#ifdef ACPI_EXEC_APP -#include "aecommon.h" -#endif - - -#define _COMPONENT ACPI_DISPATCHER - ACPI_MODULE_NAME ("dsfield") - -/* Local prototypes */ - -#ifdef ACPI_ASL_COMPILER -#include "acdisasm.h" - -static ACPI_STATUS -AcpiDsCreateExternalRegion ( - ACPI_STATUS LookupStatus, - ACPI_PARSE_OBJECT *Op, - char *Path, - ACPI_WALK_STATE *WalkState, - ACPI_NAMESPACE_NODE **Node); -#endif - -static ACPI_STATUS -AcpiDsGetFieldNames ( - ACPI_CREATE_FIELD_INFO *Info, - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Arg); - - -#ifdef ACPI_ASL_COMPILER -/******************************************************************************* - * - * FUNCTION: AcpiDsCreateExternalRegion (iASL Disassembler only) - * - * PARAMETERS: LookupStatus - Status from NsLookup operation - * Op - Op containing the Field definition and args - * Path - Pathname of the region - * ` WalkState - Current method state - * Node - Where the new region node is returned - * - * RETURN: Status - * - * DESCRIPTION: Add region to the external list if NOT_FOUND. Create a new - * region node/object. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDsCreateExternalRegion ( - ACPI_STATUS LookupStatus, - ACPI_PARSE_OBJECT *Op, - char *Path, - ACPI_WALK_STATE *WalkState, - ACPI_NAMESPACE_NODE **Node) -{ - ACPI_STATUS Status; - ACPI_OPERAND_OBJECT *ObjDesc; - - - if (LookupStatus != AE_NOT_FOUND) - { - return (LookupStatus); - } - - /* - * Table disassembly: - * OperationRegion not found. Generate an External for it, and - * insert the name into the namespace. - */ - AcpiDmAddOpToExternalList (Op, Path, ACPI_TYPE_REGION, 0, 0); - - Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_REGION, - ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT, WalkState, Node); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Must create and install a region object for the new node */ - - ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_REGION); - if (!ObjDesc) - { - return (AE_NO_MEMORY); - } - - ObjDesc->Region.Node = *Node; - Status = AcpiNsAttachObject (*Node, ObjDesc, ACPI_TYPE_REGION); - return (Status); -} -#endif - - -/******************************************************************************* - * - * FUNCTION: AcpiDsCreateBufferField - * - * PARAMETERS: Op - Current parse op (CreateXXField) - * WalkState - Current state - * - * RETURN: Status - * - * DESCRIPTION: Execute the CreateField operators: - * CreateBitFieldOp, - * CreateByteFieldOp, - * CreateWordFieldOp, - * CreateDwordFieldOp, - * CreateQwordFieldOp, - * CreateFieldOp (all of which define a field in a buffer) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsCreateBufferField ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState) -{ - ACPI_PARSE_OBJECT *Arg; - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_OPERAND_OBJECT *SecondDesc = NULL; - UINT32 Flags; - - - ACPI_FUNCTION_TRACE (DsCreateBufferField); - - - /* - * Get the NameString argument (name of the new BufferField) - */ - if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP) - { - /* For CreateField, name is the 4th argument */ - - Arg = AcpiPsGetArg (Op, 3); - } - else - { - /* For all other CreateXXXField operators, name is the 3rd argument */ - - Arg = AcpiPsGetArg (Op, 2); - } - - if (!Arg) - { - return_ACPI_STATUS (AE_AML_NO_OPERAND); - } - - if (WalkState->DeferredNode) - { - Node = WalkState->DeferredNode; - } - else - { - /* Execute flag should always be set when this function is entered */ - - if (!(WalkState->ParseFlags & ACPI_PARSE_EXECUTE)) - { - ACPI_ERROR ((AE_INFO, - "Parse execute mode is not set")); - return_ACPI_STATUS (AE_AML_INTERNAL); - } - - /* Creating new namespace node, should not already exist */ - - Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | - ACPI_NS_ERROR_IF_FOUND; - - /* - * Mark node temporary if we are executing a normal control - * method. (Don't mark if this is a module-level code method) - */ - if (WalkState->MethodNode && - !(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL)) - { - Flags |= ACPI_NS_TEMPORARY; - } - - /* Enter the NameString into the namespace */ - - Status = AcpiNsLookup (WalkState->ScopeInfo, - Arg->Common.Value.String, ACPI_TYPE_ANY, - ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &Node); - if ((WalkState->ParseFlags & ACPI_PARSE_DISASSEMBLE) && - Status == AE_ALREADY_EXISTS) - { - Status = AE_OK; - } - else if (ACPI_FAILURE (Status)) - { - ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, - Arg->Common.Value.String, Status); - return_ACPI_STATUS (Status); - } - } - - /* - * We could put the returned object (Node) on the object stack for later, - * but for now, we will put it in the "op" object that the parser uses, - * so we can get it again at the end of this scope. - */ - Op->Common.Node = Node; - - /* - * If there is no object attached to the node, this node was just created - * and we need to create the field object. Otherwise, this was a lookup - * of an existing node and we don't want to create the field object again. - */ - ObjDesc = AcpiNsGetAttachedObject (Node); - if (ObjDesc) - { - return_ACPI_STATUS (AE_OK); - } - - /* - * The Field definition is not fully parsed at this time. - * (We must save the address of the AML for the buffer and index operands) - */ - - /* Create the buffer field object */ - - ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER_FIELD); - if (!ObjDesc) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - /* - * Remember location in AML stream of the field unit opcode and operands - * -- since the buffer and index operands must be evaluated. - */ - SecondDesc = ObjDesc->Common.NextObject; - SecondDesc->Extra.AmlStart = Op->Named.Data; - SecondDesc->Extra.AmlLength = Op->Named.Length; - ObjDesc->BufferField.Node = Node; - - /* Attach constructed field descriptors to parent node */ - - Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_BUFFER_FIELD); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - -Cleanup: - - /* Remove local reference to the object */ - - AcpiUtRemoveReference (ObjDesc); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsGetFieldNames - * - * PARAMETERS: Info - CreateField info structure - * WalkState - Current method state - * Arg - First parser arg for the field name list - * - * RETURN: Status - * - * DESCRIPTION: Process all named fields in a field declaration. Names are - * entered into the namespace. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDsGetFieldNames ( - ACPI_CREATE_FIELD_INFO *Info, - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Arg) -{ - ACPI_STATUS Status; - UINT64 Position; - ACPI_PARSE_OBJECT *Child; - -#ifdef ACPI_EXEC_APP - ACPI_OPERAND_OBJECT *ResultDesc; - ACPI_OPERAND_OBJECT *ObjDesc; - char *NamePath; -#endif - - - ACPI_FUNCTION_TRACE_PTR (DsGetFieldNames, Info); - - - /* First field starts at bit zero */ - - Info->FieldBitPosition = 0; - - /* Process all elements in the field list (of parse nodes) */ - - while (Arg) - { - /* - * Four types of field elements are handled: - * 1) Name - Enters a new named field into the namespace - * 2) Offset - specifies a bit offset - * 3) AccessAs - changes the access mode/attributes - * 4) Connection - Associate a resource template with the field - */ - switch (Arg->Common.AmlOpcode) - { - case AML_INT_RESERVEDFIELD_OP: - - Position = (UINT64) Info->FieldBitPosition + - (UINT64) Arg->Common.Value.Size; - - if (Position > ACPI_UINT32_MAX) - { - ACPI_ERROR ((AE_INFO, - "Bit offset within field too large (> 0xFFFFFFFF)")); - return_ACPI_STATUS (AE_SUPPORT); - } - - Info->FieldBitPosition = (UINT32) Position; - break; - - case AML_INT_ACCESSFIELD_OP: - case AML_INT_EXTACCESSFIELD_OP: - /* - * Get new AccessType, AccessAttribute, and AccessLength fields - * -- to be used for all field units that follow, until the - * end-of-field or another AccessAs keyword is encountered. - * NOTE. These three bytes are encoded in the integer value - * of the parseop for convenience. - * - * In FieldFlags, preserve the flag bits other than the - * ACCESS_TYPE bits. - */ - - /* AccessType (ByteAcc, WordAcc, etc.) */ - - Info->FieldFlags = (UINT8) - ((Info->FieldFlags & ~(AML_FIELD_ACCESS_TYPE_MASK)) | - ((UINT8) ((UINT32) (Arg->Common.Value.Integer & 0x07)))); - - /* AccessAttribute (AttribQuick, AttribByte, etc.) */ - - Info->Attribute = (UINT8) - ((Arg->Common.Value.Integer >> 8) & 0xFF); - - /* AccessLength (for serial/buffer protocols) */ - - Info->AccessLength = (UINT8) - ((Arg->Common.Value.Integer >> 16) & 0xFF); - break; - - case AML_INT_CONNECTION_OP: - /* - * Clear any previous connection. New connection is used for all - * fields that follow, similar to AccessAs - */ - Info->ResourceBuffer = NULL; - Info->ConnectionNode = NULL; - Info->PinNumberIndex = 0; - - /* - * A Connection() is either an actual resource descriptor (buffer) - * or a named reference to a resource template - */ - Child = Arg->Common.Value.Arg; - if (Child->Common.AmlOpcode == AML_INT_BYTELIST_OP) - { - Info->ResourceBuffer = Child->Named.Data; - Info->ResourceLength = (UINT16) Child->Named.Value.Integer; - } - else - { - /* Lookup the Connection() namepath, it should already exist */ - - Status = AcpiNsLookup (WalkState->ScopeInfo, - Child->Common.Value.Name, ACPI_TYPE_ANY, - ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE, - WalkState, &Info->ConnectionNode); - if (ACPI_FAILURE (Status)) - { - ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, - Child->Common.Value.Name, Status); - return_ACPI_STATUS (Status); - } - } - break; - - case AML_INT_NAMEDFIELD_OP: - - /* Lookup the name, it should already exist */ - - Status = AcpiNsLookup (WalkState->ScopeInfo, - (char *) &Arg->Named.Name, Info->FieldType, - ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE, - WalkState, &Info->FieldNode); - if (ACPI_FAILURE (Status)) - { - ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, - (char *) &Arg->Named.Name, Status); - return_ACPI_STATUS (Status); - } - else - { - Arg->Common.Node = Info->FieldNode; - Info->FieldBitLength = Arg->Common.Value.Size; - - /* - * If there is no object attached to the node, this node was - * just created and we need to create the field object. - * Otherwise, this was a lookup of an existing node and we - * don't want to create the field object again. - */ - if (!AcpiNsGetAttachedObject (Info->FieldNode)) - { - Status = AcpiExPrepFieldValue (Info); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } -#ifdef ACPI_EXEC_APP - NamePath = AcpiNsGetExternalPathname (Info->FieldNode); - if (ACPI_SUCCESS (AeLookupInitFileEntry (NamePath, &ObjDesc))) - { - AcpiExWriteDataToField (ObjDesc, - AcpiNsGetAttachedObject (Info->FieldNode), - &ResultDesc); - AcpiUtRemoveReference (ObjDesc); - } - ACPI_FREE (NamePath); -#endif - } - } - - /* Keep track of bit position for the next field */ - - Position = (UINT64) Info->FieldBitPosition + - (UINT64) Arg->Common.Value.Size; - - if (Position > ACPI_UINT32_MAX) - { - ACPI_ERROR ((AE_INFO, - "Field [%4.4s] bit offset too large (> 0xFFFFFFFF)", - ACPI_CAST_PTR (char, &Info->FieldNode->Name))); - return_ACPI_STATUS (AE_SUPPORT); - } - - Info->FieldBitPosition += Info->FieldBitLength; - Info->PinNumberIndex++; /* Index relative to previous Connection() */ - break; - - default: - - ACPI_ERROR ((AE_INFO, - "Invalid opcode in field list: 0x%X", - Arg->Common.AmlOpcode)); - return_ACPI_STATUS (AE_AML_BAD_OPCODE); - } - - Arg = Arg->Common.Next; - } - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsCreateField - * - * PARAMETERS: Op - Op containing the Field definition and args - * RegionNode - Object for the containing Operation Region - * ` WalkState - Current method state - * - * RETURN: Status - * - * DESCRIPTION: Create a new field in the specified operation region - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsCreateField ( - ACPI_PARSE_OBJECT *Op, - ACPI_NAMESPACE_NODE *RegionNode, - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status; - ACPI_PARSE_OBJECT *Arg; - ACPI_CREATE_FIELD_INFO Info; - - - ACPI_FUNCTION_TRACE_PTR (DsCreateField, Op); - - - /* First arg is the name of the parent OpRegion (must already exist) */ - - Arg = Op->Common.Value.Arg; - - if (!RegionNode) - { - Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.Name, - ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode); -#ifdef ACPI_ASL_COMPILER - Status = AcpiDsCreateExternalRegion (Status, Arg, - Arg->Common.Value.Name, WalkState, &RegionNode); -#endif - if (ACPI_FAILURE (Status)) - { - ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, - Arg->Common.Value.Name, Status); - return_ACPI_STATUS (Status); - } - } - - memset (&Info, 0, sizeof (ACPI_CREATE_FIELD_INFO)); - - /* Second arg is the field flags */ - - Arg = Arg->Common.Next; - Info.FieldFlags = (UINT8) Arg->Common.Value.Integer; - Info.Attribute = 0; - - /* Each remaining arg is a Named Field */ - - Info.FieldType = ACPI_TYPE_LOCAL_REGION_FIELD; - Info.RegionNode = RegionNode; - - Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - if (Info.RegionNode->Object->Region.SpaceId == ACPI_ADR_SPACE_PLATFORM_COMM) - { - RegionNode->Object->Field.InternalPccBuffer = - ACPI_ALLOCATE_ZEROED(Info.RegionNode->Object->Region.Length); - if (!RegionNode->Object->Field.InternalPccBuffer) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsInitFieldObjects - * - * PARAMETERS: Op - Op containing the Field definition and args - * ` WalkState - Current method state - * - * RETURN: Status - * - * DESCRIPTION: For each "Field Unit" name in the argument list that is - * part of the field declaration, enter the name into the - * namespace. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsInitFieldObjects ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status; - ACPI_PARSE_OBJECT *Arg = NULL; - ACPI_NAMESPACE_NODE *Node; - UINT8 Type = 0; - UINT32 Flags; - - - ACPI_FUNCTION_TRACE_PTR (DsInitFieldObjects, Op); - - - /* Execute flag should always be set when this function is entered */ - - if (!(WalkState->ParseFlags & ACPI_PARSE_EXECUTE)) - { - if (WalkState->ParseFlags & ACPI_PARSE_DEFERRED_OP) - { - /* BankField Op is deferred, just return OK */ - - return_ACPI_STATUS (AE_OK); - } - - ACPI_ERROR ((AE_INFO, - "Parse deferred mode is not set")); - return_ACPI_STATUS (AE_AML_INTERNAL); - } - - /* - * Get the FieldList argument for this opcode. This is the start of the - * list of field elements. - */ - switch (WalkState->Opcode) - { - case AML_FIELD_OP: - - Arg = AcpiPsGetArg (Op, 2); - Type = ACPI_TYPE_LOCAL_REGION_FIELD; - break; - - case AML_BANK_FIELD_OP: - - Arg = AcpiPsGetArg (Op, 4); - Type = ACPI_TYPE_LOCAL_BANK_FIELD; - break; - - case AML_INDEX_FIELD_OP: - - Arg = AcpiPsGetArg (Op, 3); - Type = ACPI_TYPE_LOCAL_INDEX_FIELD; - break; - - default: - - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* Creating new namespace node(s), should not already exist */ - - Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | - ACPI_NS_ERROR_IF_FOUND; - - /* - * Mark node(s) temporary if we are executing a normal control - * method. (Don't mark if this is a module-level code method) - */ - if (WalkState->MethodNode && - !(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL)) - { - Flags |= ACPI_NS_TEMPORARY; - } - -#ifdef ACPI_EXEC_APP - Flags |= ACPI_NS_OVERRIDE_IF_FOUND; -#endif - /* - * Walk the list of entries in the FieldList - * Note: FieldList can be of zero length. In this case, Arg will be NULL. - */ - while (Arg) - { - /* - * Ignore OFFSET/ACCESSAS/CONNECTION terms here; we are only interested - * in the field names in order to enter them into the namespace. - */ - if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP) - { - Status = AcpiNsLookup (WalkState->ScopeInfo, - (char *) &Arg->Named.Name, Type, ACPI_IMODE_LOAD_PASS1, - Flags, WalkState, &Node); - if (ACPI_FAILURE (Status)) - { - ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, - (char *) &Arg->Named.Name, Status); - if (Status != AE_ALREADY_EXISTS) - { - return_ACPI_STATUS (Status); - } - - /* Name already exists, just ignore this error */ - } - - Arg->Common.Node = Node; - } - - /* Get the next field element in the list */ - - Arg = Arg->Common.Next; - } - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsCreateBankField - * - * PARAMETERS: Op - Op containing the Field definition and args - * RegionNode - Object for the containing Operation Region - * WalkState - Current method state - * - * RETURN: Status - * - * DESCRIPTION: Create a new bank field in the specified operation region - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsCreateBankField ( - ACPI_PARSE_OBJECT *Op, - ACPI_NAMESPACE_NODE *RegionNode, - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status; - ACPI_PARSE_OBJECT *Arg; - ACPI_CREATE_FIELD_INFO Info; - - - ACPI_FUNCTION_TRACE_PTR (DsCreateBankField, Op); - - - /* First arg is the name of the parent OpRegion (must already exist) */ - - Arg = Op->Common.Value.Arg; - if (!RegionNode) - { - Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.Name, - ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode); -#ifdef ACPI_ASL_COMPILER - Status = AcpiDsCreateExternalRegion (Status, Arg, - Arg->Common.Value.Name, WalkState, &RegionNode); -#endif - if (ACPI_FAILURE (Status)) - { - ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, - Arg->Common.Value.Name, Status); - return_ACPI_STATUS (Status); - } - } - - /* Second arg is the Bank Register (Field) (must already exist) */ - - Arg = Arg->Common.Next; - Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, - ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode); - if (ACPI_FAILURE (Status)) - { - ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, - Arg->Common.Value.String, Status); - return_ACPI_STATUS (Status); - } - - /* - * Third arg is the BankValue - * This arg is a TermArg, not a constant - * It will be evaluated later, by AcpiDsEvalBankFieldOperands - */ - Arg = Arg->Common.Next; - - /* Fourth arg is the field flags */ - - Arg = Arg->Common.Next; - Info.FieldFlags = (UINT8) Arg->Common.Value.Integer; - - /* Each remaining arg is a Named Field */ - - Info.FieldType = ACPI_TYPE_LOCAL_BANK_FIELD; - Info.RegionNode = RegionNode; - - /* - * Use Info.DataRegisterNode to store BankField Op - * It's safe because DataRegisterNode will never be used when create - * bank field \we store AmlStart and AmlLength in the BankField Op for - * late evaluation. Used in AcpiExPrepFieldValue(Info) - * - * TBD: Or, should we add a field in ACPI_CREATE_FIELD_INFO, like - * "void *ParentOp"? - */ - Info.DataRegisterNode = (ACPI_NAMESPACE_NODE*) Op; - - Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsCreateIndexField - * - * PARAMETERS: Op - Op containing the Field definition and args - * RegionNode - Object for the containing Operation Region - * ` WalkState - Current method state - * - * RETURN: Status - * - * DESCRIPTION: Create a new index field in the specified operation region - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsCreateIndexField ( - ACPI_PARSE_OBJECT *Op, - ACPI_NAMESPACE_NODE *RegionNode, - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status; - ACPI_PARSE_OBJECT *Arg; - ACPI_CREATE_FIELD_INFO Info; - - - ACPI_FUNCTION_TRACE_PTR (DsCreateIndexField, Op); - - - /* First arg is the name of the Index register (must already exist) */ - - Arg = Op->Common.Value.Arg; - Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, - ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode); - if (ACPI_FAILURE (Status)) - { - ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, - Arg->Common.Value.String, Status); - return_ACPI_STATUS (Status); - } - - /* Second arg is the data register (must already exist) */ - - Arg = Arg->Common.Next; - Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, - ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT, WalkState, &Info.DataRegisterNode); - if (ACPI_FAILURE (Status)) - { - ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, - Arg->Common.Value.String, Status); - return_ACPI_STATUS (Status); - } - - /* Next arg is the field flags */ - - Arg = Arg->Common.Next; - Info.FieldFlags = (UINT8) Arg->Common.Value.Integer; - - /* Each remaining arg is a Named Field */ - - Info.FieldType = ACPI_TYPE_LOCAL_INDEX_FIELD; - Info.RegionNode = RegionNode; - - Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next); - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/dsinit.c b/drivers/acpica/dsinit.c deleted file mode 100644 index 758233e..0000000 --- a/drivers/acpica/dsinit.c +++ /dev/null @@ -1,382 +0,0 @@ -/****************************************************************************** - * - * Module Name: dsinit - Object initialization namespace walk - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acdispat.h" -#include "acnamesp.h" -#include "actables.h" -#include "acinterp.h" - -#define _COMPONENT ACPI_DISPATCHER - ACPI_MODULE_NAME ("dsinit") - - -/* Local prototypes */ - -static ACPI_STATUS -AcpiDsInitOneObject ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue); - - -/******************************************************************************* - * - * FUNCTION: AcpiDsInitOneObject - * - * PARAMETERS: ObjHandle - Node for the object - * Level - Current nesting level - * Context - Points to a init info struct - * ReturnValue - Not used - * - * RETURN: Status - * - * DESCRIPTION: Callback from AcpiWalkNamespace. Invoked for every object - * within the namespace. - * - * Currently, the only objects that require initialization are: - * 1) Methods - * 2) Operation Regions - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDsInitOneObject ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue) -{ - ACPI_INIT_WALK_INFO *Info = (ACPI_INIT_WALK_INFO *) Context; - ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; - ACPI_STATUS Status; - ACPI_OPERAND_OBJECT *ObjDesc; - - - ACPI_FUNCTION_ENTRY (); - - - /* - * We are only interested in NS nodes owned by the table that - * was just loaded - */ - if (Node->OwnerId != Info->OwnerId) - { - return (AE_OK); - } - - Info->ObjectCount++; - - /* And even then, we are only interested in a few object types */ - - switch (AcpiNsGetType (ObjHandle)) - { - case ACPI_TYPE_REGION: - - Status = AcpiDsInitializeRegion (ObjHandle); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "During Region initialization %p [%4.4s]", - ObjHandle, AcpiUtGetNodeName (ObjHandle))); - } - - Info->OpRegionCount++; - break; - - case ACPI_TYPE_METHOD: - /* - * Auto-serialization support. We will examine each method that is - * NotSerialized to determine if it creates any Named objects. If - * it does, it will be marked serialized to prevent problems if - * the method is entered by two or more threads and an attempt is - * made to create the same named object twice -- which results in - * an AE_ALREADY_EXISTS exception and method abort. - */ - Info->MethodCount++; - ObjDesc = AcpiNsGetAttachedObject (Node); - if (!ObjDesc) - { - break; - } - - /* Ignore if already serialized */ - - if (ObjDesc->Method.InfoFlags & ACPI_METHOD_SERIALIZED) - { - Info->SerialMethodCount++; - break; - } - - if (AcpiGbl_AutoSerializeMethods) - { - /* Parse/scan method and serialize it if necessary */ - - AcpiDsAutoSerializeMethod (Node, ObjDesc); - if (ObjDesc->Method.InfoFlags & ACPI_METHOD_SERIALIZED) - { - /* Method was just converted to Serialized */ - - Info->SerialMethodCount++; - Info->SerializedMethodCount++; - break; - } - } - - Info->NonSerialMethodCount++; - break; - - case ACPI_TYPE_DEVICE: - - Info->DeviceCount++; - break; - - default: - - break; - } - - /* - * We ignore errors from above, and always return OK, since - * we don't want to abort the walk on a single error. - */ - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsInitializeObjects - * - * PARAMETERS: TableDesc - Descriptor for parent ACPI table - * StartNode - Root of subtree to be initialized. - * - * RETURN: Status - * - * DESCRIPTION: Walk the namespace starting at "StartNode" and perform any - * necessary initialization on the objects found therein - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsInitializeObjects ( - UINT32 TableIndex, - ACPI_NAMESPACE_NODE *StartNode) -{ - ACPI_STATUS Status; - ACPI_INIT_WALK_INFO Info; - ACPI_TABLE_HEADER *Table; - ACPI_OWNER_ID OwnerId; - - - ACPI_FUNCTION_TRACE (DsInitializeObjects); - - - Status = AcpiTbGetOwnerId (TableIndex, &OwnerId); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "**** Starting initialization of namespace objects ****\n")); - - /* Set all init info to zero */ - - memset (&Info, 0, sizeof (ACPI_INIT_WALK_INFO)); - - Info.OwnerId = OwnerId; - Info.TableIndex = TableIndex; - - /* Walk entire namespace from the supplied root */ - - /* - * We don't use AcpiWalkNamespace since we do not want to acquire - * the namespace reader lock. - */ - Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, StartNode, ACPI_UINT32_MAX, - ACPI_NS_WALK_NO_UNLOCK, AcpiDsInitOneObject, NULL, &Info, NULL); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace")); - } - - Status = AcpiGetTableByIndex (TableIndex, &Table); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* DSDT is always the first AML table */ - - if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_DSDT)) - { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - "\nACPI table initialization:\n")); - } - - /* Summary of objects initialized */ - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - "Table [%4.4s: %-8.8s] (id %.2X) - %4u Objects with %3u Devices, " - "%3u Regions, %4u Methods (%u/%u/%u Serial/Non/Cvt)\n", - Table->Signature, Table->OemTableId, OwnerId, Info.ObjectCount, - Info.DeviceCount,Info.OpRegionCount, Info.MethodCount, - Info.SerialMethodCount, Info.NonSerialMethodCount, - Info.SerializedMethodCount)); - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "%u Methods, %u Regions\n", - Info.MethodCount, Info.OpRegionCount)); - - return_ACPI_STATUS (AE_OK); -} diff --git a/drivers/acpica/dsmethod.c b/drivers/acpica/dsmethod.c deleted file mode 100644 index 09745e1..0000000 --- a/drivers/acpica/dsmethod.c +++ /dev/null @@ -1,1055 +0,0 @@ -/****************************************************************************** - * - * Module Name: dsmethod - Parser/Interpreter interface - control method parsing - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acdispat.h" -#include "acinterp.h" -#include "acnamesp.h" -#include "acparser.h" -#include "amlcode.h" -#include "acdebug.h" - - -#define _COMPONENT ACPI_DISPATCHER - ACPI_MODULE_NAME ("dsmethod") - -/* Local prototypes */ - -static ACPI_STATUS -AcpiDsDetectNamedOpcodes ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT **OutOp); - -static ACPI_STATUS -AcpiDsCreateMethodMutex ( - ACPI_OPERAND_OBJECT *MethodDesc); - - -/******************************************************************************* - * - * FUNCTION: AcpiDsAutoSerializeMethod - * - * PARAMETERS: Node - Namespace Node of the method - * ObjDesc - Method object attached to node - * - * RETURN: Status - * - * DESCRIPTION: Parse a control method AML to scan for control methods that - * need serialization due to the creation of named objects. - * - * NOTE: It is a bit of overkill to mark all such methods serialized, since - * there is only a problem if the method actually blocks during execution. - * A blocking operation is, for example, a Sleep() operation, or any access - * to an operation region. However, it is probably not possible to easily - * detect whether a method will block or not, so we simply mark all suspicious - * methods as serialized. - * - * NOTE2: This code is essentially a generic routine for parsing a single - * control method. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsAutoSerializeMethod ( - ACPI_NAMESPACE_NODE *Node, - ACPI_OPERAND_OBJECT *ObjDesc) -{ - ACPI_STATUS Status; - ACPI_PARSE_OBJECT *Op = NULL; - ACPI_WALK_STATE *WalkState; - - - ACPI_FUNCTION_TRACE_PTR (DsAutoSerializeMethod, Node); - - - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "Method auto-serialization parse [%4.4s] %p\n", - AcpiUtGetNodeName (Node), Node)); - - /* Create/Init a root op for the method parse tree */ - - Op = AcpiPsAllocOp (AML_METHOD_OP, ObjDesc->Method.AmlStart); - if (!Op) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - AcpiPsSetName (Op, Node->Name.Integer); - Op->Common.Node = Node; - - /* Create and initialize a new walk state */ - - WalkState = AcpiDsCreateWalkState (Node->OwnerId, NULL, NULL, NULL); - if (!WalkState) - { - AcpiPsFreeOp (Op); - return_ACPI_STATUS (AE_NO_MEMORY); - } - - Status = AcpiDsInitAmlWalk (WalkState, Op, Node, - ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength, NULL, 0); - if (ACPI_FAILURE (Status)) - { - AcpiDsDeleteWalkState (WalkState); - AcpiPsFreeOp (Op); - return_ACPI_STATUS (Status); - } - - WalkState->DescendingCallback = AcpiDsDetectNamedOpcodes; - - /* Parse the method, scan for creation of named objects */ - - Status = AcpiPsParseAml (WalkState); - - AcpiPsDeleteParseTree (Op); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsDetectNamedOpcodes - * - * PARAMETERS: WalkState - Current state of the parse tree walk - * OutOp - Unused, required for parser interface - * - * RETURN: Status - * - * DESCRIPTION: Descending callback used during the loading of ACPI tables. - * Currently used to detect methods that must be marked serialized - * in order to avoid problems with the creation of named objects. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDsDetectNamedOpcodes ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT **OutOp) -{ - - ACPI_FUNCTION_NAME (AcpiDsDetectNamedOpcodes); - - - /* We are only interested in opcodes that create a new name */ - - if (!(WalkState->OpInfo->Flags & (AML_NAMED | AML_CREATE | AML_FIELD))) - { - return (AE_OK); - } - - /* - * At this point, we know we have a Named object opcode. - * Mark the method as serialized. Later code will create a mutex for - * this method to enforce serialization. - * - * Note, ACPI_METHOD_IGNORE_SYNC_LEVEL flag means that we will ignore the - * Sync Level mechanism for this method, even though it is now serialized. - * Otherwise, there can be conflicts with existing ASL code that actually - * uses sync levels. - */ - WalkState->MethodDesc->Method.SyncLevel = 0; - WalkState->MethodDesc->Method.InfoFlags |= - (ACPI_METHOD_SERIALIZED | ACPI_METHOD_IGNORE_SYNC_LEVEL); - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Method serialized [%4.4s] %p - [%s] (%4.4X)\n", - WalkState->MethodNode->Name.Ascii, WalkState->MethodNode, - WalkState->OpInfo->Name, WalkState->Opcode)); - - /* Abort the parse, no need to examine this method any further */ - - return (AE_CTRL_TERMINATE); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsMethodError - * - * PARAMETERS: Status - Execution status - * WalkState - Current state - * - * RETURN: Status - * - * DESCRIPTION: Called on method error. Invoke the global exception handler if - * present, dump the method data if the debugger is configured - * - * Note: Allows the exception handler to change the status code - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsMethodError ( - ACPI_STATUS Status, - ACPI_WALK_STATE *WalkState) -{ - UINT32 AmlOffset; - ACPI_NAME Name = 0; - - - ACPI_FUNCTION_ENTRY (); - - - /* Ignore AE_OK and control exception codes */ - - if (ACPI_SUCCESS (Status) || - (Status & AE_CODE_CONTROL)) - { - return (Status); - } - - /* Invoke the global exception handler */ - - if (AcpiGbl_ExceptionHandler) - { - /* Exit the interpreter, allow handler to execute methods */ - - AcpiExExitInterpreter (); - - /* - * Handler can map the exception code to anything it wants, including - * AE_OK, in which case the executing method will not be aborted. - */ - AmlOffset = (UINT32) ACPI_PTR_DIFF (WalkState->Aml, - WalkState->ParserState.AmlStart); - - if (WalkState->MethodNode) - { - Name = WalkState->MethodNode->Name.Integer; - } - else if (WalkState->DeferredNode) - { - Name = WalkState->DeferredNode->Name.Integer; - } - - Status = AcpiGbl_ExceptionHandler (Status, Name, - WalkState->Opcode, AmlOffset, NULL); - AcpiExEnterInterpreter (); - } - - AcpiDsClearImplicitReturn (WalkState); - - if (ACPI_FAILURE (Status)) - { - AcpiDsDumpMethodStack (Status, WalkState, WalkState->Op); - - /* Display method locals/args if debugger is present */ - -#ifdef ACPI_DEBUGGER - AcpiDbDumpMethodInfo (Status, WalkState); -#endif - } - - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsCreateMethodMutex - * - * PARAMETERS: ObjDesc - The method object - * - * RETURN: Status - * - * DESCRIPTION: Create a mutex object for a serialized control method - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDsCreateMethodMutex ( - ACPI_OPERAND_OBJECT *MethodDesc) -{ - ACPI_OPERAND_OBJECT *MutexDesc; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (DsCreateMethodMutex); - - - /* Create the new mutex object */ - - MutexDesc = AcpiUtCreateInternalObject (ACPI_TYPE_MUTEX); - if (!MutexDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Create the actual OS Mutex */ - - Status = AcpiOsCreateMutex (&MutexDesc->Mutex.OsMutex); - if (ACPI_FAILURE (Status)) - { - AcpiUtDeleteObjectDesc (MutexDesc); - return_ACPI_STATUS (Status); - } - - MutexDesc->Mutex.SyncLevel = MethodDesc->Method.SyncLevel; - MethodDesc->Method.Mutex = MutexDesc; - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsBeginMethodExecution - * - * PARAMETERS: MethodNode - Node of the method - * ObjDesc - The method object - * WalkState - current state, NULL if not yet executing - * a method. - * - * RETURN: Status - * - * DESCRIPTION: Prepare a method for execution. Parses the method if necessary, - * increments the thread count, and waits at the method semaphore - * for clearance to execute. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsBeginMethodExecution ( - ACPI_NAMESPACE_NODE *MethodNode, - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE_PTR (DsBeginMethodExecution, MethodNode); - - - if (!MethodNode) - { - return_ACPI_STATUS (AE_NULL_ENTRY); - } - - AcpiExStartTraceMethod (MethodNode, ObjDesc, WalkState); - - /* Prevent wraparound of thread count */ - - if (ObjDesc->Method.ThreadCount == ACPI_UINT8_MAX) - { - ACPI_ERROR ((AE_INFO, - "Method reached maximum reentrancy limit (255)")); - return_ACPI_STATUS (AE_AML_METHOD_LIMIT); - } - - /* - * If this method is serialized, we need to acquire the method mutex. - */ - if (ObjDesc->Method.InfoFlags & ACPI_METHOD_SERIALIZED) - { - /* - * Create a mutex for the method if it is defined to be Serialized - * and a mutex has not already been created. We defer the mutex creation - * until a method is actually executed, to minimize the object count - */ - if (!ObjDesc->Method.Mutex) - { - Status = AcpiDsCreateMethodMutex (ObjDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - /* - * The CurrentSyncLevel (per-thread) must be less than or equal to - * the sync level of the method. This mechanism provides some - * deadlock prevention. - * - * If the method was auto-serialized, we just ignore the sync level - * mechanism, because auto-serialization of methods can interfere - * with ASL code that actually uses sync levels. - * - * Top-level method invocation has no walk state at this point - */ - if (WalkState && - (!(ObjDesc->Method.InfoFlags & ACPI_METHOD_IGNORE_SYNC_LEVEL)) && - (WalkState->Thread->CurrentSyncLevel > - ObjDesc->Method.Mutex->Mutex.SyncLevel)) - { - ACPI_ERROR ((AE_INFO, - "Cannot acquire Mutex for method [%4.4s]" - ", current SyncLevel is too large (%u)", - AcpiUtGetNodeName (MethodNode), - WalkState->Thread->CurrentSyncLevel)); - - return_ACPI_STATUS (AE_AML_MUTEX_ORDER); - } - - /* - * Obtain the method mutex if necessary. Do not acquire mutex for a - * recursive call. - */ - if (!WalkState || - !ObjDesc->Method.Mutex->Mutex.ThreadId || - (WalkState->Thread->ThreadId != - ObjDesc->Method.Mutex->Mutex.ThreadId)) - { - /* - * Acquire the method mutex. This releases the interpreter if we - * block (and reacquires it before it returns) - */ - Status = AcpiExSystemWaitMutex ( - ObjDesc->Method.Mutex->Mutex.OsMutex, ACPI_WAIT_FOREVER); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Update the mutex and walk info and save the original SyncLevel */ - - if (WalkState) - { - ObjDesc->Method.Mutex->Mutex.OriginalSyncLevel = - WalkState->Thread->CurrentSyncLevel; - - ObjDesc->Method.Mutex->Mutex.ThreadId = - WalkState->Thread->ThreadId; - - /* - * Update the current SyncLevel only if this is not an auto- - * serialized method. In the auto case, we have to ignore - * the sync level for the method mutex (created for the - * auto-serialization) because we have no idea of what the - * sync level should be. Therefore, just ignore it. - */ - if (!(ObjDesc->Method.InfoFlags & - ACPI_METHOD_IGNORE_SYNC_LEVEL)) - { - WalkState->Thread->CurrentSyncLevel = - ObjDesc->Method.SyncLevel; - } - } - else - { - ObjDesc->Method.Mutex->Mutex.OriginalSyncLevel = - ObjDesc->Method.Mutex->Mutex.SyncLevel; - - ObjDesc->Method.Mutex->Mutex.ThreadId = - AcpiOsGetThreadId (); - } - } - - /* Always increase acquisition depth */ - - ObjDesc->Method.Mutex->Mutex.AcquisitionDepth++; - } - - /* - * Allocate an Owner ID for this method, only if this is the first thread - * to begin concurrent execution. We only need one OwnerId, even if the - * method is invoked recursively. - */ - if (!ObjDesc->Method.OwnerId) - { - Status = AcpiUtAllocateOwnerId (&ObjDesc->Method.OwnerId); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - } - - /* - * Increment the method parse tree thread count since it has been - * reentered one more time (even if it is the same thread) - */ - ObjDesc->Method.ThreadCount++; - AcpiMethodCount++; - return_ACPI_STATUS (Status); - - -Cleanup: - /* On error, must release the method mutex (if present) */ - - if (ObjDesc->Method.Mutex) - { - AcpiOsReleaseMutex (ObjDesc->Method.Mutex->Mutex.OsMutex); - } - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsCallControlMethod - * - * PARAMETERS: Thread - Info for this thread - * ThisWalkState - Current walk state - * Op - Current Op to be walked - * - * RETURN: Status - * - * DESCRIPTION: Transfer execution to a called control method - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsCallControlMethod ( - ACPI_THREAD_STATE *Thread, - ACPI_WALK_STATE *ThisWalkState, - ACPI_PARSE_OBJECT *Op) -{ - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *MethodNode; - ACPI_WALK_STATE *NextWalkState = NULL; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_EVALUATE_INFO *Info; - - ACPI_FUNCTION_TRACE_PTR (DsCallControlMethod, ThisWalkState); - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Calling method %p, currentstate=%p\n", - ThisWalkState->PrevOp, ThisWalkState)); - - /* - * Get the namespace entry for the control method we are about to call - */ - MethodNode = ThisWalkState->MethodCallNode; - if (!MethodNode) - { - return_ACPI_STATUS (AE_NULL_ENTRY); - } - - ObjDesc = AcpiNsGetAttachedObject (MethodNode); - if (!ObjDesc) - { - return_ACPI_STATUS (AE_NULL_OBJECT); - } - - if (ThisWalkState->NumOperands < ObjDesc->Method.ParamCount) - { - ACPI_ERROR ((AE_INFO, "Missing argument(s) for method [%4.4s]", - AcpiUtGetNodeName (MethodNode))); - - return_ACPI_STATUS (AE_AML_TOO_FEW_ARGUMENTS); - } - - else if (ThisWalkState->NumOperands > ObjDesc->Method.ParamCount) - { - ACPI_ERROR ((AE_INFO, "Too many arguments for method [%4.4s]", - AcpiUtGetNodeName (MethodNode))); - - return_ACPI_STATUS (AE_AML_TOO_MANY_ARGUMENTS); - } - - - /* Init for new method, possibly wait on method mutex */ - - Status = AcpiDsBeginMethodExecution ( - MethodNode, ObjDesc, ThisWalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Begin method parse/execution. Create a new walk state */ - - NextWalkState = AcpiDsCreateWalkState ( - ObjDesc->Method.OwnerId, NULL, ObjDesc, Thread); - if (!NextWalkState) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - /* - * The resolved arguments were put on the previous walk state's operand - * stack. Operands on the previous walk state stack always - * start at index 0. Also, null terminate the list of arguments - */ - ThisWalkState->Operands [ThisWalkState->NumOperands] = NULL; - - /* - * Allocate and initialize the evaluation information block - * TBD: this is somewhat inefficient, should change interface to - * DsInitAmlWalk. For now, keeps this struct off the CPU stack - */ - Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO)); - if (!Info) - { - Status = AE_NO_MEMORY; - goto PopWalkState; - } - - Info->Parameters = &ThisWalkState->Operands[0]; - - Status = AcpiDsInitAmlWalk (NextWalkState, NULL, MethodNode, - ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength, - Info, ACPI_IMODE_EXECUTE); - - ACPI_FREE (Info); - if (ACPI_FAILURE (Status)) - { - goto PopWalkState; - } - - NextWalkState->MethodNestingDepth = ThisWalkState->MethodNestingDepth + 1; - - /* - * Delete the operands on the previous walkstate operand stack - * (they were copied to new objects) - */ - AcpiDsClearOperands (ThisWalkState); - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "**** Begin nested execution of [%4.4s] **** WalkState=%p\n", - MethodNode->Name.Ascii, NextWalkState)); - - ThisWalkState->MethodPathname = AcpiNsGetNormalizedPathname (MethodNode, TRUE); - ThisWalkState->MethodIsNested = TRUE; - - /* Optional object evaluation log */ - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EVALUATION, - "%-26s: %*s%s\n", " Nested method call", - NextWalkState->MethodNestingDepth * 3, " ", - &ThisWalkState->MethodPathname[1])); - - /* Invoke an internal method if necessary */ - - if (ObjDesc->Method.InfoFlags & ACPI_METHOD_INTERNAL_ONLY) - { - Status = ObjDesc->Method.Dispatch.Implementation (NextWalkState); - if (Status == AE_OK) - { - Status = AE_CTRL_TERMINATE; - } - } - - return_ACPI_STATUS (Status); - - -PopWalkState: - - /* On error, pop the walk state to be deleted from thread */ - - AcpiDsPopWalkState(Thread); - -Cleanup: - - /* On error, we must terminate the method properly */ - - AcpiDsTerminateControlMethod (ObjDesc, NextWalkState); - AcpiDsDeleteWalkState (NextWalkState); - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsRestartControlMethod - * - * PARAMETERS: WalkState - State for preempted method (caller) - * ReturnDesc - Return value from the called method - * - * RETURN: Status - * - * DESCRIPTION: Restart a method that was preempted by another (nested) method - * invocation. Handle the return value (if any) from the callee. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsRestartControlMethod ( - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT *ReturnDesc) -{ - ACPI_STATUS Status; - int SameAsImplicitReturn; - - - ACPI_FUNCTION_TRACE_PTR (DsRestartControlMethod, WalkState); - - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "****Restart [%4.4s] Op %p ReturnValueFromCallee %p\n", - AcpiUtGetNodeName (WalkState->MethodNode), - WalkState->MethodCallOp, ReturnDesc)); - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - " ReturnFromThisMethodUsed?=%X ResStack %p Walk %p\n", - WalkState->ReturnUsed, - WalkState->Results, WalkState)); - - /* Did the called method return a value? */ - - if (ReturnDesc) - { - /* Is the implicit return object the same as the return desc? */ - - SameAsImplicitReturn = (WalkState->ImplicitReturnObj == ReturnDesc); - - /* Are we actually going to use the return value? */ - - if (WalkState->ReturnUsed) - { - /* Save the return value from the previous method */ - - Status = AcpiDsResultPush (ReturnDesc, WalkState); - if (ACPI_FAILURE (Status)) - { - AcpiUtRemoveReference (ReturnDesc); - return_ACPI_STATUS (Status); - } - - /* - * Save as THIS method's return value in case it is returned - * immediately to yet another method - */ - WalkState->ReturnDesc = ReturnDesc; - } - - /* - * The following code is the optional support for the so-called - * "implicit return". Some AML code assumes that the last value of the - * method is "implicitly" returned to the caller, in the absence of an - * explicit return value. - * - * Just save the last result of the method as the return value. - * - * NOTE: this is optional because the ASL language does not actually - * support this behavior. - */ - else if (!AcpiDsDoImplicitReturn (ReturnDesc, WalkState, FALSE) || - SameAsImplicitReturn) - { - /* - * Delete the return value if it will not be used by the - * calling method or remove one reference if the explicit return - * is the same as the implicit return value. - */ - AcpiUtRemoveReference (ReturnDesc); - } - } - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsTerminateControlMethod - * - * PARAMETERS: MethodDesc - Method object - * WalkState - State associated with the method - * - * RETURN: None - * - * DESCRIPTION: Terminate a control method. Delete everything that the method - * created, delete all locals and arguments, and delete the parse - * tree if requested. - * - * MUTEX: Interpreter is locked - * - ******************************************************************************/ - -void -AcpiDsTerminateControlMethod ( - ACPI_OPERAND_OBJECT *MethodDesc, - ACPI_WALK_STATE *WalkState) -{ - - ACPI_FUNCTION_TRACE_PTR (DsTerminateControlMethod, WalkState); - - - /* MethodDesc is required, WalkState is optional */ - - if (!MethodDesc) - { - return_VOID; - } - - if (WalkState) - { - /* Delete all arguments and locals */ - - AcpiDsMethodDataDeleteAll (WalkState); - - /* - * Delete any namespace objects created anywhere within the - * namespace by the execution of this method. Unless: - * 1) This method is a module-level executable code method, in which - * case we want make the objects permanent. - * 2) There are other threads executing the method, in which case we - * will wait until the last thread has completed. - */ - if (!(MethodDesc->Method.InfoFlags & ACPI_METHOD_MODULE_LEVEL) && - (MethodDesc->Method.ThreadCount == 1)) - { - /* Delete any direct children of (created by) this method */ - - (void) AcpiExExitInterpreter (); - AcpiNsDeleteNamespaceSubtree (WalkState->MethodNode); - (void) AcpiExEnterInterpreter (); - - /* - * Delete any objects that were created by this method - * elsewhere in the namespace (if any were created). - * Use of the ACPI_METHOD_MODIFIED_NAMESPACE optimizes the - * deletion such that we don't have to perform an entire - * namespace walk for every control method execution. - */ - if (MethodDesc->Method.InfoFlags & ACPI_METHOD_MODIFIED_NAMESPACE) - { - (void) AcpiExExitInterpreter (); - AcpiNsDeleteNamespaceByOwner (MethodDesc->Method.OwnerId); - (void) AcpiExEnterInterpreter (); - MethodDesc->Method.InfoFlags &= - ~ACPI_METHOD_MODIFIED_NAMESPACE; - } - } - - /* - * If method is serialized, release the mutex and restore the - * current sync level for this thread - */ - if (MethodDesc->Method.Mutex) - { - /* Acquisition Depth handles recursive calls */ - - MethodDesc->Method.Mutex->Mutex.AcquisitionDepth--; - if (!MethodDesc->Method.Mutex->Mutex.AcquisitionDepth) - { - WalkState->Thread->CurrentSyncLevel = - MethodDesc->Method.Mutex->Mutex.OriginalSyncLevel; - - AcpiOsReleaseMutex ( - MethodDesc->Method.Mutex->Mutex.OsMutex); - MethodDesc->Method.Mutex->Mutex.ThreadId = 0; - } - } - } - - /* Decrement the thread count on the method */ - - if (MethodDesc->Method.ThreadCount) - { - MethodDesc->Method.ThreadCount--; - } - else - { - ACPI_ERROR ((AE_INFO, - "Invalid zero thread count in method")); - } - - /* Are there any other threads currently executing this method? */ - - if (MethodDesc->Method.ThreadCount) - { - /* - * Additional threads. Do not release the OwnerId in this case, - * we immediately reuse it for the next thread executing this method - */ - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "*** Completed execution of one thread, %u threads remaining\n", - MethodDesc->Method.ThreadCount)); - } - else - { - /* This is the only executing thread for this method */ - - /* - * Support to dynamically change a method from NotSerialized to - * Serialized if it appears that the method is incorrectly written and - * does not support multiple thread execution. The best example of this - * is if such a method creates namespace objects and blocks. A second - * thread will fail with an AE_ALREADY_EXISTS exception. - * - * This code is here because we must wait until the last thread exits - * before marking the method as serialized. - */ - if (MethodDesc->Method.InfoFlags & ACPI_METHOD_SERIALIZED_PENDING) - { - if (WalkState) - { - ACPI_INFO (( - "Marking method %4.4s as Serialized " - "because of AE_ALREADY_EXISTS error", - WalkState->MethodNode->Name.Ascii)); - } - - /* - * Method tried to create an object twice and was marked as - * "pending serialized". The probable cause is that the method - * cannot handle reentrancy. - * - * The method was created as NotSerialized, but it tried to create - * a named object and then blocked, causing the second thread - * entrance to begin and then fail. Workaround this problem by - * marking the method permanently as Serialized when the last - * thread exits here. - */ - MethodDesc->Method.InfoFlags &= - ~ACPI_METHOD_SERIALIZED_PENDING; - - MethodDesc->Method.InfoFlags |= - (ACPI_METHOD_SERIALIZED | ACPI_METHOD_IGNORE_SYNC_LEVEL); - MethodDesc->Method.SyncLevel = 0; - } - - /* No more threads, we can free the OwnerId */ - - if (!(MethodDesc->Method.InfoFlags & ACPI_METHOD_MODULE_LEVEL)) - { - AcpiUtReleaseOwnerId (&MethodDesc->Method.OwnerId); - } - } - - AcpiExStopTraceMethod ((ACPI_NAMESPACE_NODE *) MethodDesc->Method.Node, - MethodDesc, WalkState); - - return_VOID; -} diff --git a/drivers/acpica/dsmthdat.c b/drivers/acpica/dsmthdat.c deleted file mode 100644 index 98e69ef..0000000 --- a/drivers/acpica/dsmthdat.c +++ /dev/null @@ -1,887 +0,0 @@ -/******************************************************************************* - * - * Module Name: dsmthdat - control method arguments and local variables - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acdispat.h" -#include "acnamesp.h" -#include "acinterp.h" - - -#define _COMPONENT ACPI_DISPATCHER - ACPI_MODULE_NAME ("dsmthdat") - -/* Local prototypes */ - -static void -AcpiDsMethodDataDeleteValue ( - UINT8 Type, - UINT32 Index, - ACPI_WALK_STATE *WalkState); - -static ACPI_STATUS -AcpiDsMethodDataSetValue ( - UINT8 Type, - UINT32 Index, - ACPI_OPERAND_OBJECT *Object, - ACPI_WALK_STATE *WalkState); - -#ifdef ACPI_OBSOLETE_FUNCTIONS -ACPI_OBJECT_TYPE -AcpiDsMethodDataGetType ( - UINT16 Opcode, - UINT32 Index, - ACPI_WALK_STATE *WalkState); -#endif - - -/******************************************************************************* - * - * FUNCTION: AcpiDsMethodDataInit - * - * PARAMETERS: WalkState - Current walk state object - * - * RETURN: Status - * - * DESCRIPTION: Initialize the data structures that hold the method's arguments - * and locals. The data struct is an array of namespace nodes for - * each - this allows RefOf and DeRefOf to work properly for these - * special data types. - * - * NOTES: WalkState fields are initialized to zero by the - * ACPI_ALLOCATE_ZEROED(). - * - * A pseudo-Namespace Node is assigned to each argument and local - * so that RefOf() can return a pointer to the Node. - * - ******************************************************************************/ - -void -AcpiDsMethodDataInit ( - ACPI_WALK_STATE *WalkState) -{ - UINT32 i; - - - ACPI_FUNCTION_TRACE (DsMethodDataInit); - - - /* Init the method arguments */ - - for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) - { - ACPI_MOVE_32_TO_32 (&WalkState->Arguments[i].Name, - NAMEOF_ARG_NTE); - - WalkState->Arguments[i].Name.Integer |= (i << 24); - WalkState->Arguments[i].DescriptorType = ACPI_DESC_TYPE_NAMED; - WalkState->Arguments[i].Type = ACPI_TYPE_ANY; - WalkState->Arguments[i].Flags = ANOBJ_METHOD_ARG; - } - - /* Init the method locals */ - - for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++) - { - ACPI_MOVE_32_TO_32 (&WalkState->LocalVariables[i].Name, - NAMEOF_LOCAL_NTE); - - WalkState->LocalVariables[i].Name.Integer |= (i << 24); - WalkState->LocalVariables[i].DescriptorType = ACPI_DESC_TYPE_NAMED; - WalkState->LocalVariables[i].Type = ACPI_TYPE_ANY; - WalkState->LocalVariables[i].Flags = ANOBJ_METHOD_LOCAL; - } - - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsMethodDataDeleteAll - * - * PARAMETERS: WalkState - Current walk state object - * - * RETURN: None - * - * DESCRIPTION: Delete method locals and arguments. Arguments are only - * deleted if this method was called from another method. - * - ******************************************************************************/ - -void -AcpiDsMethodDataDeleteAll ( - ACPI_WALK_STATE *WalkState) -{ - UINT32 Index; - - - ACPI_FUNCTION_TRACE (DsMethodDataDeleteAll); - - - /* Detach the locals */ - - for (Index = 0; Index < ACPI_METHOD_NUM_LOCALS; Index++) - { - if (WalkState->LocalVariables[Index].Object) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Local%u=%p\n", - Index, WalkState->LocalVariables[Index].Object)); - - /* Detach object (if present) and remove a reference */ - - AcpiNsDetachObject (&WalkState->LocalVariables[Index]); - } - } - - /* Detach the arguments */ - - for (Index = 0; Index < ACPI_METHOD_NUM_ARGS; Index++) - { - if (WalkState->Arguments[Index].Object) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Arg%u=%p\n", - Index, WalkState->Arguments[Index].Object)); - - /* Detach object (if present) and remove a reference */ - - AcpiNsDetachObject (&WalkState->Arguments[Index]); - } - } - - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsMethodDataInitArgs - * - * PARAMETERS: *Params - Pointer to a parameter list for the method - * MaxParamCount - The arg count for this method - * WalkState - Current walk state object - * - * RETURN: Status - * - * DESCRIPTION: Initialize arguments for a method. The parameter list is a list - * of ACPI operand objects, either null terminated or whose length - * is defined by MaxParamCount. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsMethodDataInitArgs ( - ACPI_OPERAND_OBJECT **Params, - UINT32 MaxParamCount, - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status; - UINT32 Index = 0; - - - ACPI_FUNCTION_TRACE_PTR (DsMethodDataInitArgs, Params); - - - if (!Params) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "No parameter list passed to method\n")); - return_ACPI_STATUS (AE_OK); - } - - /* Copy passed parameters into the new method stack frame */ - - while ((Index < ACPI_METHOD_NUM_ARGS) && - (Index < MaxParamCount) && - Params[Index]) - { - /* - * A valid parameter. - * Store the argument in the method/walk descriptor. - * Do not copy the arg in order to implement call by reference - */ - Status = AcpiDsMethodDataSetValue ( - ACPI_REFCLASS_ARG, Index, Params[Index], WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Index++; - } - AcpiExTraceArgs(Params, Index); - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%u args passed to method\n", Index)); - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsMethodDataGetNode - * - * PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or - * ACPI_REFCLASS_ARG - * Index - Which Local or Arg whose type to get - * WalkState - Current walk state object - * Node - Where the node is returned. - * - * RETURN: Status and node - * - * DESCRIPTION: Get the Node associated with a local or arg. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsMethodDataGetNode ( - UINT8 Type, - UINT32 Index, - ACPI_WALK_STATE *WalkState, - ACPI_NAMESPACE_NODE **Node) -{ - ACPI_FUNCTION_TRACE (DsMethodDataGetNode); - - - /* - * Method Locals and Arguments are supported - */ - switch (Type) - { - case ACPI_REFCLASS_LOCAL: - - if (Index > ACPI_METHOD_MAX_LOCAL) - { - ACPI_ERROR ((AE_INFO, - "Local index %u is invalid (max %u)", - Index, ACPI_METHOD_MAX_LOCAL)); - return_ACPI_STATUS (AE_AML_INVALID_INDEX); - } - - /* Return a pointer to the pseudo-node */ - - *Node = &WalkState->LocalVariables[Index]; - break; - - case ACPI_REFCLASS_ARG: - - if (Index > ACPI_METHOD_MAX_ARG) - { - ACPI_ERROR ((AE_INFO, - "Arg index %u is invalid (max %u)", - Index, ACPI_METHOD_MAX_ARG)); - return_ACPI_STATUS (AE_AML_INVALID_INDEX); - } - - /* Return a pointer to the pseudo-node */ - - *Node = &WalkState->Arguments[Index]; - break; - - default: - - ACPI_ERROR ((AE_INFO, "Type %u is invalid", Type)); - return_ACPI_STATUS (AE_TYPE); - } - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsMethodDataSetValue - * - * PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or - * ACPI_REFCLASS_ARG - * Index - Which Local or Arg to get - * Object - Object to be inserted into the stack entry - * WalkState - Current walk state object - * - * RETURN: Status - * - * DESCRIPTION: Insert an object onto the method stack at entry Opcode:Index. - * Note: There is no "implicit conversion" for locals. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDsMethodDataSetValue ( - UINT8 Type, - UINT32 Index, - ACPI_OPERAND_OBJECT *Object, - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node; - - - ACPI_FUNCTION_TRACE (DsMethodDataSetValue); - - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "NewObj %p Type %2.2X, Refs=%u [%s]\n", Object, - Type, Object->Common.ReferenceCount, - AcpiUtGetTypeName (Object->Common.Type))); - - /* Get the namespace node for the arg/local */ - - Status = AcpiDsMethodDataGetNode (Type, Index, WalkState, &Node); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* - * Increment ref count so object can't be deleted while installed. - * NOTE: We do not copy the object in order to preserve the call by - * reference semantics of ACPI Control Method invocation. - * (See ACPI Specification 2.0C) - */ - AcpiUtAddReference (Object); - - /* Install the object */ - - Node->Object = Object; - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsMethodDataGetValue - * - * PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or - * ACPI_REFCLASS_ARG - * Index - Which localVar or argument to get - * WalkState - Current walk state object - * DestDesc - Where Arg or Local value is returned - * - * RETURN: Status - * - * DESCRIPTION: Retrieve value of selected Arg or Local for this method - * Used only in AcpiExResolveToValue(). - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsMethodDataGetValue ( - UINT8 Type, - UINT32 Index, - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT **DestDesc) -{ - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node; - ACPI_OPERAND_OBJECT *Object; - - - ACPI_FUNCTION_TRACE (DsMethodDataGetValue); - - - /* Validate the object descriptor */ - - if (!DestDesc) - { - ACPI_ERROR ((AE_INFO, "Null object descriptor pointer")); - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* Get the namespace node for the arg/local */ - - Status = AcpiDsMethodDataGetNode (Type, Index, WalkState, &Node); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Get the object from the node */ - - Object = Node->Object; - - /* Examine the returned object, it must be valid. */ - - if (!Object) - { - /* - * Index points to uninitialized object. - * This means that either 1) The expected argument was - * not passed to the method, or 2) A local variable - * was referenced by the method (via the ASL) - * before it was initialized. Either case is an error. - */ - - /* If slack enabled, init the LocalX/ArgX to an Integer of value zero */ - - if (AcpiGbl_EnableInterpreterSlack) - { - Object = AcpiUtCreateIntegerObject ((UINT64) 0); - if (!Object) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - Node->Object = Object; - } - - /* Otherwise, return the error */ - - else switch (Type) - { - case ACPI_REFCLASS_ARG: - - ACPI_ERROR ((AE_INFO, - "Uninitialized Arg[%u] at node %p", - Index, Node)); - - return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG); - - case ACPI_REFCLASS_LOCAL: - /* - * No error message for this case, will be trapped again later to - * detect and ignore cases of Store(LocalX,LocalX) - */ - return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL); - - default: - - ACPI_ERROR ((AE_INFO, "Not a Arg/Local opcode: 0x%X", Type)); - return_ACPI_STATUS (AE_AML_INTERNAL); - } - } - - /* - * The Index points to an initialized and valid object. - * Return an additional reference to the object - */ - *DestDesc = Object; - AcpiUtAddReference (Object); - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsMethodDataDeleteValue - * - * PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or - * ACPI_REFCLASS_ARG - * Index - Which localVar or argument to delete - * WalkState - Current walk state object - * - * RETURN: None - * - * DESCRIPTION: Delete the entry at Opcode:Index. Inserts - * a null into the stack slot after the object is deleted. - * - ******************************************************************************/ - -static void -AcpiDsMethodDataDeleteValue ( - UINT8 Type, - UINT32 Index, - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node; - ACPI_OPERAND_OBJECT *Object; - - - ACPI_FUNCTION_TRACE (DsMethodDataDeleteValue); - - - /* Get the namespace node for the arg/local */ - - Status = AcpiDsMethodDataGetNode (Type, Index, WalkState, &Node); - if (ACPI_FAILURE (Status)) - { - return_VOID; - } - - /* Get the associated object */ - - Object = AcpiNsGetAttachedObject (Node); - - /* - * Undefine the Arg or Local by setting its descriptor - * pointer to NULL. Locals/Args can contain both - * ACPI_OPERAND_OBJECTS and ACPI_NAMESPACE_NODEs - */ - Node->Object = NULL; - - if ((Object) && - (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_OPERAND)) - { - /* - * There is a valid object. - * Decrement the reference count by one to balance the - * increment when the object was stored. - */ - AcpiUtRemoveReference (Object); - } - - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsStoreObjectToLocal - * - * PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or - * ACPI_REFCLASS_ARG - * Index - Which Local or Arg to set - * ObjDesc - Value to be stored - * WalkState - Current walk state - * - * RETURN: Status - * - * DESCRIPTION: Store a value in an Arg or Local. The ObjDesc is installed - * as the new value for the Arg or Local and the reference count - * for ObjDesc is incremented. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsStoreObjectToLocal ( - UINT8 Type, - UINT32 Index, - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node; - ACPI_OPERAND_OBJECT *CurrentObjDesc; - ACPI_OPERAND_OBJECT *NewObjDesc; - - - ACPI_FUNCTION_TRACE (DsStoreObjectToLocal); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Type=%2.2X Index=%u Obj=%p\n", - Type, Index, ObjDesc)); - - /* Parameter validation */ - - if (!ObjDesc) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* Get the namespace node for the arg/local */ - - Status = AcpiDsMethodDataGetNode (Type, Index, WalkState, &Node); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - CurrentObjDesc = AcpiNsGetAttachedObject (Node); - if (CurrentObjDesc == ObjDesc) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p already installed!\n", - ObjDesc)); - return_ACPI_STATUS (Status); - } - - /* - * If the reference count on the object is more than one, we must - * take a copy of the object before we store. A reference count - * of exactly 1 means that the object was just created during the - * evaluation of an expression, and we can safely use it since it - * is not used anywhere else. - */ - NewObjDesc = ObjDesc; - if (ObjDesc->Common.ReferenceCount > 1) - { - Status = AcpiUtCopyIobjectToIobject ( - ObjDesc, &NewObjDesc, WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - /* - * If there is an object already in this slot, we either - * have to delete it, or if this is an argument and there - * is an object reference stored there, we have to do - * an indirect store! - */ - if (CurrentObjDesc) - { - /* - * Check for an indirect store if an argument - * contains an object reference (stored as an Node). - * We don't allow this automatic dereferencing for - * locals, since a store to a local should overwrite - * anything there, including an object reference. - * - * If both Arg0 and Local0 contain RefOf (Local4): - * - * Store (1, Arg0) - Causes indirect store to local4 - * Store (1, Local0) - Stores 1 in local0, overwriting - * the reference to local4 - * Store (1, DeRefof (Local0)) - Causes indirect store to local4 - * - * Weird, but true. - */ - if (Type == ACPI_REFCLASS_ARG) - { - /* - * If we have a valid reference object that came from RefOf(), - * do the indirect store - */ - if ((ACPI_GET_DESCRIPTOR_TYPE (CurrentObjDesc) == - ACPI_DESC_TYPE_OPERAND) && - (CurrentObjDesc->Common.Type == - ACPI_TYPE_LOCAL_REFERENCE) && - (CurrentObjDesc->Reference.Class == - ACPI_REFCLASS_REFOF)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Arg (%p) is an ObjRef(Node), storing in node %p\n", - NewObjDesc, CurrentObjDesc)); - - /* - * Store this object to the Node (perform the indirect store) - * NOTE: No implicit conversion is performed, as per the ACPI - * specification rules on storing to Locals/Args. - */ - Status = AcpiExStoreObjectToNode (NewObjDesc, - CurrentObjDesc->Reference.Object, WalkState, - ACPI_NO_IMPLICIT_CONVERSION); - - /* Remove local reference if we copied the object above */ - - if (NewObjDesc != ObjDesc) - { - AcpiUtRemoveReference (NewObjDesc); - } - - return_ACPI_STATUS (Status); - } - } - - /* Delete the existing object before storing the new one */ - - AcpiDsMethodDataDeleteValue (Type, Index, WalkState); - } - - /* - * Install the Obj descriptor (*NewObjDesc) into - * the descriptor for the Arg or Local. - * (increments the object reference count by one) - */ - Status = AcpiDsMethodDataSetValue (Type, Index, NewObjDesc, WalkState); - - /* Remove local reference if we copied the object above */ - - if (NewObjDesc != ObjDesc) - { - AcpiUtRemoveReference (NewObjDesc); - } - - return_ACPI_STATUS (Status); -} - - -#ifdef ACPI_OBSOLETE_FUNCTIONS -/******************************************************************************* - * - * FUNCTION: AcpiDsMethodDataGetType - * - * PARAMETERS: Opcode - Either AML_FIRST LOCAL_OP or - * AML_FIRST_ARG_OP - * Index - Which Local or Arg whose type to get - * WalkState - Current walk state object - * - * RETURN: Data type of current value of the selected Arg or Local - * - * DESCRIPTION: Get the type of the object stored in the Local or Arg - * - ******************************************************************************/ - -ACPI_OBJECT_TYPE -AcpiDsMethodDataGetType ( - UINT16 Opcode, - UINT32 Index, - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node; - ACPI_OPERAND_OBJECT *Object; - - - ACPI_FUNCTION_TRACE (DsMethodDataGetType); - - - /* Get the namespace node for the arg/local */ - - Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node); - if (ACPI_FAILURE (Status)) - { - return_VALUE ((ACPI_TYPE_NOT_FOUND)); - } - - /* Get the object */ - - Object = AcpiNsGetAttachedObject (Node); - if (!Object) - { - /* Uninitialized local/arg, return TYPE_ANY */ - - return_VALUE (ACPI_TYPE_ANY); - } - - /* Get the object type */ - - return_VALUE (Object->Type); -} -#endif diff --git a/drivers/acpica/dsobject.c b/drivers/acpica/dsobject.c deleted file mode 100644 index 08d93ec..0000000 --- a/drivers/acpica/dsobject.c +++ /dev/null @@ -1,698 +0,0 @@ -/****************************************************************************** - * - * Module Name: dsobject - Dispatcher object management routines - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acparser.h" -#include "amlcode.h" -#include "acdispat.h" -#include "acnamesp.h" -#include "acinterp.h" - -#define _COMPONENT ACPI_DISPATCHER - ACPI_MODULE_NAME ("dsobject") - - -/******************************************************************************* - * - * FUNCTION: AcpiDsBuildInternalObject - * - * PARAMETERS: WalkState - Current walk state - * Op - Parser object to be translated - * ObjDescPtr - Where the ACPI internal object is returned - * - * RETURN: Status - * - * DESCRIPTION: Translate a parser Op object to the equivalent namespace object - * Simple objects are any objects other than a package object! - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsBuildInternalObject ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op, - ACPI_OPERAND_OBJECT **ObjDescPtr) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (DsBuildInternalObject); - - - *ObjDescPtr = NULL; - if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP) - { - /* - * This is a named object reference. If this name was - * previously looked up in the namespace, it was stored in - * this op. Otherwise, go ahead and look it up now - */ - if (!Op->Common.Node) - { - /* Check if we are resolving a named reference within a package */ - - if ((Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) || - (Op->Common.Parent->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP)) - { - /* - * We won't resolve package elements here, we will do this - * after all ACPI tables are loaded into the namespace. This - * behavior supports both forward references to named objects - * and external references to objects in other tables. - */ - goto CreateNewObject; - } - else - { - Status = AcpiNsLookup (WalkState->ScopeInfo, - Op->Common.Value.String, - ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, - ACPI_CAST_INDIRECT_PTR ( - ACPI_NAMESPACE_NODE, &(Op->Common.Node))); - if (ACPI_FAILURE (Status)) - { - ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, - Op->Common.Value.String, Status); - return_ACPI_STATUS (Status); - } - } - } - } - -CreateNewObject: - - /* Create and init a new internal ACPI object */ - - ObjDesc = AcpiUtCreateInternalObject ( - (AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode))->ObjectType); - if (!ObjDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - Status = AcpiDsInitObjectFromOp ( - WalkState, Op, Op->Common.AmlOpcode, &ObjDesc); - if (ACPI_FAILURE (Status)) - { - AcpiUtRemoveReference (ObjDesc); - return_ACPI_STATUS (Status); - } - - /* - * Handling for unresolved package reference elements. - * These are elements that are namepaths. - */ - if ((Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) || - (Op->Common.Parent->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP)) - { - ObjDesc->Reference.Resolved = TRUE; - - if ((Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP) && - !ObjDesc->Reference.Node) - { - /* - * Name was unresolved above. - * Get the prefix node for later lookup - */ - ObjDesc->Reference.Node = WalkState->ScopeInfo->Scope.Node; - ObjDesc->Reference.Aml = Op->Common.Aml; - ObjDesc->Reference.Resolved = FALSE; - } - } - - *ObjDescPtr = ObjDesc; - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsBuildInternalBufferObj - * - * PARAMETERS: WalkState - Current walk state - * Op - Parser object to be translated - * BufferLength - Length of the buffer - * ObjDescPtr - Where the ACPI internal object is returned - * - * RETURN: Status - * - * DESCRIPTION: Translate a parser Op package object to the equivalent - * namespace object - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsBuildInternalBufferObj ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op, - UINT32 BufferLength, - ACPI_OPERAND_OBJECT **ObjDescPtr) -{ - ACPI_PARSE_OBJECT *Arg; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_PARSE_OBJECT *ByteList; - UINT32 ByteListLength = 0; - - - ACPI_FUNCTION_TRACE (DsBuildInternalBufferObj); - - - /* - * If we are evaluating a Named buffer object "Name (xxxx, Buffer)". - * The buffer object already exists (from the NS node), otherwise it must - * be created. - */ - ObjDesc = *ObjDescPtr; - if (!ObjDesc) - { - /* Create a new buffer object */ - - ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER); - *ObjDescPtr = ObjDesc; - if (!ObjDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - } - - /* - * Second arg is the buffer data (optional) ByteList can be either - * individual bytes or a string initializer. In either case, a - * ByteList appears in the AML. - */ - Arg = Op->Common.Value.Arg; /* skip first arg */ - - ByteList = Arg->Named.Next; - if (ByteList) - { - if (ByteList->Common.AmlOpcode != AML_INT_BYTELIST_OP) - { - ACPI_ERROR ((AE_INFO, - "Expecting bytelist, found AML opcode 0x%X in op %p", - ByteList->Common.AmlOpcode, ByteList)); - - AcpiUtRemoveReference (ObjDesc); - return (AE_TYPE); - } - - ByteListLength = (UINT32) ByteList->Common.Value.Integer; - } - - /* - * The buffer length (number of bytes) will be the larger of: - * 1) The specified buffer length and - * 2) The length of the initializer byte list - */ - ObjDesc->Buffer.Length = BufferLength; - if (ByteListLength > BufferLength) - { - ObjDesc->Buffer.Length = ByteListLength; - } - - /* Allocate the buffer */ - - if (ObjDesc->Buffer.Length == 0) - { - ObjDesc->Buffer.Pointer = NULL; - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Buffer defined with zero length in AML, creating\n")); - } - else - { - ObjDesc->Buffer.Pointer = - ACPI_ALLOCATE_ZEROED (ObjDesc->Buffer.Length); - if (!ObjDesc->Buffer.Pointer) - { - AcpiUtDeleteObjectDesc (ObjDesc); - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Initialize buffer from the ByteList (if present) */ - - if (ByteList) - { - memcpy (ObjDesc->Buffer.Pointer, ByteList->Named.Data, - ByteListLength); - } - } - - ObjDesc->Buffer.Flags |= AOPOBJ_DATA_VALID; - Op->Common.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjDesc); - return_ACPI_STATUS (AE_OK); -} - -/******************************************************************************* - * - * FUNCTION: AcpiDsCreateNode - * - * PARAMETERS: WalkState - Current walk state - * Node - NS Node to be initialized - * Op - Parser object to be translated - * - * RETURN: Status - * - * DESCRIPTION: Create the object to be associated with a namespace node - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsCreateNode ( - ACPI_WALK_STATE *WalkState, - ACPI_NAMESPACE_NODE *Node, - ACPI_PARSE_OBJECT *Op) -{ - ACPI_STATUS Status; - ACPI_OPERAND_OBJECT *ObjDesc; - - - ACPI_FUNCTION_TRACE_PTR (DsCreateNode, Op); - - - /* - * Because of the execution pass through the non-control-method - * parts of the table, we can arrive here twice. Only init - * the named object node the first time through - */ - if (AcpiNsGetAttachedObject (Node)) - { - return_ACPI_STATUS (AE_OK); - } - - if (!Op->Common.Value.Arg) - { - /* No arguments, there is nothing to do */ - - return_ACPI_STATUS (AE_OK); - } - - /* Build an internal object for the argument(s) */ - - Status = AcpiDsBuildInternalObject ( - WalkState, Op->Common.Value.Arg, &ObjDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Re-type the object according to its argument */ - - Node->Type = ObjDesc->Common.Type; - - /* Attach obj to node */ - - Status = AcpiNsAttachObject (Node, ObjDesc, Node->Type); - - /* Remove local reference to the object */ - - AcpiUtRemoveReference (ObjDesc); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsInitObjectFromOp - * - * PARAMETERS: WalkState - Current walk state - * Op - Parser op used to init the internal object - * Opcode - AML opcode associated with the object - * RetObjDesc - Namespace object to be initialized - * - * RETURN: Status - * - * DESCRIPTION: Initialize a namespace object from a parser Op and its - * associated arguments. The namespace object is a more compact - * representation of the Op and its arguments. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsInitObjectFromOp ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op, - UINT16 Opcode, - ACPI_OPERAND_OBJECT **RetObjDesc) -{ - const ACPI_OPCODE_INFO *OpInfo; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE (DsInitObjectFromOp); - - - ObjDesc = *RetObjDesc; - OpInfo = AcpiPsGetOpcodeInfo (Opcode); - if (OpInfo->Class == AML_CLASS_UNKNOWN) - { - /* Unknown opcode */ - - return_ACPI_STATUS (AE_TYPE); - } - - /* Perform per-object initialization */ - - switch (ObjDesc->Common.Type) - { - case ACPI_TYPE_BUFFER: - /* - * Defer evaluation of Buffer TermArg operand - */ - ObjDesc->Buffer.Node = ACPI_CAST_PTR ( - ACPI_NAMESPACE_NODE, WalkState->Operands[0]); - ObjDesc->Buffer.AmlStart = Op->Named.Data; - ObjDesc->Buffer.AmlLength = Op->Named.Length; - break; - - case ACPI_TYPE_PACKAGE: - /* - * Defer evaluation of Package TermArg operand and all - * package elements. (01/2017): We defer the element - * resolution to allow forward references from the package - * in order to provide compatibility with other ACPI - * implementations. - */ - ObjDesc->Package.Node = ACPI_CAST_PTR ( - ACPI_NAMESPACE_NODE, WalkState->Operands[0]); - - if (!Op->Named.Data) - { - return_ACPI_STATUS (AE_OK); - } - - ObjDesc->Package.AmlStart = Op->Named.Data; - ObjDesc->Package.AmlLength = Op->Named.Length; - break; - - case ACPI_TYPE_INTEGER: - - switch (OpInfo->Type) - { - case AML_TYPE_CONSTANT: - /* - * Resolve AML Constants here - AND ONLY HERE! - * All constants are integers. - * We mark the integer with a flag that indicates that it started - * life as a constant -- so that stores to constants will perform - * as expected (noop). ZeroOp is used as a placeholder for optional - * target operands. - */ - ObjDesc->Common.Flags = AOPOBJ_AML_CONSTANT; - - switch (Opcode) - { - case AML_ZERO_OP: - - ObjDesc->Integer.Value = 0; - break; - - case AML_ONE_OP: - - ObjDesc->Integer.Value = 1; - break; - - case AML_ONES_OP: - - ObjDesc->Integer.Value = ACPI_UINT64_MAX; - - /* Truncate value if we are executing from a 32-bit ACPI table */ - - (void) AcpiExTruncateFor32bitTable (ObjDesc); - break; - - case AML_REVISION_OP: - - ObjDesc->Integer.Value = ACPI_CA_VERSION; - break; - - default: - - ACPI_ERROR ((AE_INFO, - "Unknown constant opcode 0x%X", Opcode)); - Status = AE_AML_OPERAND_TYPE; - break; - } - break; - - case AML_TYPE_LITERAL: - - ObjDesc->Integer.Value = Op->Common.Value.Integer; - - if (AcpiExTruncateFor32bitTable (ObjDesc)) - { - /* Warn if we found a 64-bit constant in a 32-bit table */ - - ACPI_WARNING ((AE_INFO, - "Truncated 64-bit constant found in 32-bit table: %8.8X%8.8X => %8.8X", - ACPI_FORMAT_UINT64 (Op->Common.Value.Integer), - (UINT32) ObjDesc->Integer.Value)); - } - break; - - default: - - ACPI_ERROR ((AE_INFO, "Unknown Integer type 0x%X", - OpInfo->Type)); - Status = AE_AML_OPERAND_TYPE; - break; - } - break; - - case ACPI_TYPE_STRING: - - ObjDesc->String.Pointer = Op->Common.Value.String; - ObjDesc->String.Length = (UINT32) strlen (Op->Common.Value.String); - - /* - * The string is contained in the ACPI table, don't ever try - * to delete it - */ - ObjDesc->Common.Flags |= AOPOBJ_STATIC_POINTER; - break; - - case ACPI_TYPE_METHOD: - break; - - case ACPI_TYPE_LOCAL_REFERENCE: - - switch (OpInfo->Type) - { - case AML_TYPE_LOCAL_VARIABLE: - - /* Local ID (0-7) is (AML opcode - base AML_FIRST_LOCAL_OP) */ - - ObjDesc->Reference.Value = ((UINT32) Opcode) - AML_FIRST_LOCAL_OP; - ObjDesc->Reference.Class = ACPI_REFCLASS_LOCAL; - - Status = AcpiDsMethodDataGetNode (ACPI_REFCLASS_LOCAL, - ObjDesc->Reference.Value, WalkState, - ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, - &ObjDesc->Reference.Object)); - break; - - case AML_TYPE_METHOD_ARGUMENT: - - /* Arg ID (0-6) is (AML opcode - base AML_FIRST_ARG_OP) */ - - ObjDesc->Reference.Value = ((UINT32) Opcode) - AML_FIRST_ARG_OP; - ObjDesc->Reference.Class = ACPI_REFCLASS_ARG; - - Status = AcpiDsMethodDataGetNode (ACPI_REFCLASS_ARG, - ObjDesc->Reference.Value, WalkState, - ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, - &ObjDesc->Reference.Object)); - break; - - default: /* Object name or Debug object */ - - switch (Op->Common.AmlOpcode) - { - case AML_INT_NAMEPATH_OP: - - /* Node was saved in Op */ - - ObjDesc->Reference.Node = Op->Common.Node; - ObjDesc->Reference.Class = ACPI_REFCLASS_NAME; - if (Op->Common.Node) - { - ObjDesc->Reference.Object = Op->Common.Node->Object; - } - break; - - case AML_DEBUG_OP: - - ObjDesc->Reference.Class = ACPI_REFCLASS_DEBUG; - break; - - default: - - ACPI_ERROR ((AE_INFO, - "Unimplemented reference type for AML opcode: 0x%4.4X", Opcode)); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - break; - } - break; - - default: - - ACPI_ERROR ((AE_INFO, "Unimplemented data type: 0x%X", - ObjDesc->Common.Type)); - - Status = AE_AML_OPERAND_TYPE; - break; - } - - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/dsopcode.c b/drivers/acpica/dsopcode.c deleted file mode 100644 index baba680..0000000 --- a/drivers/acpica/dsopcode.c +++ /dev/null @@ -1,950 +0,0 @@ -/****************************************************************************** - * - * Module Name: dsopcode - Dispatcher support for regions and fields - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acparser.h" -#include "amlcode.h" -#include "acdispat.h" -#include "acinterp.h" -#include "acnamesp.h" -#include "acevents.h" -#include "actables.h" - -#define _COMPONENT ACPI_DISPATCHER - ACPI_MODULE_NAME ("dsopcode") - -/* Local prototypes */ - -static ACPI_STATUS -AcpiDsInitBufferField ( - UINT16 AmlOpcode, - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT *BufferDesc, - ACPI_OPERAND_OBJECT *OffsetDesc, - ACPI_OPERAND_OBJECT *LengthDesc, - ACPI_OPERAND_OBJECT *ResultDesc); - - -/******************************************************************************* - * - * FUNCTION: AcpiDsInitializeRegion - * - * PARAMETERS: ObjHandle - Region namespace node - * - * RETURN: Status - * - * DESCRIPTION: Front end to EvInitializeRegion - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsInitializeRegion ( - ACPI_HANDLE ObjHandle) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_STATUS Status; - - - ObjDesc = AcpiNsGetAttachedObject (ObjHandle); - - /* Namespace is NOT locked */ - - Status = AcpiEvInitializeRegion (ObjDesc); - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsInitBufferField - * - * PARAMETERS: AmlOpcode - CreateXxxField - * ObjDesc - BufferField object - * BufferDesc - Host Buffer - * OffsetDesc - Offset into buffer - * LengthDesc - Length of field (CREATE_FIELD_OP only) - * ResultDesc - Where to store the result - * - * RETURN: Status - * - * DESCRIPTION: Perform actual initialization of a buffer field - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDsInitBufferField ( - UINT16 AmlOpcode, - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT *BufferDesc, - ACPI_OPERAND_OBJECT *OffsetDesc, - ACPI_OPERAND_OBJECT *LengthDesc, - ACPI_OPERAND_OBJECT *ResultDesc) -{ - UINT32 Offset; - UINT32 BitOffset; - UINT32 BitCount; - UINT8 FieldFlags; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE_PTR (DsInitBufferField, ObjDesc); - - - /* Host object must be a Buffer */ - - if (BufferDesc->Common.Type != ACPI_TYPE_BUFFER) - { - ACPI_ERROR ((AE_INFO, - "Target of Create Field is not a Buffer object - %s", - AcpiUtGetObjectTypeName (BufferDesc))); - - Status = AE_AML_OPERAND_TYPE; - goto Cleanup; - } - - /* - * The last parameter to all of these opcodes (ResultDesc) started - * out as a NameString, and should therefore now be a NS node - * after resolution in AcpiExResolveOperands(). - */ - if (ACPI_GET_DESCRIPTOR_TYPE (ResultDesc) != ACPI_DESC_TYPE_NAMED) - { - ACPI_ERROR ((AE_INFO, - "(%s) destination not a NS Node [%s]", - AcpiPsGetOpcodeName (AmlOpcode), - AcpiUtGetDescriptorName (ResultDesc))); - - Status = AE_AML_OPERAND_TYPE; - goto Cleanup; - } - - Offset = (UINT32) OffsetDesc->Integer.Value; - - /* - * Setup the Bit offsets and counts, according to the opcode - */ - switch (AmlOpcode) - { - case AML_CREATE_FIELD_OP: - - /* Offset is in bits, count is in bits */ - - FieldFlags = AML_FIELD_ACCESS_BYTE; - BitOffset = Offset; - BitCount = (UINT32) LengthDesc->Integer.Value; - - /* Must have a valid (>0) bit count */ - - if (BitCount == 0) - { - ACPI_BIOS_ERROR ((AE_INFO, - "Attempt to CreateField of length zero")); - Status = AE_AML_OPERAND_VALUE; - goto Cleanup; - } - break; - - case AML_CREATE_BIT_FIELD_OP: - - /* Offset is in bits, Field is one bit */ - - BitOffset = Offset; - BitCount = 1; - FieldFlags = AML_FIELD_ACCESS_BYTE; - break; - - case AML_CREATE_BYTE_FIELD_OP: - - /* Offset is in bytes, field is one byte */ - - BitOffset = 8 * Offset; - BitCount = 8; - FieldFlags = AML_FIELD_ACCESS_BYTE; - break; - - case AML_CREATE_WORD_FIELD_OP: - - /* Offset is in bytes, field is one word */ - - BitOffset = 8 * Offset; - BitCount = 16; - FieldFlags = AML_FIELD_ACCESS_WORD; - break; - - case AML_CREATE_DWORD_FIELD_OP: - - /* Offset is in bytes, field is one dword */ - - BitOffset = 8 * Offset; - BitCount = 32; - FieldFlags = AML_FIELD_ACCESS_DWORD; - break; - - case AML_CREATE_QWORD_FIELD_OP: - - /* Offset is in bytes, field is one qword */ - - BitOffset = 8 * Offset; - BitCount = 64; - FieldFlags = AML_FIELD_ACCESS_QWORD; - break; - - default: - - ACPI_ERROR ((AE_INFO, - "Unknown field creation opcode 0x%02X", - AmlOpcode)); - Status = AE_AML_BAD_OPCODE; - goto Cleanup; - } - - /* Entire field must fit within the current length of the buffer */ - - if ((BitOffset + BitCount) > - (8 * (UINT32) BufferDesc->Buffer.Length)) - { - Status = AE_AML_BUFFER_LIMIT; - ACPI_BIOS_EXCEPTION ((AE_INFO, Status, - "Field [%4.4s] at bit offset/length %u/%u " - "exceeds size of target Buffer (%u bits)", - AcpiUtGetNodeName (ResultDesc), BitOffset, BitCount, - 8 * (UINT32) BufferDesc->Buffer.Length)); - goto Cleanup; - } - - /* - * Initialize areas of the field object that are common to all fields - * For FieldFlags, use LOCK_RULE = 0 (NO_LOCK), - * UPDATE_RULE = 0 (UPDATE_PRESERVE) - */ - Status = AcpiExPrepCommonFieldObject ( - ObjDesc, FieldFlags, 0, BitOffset, BitCount); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - ObjDesc->BufferField.BufferObj = BufferDesc; - ObjDesc->BufferField.IsCreateField = AmlOpcode == AML_CREATE_FIELD_OP; - - /* Reference count for BufferDesc inherits ObjDesc count */ - - BufferDesc->Common.ReferenceCount = (UINT16) - (BufferDesc->Common.ReferenceCount + ObjDesc->Common.ReferenceCount); - - -Cleanup: - - /* Always delete the operands */ - - AcpiUtRemoveReference (OffsetDesc); - AcpiUtRemoveReference (BufferDesc); - - if (AmlOpcode == AML_CREATE_FIELD_OP) - { - AcpiUtRemoveReference (LengthDesc); - } - - /* On failure, delete the result descriptor */ - - if (ACPI_FAILURE (Status)) - { - AcpiUtRemoveReference (ResultDesc); /* Result descriptor */ - } - else - { - /* Now the address and length are valid for this BufferField */ - - ObjDesc->BufferField.Flags |= AOPOBJ_DATA_VALID; - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsEvalBufferFieldOperands - * - * PARAMETERS: WalkState - Current walk - * Op - A valid BufferField Op object - * - * RETURN: Status - * - * DESCRIPTION: Get BufferField Buffer and Index - * Called from AcpiDsExecEndOp during BufferField parse tree walk - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsEvalBufferFieldOperands ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op) -{ - ACPI_STATUS Status; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_NAMESPACE_NODE *Node; - ACPI_PARSE_OBJECT *NextOp; - - - ACPI_FUNCTION_TRACE_PTR (DsEvalBufferFieldOperands, Op); - - - /* - * This is where we evaluate the address and length fields of the - * CreateXxxField declaration - */ - Node = Op->Common.Node; - - /* NextOp points to the op that holds the Buffer */ - - NextOp = Op->Common.Value.Arg; - - /* Evaluate/create the address and length operands */ - - Status = AcpiDsCreateOperands (WalkState, NextOp); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - ObjDesc = AcpiNsGetAttachedObject (Node); - if (!ObjDesc) - { - return_ACPI_STATUS (AE_NOT_EXIST); - } - - /* Resolve the operands */ - - Status = AcpiExResolveOperands ( - Op->Common.AmlOpcode, ACPI_WALK_OPERANDS, WalkState); - if (ACPI_FAILURE (Status)) - { - ACPI_ERROR ((AE_INFO, "(%s) bad operand(s), status 0x%X", - AcpiPsGetOpcodeName (Op->Common.AmlOpcode), Status)); - - return_ACPI_STATUS (Status); - } - - /* Initialize the Buffer Field */ - - if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP) - { - /* NOTE: Slightly different operands for this opcode */ - - Status = AcpiDsInitBufferField (Op->Common.AmlOpcode, ObjDesc, - WalkState->Operands[0], WalkState->Operands[1], - WalkState->Operands[2], WalkState->Operands[3]); - } - else - { - /* All other, CreateXxxField opcodes */ - - Status = AcpiDsInitBufferField (Op->Common.AmlOpcode, ObjDesc, - WalkState->Operands[0], WalkState->Operands[1], - NULL, WalkState->Operands[2]); - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsEvalRegionOperands - * - * PARAMETERS: WalkState - Current walk - * Op - A valid region Op object - * - * RETURN: Status - * - * DESCRIPTION: Get region address and length - * Called from AcpiDsExecEndOp during OpRegion parse tree walk - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsEvalRegionOperands ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op) -{ - ACPI_STATUS Status; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_OPERAND_OBJECT *OperandDesc; - ACPI_NAMESPACE_NODE *Node; - ACPI_PARSE_OBJECT *NextOp; - ACPI_ADR_SPACE_TYPE SpaceId; - - - ACPI_FUNCTION_TRACE_PTR (DsEvalRegionOperands, Op); - - - /* - * This is where we evaluate the address and length fields of the - * OpRegion declaration - */ - Node = Op->Common.Node; - - /* NextOp points to the op that holds the SpaceID */ - - NextOp = Op->Common.Value.Arg; - SpaceId = (ACPI_ADR_SPACE_TYPE) NextOp->Common.Value.Integer; - - /* NextOp points to address op */ - - NextOp = NextOp->Common.Next; - - /* Evaluate/create the address and length operands */ - - Status = AcpiDsCreateOperands (WalkState, NextOp); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Resolve the length and address operands to numbers */ - - Status = AcpiExResolveOperands ( - Op->Common.AmlOpcode, ACPI_WALK_OPERANDS, WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - ObjDesc = AcpiNsGetAttachedObject (Node); - if (!ObjDesc) - { - return_ACPI_STATUS (AE_NOT_EXIST); - } - - /* - * Get the length operand and save it - * (at Top of stack) - */ - OperandDesc = WalkState->Operands[WalkState->NumOperands - 1]; - - ObjDesc->Region.Length = (UINT32) OperandDesc->Integer.Value; - AcpiUtRemoveReference (OperandDesc); - - /* A zero-length operation region is unusable. Just warn */ - - if (!ObjDesc->Region.Length && (SpaceId < ACPI_NUM_PREDEFINED_REGIONS)) - { - ACPI_WARNING ((AE_INFO, - "Operation Region [%4.4s] has zero length (SpaceId %X)", - Node->Name.Ascii, SpaceId)); - } - - /* - * Get the address and save it - * (at top of stack - 1) - */ - OperandDesc = WalkState->Operands[WalkState->NumOperands - 2]; - - ObjDesc->Region.Address = (ACPI_PHYSICAL_ADDRESS) - OperandDesc->Integer.Value; - AcpiUtRemoveReference (OperandDesc); - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n", - ObjDesc, ACPI_FORMAT_UINT64 (ObjDesc->Region.Address), - ObjDesc->Region.Length)); - - Status = AcpiUtAddAddressRange (ObjDesc->Region.SpaceId, - ObjDesc->Region.Address, ObjDesc->Region.Length, Node); - - /* Now the address and length are valid for this opregion */ - - ObjDesc->Region.Flags |= AOPOBJ_DATA_VALID; - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsEvalTableRegionOperands - * - * PARAMETERS: WalkState - Current walk - * Op - A valid region Op object - * - * RETURN: Status - * - * DESCRIPTION: Get region address and length. - * Called from AcpiDsExecEndOp during DataTableRegion parse - * tree walk. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsEvalTableRegionOperands ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op) -{ - ACPI_STATUS Status; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_OPERAND_OBJECT **Operand; - ACPI_NAMESPACE_NODE *Node; - ACPI_PARSE_OBJECT *NextOp; - ACPI_TABLE_HEADER *Table; - UINT32 TableIndex; - - - ACPI_FUNCTION_TRACE_PTR (DsEvalTableRegionOperands, Op); - - - /* - * This is where we evaluate the Signature string, OemId string, - * and OemTableId string of the Data Table Region declaration - */ - Node = Op->Common.Node; - - /* NextOp points to Signature string op */ - - NextOp = Op->Common.Value.Arg; - - /* - * Evaluate/create the Signature string, OemId string, - * and OemTableId string operands - */ - Status = AcpiDsCreateOperands (WalkState, NextOp); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Operand = &WalkState->Operands[0]; - - /* - * Resolve the Signature string, OemId string, - * and OemTableId string operands - */ - Status = AcpiExResolveOperands ( - Op->Common.AmlOpcode, ACPI_WALK_OPERANDS, WalkState); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - /* Find the ACPI table */ - - Status = AcpiTbFindTable ( - Operand[0]->String.Pointer, - Operand[1]->String.Pointer, - Operand[2]->String.Pointer, &TableIndex); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_NOT_FOUND) - { - ACPI_ERROR ((AE_INFO, - "ACPI Table [%4.4s] OEM:(%s, %s) not found in RSDT/XSDT", - Operand[0]->String.Pointer, - Operand[1]->String.Pointer, - Operand[2]->String.Pointer)); - } - goto Cleanup; - } - - Status = AcpiGetTableByIndex (TableIndex, &Table); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - ObjDesc = AcpiNsGetAttachedObject (Node); - if (!ObjDesc) - { - Status = AE_NOT_EXIST; - goto Cleanup; - } - - ObjDesc->Region.Address = ACPI_PTR_TO_PHYSADDR (Table); - ObjDesc->Region.Length = Table->Length; - ObjDesc->Region.Pointer = Table; - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n", - ObjDesc, ACPI_FORMAT_UINT64 (ObjDesc->Region.Address), - ObjDesc->Region.Length)); - - /* Now the address and length are valid for this opregion */ - - ObjDesc->Region.Flags |= AOPOBJ_DATA_VALID; - -Cleanup: - AcpiUtRemoveReference (Operand[0]); - AcpiUtRemoveReference (Operand[1]); - AcpiUtRemoveReference (Operand[2]); - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsEvalDataObjectOperands - * - * PARAMETERS: WalkState - Current walk - * Op - A valid DataObject Op object - * ObjDesc - DataObject - * - * RETURN: Status - * - * DESCRIPTION: Get the operands and complete the following data object types: - * Buffer, Package. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsEvalDataObjectOperands ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op, - ACPI_OPERAND_OBJECT *ObjDesc) -{ - ACPI_STATUS Status; - ACPI_OPERAND_OBJECT *ArgDesc; - UINT32 Length; - - - ACPI_FUNCTION_TRACE (DsEvalDataObjectOperands); - - - /* The first operand (for all of these data objects) is the length */ - - /* - * Set proper index into operand stack for AcpiDsObjStackPush - * invoked inside AcpiDsCreateOperand. - */ - WalkState->OperandIndex = WalkState->NumOperands; - - /* Ignore if child is not valid */ - - if (!Op->Common.Value.Arg) - { - ACPI_ERROR ((AE_INFO, - "Missing child while evaluating opcode %4.4X, Op %p", - Op->Common.AmlOpcode, Op)); - return_ACPI_STATUS (AE_OK); - } - - Status = AcpiDsCreateOperand (WalkState, Op->Common.Value.Arg, 1); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Status = AcpiExResolveOperands (WalkState->Opcode, - &(WalkState->Operands [WalkState->NumOperands -1]), - WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Extract length operand */ - - ArgDesc = WalkState->Operands [WalkState->NumOperands - 1]; - Length = (UINT32) ArgDesc->Integer.Value; - - /* Cleanup for length operand */ - - Status = AcpiDsObjStackPop (1, WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - AcpiUtRemoveReference (ArgDesc); - - /* - * Create the actual data object - */ - switch (Op->Common.AmlOpcode) - { - case AML_BUFFER_OP: - - Status = AcpiDsBuildInternalBufferObj ( - WalkState, Op, Length, &ObjDesc); - break; - - case AML_PACKAGE_OP: - case AML_VARIABLE_PACKAGE_OP: - - Status = AcpiDsBuildInternalPackageObj ( - WalkState, Op, Length, &ObjDesc); - break; - - default: - - return_ACPI_STATUS (AE_AML_BAD_OPCODE); - } - - if (ACPI_SUCCESS (Status)) - { - /* - * Return the object in the WalkState, unless the parent is a package - - * in this case, the return object will be stored in the parse tree - * for the package. - */ - if ((!Op->Common.Parent) || - ((Op->Common.Parent->Common.AmlOpcode != AML_PACKAGE_OP) && - (Op->Common.Parent->Common.AmlOpcode != AML_VARIABLE_PACKAGE_OP) && - (Op->Common.Parent->Common.AmlOpcode != AML_NAME_OP))) - { - WalkState->ResultObj = ObjDesc; - } - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsEvalBankFieldOperands - * - * PARAMETERS: WalkState - Current walk - * Op - A valid BankField Op object - * - * RETURN: Status - * - * DESCRIPTION: Get BankField BankValue - * Called from AcpiDsExecEndOp during BankField parse tree walk - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsEvalBankFieldOperands ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op) -{ - ACPI_STATUS Status; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_OPERAND_OBJECT *OperandDesc; - ACPI_NAMESPACE_NODE *Node; - ACPI_PARSE_OBJECT *NextOp; - ACPI_PARSE_OBJECT *Arg; - - - ACPI_FUNCTION_TRACE_PTR (DsEvalBankFieldOperands, Op); - - - /* - * This is where we evaluate the BankValue field of the - * BankField declaration - */ - - /* NextOp points to the op that holds the Region */ - - NextOp = Op->Common.Value.Arg; - - /* NextOp points to the op that holds the Bank Register */ - - NextOp = NextOp->Common.Next; - - /* NextOp points to the op that holds the Bank Value */ - - NextOp = NextOp->Common.Next; - - /* - * Set proper index into operand stack for AcpiDsObjStackPush - * invoked inside AcpiDsCreateOperand. - * - * We use WalkState->Operands[0] to store the evaluated BankValue - */ - WalkState->OperandIndex = 0; - - Status = AcpiDsCreateOperand (WalkState, NextOp, 0); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Status = AcpiExResolveToValue (&WalkState->Operands[0], WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, - AcpiPsGetOpcodeName (Op->Common.AmlOpcode), 1); - /* - * Get the BankValue operand and save it - * (at Top of stack) - */ - OperandDesc = WalkState->Operands[0]; - - /* Arg points to the start Bank Field */ - - Arg = AcpiPsGetArg (Op, 4); - while (Arg) - { - /* Ignore OFFSET and ACCESSAS terms here */ - - if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP) - { - Node = Arg->Common.Node; - - ObjDesc = AcpiNsGetAttachedObject (Node); - if (!ObjDesc) - { - return_ACPI_STATUS (AE_NOT_EXIST); - } - - ObjDesc->BankField.Value = (UINT32) OperandDesc->Integer.Value; - } - - /* Move to next field in the list */ - - Arg = Arg->Common.Next; - } - - AcpiUtRemoveReference (OperandDesc); - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/dspkginit.c b/drivers/acpica/dspkginit.c deleted file mode 100644 index 22f4a99..0000000 --- a/drivers/acpica/dspkginit.c +++ /dev/null @@ -1,702 +0,0 @@ -/****************************************************************************** - * - * Module Name: dspkginit - Completion of deferred package initialization - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" -#include "amlcode.h" -#include "acdispat.h" -#include "acinterp.h" -#include "acparser.h" - - -#define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("dspkginit") - - -/* Local prototypes */ - -static void -AcpiDsResolvePackageElement ( - ACPI_OPERAND_OBJECT **Element); - - -/******************************************************************************* - * - * FUNCTION: AcpiDsBuildInternalPackageObj - * - * PARAMETERS: WalkState - Current walk state - * Op - Parser object to be translated - * ElementCount - Number of elements in the package - this is - * the NumElements argument to Package() - * ObjDescPtr - Where the ACPI internal object is returned - * - * RETURN: Status - * - * DESCRIPTION: Translate a parser Op package object to the equivalent - * namespace object - * - * NOTE: The number of elements in the package will be always be the NumElements - * count, regardless of the number of elements in the package list. If - * NumElements is smaller, only that many package list elements are used. - * if NumElements is larger, the Package object is padded out with - * objects of type Uninitialized (as per ACPI spec.) - * - * Even though the ASL compilers do not allow NumElements to be smaller - * than the Package list length (for the fixed length package opcode), some - * BIOS code modifies the AML on the fly to adjust the NumElements, and - * this code compensates for that. This also provides compatibility with - * other AML interpreters. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsBuildInternalPackageObj ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op, - UINT32 ElementCount, - ACPI_OPERAND_OBJECT **ObjDescPtr) -{ - ACPI_PARSE_OBJECT *Arg; - ACPI_PARSE_OBJECT *Parent; - ACPI_OPERAND_OBJECT *ObjDesc = NULL; - ACPI_STATUS Status = AE_OK; - BOOLEAN ModuleLevelCode = FALSE; - UINT16 ReferenceCount; - UINT32 Index; - UINT32 i; - - - ACPI_FUNCTION_TRACE (DsBuildInternalPackageObj); - - - /* Check if we are executing module level code */ - - if (WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL) - { - ModuleLevelCode = TRUE; - } - - /* Find the parent of a possibly nested package */ - - Parent = Op->Common.Parent; - while ((Parent->Common.AmlOpcode == AML_PACKAGE_OP) || - (Parent->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP)) - { - Parent = Parent->Common.Parent; - } - - /* - * If we are evaluating a Named package object of the form: - * Name (xxxx, Package) - * the package object already exists, otherwise it must be created. - */ - ObjDesc = *ObjDescPtr; - if (!ObjDesc) - { - ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_PACKAGE); - *ObjDescPtr = ObjDesc; - if (!ObjDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - ObjDesc->Package.Node = Parent->Common.Node; - } - - if (ObjDesc->Package.Flags & AOPOBJ_DATA_VALID) /* Just in case */ - { - return_ACPI_STATUS (AE_OK); - } - - /* - * Allocate the element array (array of pointers to the individual - * objects) if necessary. the count is based on the NumElements - * parameter. Add an extra pointer slot so that the list is always - * null terminated. - */ - if (!ObjDesc->Package.Elements) - { - ObjDesc->Package.Elements = ACPI_ALLOCATE_ZEROED ( - ((ACPI_SIZE) ElementCount + 1) * sizeof (void *)); - - if (!ObjDesc->Package.Elements) - { - AcpiUtDeleteObjectDesc (ObjDesc); - return_ACPI_STATUS (AE_NO_MEMORY); - } - - ObjDesc->Package.Count = ElementCount; - } - - /* First arg is element count. Second arg begins the initializer list */ - - Arg = Op->Common.Value.Arg; - Arg = Arg->Common.Next; - - /* - * If we are executing module-level code, we will defer the - * full resolution of the package elements in order to support - * forward references from the elements. This provides - * compatibility with other ACPI implementations. - */ - if (ModuleLevelCode) - { - ObjDesc->Package.AmlStart = WalkState->Aml; - ObjDesc->Package.AmlLength = 0; - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_PARSE, - "%s: Deferring resolution of Package elements\n", - ACPI_GET_FUNCTION_NAME)); - } - - /* - * Initialize the elements of the package, up to the NumElements count. - * Package is automatically padded with uninitialized (NULL) elements - * if NumElements is greater than the package list length. Likewise, - * Package is truncated if NumElements is less than the list length. - */ - for (i = 0; Arg && (i < ElementCount); i++) - { - if (Arg->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP) - { - if (!Arg->Common.Node) - { - /* - * This is the case where an expression has returned a value. - * The use of expressions (TermArgs) within individual - * package elements is not supported by the AML interpreter, - * even though the ASL grammar supports it. Example: - * - * Name (INT1, 0x1234) - * - * Name (PKG3, Package () { - * Add (INT1, 0xAAAA0000) - * }) - * - * 1) No known AML interpreter supports this type of construct - * 2) This fixes a fault if the construct is encountered - */ - ACPI_EXCEPTION ((AE_INFO, AE_SUPPORT, - "Expressions within package elements are not supported")); - - /* Cleanup the return object, it is not needed */ - - AcpiUtRemoveReference (WalkState->Results->Results.ObjDesc[0]); - return_ACPI_STATUS (AE_SUPPORT); - } - - if (Arg->Common.Node->Type == ACPI_TYPE_METHOD) - { - /* - * A method reference "looks" to the parser to be a method - * invocation, so we special case it here - */ - Arg->Common.AmlOpcode = AML_INT_NAMEPATH_OP; - Status = AcpiDsBuildInternalObject ( - WalkState, Arg, &ObjDesc->Package.Elements[i]); - } - else - { - /* This package element is already built, just get it */ - - ObjDesc->Package.Elements[i] = - ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Arg->Common.Node); - } - } - else - { - Status = AcpiDsBuildInternalObject ( - WalkState, Arg, &ObjDesc->Package.Elements[i]); - if (Status == AE_NOT_FOUND) - { - ACPI_ERROR ((AE_INFO, "%-48s", "****DS namepath not found")); - } - - if (!ModuleLevelCode) - { - /* - * Initialize this package element. This function handles the - * resolution of named references within the package. - * Forward references from module-level code are deferred - * until all ACPI tables are loaded. - */ - AcpiDsInitPackageElement (0, ObjDesc->Package.Elements[i], - NULL, &ObjDesc->Package.Elements[i]); - } - } - - if (*ObjDescPtr) - { - /* Existing package, get existing reference count */ - - ReferenceCount = (*ObjDescPtr)->Common.ReferenceCount; - if (ReferenceCount > 1) - { - /* Make new element ref count match original ref count */ - /* TBD: Probably need an AcpiUtAddReferences function */ - - for (Index = 0; Index < ((UINT32) ReferenceCount - 1); Index++) - { - AcpiUtAddReference ((ObjDesc->Package.Elements[i])); - } - } - } - - Arg = Arg->Common.Next; - } - - /* Check for match between NumElements and actual length of PackageList */ - - if (Arg) - { - /* - * NumElements was exhausted, but there are remaining elements in - * the PackageList. Truncate the package to NumElements. - * - * Note: technically, this is an error, from ACPI spec: "It is an - * error for NumElements to be less than the number of elements in - * the PackageList". However, we just print a message and no - * exception is returned. This provides compatibility with other - * ACPI implementations. Some firmware implementations will alter - * the NumElements on the fly, possibly creating this type of - * ill-formed package object. - */ - while (Arg) - { - /* - * We must delete any package elements that were created earlier - * and are not going to be used because of the package truncation. - */ - if (Arg->Common.Node) - { - AcpiUtRemoveReference ( - ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Arg->Common.Node)); - Arg->Common.Node = NULL; - } - - /* Find out how many elements there really are */ - - i++; - Arg = Arg->Common.Next; - } - - ACPI_INFO (( - "Actual Package length (%u) is larger than " - "NumElements field (%u), truncated", - i, ElementCount)); - } - else if (i < ElementCount) - { - /* - * Arg list (elements) was exhausted, but we did not reach - * NumElements count. - * - * Note: this is not an error, the package is padded out - * with NULLs as per the ACPI specification. - */ - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, - "%s: Package List length (%u) smaller than NumElements " - "count (%u), padded with null elements\n", - ACPI_GET_FUNCTION_NAME, i, ElementCount)); - } - - /* Module-level packages will be resolved later */ - - if (!ModuleLevelCode) - { - ObjDesc->Package.Flags |= AOPOBJ_DATA_VALID; - } - - Op->Common.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjDesc); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsInitPackageElement - * - * PARAMETERS: ACPI_PKG_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Resolve a named reference element within a package object - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsInitPackageElement ( - UINT8 ObjectType, - ACPI_OPERAND_OBJECT *SourceObject, - ACPI_GENERIC_STATE *State, - void *Context) -{ - ACPI_OPERAND_OBJECT **ElementPtr; - - - ACPI_FUNCTION_TRACE (DsInitPackageElement); - - - if (!SourceObject) - { - return_ACPI_STATUS (AE_OK); - } - - /* - * The following code is a bit of a hack to workaround a (current) - * limitation of the ACPI_PKG_CALLBACK interface. We need a pointer - * to the location within the element array because a new object - * may be created and stored there. - */ - if (Context) - { - /* A direct call was made to this function */ - - ElementPtr = (ACPI_OPERAND_OBJECT **) Context; - } - else - { - /* Call came from AcpiUtWalkPackageTree */ - - ElementPtr = State->Pkg.ThisTargetObj; - } - - /* We are only interested in reference objects/elements */ - - if (SourceObject->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) - { - /* Attempt to resolve the (named) reference to a namespace node */ - - AcpiDsResolvePackageElement (ElementPtr); - } - else if (SourceObject->Common.Type == ACPI_TYPE_PACKAGE) - { - SourceObject->Package.Flags |= AOPOBJ_DATA_VALID; - } - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsResolvePackageElement - * - * PARAMETERS: ElementPtr - Pointer to a reference object - * - * RETURN: Possible new element is stored to the indirect ElementPtr - * - * DESCRIPTION: Resolve a package element that is a reference to a named - * object. - * - ******************************************************************************/ - -static void -AcpiDsResolvePackageElement ( - ACPI_OPERAND_OBJECT **ElementPtr) -{ - ACPI_STATUS Status; - ACPI_STATUS Status2; - ACPI_GENERIC_STATE ScopeInfo; - ACPI_OPERAND_OBJECT *Element = *ElementPtr; - ACPI_NAMESPACE_NODE *ResolvedNode; - ACPI_NAMESPACE_NODE *OriginalNode; - char *ExternalPath = ""; - ACPI_OBJECT_TYPE Type; - - - ACPI_FUNCTION_TRACE (DsResolvePackageElement); - - - /* Check if reference element is already resolved */ - - if (Element->Reference.Resolved) - { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_PARSE, - "%s: Package element is already resolved\n", - ACPI_GET_FUNCTION_NAME)); - - return_VOID; - } - - /* Element must be a reference object of correct type */ - - ScopeInfo.Scope.Node = Element->Reference.Node; /* Prefix node */ - - Status = AcpiNsLookup (&ScopeInfo, (char *) Element->Reference.Aml, - ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, - NULL, &ResolvedNode); - if (ACPI_FAILURE (Status)) - { - if ((Status == AE_NOT_FOUND) && AcpiGbl_IgnorePackageResolutionErrors) - { - /* - * Optionally be silent about the NOT_FOUND case for the referenced - * name. Although this is potentially a serious problem, - * it can generate a lot of noise/errors on platforms whose - * firmware carries around a bunch of unused Package objects. - * To disable these errors, set this global to TRUE: - * AcpiGbl_IgnorePackageResolutionErrors - * - * If the AML actually tries to use such a package, the unresolved - * element(s) will be replaced with NULL elements. - */ - - /* Referenced name not found, set the element to NULL */ - - AcpiUtRemoveReference (*ElementPtr); - *ElementPtr = NULL; - return_VOID; - } - - Status2 = AcpiNsExternalizeName (ACPI_UINT32_MAX, - (char *) Element->Reference.Aml, NULL, &ExternalPath); - - ACPI_EXCEPTION ((AE_INFO, Status, - "While resolving a named reference package element - %s", - ExternalPath)); - if (ACPI_SUCCESS (Status2)) - { - ACPI_FREE (ExternalPath); - } - - /* Could not resolve name, set the element to NULL */ - - AcpiUtRemoveReference (*ElementPtr); - *ElementPtr = NULL; - return_VOID; - } - else if (ResolvedNode->Type == ACPI_TYPE_ANY) - { - /* Named reference not resolved, return a NULL package element */ - - ACPI_ERROR ((AE_INFO, - "Could not resolve named package element [%4.4s] in [%4.4s]", - ResolvedNode->Name.Ascii, ScopeInfo.Scope.Node->Name.Ascii)); - *ElementPtr = NULL; - return_VOID; - } - - /* - * Special handling for Alias objects. We need ResolvedNode to point - * to the Alias target. This effectively "resolves" the alias. - */ - if (ResolvedNode->Type == ACPI_TYPE_LOCAL_ALIAS) - { - ResolvedNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, - ResolvedNode->Object); - } - - /* Update the reference object */ - - Element->Reference.Resolved = TRUE; - Element->Reference.Node = ResolvedNode; - Type = Element->Reference.Node->Type; - - /* - * Attempt to resolve the node to a value before we insert it into - * the package. If this is a reference to a common data type, - * resolve it immediately. According to the ACPI spec, package - * elements can only be "data objects" or method references. - * Attempt to resolve to an Integer, Buffer, String or Package. - * If cannot, return the named reference (for things like Devices, - * Methods, etc.) Buffer Fields and Fields will resolve to simple - * objects (int/buf/str/pkg). - * - * NOTE: References to things like Devices, Methods, Mutexes, etc. - * will remain as named references. This behavior is not described - * in the ACPI spec, but it appears to be an oversight. - */ - OriginalNode = ResolvedNode; - Status = AcpiExResolveNodeToValue (&ResolvedNode, NULL); - if (ACPI_FAILURE (Status)) - { - return_VOID; - } - - switch (Type) - { - /* - * These object types are a result of named references, so we will - * leave them as reference objects. In other words, these types - * have no intrinsic "value". - */ - case ACPI_TYPE_DEVICE: - case ACPI_TYPE_THERMAL: - case ACPI_TYPE_METHOD: - break; - - case ACPI_TYPE_MUTEX: - case ACPI_TYPE_POWER: - case ACPI_TYPE_PROCESSOR: - case ACPI_TYPE_EVENT: - case ACPI_TYPE_REGION: - - /* AcpiExResolveNodeToValue gave these an extra reference */ - - AcpiUtRemoveReference (OriginalNode->Object); - break; - - default: - /* - * For all other types - the node was resolved to an actual - * operand object with a value, return the object. Remove - * a reference on the existing object. - */ - AcpiUtRemoveReference (Element); - *ElementPtr = (ACPI_OPERAND_OBJECT *) ResolvedNode; - break; - } - - return_VOID; -} diff --git a/drivers/acpica/dsutils.c b/drivers/acpica/dsutils.c deleted file mode 100644 index d2d16c4..0000000 --- a/drivers/acpica/dsutils.c +++ /dev/null @@ -1,1055 +0,0 @@ -/******************************************************************************* - * - * Module Name: dsutils - Dispatcher utilities - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acparser.h" -#include "amlcode.h" -#include "acdispat.h" -#include "acinterp.h" -#include "acnamesp.h" -#include "acdebug.h" - -#define _COMPONENT ACPI_DISPATCHER - ACPI_MODULE_NAME ("dsutils") - - -/******************************************************************************* - * - * FUNCTION: AcpiDsClearImplicitReturn - * - * PARAMETERS: WalkState - Current State - * - * RETURN: None. - * - * DESCRIPTION: Clear and remove a reference on an implicit return value. Used - * to delete "stale" return values (if enabled, the return value - * from every operator is saved at least momentarily, in case the - * parent method exits.) - * - ******************************************************************************/ - -void -AcpiDsClearImplicitReturn ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_FUNCTION_NAME (DsClearImplicitReturn); - - - /* - * Slack must be enabled for this feature - */ - if (!AcpiGbl_EnableInterpreterSlack) - { - return; - } - - if (WalkState->ImplicitReturnObj) - { - /* - * Delete any "stale" implicit return. However, in - * complex statements, the implicit return value can be - * bubbled up several levels. - */ - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Removing reference on stale implicit return obj %p\n", - WalkState->ImplicitReturnObj)); - - AcpiUtRemoveReference (WalkState->ImplicitReturnObj); - WalkState->ImplicitReturnObj = NULL; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsDoImplicitReturn - * - * PARAMETERS: ReturnDesc - The return value - * WalkState - Current State - * AddReference - True if a reference should be added to the - * return object - * - * RETURN: TRUE if implicit return enabled, FALSE otherwise - * - * DESCRIPTION: Implements the optional "implicit return". We save the result - * of every ASL operator and control method invocation in case the - * parent method exit. Before storing a new return value, we - * delete the previous return value. - * - ******************************************************************************/ - -BOOLEAN -AcpiDsDoImplicitReturn ( - ACPI_OPERAND_OBJECT *ReturnDesc, - ACPI_WALK_STATE *WalkState, - BOOLEAN AddReference) -{ - ACPI_FUNCTION_NAME (DsDoImplicitReturn); - - - /* - * Slack must be enabled for this feature, and we must - * have a valid return object - */ - if ((!AcpiGbl_EnableInterpreterSlack) || - (!ReturnDesc)) - { - return (FALSE); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Result %p will be implicitly returned; Prev=%p\n", - ReturnDesc, - WalkState->ImplicitReturnObj)); - - /* - * Delete any "stale" implicit return value first. However, in - * complex statements, the implicit return value can be - * bubbled up several levels, so we don't clear the value if it - * is the same as the ReturnDesc. - */ - if (WalkState->ImplicitReturnObj) - { - if (WalkState->ImplicitReturnObj == ReturnDesc) - { - return (TRUE); - } - AcpiDsClearImplicitReturn (WalkState); - } - - /* Save the implicit return value, add a reference if requested */ - - WalkState->ImplicitReturnObj = ReturnDesc; - if (AddReference) - { - AcpiUtAddReference (ReturnDesc); - } - - return (TRUE); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsIsResultUsed - * - * PARAMETERS: Op - Current Op - * WalkState - Current State - * - * RETURN: TRUE if result is used, FALSE otherwise - * - * DESCRIPTION: Check if a result object will be used by the parent - * - ******************************************************************************/ - -BOOLEAN -AcpiDsIsResultUsed ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState) -{ - const ACPI_OPCODE_INFO *ParentInfo; - - ACPI_FUNCTION_TRACE_PTR (DsIsResultUsed, Op); - - - /* Must have both an Op and a Result Object */ - - if (!Op) - { - ACPI_ERROR ((AE_INFO, "Null Op")); - return_UINT8 (TRUE); - } - - /* - * We know that this operator is not a - * Return() operator (would not come here.) The following code is the - * optional support for a so-called "implicit return". Some AML code - * assumes that the last value of the method is "implicitly" returned - * to the caller. Just save the last result as the return value. - * NOTE: this is optional because the ASL language does not actually - * support this behavior. - */ - (void) AcpiDsDoImplicitReturn (WalkState->ResultObj, WalkState, TRUE); - - /* - * Now determine if the parent will use the result - * - * If there is no parent, or the parent is a ScopeOp, we are executing - * at the method level. An executing method typically has no parent, - * since each method is parsed separately. A method invoked externally - * via ExecuteControlMethod has a ScopeOp as the parent. - */ - if ((!Op->Common.Parent) || - (Op->Common.Parent->Common.AmlOpcode == AML_SCOPE_OP)) - { - /* No parent, the return value cannot possibly be used */ - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "At Method level, result of [%s] not used\n", - AcpiPsGetOpcodeName (Op->Common.AmlOpcode))); - return_UINT8 (FALSE); - } - - /* Get info on the parent. The RootOp is AML_SCOPE */ - - ParentInfo = AcpiPsGetOpcodeInfo (Op->Common.Parent->Common.AmlOpcode); - if (ParentInfo->Class == AML_CLASS_UNKNOWN) - { - ACPI_ERROR ((AE_INFO, - "Unknown parent opcode Op=%p", Op)); - return_UINT8 (FALSE); - } - - /* - * Decide what to do with the result based on the parent. If - * the parent opcode will not use the result, delete the object. - * Otherwise leave it as is, it will be deleted when it is used - * as an operand later. - */ - switch (ParentInfo->Class) - { - case AML_CLASS_CONTROL: - - switch (Op->Common.Parent->Common.AmlOpcode) - { - case AML_RETURN_OP: - - /* Never delete the return value associated with a return opcode */ - - goto ResultUsed; - - case AML_IF_OP: - case AML_WHILE_OP: - /* - * If we are executing the predicate AND this is the predicate op, - * we will use the return value - */ - if ((WalkState->ControlState->Common.State == - ACPI_CONTROL_PREDICATE_EXECUTING) && - (WalkState->ControlState->Control.PredicateOp == Op)) - { - goto ResultUsed; - } - break; - - default: - - /* Ignore other control opcodes */ - - break; - } - - /* The general control opcode returns no result */ - - goto ResultNotUsed; - - case AML_CLASS_CREATE: - /* - * These opcodes allow TermArg(s) as operands and therefore - * the operands can be method calls. The result is used. - */ - goto ResultUsed; - - case AML_CLASS_NAMED_OBJECT: - - if ((Op->Common.Parent->Common.AmlOpcode == AML_REGION_OP) || - (Op->Common.Parent->Common.AmlOpcode == AML_DATA_REGION_OP) || - (Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) || - (Op->Common.Parent->Common.AmlOpcode == AML_BUFFER_OP) || - (Op->Common.Parent->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP) || - (Op->Common.Parent->Common.AmlOpcode == AML_INT_EVAL_SUBTREE_OP) || - (Op->Common.Parent->Common.AmlOpcode == AML_BANK_FIELD_OP)) - { - /* - * These opcodes allow TermArg(s) as operands and therefore - * the operands can be method calls. The result is used. - */ - goto ResultUsed; - } - - goto ResultNotUsed; - - default: - /* - * In all other cases. the parent will actually use the return - * object, so keep it. - */ - goto ResultUsed; - } - - -ResultUsed: - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Result of [%s] used by Parent [%s] Op=%p\n", - AcpiPsGetOpcodeName (Op->Common.AmlOpcode), - AcpiPsGetOpcodeName (Op->Common.Parent->Common.AmlOpcode), Op)); - - return_UINT8 (TRUE); - - -ResultNotUsed: - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Result of [%s] not used by Parent [%s] Op=%p\n", - AcpiPsGetOpcodeName (Op->Common.AmlOpcode), - AcpiPsGetOpcodeName (Op->Common.Parent->Common.AmlOpcode), Op)); - - return_UINT8 (FALSE); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsDeleteResultIfNotUsed - * - * PARAMETERS: Op - Current parse Op - * ResultObj - Result of the operation - * WalkState - Current state - * - * RETURN: Status - * - * DESCRIPTION: Used after interpretation of an opcode. If there is an internal - * result descriptor, check if the parent opcode will actually use - * this result. If not, delete the result now so that it will - * not become orphaned. - * - ******************************************************************************/ - -void -AcpiDsDeleteResultIfNotUsed ( - ACPI_PARSE_OBJECT *Op, - ACPI_OPERAND_OBJECT *ResultObj, - ACPI_WALK_STATE *WalkState) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE_PTR (DsDeleteResultIfNotUsed, ResultObj); - - - if (!Op) - { - ACPI_ERROR ((AE_INFO, "Null Op")); - return_VOID; - } - - if (!ResultObj) - { - return_VOID; - } - - if (!AcpiDsIsResultUsed (Op, WalkState)) - { - /* Must pop the result stack (ObjDesc should be equal to ResultObj) */ - - Status = AcpiDsResultPop (&ObjDesc, WalkState); - if (ACPI_SUCCESS (Status)) - { - AcpiUtRemoveReference (ResultObj); - } - } - - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsResolveOperands - * - * PARAMETERS: WalkState - Current walk state with operands on stack - * - * RETURN: Status - * - * DESCRIPTION: Resolve all operands to their values. Used to prepare - * arguments to a control method invocation (a call from one - * method to another.) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsResolveOperands ( - ACPI_WALK_STATE *WalkState) -{ - UINT32 i; - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE_PTR (DsResolveOperands, WalkState); - - - /* - * Attempt to resolve each of the valid operands - * Method arguments are passed by reference, not by value. This means - * that the actual objects are passed, not copies of the objects. - */ - for (i = 0; i < WalkState->NumOperands; i++) - { - Status = AcpiExResolveToValue (&WalkState->Operands[i], WalkState); - if (ACPI_FAILURE (Status)) - { - break; - } - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsClearOperands - * - * PARAMETERS: WalkState - Current walk state with operands on stack - * - * RETURN: None - * - * DESCRIPTION: Clear all operands on the current walk state operand stack. - * - ******************************************************************************/ - -void -AcpiDsClearOperands ( - ACPI_WALK_STATE *WalkState) -{ - UINT32 i; - - - ACPI_FUNCTION_TRACE_PTR (DsClearOperands, WalkState); - - - /* Remove a reference on each operand on the stack */ - - for (i = 0; i < WalkState->NumOperands; i++) - { - /* - * Remove a reference to all operands, including both - * "Arguments" and "Targets". - */ - AcpiUtRemoveReference (WalkState->Operands[i]); - WalkState->Operands[i] = NULL; - } - - WalkState->NumOperands = 0; - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsCreateOperand - * - * PARAMETERS: WalkState - Current walk state - * Arg - Parse object for the argument - * ArgIndex - Which argument (zero based) - * - * RETURN: Status - * - * DESCRIPTION: Translate a parse tree object that is an argument to an AML - * opcode to the equivalent interpreter object. This may include - * looking up a name or entering a new name into the internal - * namespace. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsCreateOperand ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Arg, - UINT32 ArgIndex) -{ - ACPI_STATUS Status = AE_OK; - char *NameString; - UINT32 NameLength; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_PARSE_OBJECT *ParentOp; - UINT16 Opcode; - ACPI_INTERPRETER_MODE InterpreterMode; - const ACPI_OPCODE_INFO *OpInfo; - - - ACPI_FUNCTION_TRACE_PTR (DsCreateOperand, Arg); - - - /* A valid name must be looked up in the namespace */ - - if ((Arg->Common.AmlOpcode == AML_INT_NAMEPATH_OP) && - (Arg->Common.Value.String) && - !(Arg->Common.Flags & ACPI_PARSEOP_IN_STACK)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Getting a name: Arg=%p\n", Arg)); - - /* Get the entire name string from the AML stream */ - - Status = AcpiExGetNameString (ACPI_TYPE_ANY, - Arg->Common.Value.Buffer, &NameString, &NameLength); - - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* All prefixes have been handled, and the name is in NameString */ - - /* - * Special handling for BufferField declarations. This is a deferred - * opcode that unfortunately defines the field name as the last - * parameter instead of the first. We get here when we are performing - * the deferred execution, so the actual name of the field is already - * in the namespace. We don't want to attempt to look it up again - * because we may be executing in a different scope than where the - * actual opcode exists. - */ - if ((WalkState->DeferredNode) && - (WalkState->DeferredNode->Type == ACPI_TYPE_BUFFER_FIELD) && - (ArgIndex == (UINT32) - ((WalkState->Opcode == AML_CREATE_FIELD_OP) ? 3 : 2))) - { - ObjDesc = ACPI_CAST_PTR ( - ACPI_OPERAND_OBJECT, WalkState->DeferredNode); - Status = AE_OK; - } - else /* All other opcodes */ - { - /* - * Differentiate between a namespace "create" operation - * versus a "lookup" operation (IMODE_LOAD_PASS2 vs. - * IMODE_EXECUTE) in order to support the creation of - * namespace objects during the execution of control methods. - */ - ParentOp = Arg->Common.Parent; - OpInfo = AcpiPsGetOpcodeInfo (ParentOp->Common.AmlOpcode); - - if ((OpInfo->Flags & AML_NSNODE) && - (ParentOp->Common.AmlOpcode != AML_INT_METHODCALL_OP) && - (ParentOp->Common.AmlOpcode != AML_REGION_OP) && - (ParentOp->Common.AmlOpcode != AML_INT_NAMEPATH_OP)) - { - /* Enter name into namespace if not found */ - - InterpreterMode = ACPI_IMODE_LOAD_PASS2; - } - else - { - /* Return a failure if name not found */ - - InterpreterMode = ACPI_IMODE_EXECUTE; - } - - Status = AcpiNsLookup (WalkState->ScopeInfo, NameString, - ACPI_TYPE_ANY, InterpreterMode, - ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, WalkState, - ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &ObjDesc)); - /* - * The only case where we pass through (ignore) a NOT_FOUND - * error is for the CondRefOf opcode. - */ - if (Status == AE_NOT_FOUND) - { - if (ParentOp->Common.AmlOpcode == AML_CONDITIONAL_REF_OF_OP) - { - /* - * For the Conditional Reference op, it's OK if - * the name is not found; We just need a way to - * indicate this to the interpreter, set the - * object to the root - */ - ObjDesc = ACPI_CAST_PTR ( - ACPI_OPERAND_OBJECT, AcpiGbl_RootNode); - Status = AE_OK; - } - else if (ParentOp->Common.AmlOpcode == AML_EXTERNAL_OP) - { - /* - * This opcode should never appear here. It is used only - * by AML disassemblers and is surrounded by an If(0) - * by the ASL compiler. - * - * Therefore, if we see it here, it is a serious error. - */ - Status = AE_AML_BAD_OPCODE; - } - else - { - /* - * We just plain didn't find it -- which is a - * very serious error at this point - */ - Status = AE_AML_NAME_NOT_FOUND; - } - } - - if (ACPI_FAILURE (Status)) - { - ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, - NameString, Status); - } - } - - /* Free the namestring created above */ - - ACPI_FREE (NameString); - - /* Check status from the lookup */ - - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Put the resulting object onto the current object stack */ - - Status = AcpiDsObjStackPush (ObjDesc, WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - AcpiDbDisplayArgumentObject (ObjDesc, WalkState); - } - else - { - /* Check for null name case */ - - if ((Arg->Common.AmlOpcode == AML_INT_NAMEPATH_OP) && - !(Arg->Common.Flags & ACPI_PARSEOP_IN_STACK)) - { - /* - * If the name is null, this means that this is an - * optional result parameter that was not specified - * in the original ASL. Create a Zero Constant for a - * placeholder. (Store to a constant is a Noop.) - */ - Opcode = AML_ZERO_OP; /* Has no arguments! */ - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Null namepath: Arg=%p\n", Arg)); - } - else - { - Opcode = Arg->Common.AmlOpcode; - } - - /* Get the object type of the argument */ - - OpInfo = AcpiPsGetOpcodeInfo (Opcode); - if (OpInfo->ObjectType == ACPI_TYPE_INVALID) - { - return_ACPI_STATUS (AE_NOT_IMPLEMENTED); - } - - if ((OpInfo->Flags & AML_HAS_RETVAL) || - (Arg->Common.Flags & ACPI_PARSEOP_IN_STACK)) - { - /* - * Use value that was already previously returned - * by the evaluation of this argument - */ - Status = AcpiDsResultPop (&ObjDesc, WalkState); - if (ACPI_FAILURE (Status)) - { - /* - * Only error is underflow, and this indicates - * a missing or null operand! - */ - ACPI_EXCEPTION ((AE_INFO, Status, - "Missing or null operand")); - return_ACPI_STATUS (Status); - } - } - else - { - /* Create an ACPI_INTERNAL_OBJECT for the argument */ - - ObjDesc = AcpiUtCreateInternalObject (OpInfo->ObjectType); - if (!ObjDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Initialize the new object */ - - Status = AcpiDsInitObjectFromOp ( - WalkState, Arg, Opcode, &ObjDesc); - if (ACPI_FAILURE (Status)) - { - AcpiUtDeleteObjectDesc (ObjDesc); - return_ACPI_STATUS (Status); - } - } - - /* Put the operand object on the object stack */ - - Status = AcpiDsObjStackPush (ObjDesc, WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - AcpiDbDisplayArgumentObject (ObjDesc, WalkState); - } - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsCreateOperands - * - * PARAMETERS: WalkState - Current state - * FirstArg - First argument of a parser argument tree - * - * RETURN: Status - * - * DESCRIPTION: Convert an operator's arguments from a parse tree format to - * namespace objects and place those argument object on the object - * stack in preparation for evaluation by the interpreter. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsCreateOperands ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *FirstArg) -{ - ACPI_STATUS Status = AE_OK; - ACPI_PARSE_OBJECT *Arg; - ACPI_PARSE_OBJECT *Arguments[ACPI_OBJ_NUM_OPERANDS]; - UINT32 ArgCount = 0; - UINT32 Index = WalkState->NumOperands; - UINT32 PrevNumOperands = WalkState->NumOperands; - UINT32 NewNumOperands; - UINT32 i; - - - ACPI_FUNCTION_TRACE_PTR (DsCreateOperands, FirstArg); - - - /* Get all arguments in the list */ - - Arg = FirstArg; - while (Arg) - { - if (Index >= ACPI_OBJ_NUM_OPERANDS) - { - return_ACPI_STATUS (AE_BAD_DATA); - } - - Arguments[Index] = Arg; - WalkState->Operands [Index] = NULL; - - /* Move on to next argument, if any */ - - Arg = Arg->Common.Next; - ArgCount++; - Index++; - } - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "NumOperands %d, ArgCount %d, Index %d\n", - WalkState->NumOperands, ArgCount, Index)); - - /* Create the interpreter arguments, in reverse order */ - - NewNumOperands = Index; - Index--; - for (i = 0; i < ArgCount; i++) - { - Arg = Arguments[Index]; - WalkState->OperandIndex = (UINT8) Index; - - Status = AcpiDsCreateOperand (WalkState, Arg, Index); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Created Arg #%u (%p) %u args total\n", - Index, Arg, ArgCount)); - Index--; - } - - return_ACPI_STATUS (Status); - - -Cleanup: - /* - * We must undo everything done above; meaning that we must - * pop everything off of the operand stack and delete those - * objects - */ - WalkState->NumOperands = (UINT8) (i); - AcpiDsObjStackPopAndDelete (NewNumOperands, WalkState); - - /* Restore operand count */ - WalkState->NumOperands = (UINT8) (PrevNumOperands); - - ACPI_EXCEPTION ((AE_INFO, Status, "While creating Arg %u", Index)); - return_ACPI_STATUS (Status); -} - - -/***************************************************************************** - * - * FUNCTION: AcpiDsEvaluateNamePath - * - * PARAMETERS: WalkState - Current state of the parse tree walk, - * the opcode of current operation should be - * AML_INT_NAMEPATH_OP - * - * RETURN: Status - * - * DESCRIPTION: Translate the -NamePath- parse tree object to the equivalent - * interpreter object, convert it to value, if needed, duplicate - * it, if needed, and push it onto the current result stack. - * - ****************************************************************************/ - -ACPI_STATUS -AcpiDsEvaluateNamePath ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status = AE_OK; - ACPI_PARSE_OBJECT *Op = WalkState->Op; - ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; - ACPI_OPERAND_OBJECT *NewObjDesc; - UINT8 Type; - - - ACPI_FUNCTION_TRACE_PTR (DsEvaluateNamePath, WalkState); - - - if (!Op->Common.Parent) - { - /* This happens after certain exception processing */ - - goto Exit; - } - - if ((Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) || - (Op->Common.Parent->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP) || - (Op->Common.Parent->Common.AmlOpcode == AML_REF_OF_OP)) - { - /* TBD: Should we specify this feature as a bit of OpInfo->Flags of these opcodes? */ - - goto Exit; - } - - Status = AcpiDsCreateOperand (WalkState, Op, 0); - if (ACPI_FAILURE (Status)) - { - goto Exit; - } - - if (Op->Common.Flags & ACPI_PARSEOP_TARGET) - { - NewObjDesc = *Operand; - goto PushResult; - } - - Type = (*Operand)->Common.Type; - - Status = AcpiExResolveToValue (Operand, WalkState); - if (ACPI_FAILURE (Status)) - { - goto Exit; - } - - if (Type == ACPI_TYPE_INTEGER) - { - /* It was incremented by AcpiExResolveToValue */ - - AcpiUtRemoveReference (*Operand); - - Status = AcpiUtCopyIobjectToIobject ( - *Operand, &NewObjDesc, WalkState); - if (ACPI_FAILURE (Status)) - { - goto Exit; - } - } - else - { - /* - * The object either was anew created or is - * a Namespace node - don't decrement it. - */ - NewObjDesc = *Operand; - } - - /* Cleanup for name-path operand */ - - Status = AcpiDsObjStackPop (1, WalkState); - if (ACPI_FAILURE (Status)) - { - WalkState->ResultObj = NewObjDesc; - goto Exit; - } - -PushResult: - - WalkState->ResultObj = NewObjDesc; - - Status = AcpiDsResultPush (WalkState->ResultObj, WalkState); - if (ACPI_SUCCESS (Status)) - { - /* Force to take it from stack */ - - Op->Common.Flags |= ACPI_PARSEOP_IN_STACK; - } - -Exit: - - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/dswexec.c b/drivers/acpica/dswexec.c deleted file mode 100644 index bb1558e..0000000 --- a/drivers/acpica/dswexec.c +++ /dev/null @@ -1,928 +0,0 @@ -/****************************************************************************** - * - * Module Name: dswexec - Dispatcher method execution callbacks; - * dispatch to interpreter. - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acparser.h" -#include "amlcode.h" -#include "acdispat.h" -#include "acinterp.h" -#include "acnamesp.h" -#include "acdebug.h" -#ifdef ACPI_EXEC_APP -#include "aecommon.h" -#endif - -#define _COMPONENT ACPI_DISPATCHER - ACPI_MODULE_NAME ("dswexec") - -/* - * Dispatch table for opcode classes - */ -static ACPI_EXECUTE_OP AcpiGbl_OpTypeDispatch [] = -{ - AcpiExOpcode_0A_0T_1R, - AcpiExOpcode_1A_0T_0R, - AcpiExOpcode_1A_0T_1R, - NULL, /* Was: AcpiExOpcode_1A_0T_0R (Was for Load operator) */ - AcpiExOpcode_1A_1T_1R, - AcpiExOpcode_2A_0T_0R, - AcpiExOpcode_2A_0T_1R, - AcpiExOpcode_2A_1T_1R, - AcpiExOpcode_2A_2T_1R, - AcpiExOpcode_3A_0T_0R, - AcpiExOpcode_3A_1T_1R, - AcpiExOpcode_6A_0T_1R -}; - - -/***************************************************************************** - * - * FUNCTION: AcpiDsGetPredicateValue - * - * PARAMETERS: WalkState - Current state of the parse tree walk - * ResultObj - if non-zero, pop result from result stack - * - * RETURN: Status - * - * DESCRIPTION: Get the result of a predicate evaluation - * - ****************************************************************************/ - -ACPI_STATUS -AcpiDsGetPredicateValue ( - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT *ResultObj) -{ - ACPI_STATUS Status = AE_OK; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_OPERAND_OBJECT *LocalObjDesc = NULL; - - - ACPI_FUNCTION_TRACE_PTR (DsGetPredicateValue, WalkState); - - - WalkState->ControlState->Common.State = 0; - - if (ResultObj) - { - Status = AcpiDsResultPop (&ObjDesc, WalkState); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Could not get result from predicate evaluation")); - - return_ACPI_STATUS (Status); - } - } - else - { - Status = AcpiDsCreateOperand (WalkState, WalkState->Op, 0); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Status = AcpiExResolveToValue (&WalkState->Operands [0], WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - ObjDesc = WalkState->Operands [0]; - } - - if (!ObjDesc) - { - ACPI_ERROR ((AE_INFO, - "No predicate ObjDesc=%p State=%p", - ObjDesc, WalkState)); - - return_ACPI_STATUS (AE_AML_NO_OPERAND); - } - - /* - * Result of predicate evaluation must be an Integer - * object. Implicitly convert the argument if necessary. - */ - Status = AcpiExConvertToInteger (ObjDesc, &LocalObjDesc, - ACPI_IMPLICIT_CONVERSION); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - if (LocalObjDesc->Common.Type != ACPI_TYPE_INTEGER) - { - ACPI_ERROR ((AE_INFO, - "Bad predicate (not an integer) ObjDesc=%p State=%p Type=0x%X", - ObjDesc, WalkState, ObjDesc->Common.Type)); - - Status = AE_AML_OPERAND_TYPE; - goto Cleanup; - } - - /* Truncate the predicate to 32-bits if necessary */ - - (void) AcpiExTruncateFor32bitTable (LocalObjDesc); - - /* - * Save the result of the predicate evaluation on - * the control stack - */ - if (LocalObjDesc->Integer.Value) - { - WalkState->ControlState->Common.Value = TRUE; - } - else - { - /* - * Predicate is FALSE, we will just toss the - * rest of the package - */ - WalkState->ControlState->Common.Value = FALSE; - Status = AE_CTRL_FALSE; - } - - /* Predicate can be used for an implicit return value */ - - (void) AcpiDsDoImplicitReturn (LocalObjDesc, WalkState, TRUE); - - -Cleanup: - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Completed a predicate eval=%X Op=%p\n", - WalkState->ControlState->Common.Value, WalkState->Op)); - - /* Break to debugger to display result */ - - AcpiDbDisplayResultObject (LocalObjDesc, WalkState); - - /* - * Delete the predicate result object (we know that - * we don't need it anymore) - */ - if (LocalObjDesc != ObjDesc) - { - AcpiUtRemoveReference (LocalObjDesc); - } - AcpiUtRemoveReference (ObjDesc); - - WalkState->ControlState->Common.State = ACPI_CONTROL_NORMAL; - return_ACPI_STATUS (Status); -} - - -/***************************************************************************** - * - * FUNCTION: AcpiDsExecBeginOp - * - * PARAMETERS: WalkState - Current state of the parse tree walk - * OutOp - Where to return op if a new one is created - * - * RETURN: Status - * - * DESCRIPTION: Descending callback used during the execution of control - * methods. This is where most operators and operands are - * dispatched to the interpreter. - * - ****************************************************************************/ - -ACPI_STATUS -AcpiDsExecBeginOp ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT **OutOp) -{ - ACPI_PARSE_OBJECT *Op; - ACPI_STATUS Status = AE_OK; - UINT32 OpcodeClass; - - - ACPI_FUNCTION_TRACE_PTR (DsExecBeginOp, WalkState); - - - Op = WalkState->Op; - if (!Op) - { - Status = AcpiDsLoad2BeginOp (WalkState, OutOp); - if (ACPI_FAILURE (Status)) - { - goto ErrorExit; - } - - Op = *OutOp; - WalkState->Op = Op; - WalkState->Opcode = Op->Common.AmlOpcode; - WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - - if (AcpiNsOpensScope (WalkState->OpInfo->ObjectType)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "(%s) Popping scope for Op %p\n", - AcpiUtGetTypeName (WalkState->OpInfo->ObjectType), Op)); - - Status = AcpiDsScopeStackPop (WalkState); - if (ACPI_FAILURE (Status)) - { - goto ErrorExit; - } - } - } - - if (Op == WalkState->Origin) - { - if (OutOp) - { - *OutOp = Op; - } - - return_ACPI_STATUS (AE_OK); - } - - /* - * If the previous opcode was a conditional, this opcode - * must be the beginning of the associated predicate. - * Save this knowledge in the current scope descriptor - */ - if ((WalkState->ControlState) && - (WalkState->ControlState->Common.State == - ACPI_CONTROL_CONDITIONAL_EXECUTING)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Exec predicate Op=%p State=%p\n", - Op, WalkState)); - - WalkState->ControlState->Common.State = - ACPI_CONTROL_PREDICATE_EXECUTING; - - /* Save start of predicate */ - - WalkState->ControlState->Control.PredicateOp = Op; - } - - - OpcodeClass = WalkState->OpInfo->Class; - - /* We want to send namepaths to the load code */ - - if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP) - { - OpcodeClass = AML_CLASS_NAMED_OBJECT; - } - - /* - * Handle the opcode based upon the opcode type - */ - switch (OpcodeClass) - { - case AML_CLASS_CONTROL: - - Status = AcpiDsExecBeginControlOp (WalkState, Op); - break; - - case AML_CLASS_NAMED_OBJECT: - - if (WalkState->WalkType & ACPI_WALK_METHOD) - { - /* - * Found a named object declaration during method execution; - * we must enter this object into the namespace. The created - * object is temporary and will be deleted upon completion of - * the execution of this method. - * - * Note 10/2010: Except for the Scope() op. This opcode does - * not actually create a new object, it refers to an existing - * object. However, for Scope(), we want to indeed open a - * new scope. - */ - if (Op->Common.AmlOpcode != AML_SCOPE_OP) - { - Status = AcpiDsLoad2BeginOp (WalkState, NULL); - } - else - { - Status = AcpiDsScopeStackPush ( - Op->Named.Node, Op->Named.Node->Type, WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - } - break; - - case AML_CLASS_EXECUTE: - case AML_CLASS_CREATE: - - break; - - default: - - break; - } - - /* Nothing to do here during method execution */ - - return_ACPI_STATUS (Status); - - -ErrorExit: - Status = AcpiDsMethodError (Status, WalkState); - return_ACPI_STATUS (Status); -} - - -/***************************************************************************** - * - * FUNCTION: AcpiDsExecEndOp - * - * PARAMETERS: WalkState - Current state of the parse tree walk - * - * RETURN: Status - * - * DESCRIPTION: Ascending callback used during the execution of control - * methods. The only thing we really need to do here is to - * notice the beginning of IF, ELSE, and WHILE blocks. - * - ****************************************************************************/ - -ACPI_STATUS -AcpiDsExecEndOp ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_PARSE_OBJECT *Op; - ACPI_STATUS Status = AE_OK; - UINT32 OpType; - UINT32 OpClass; - ACPI_PARSE_OBJECT *NextOp; - ACPI_PARSE_OBJECT *FirstArg; -#ifdef ACPI_EXEC_APP - char *Namepath; - ACPI_OPERAND_OBJECT *ObjDesc; -#endif - - ACPI_FUNCTION_TRACE_PTR (DsExecEndOp, WalkState); - - - Op = WalkState->Op; - OpType = WalkState->OpInfo->Type; - OpClass = WalkState->OpInfo->Class; - - if (OpClass == AML_CLASS_UNKNOWN) - { - ACPI_ERROR ((AE_INFO, "Unknown opcode 0x%X", Op->Common.AmlOpcode)); - return_ACPI_STATUS (AE_NOT_IMPLEMENTED); - } - - FirstArg = Op->Common.Value.Arg; - - /* Init the walk state */ - - WalkState->NumOperands = 0; - WalkState->OperandIndex = 0; - WalkState->ReturnDesc = NULL; - WalkState->ResultObj = NULL; - - /* Call debugger for single step support (DEBUG build only) */ - - Status = AcpiDbSingleStep (WalkState, Op, OpClass); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Decode the Opcode Class */ - - switch (OpClass) - { - case AML_CLASS_ARGUMENT: /* Constants, literals, etc. */ - - if (WalkState->Opcode == AML_INT_NAMEPATH_OP) - { - Status = AcpiDsEvaluateNamePath (WalkState); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - } - break; - - case AML_CLASS_EXECUTE: /* Most operators with arguments */ - - /* Build resolved operand stack */ - - Status = AcpiDsCreateOperands (WalkState, FirstArg); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - /* - * All opcodes require operand resolution, with the only exceptions - * being the ObjectType and SizeOf operators as well as opcodes that - * take no arguments. - */ - if (!(WalkState->OpInfo->Flags & AML_NO_OPERAND_RESOLVE) && - (WalkState->OpInfo->Flags & AML_HAS_ARGS)) - { - /* Resolve all operands */ - - Status = AcpiExResolveOperands (WalkState->Opcode, - &(WalkState->Operands [WalkState->NumOperands -1]), - WalkState); - } - - if (ACPI_SUCCESS (Status)) - { - /* - * Dispatch the request to the appropriate interpreter handler - * routine. There is one routine per opcode "type" based upon the - * number of opcode arguments and return type. - */ - Status = AcpiGbl_OpTypeDispatch[OpType] (WalkState); - } - else - { - /* - * Treat constructs of the form "Store(LocalX,LocalX)" as noops when the - * Local is uninitialized. - */ - if ((Status == AE_AML_UNINITIALIZED_LOCAL) && - (WalkState->Opcode == AML_STORE_OP) && - (WalkState->Operands[0]->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) && - (WalkState->Operands[1]->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) && - (WalkState->Operands[0]->Reference.Class == - WalkState->Operands[1]->Reference.Class) && - (WalkState->Operands[0]->Reference.Value == - WalkState->Operands[1]->Reference.Value)) - { - Status = AE_OK; - } - else - { - ACPI_EXCEPTION ((AE_INFO, Status, - "While resolving operands for [%s]", - AcpiPsGetOpcodeName (WalkState->Opcode))); - } - } - - /* Always delete the argument objects and clear the operand stack */ - - AcpiDsClearOperands (WalkState); - - /* - * If a result object was returned from above, push it on the - * current result stack - */ - if (ACPI_SUCCESS (Status) && - WalkState->ResultObj) - { - Status = AcpiDsResultPush (WalkState->ResultObj, WalkState); - } - break; - - default: - - switch (OpType) - { - case AML_TYPE_CONTROL: /* Type 1 opcode, IF/ELSE/WHILE/NOOP */ - - /* 1 Operand, 0 ExternalResult, 0 InternalResult */ - - Status = AcpiDsExecEndControlOp (WalkState, Op); - - break; - - case AML_TYPE_METHOD_CALL: - /* - * If the method is referenced from within a package - * declaration, it is not a invocation of the method, just - * a reference to it. - */ - if ((Op->Asl.Parent) && - ((Op->Asl.Parent->Asl.AmlOpcode == AML_PACKAGE_OP) || - (Op->Asl.Parent->Asl.AmlOpcode == AML_VARIABLE_PACKAGE_OP))) - { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Method Reference in a Package, Op=%p\n", Op)); - - Op->Common.Node = (ACPI_NAMESPACE_NODE *) - Op->Asl.Value.Arg->Asl.Node; - AcpiUtAddReference (Op->Asl.Value.Arg->Asl.Node->Object); - return_ACPI_STATUS (AE_OK); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Method invocation, Op=%p\n", Op)); - - /* - * (AML_METHODCALL) Op->Asl.Value.Arg->Asl.Node contains - * the method Node pointer - */ - /* NextOp points to the op that holds the method name */ - - NextOp = FirstArg; - - /* NextOp points to first argument op */ - - NextOp = NextOp->Common.Next; - - /* - * Get the method's arguments and put them on the operand stack - */ - Status = AcpiDsCreateOperands (WalkState, NextOp); - if (ACPI_FAILURE (Status)) - { - break; - } - - /* - * Since the operands will be passed to another control method, - * we must resolve all local references here (Local variables, - * arguments to *this* method, etc.) - */ - Status = AcpiDsResolveOperands (WalkState); - if (ACPI_FAILURE (Status)) - { - /* On error, clear all resolved operands */ - - AcpiDsClearOperands (WalkState); - break; - } - - /* - * Tell the walk loop to preempt this running method and - * execute the new method - */ - Status = AE_CTRL_TRANSFER; - - /* - * Return now; we don't want to disturb anything, - * especially the operand count! - */ - return_ACPI_STATUS (Status); - - case AML_TYPE_CREATE_FIELD: - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Executing CreateField Buffer/Index Op=%p\n", Op)); - - Status = AcpiDsLoad2EndOp (WalkState); - if (ACPI_FAILURE (Status)) - { - break; - } - - Status = AcpiDsEvalBufferFieldOperands (WalkState, Op); - if (ACPI_FAILURE (Status)) - { - break; - } - -#ifdef ACPI_EXEC_APP - /* - * AcpiExec support for namespace initialization file (initialize - * BufferFields in this code.) - */ - Namepath = AcpiNsGetExternalPathname (Op->Common.Node); - Status = AeLookupInitFileEntry (Namepath, &ObjDesc); - if (ACPI_SUCCESS (Status)) - { - Status = AcpiExWriteDataToField (ObjDesc, Op->Common.Node->Object, NULL); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, "While writing to buffer field")); - } - } - ACPI_FREE (Namepath); - Status = AE_OK; -#endif - break; - - - case AML_TYPE_CREATE_OBJECT: - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Executing CreateObject (Buffer/Package) Op=%p Child=%p ParentOpcode=%4.4X\n", - Op, Op->Named.Value.Arg, Op->Common.Parent->Common.AmlOpcode)); - - switch (Op->Common.Parent->Common.AmlOpcode) - { - case AML_NAME_OP: - /* - * Put the Node on the object stack (Contains the ACPI Name - * of this object) - */ - WalkState->Operands[0] = (void *) - Op->Common.Parent->Common.Node; - WalkState->NumOperands = 1; - - Status = AcpiDsCreateNode (WalkState, - Op->Common.Parent->Common.Node, Op->Common.Parent); - if (ACPI_FAILURE (Status)) - { - break; - } - - ACPI_FALLTHROUGH; - - case AML_INT_EVAL_SUBTREE_OP: - - Status = AcpiDsEvalDataObjectOperands (WalkState, Op, - AcpiNsGetAttachedObject (Op->Common.Parent->Common.Node)); - break; - - default: - - Status = AcpiDsEvalDataObjectOperands (WalkState, Op, NULL); - break; - } - - /* - * If a result object was returned from above, push it on the - * current result stack - */ - if (WalkState->ResultObj) - { - Status = AcpiDsResultPush (WalkState->ResultObj, WalkState); - } - break; - - case AML_TYPE_NAMED_FIELD: - case AML_TYPE_NAMED_COMPLEX: - case AML_TYPE_NAMED_SIMPLE: - case AML_TYPE_NAMED_NO_OBJ: - - Status = AcpiDsLoad2EndOp (WalkState); - if (ACPI_FAILURE (Status)) - { - break; - } - - if (Op->Common.AmlOpcode == AML_REGION_OP) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Executing OpRegion Address/Length Op=%p\n", Op)); - - Status = AcpiDsEvalRegionOperands (WalkState, Op); - if (ACPI_FAILURE (Status)) - { - break; - } - } - else if (Op->Common.AmlOpcode == AML_DATA_REGION_OP) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Executing DataTableRegion Strings Op=%p\n", Op)); - - Status = AcpiDsEvalTableRegionOperands (WalkState, Op); - if (ACPI_FAILURE (Status)) - { - break; - } - } - else if (Op->Common.AmlOpcode == AML_BANK_FIELD_OP) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Executing BankField Op=%p\n", Op)); - - Status = AcpiDsEvalBankFieldOperands (WalkState, Op); - if (ACPI_FAILURE (Status)) - { - break; - } - } - break; - - case AML_TYPE_UNDEFINED: - - ACPI_ERROR ((AE_INFO, - "Undefined opcode type Op=%p", Op)); - return_ACPI_STATUS (AE_NOT_IMPLEMENTED); - - case AML_TYPE_BOGUS: - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Internal opcode=%X type Op=%p\n", - WalkState->Opcode, Op)); - break; - - default: - - ACPI_ERROR ((AE_INFO, - "Unimplemented opcode, class=0x%X " - "type=0x%X Opcode=0x%X Op=%p", - OpClass, OpType, Op->Common.AmlOpcode, Op)); - - Status = AE_NOT_IMPLEMENTED; - break; - } - } - - /* - * ACPI 2.0 support for 64-bit integers: Truncate numeric - * result value if we are executing from a 32-bit ACPI table - */ - (void) AcpiExTruncateFor32bitTable (WalkState->ResultObj); - - /* - * Check if we just completed the evaluation of a - * conditional predicate - */ - if ((ACPI_SUCCESS (Status)) && - (WalkState->ControlState) && - (WalkState->ControlState->Common.State == - ACPI_CONTROL_PREDICATE_EXECUTING) && - (WalkState->ControlState->Control.PredicateOp == Op)) - { - Status = AcpiDsGetPredicateValue (WalkState, WalkState->ResultObj); - WalkState->ResultObj = NULL; - } - - -Cleanup: - - if (WalkState->ResultObj) - { - /* Break to debugger to display result */ - - AcpiDbDisplayResultObject (WalkState->ResultObj,WalkState); - - /* - * Delete the result op if and only if: - * Parent will not use the result -- such as any - * non-nested type2 op in a method (parent will be method) - */ - AcpiDsDeleteResultIfNotUsed (Op, WalkState->ResultObj, WalkState); - } - -#ifdef _UNDER_DEVELOPMENT - - if (WalkState->ParserState.Aml == WalkState->ParserState.AmlEnd) - { - AcpiDbMethodEnd (WalkState); - } -#endif - - /* Invoke exception handler on error */ - - if (ACPI_FAILURE (Status)) - { - Status = AcpiDsMethodError (Status, WalkState); - } - - /* Always clear the object stack */ - - WalkState->NumOperands = 0; - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/dswload.c b/drivers/acpica/dswload.c deleted file mode 100644 index b4b7e51..0000000 --- a/drivers/acpica/dswload.c +++ /dev/null @@ -1,753 +0,0 @@ -/****************************************************************************** - * - * Module Name: dswload - Dispatcher first pass namespace load callbacks - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acparser.h" -#include "amlcode.h" -#include "acdispat.h" -#include "acinterp.h" -#include "acnamesp.h" -#ifdef ACPI_ASL_COMPILER -#include "acdisasm.h" -#endif - -#define _COMPONENT ACPI_DISPATCHER - ACPI_MODULE_NAME ("dswload") - - -/******************************************************************************* - * - * FUNCTION: AcpiDsInitCallbacks - * - * PARAMETERS: WalkState - Current state of the parse tree walk - * PassNumber - 1, 2, or 3 - * - * RETURN: Status - * - * DESCRIPTION: Init walk state callbacks - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsInitCallbacks ( - ACPI_WALK_STATE *WalkState, - UINT32 PassNumber) -{ - - switch (PassNumber) - { - case 0: - - /* Parse only - caller will setup callbacks */ - - WalkState->ParseFlags = ACPI_PARSE_LOAD_PASS1 | - ACPI_PARSE_DELETE_TREE | - ACPI_PARSE_DISASSEMBLE; - WalkState->DescendingCallback = NULL; - WalkState->AscendingCallback = NULL; - break; - - case 1: - - /* Load pass 1 */ - - WalkState->ParseFlags = ACPI_PARSE_LOAD_PASS1 | - ACPI_PARSE_DELETE_TREE; - WalkState->DescendingCallback = AcpiDsLoad1BeginOp; - WalkState->AscendingCallback = AcpiDsLoad1EndOp; - break; - - case 2: - - /* Load pass 2 */ - - WalkState->ParseFlags = ACPI_PARSE_LOAD_PASS1 | - ACPI_PARSE_DELETE_TREE; - WalkState->DescendingCallback = AcpiDsLoad2BeginOp; - WalkState->AscendingCallback = AcpiDsLoad2EndOp; - break; - - case 3: - - /* Execution pass */ - - WalkState->ParseFlags |= ACPI_PARSE_EXECUTE | - ACPI_PARSE_DELETE_TREE; - WalkState->DescendingCallback = AcpiDsExecBeginOp; - WalkState->AscendingCallback = AcpiDsExecEndOp; - break; - - default: - - return (AE_BAD_PARAMETER); - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsLoad1BeginOp - * - * PARAMETERS: WalkState - Current state of the parse tree walk - * OutOp - Where to return op if a new one is created - * - * RETURN: Status - * - * DESCRIPTION: Descending callback used during the loading of ACPI tables. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsLoad1BeginOp ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT **OutOp) -{ - ACPI_PARSE_OBJECT *Op; - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - ACPI_OBJECT_TYPE ObjectType; - char *Path; - UINT32 Flags; - - - ACPI_FUNCTION_TRACE_PTR (DsLoad1BeginOp, WalkState->Op); - - - Op = WalkState->Op; - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState)); - - /* We are only interested in opcodes that have an associated name */ - - if (Op) - { - if (!(WalkState->OpInfo->Flags & AML_NAMED)) - { - *OutOp = Op; - return_ACPI_STATUS (AE_OK); - } - - /* Check if this object has already been installed in the namespace */ - - if (Op->Common.Node) - { - *OutOp = Op; - return_ACPI_STATUS (AE_OK); - } - } - - Path = AcpiPsGetNextNamestring (&WalkState->ParserState); - - /* Map the raw opcode into an internal object type */ - - ObjectType = WalkState->OpInfo->ObjectType; - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "State=%p Op=%p [%s]\n", WalkState, Op, - AcpiUtGetTypeName (ObjectType))); - - switch (WalkState->Opcode) - { - case AML_SCOPE_OP: - /* - * The target name of the Scope() operator must exist at this point so - * that we can actually open the scope to enter new names underneath it. - * Allow search-to-root for single namesegs. - */ - Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, - ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node)); -#ifdef ACPI_ASL_COMPILER - if (Status == AE_NOT_FOUND) - { - /* - * Table disassembly: - * Target of Scope() not found. Generate an External for it, and - * insert the name into the namespace. - */ - AcpiDmAddOpToExternalList (Op, Path, ACPI_TYPE_DEVICE, 0, 0); - Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, - ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT, - WalkState, &Node); - } -#endif - if (ACPI_FAILURE (Status)) - { - ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, Path, Status); - return_ACPI_STATUS (Status); - } - - /* - * Check to make sure that the target is - * one of the opcodes that actually opens a scope - */ - switch (Node->Type) - { - case ACPI_TYPE_ANY: - case ACPI_TYPE_LOCAL_SCOPE: /* Scope */ - case ACPI_TYPE_DEVICE: - case ACPI_TYPE_POWER: - case ACPI_TYPE_PROCESSOR: - case ACPI_TYPE_THERMAL: - - /* These are acceptable types */ - break; - - case ACPI_TYPE_INTEGER: - case ACPI_TYPE_STRING: - case ACPI_TYPE_BUFFER: - /* - * These types we will allow, but we will change the type. - * This enables some existing code of the form: - * - * Name (DEB, 0) - * Scope (DEB) { ... } - * - * Note: silently change the type here. On the second pass, - * we will report a warning - */ - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Type override - [%4.4s] had invalid type (%s) " - "for Scope operator, changed to type ANY\n", - AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type))); - - Node->Type = ACPI_TYPE_ANY; - WalkState->ScopeInfo->Common.Value = ACPI_TYPE_ANY; - break; - - case ACPI_TYPE_METHOD: - /* - * Allow scope change to root during execution of module-level - * code. Root is typed METHOD during this time. - */ - if ((Node == AcpiGbl_RootNode) && - (WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL)) - { - break; - } - - ACPI_FALLTHROUGH; - - default: - - /* All other types are an error */ - - ACPI_ERROR ((AE_INFO, - "Invalid type (%s) for target of " - "Scope operator [%4.4s] (Cannot override)", - AcpiUtGetTypeName (Node->Type), AcpiUtGetNodeName (Node))); - - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - break; - - default: - /* - * For all other named opcodes, we will enter the name into - * the namespace. - * - * Setup the search flags. - * Since we are entering a name into the namespace, we do not want to - * enable the search-to-root upsearch. - * - * There are only two conditions where it is acceptable that the name - * already exists: - * 1) the Scope() operator can reopen a scoping object that was - * previously defined (Scope, Method, Device, etc.) - * 2) Whenever we are parsing a deferred opcode (OpRegion, Buffer, - * BufferField, or Package), the name of the object is already - * in the namespace. - */ - if (WalkState->DeferredNode) - { - /* This name is already in the namespace, get the node */ - - Node = WalkState->DeferredNode; - Status = AE_OK; - break; - } - - /* - * If we are executing a method, do not create any namespace objects - * during the load phase, only during execution. - */ - if (WalkState->MethodNode) - { - Node = NULL; - Status = AE_OK; - break; - } - - Flags = ACPI_NS_NO_UPSEARCH; - if ((WalkState->Opcode != AML_SCOPE_OP) && - (!(WalkState->ParseFlags & ACPI_PARSE_DEFERRED_OP))) - { - if (WalkState->NamespaceOverride) - { - Flags |= ACPI_NS_OVERRIDE_IF_FOUND; - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Override allowed\n", - AcpiUtGetTypeName (ObjectType))); - } - else - { - Flags |= ACPI_NS_ERROR_IF_FOUND; - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Cannot already exist\n", - AcpiUtGetTypeName (ObjectType))); - } - } - else - { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "[%s] Both Find or Create allowed\n", - AcpiUtGetTypeName (ObjectType))); - } - - /* - * Enter the named type into the internal namespace. We enter the name - * as we go downward in the parse tree. Any necessary subobjects that - * involve arguments to the opcode must be created as we go back up the - * parse tree later. - */ - Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, - ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &Node); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_ALREADY_EXISTS) - { - /* The name already exists in this scope */ - - if (Node->Flags & ANOBJ_IS_EXTERNAL) - { - /* - * Allow one create on an object or segment that was - * previously declared External - */ - Node->Flags &= ~ANOBJ_IS_EXTERNAL; - Node->Type = (UINT8) ObjectType; - - /* Just retyped a node, probably will need to open a scope */ - - if (AcpiNsOpensScope (ObjectType)) - { - Status = AcpiDsScopeStackPush ( - Node, ObjectType, WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - Status = AE_OK; - } - } - - if (ACPI_FAILURE (Status)) - { - ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, Path, Status); - return_ACPI_STATUS (Status); - } - } - break; - } - - /* Common exit */ - - if (!Op) - { - /* Create a new op */ - - Op = AcpiPsAllocOp (WalkState->Opcode, WalkState->Aml); - if (!Op) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - } - - /* Initialize the op */ - -#ifdef ACPI_CONSTANT_EVAL_ONLY - Op->Named.Path = Path; -#endif - - if (Node) - { - /* - * Put the Node in the "op" object that the parser uses, so we - * can get it again quickly when this scope is closed - */ - Op->Common.Node = Node; - Op->Named.Name = Node->Name.Integer; - } - - AcpiPsAppendArg (AcpiPsGetParentScope (&WalkState->ParserState), Op); - *OutOp = Op; - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsLoad1EndOp - * - * PARAMETERS: WalkState - Current state of the parse tree walk - * - * RETURN: Status - * - * DESCRIPTION: Ascending callback used during the loading of the namespace, - * both control methods and everything else. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsLoad1EndOp ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_PARSE_OBJECT *Op; - ACPI_OBJECT_TYPE ObjectType; - ACPI_STATUS Status = AE_OK; -#ifdef ACPI_ASL_COMPILER - UINT8 ParamCount; -#endif - - - ACPI_FUNCTION_TRACE (DsLoad1EndOp); - - - Op = WalkState->Op; - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState)); - - /* - * Disassembler: handle create field operators here. - * - * CreateBufferField is a deferred op that is typically processed in load - * pass 2. However, disassembly of control method contents walk the parse - * tree with ACPI_PARSE_LOAD_PASS1 and AML_CREATE operators are processed - * in a later walk. This is a problem when there is a control method that - * has the same name as the AML_CREATE object. In this case, any use of the - * name segment will be detected as a method call rather than a reference - * to a buffer field. - * - * This earlier creation during disassembly solves this issue by inserting - * the named object in the ACPI namespace so that references to this name - * would be a name string rather than a method call. - */ - if ((WalkState->ParseFlags & ACPI_PARSE_DISASSEMBLE) && - (WalkState->OpInfo->Flags & AML_CREATE)) - { - Status = AcpiDsCreateBufferField (Op, WalkState); - return_ACPI_STATUS (Status); - } - - /* We are only interested in opcodes that have an associated name */ - - if (!(WalkState->OpInfo->Flags & (AML_NAMED | AML_FIELD))) - { - return_ACPI_STATUS (AE_OK); - } - - /* Get the object type to determine if we should pop the scope */ - - ObjectType = WalkState->OpInfo->ObjectType; - - if (WalkState->OpInfo->Flags & AML_FIELD) - { - /* - * If we are executing a method, do not create any namespace objects - * during the load phase, only during execution. - */ - if (!WalkState->MethodNode) - { - if (WalkState->Opcode == AML_FIELD_OP || - WalkState->Opcode == AML_BANK_FIELD_OP || - WalkState->Opcode == AML_INDEX_FIELD_OP) - { - Status = AcpiDsInitFieldObjects (Op, WalkState); - } - } - return_ACPI_STATUS (Status); - } - - /* - * If we are executing a method, do not create any namespace objects - * during the load phase, only during execution. - */ - if (!WalkState->MethodNode) - { - if (Op->Common.AmlOpcode == AML_REGION_OP) - { - Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length, - (ACPI_ADR_SPACE_TYPE) - ((Op->Common.Value.Arg)->Common.Value.Integer), - WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - else if (Op->Common.AmlOpcode == AML_DATA_REGION_OP) - { - Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length, - ACPI_ADR_SPACE_DATA_TABLE, WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - } - - if (Op->Common.AmlOpcode == AML_NAME_OP) - { - /* For Name opcode, get the object type from the argument */ - - if (Op->Common.Value.Arg) - { - ObjectType = (AcpiPsGetOpcodeInfo ( - (Op->Common.Value.Arg)->Common.AmlOpcode))->ObjectType; - - /* Set node type if we have a namespace node */ - - if (Op->Common.Node) - { - Op->Common.Node->Type = (UINT8) ObjectType; - } - } - } - -#ifdef ACPI_ASL_COMPILER - /* - * For external opcode, get the object type from the argument and - * get the parameter count from the argument's next. - */ - if (AcpiGbl_DisasmFlag && - Op->Common.Node && - Op->Common.AmlOpcode == AML_EXTERNAL_OP) - { - /* - * Note, if this external is not a method - * Op->Common.Value.Arg->Common.Next->Common.Value.Integer == 0 - * Therefore, ParamCount will be 0. - */ - ParamCount = (UINT8) Op->Common.Value.Arg->Common.Next->Common.Value.Integer; - ObjectType = (UINT8) Op->Common.Value.Arg->Common.Value.Integer; - Op->Common.Node->Flags |= ANOBJ_IS_EXTERNAL; - Op->Common.Node->Type = (UINT8) ObjectType; - - AcpiDmCreateSubobjectForExternal ((UINT8)ObjectType, - &Op->Common.Node, ParamCount); - - /* - * Add the external to the external list because we may be - * emitting code based off of the items within the external list. - */ - AcpiDmAddOpToExternalList (Op, Op->Named.Path, (UINT8)ObjectType, ParamCount, - ACPI_EXT_ORIGIN_FROM_OPCODE | ACPI_EXT_RESOLVED_REFERENCE); - } -#endif - - /* - * If we are executing a method, do not create any namespace objects - * during the load phase, only during execution. - */ - if (!WalkState->MethodNode) - { - if (Op->Common.AmlOpcode == AML_METHOD_OP) - { - /* - * MethodOp PkgLength NameString MethodFlags TermList - * - * Note: We must create the method node/object pair as soon as we - * see the method declaration. This allows later pass1 parsing - * of invocations of the method (need to know the number of - * arguments.) - */ - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "LOADING-Method: State=%p Op=%p NamedObj=%p\n", - WalkState, Op, Op->Named.Node)); - - if (!AcpiNsGetAttachedObject (Op->Named.Node)) - { - WalkState->Operands[0] = ACPI_CAST_PTR (void, Op->Named.Node); - WalkState->NumOperands = 1; - - Status = AcpiDsCreateOperands ( - WalkState, Op->Common.Value.Arg); - if (ACPI_SUCCESS (Status)) - { - Status = AcpiExCreateMethod (Op->Named.Data, - Op->Named.Length, WalkState); - } - - WalkState->Operands[0] = NULL; - WalkState->NumOperands = 0; - - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - } - } - - /* Pop the scope stack (only if loading a table) */ - - if (!WalkState->MethodNode && - Op->Common.AmlOpcode != AML_EXTERNAL_OP && - AcpiNsOpensScope (ObjectType)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s): Popping scope for Op %p\n", - AcpiUtGetTypeName (ObjectType), Op)); - - Status = AcpiDsScopeStackPop (WalkState); - } - - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/dswload2.c b/drivers/acpica/dswload2.c deleted file mode 100644 index 4ad4014..0000000 --- a/drivers/acpica/dswload2.c +++ /dev/null @@ -1,908 +0,0 @@ -/****************************************************************************** - * - * Module Name: dswload2 - Dispatcher second pass namespace load callbacks - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acparser.h" -#include "amlcode.h" -#include "acdispat.h" -#include "acinterp.h" -#include "acnamesp.h" -#include "acevents.h" -#ifdef ACPI_EXEC_APP -#include "aecommon.h" -#endif - -#define _COMPONENT ACPI_DISPATCHER - ACPI_MODULE_NAME ("dswload2") - - -/******************************************************************************* - * - * FUNCTION: AcpiDsLoad2BeginOp - * - * PARAMETERS: WalkState - Current state of the parse tree walk - * OutOp - Where to return op if a new one is created - * - * RETURN: Status - * - * DESCRIPTION: Descending callback used during the loading of ACPI tables. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsLoad2BeginOp ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT **OutOp) -{ - ACPI_PARSE_OBJECT *Op; - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - ACPI_OBJECT_TYPE ObjectType; - char *BufferPtr; - UINT32 Flags; - - - ACPI_FUNCTION_TRACE (DsLoad2BeginOp); - - - Op = WalkState->Op; - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState)); - - if (Op) - { - if ((WalkState->ControlState) && - (WalkState->ControlState->Common.State == - ACPI_CONTROL_CONDITIONAL_EXECUTING)) - { - /* We are executing a while loop outside of a method */ - - Status = AcpiDsExecBeginOp (WalkState, OutOp); - return_ACPI_STATUS (Status); - } - - /* We only care about Namespace opcodes here */ - - if ((!(WalkState->OpInfo->Flags & AML_NSOPCODE) && - (WalkState->Opcode != AML_INT_NAMEPATH_OP)) || - (!(WalkState->OpInfo->Flags & AML_NAMED))) - { - return_ACPI_STATUS (AE_OK); - } - - /* Get the name we are going to enter or lookup in the namespace */ - - if (WalkState->Opcode == AML_INT_NAMEPATH_OP) - { - /* For Namepath op, get the path string */ - - BufferPtr = Op->Common.Value.String; - if (!BufferPtr) - { - /* No name, just exit */ - - return_ACPI_STATUS (AE_OK); - } - } - else - { - /* Get name from the op */ - - BufferPtr = ACPI_CAST_PTR (char, &Op->Named.Name); - } - } - else - { - /* Get the namestring from the raw AML */ - - BufferPtr = AcpiPsGetNextNamestring (&WalkState->ParserState); - } - - /* Map the opcode into an internal object type */ - - ObjectType = WalkState->OpInfo->ObjectType; - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "State=%p Op=%p Type=%X\n", WalkState, Op, ObjectType)); - - switch (WalkState->Opcode) - { - case AML_FIELD_OP: - case AML_BANK_FIELD_OP: - case AML_INDEX_FIELD_OP: - - Node = NULL; - Status = AE_OK; - break; - - case AML_INT_NAMEPATH_OP: - /* - * The NamePath is an object reference to an existing object. - * Don't enter the name into the namespace, but look it up - * for use later. - */ - Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, - ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, - WalkState, &(Node)); - break; - - case AML_SCOPE_OP: - - /* Special case for Scope(\) -> refers to the Root node */ - - if (Op && (Op->Named.Node == AcpiGbl_RootNode)) - { - Node = Op->Named.Node; - - Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - else - { - /* - * The Path is an object reference to an existing object. - * Don't enter the name into the namespace, but look it up - * for use later. - */ - Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, - ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, - WalkState, &(Node)); - if (ACPI_FAILURE (Status)) - { -#ifdef ACPI_ASL_COMPILER - if (Status == AE_NOT_FOUND) - { - Status = AE_OK; - } - else - { - ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, - BufferPtr, Status); - } -#else - ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, - BufferPtr, Status); -#endif - return_ACPI_STATUS (Status); - } - } - - /* - * We must check to make sure that the target is - * one of the opcodes that actually opens a scope - */ - switch (Node->Type) - { - case ACPI_TYPE_ANY: - case ACPI_TYPE_LOCAL_SCOPE: /* Scope */ - case ACPI_TYPE_DEVICE: - case ACPI_TYPE_POWER: - case ACPI_TYPE_PROCESSOR: - case ACPI_TYPE_THERMAL: - - /* These are acceptable types */ - break; - - case ACPI_TYPE_INTEGER: - case ACPI_TYPE_STRING: - case ACPI_TYPE_BUFFER: - - /* - * These types we will allow, but we will change the type. - * This enables some existing code of the form: - * - * Name (DEB, 0) - * Scope (DEB) { ... } - */ - ACPI_WARNING ((AE_INFO, - "Type override - [%4.4s] had invalid type (%s) " - "for Scope operator, changed to type ANY", - AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type))); - - Node->Type = ACPI_TYPE_ANY; - WalkState->ScopeInfo->Common.Value = ACPI_TYPE_ANY; - break; - - case ACPI_TYPE_METHOD: - - /* - * Allow scope change to root during execution of module-level - * code. Root is typed METHOD during this time. - */ - if ((Node == AcpiGbl_RootNode) && - (WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL)) - { - break; - } - - ACPI_FALLTHROUGH; - - default: - - /* All other types are an error */ - - ACPI_ERROR ((AE_INFO, - "Invalid type (%s) for target of " - "Scope operator [%4.4s] (Cannot override)", - AcpiUtGetTypeName (Node->Type), AcpiUtGetNodeName (Node))); - - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - break; - - default: - - /* All other opcodes */ - - if (Op && Op->Common.Node) - { - /* This op/node was previously entered into the namespace */ - - Node = Op->Common.Node; - - if (AcpiNsOpensScope (ObjectType)) - { - Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - return_ACPI_STATUS (AE_OK); - } - - /* - * Enter the named type into the internal namespace. We enter the name - * as we go downward in the parse tree. Any necessary subobjects that - * involve arguments to the opcode must be created as we go back up the - * parse tree later. - * - * Note: Name may already exist if we are executing a deferred opcode. - */ - if (WalkState->DeferredNode) - { - /* This name is already in the namespace, get the node */ - - Node = WalkState->DeferredNode; - Status = AE_OK; - break; - } - - Flags = ACPI_NS_NO_UPSEARCH; - if (WalkState->PassNumber == ACPI_IMODE_EXECUTE) - { - /* Execution mode, node cannot already exist, node is temporary */ - - Flags |= ACPI_NS_ERROR_IF_FOUND; - - if (!(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL)) - { - Flags |= ACPI_NS_TEMPORARY; - } - } - -#ifdef ACPI_ASL_COMPILER - - /* - * Do not open a scope for AML_EXTERNAL_OP - * AcpiNsLookup can open a new scope based on the object type - * of this op. AML_EXTERNAL_OP is a declaration rather than a - * definition. In the case that this external is a method object, - * AcpiNsLookup will open a new scope. However, an AML_EXTERNAL_OP - * associated with the ACPI_TYPE_METHOD is a declaration, rather than - * a definition. Flags is set to avoid opening a scope for any - * AML_EXTERNAL_OP. - */ - if (WalkState->Opcode == AML_EXTERNAL_OP) - { - Flags |= ACPI_NS_DONT_OPEN_SCOPE; - } -#endif - - /* - * For name creation opcodes, the full namepath prefix must - * exist, except for the final (new) nameseg. - */ - if (WalkState->OpInfo->Flags & AML_NAMED) - { - Flags |= ACPI_NS_PREFIX_MUST_EXIST; - } - - /* Add new entry or lookup existing entry */ - - Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, - ACPI_IMODE_LOAD_PASS2, Flags, WalkState, &Node); - - if (ACPI_SUCCESS (Status) && (Flags & ACPI_NS_TEMPORARY)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "***New Node [%4.4s] %p is temporary\n", - AcpiUtGetNodeName (Node), Node)); - } - break; - } - - if (ACPI_FAILURE (Status)) - { - ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, - BufferPtr, Status); - return_ACPI_STATUS (Status); - } - - if (!Op) - { - /* Create a new op */ - - Op = AcpiPsAllocOp (WalkState->Opcode, WalkState->Aml); - if (!Op) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Initialize the new op */ - - if (Node) - { - Op->Named.Name = Node->Name.Integer; - } - *OutOp = Op; - } - - /* - * Put the Node in the "op" object that the parser uses, so we - * can get it again quickly when this scope is closed - */ - Op->Common.Node = Node; - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsLoad2EndOp - * - * PARAMETERS: WalkState - Current state of the parse tree walk - * - * RETURN: Status - * - * DESCRIPTION: Ascending callback used during the loading of the namespace, - * both control methods and everything else. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsLoad2EndOp ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_PARSE_OBJECT *Op; - ACPI_STATUS Status = AE_OK; - ACPI_OBJECT_TYPE ObjectType; - ACPI_NAMESPACE_NODE *Node; - ACPI_PARSE_OBJECT *Arg; - ACPI_NAMESPACE_NODE *NewNode; - UINT32 i; - UINT8 RegionSpace; -#ifdef ACPI_EXEC_APP - ACPI_OPERAND_OBJECT *ObjDesc; - char *Namepath; -#endif - - - ACPI_FUNCTION_TRACE (DsLoad2EndOp); - - Op = WalkState->Op; - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n", - WalkState->OpInfo->Name, Op, WalkState)); - - /* Check if opcode had an associated namespace object */ - - if (!(WalkState->OpInfo->Flags & AML_NSOBJECT)) - { - return_ACPI_STATUS (AE_OK); - } - - if (Op->Common.AmlOpcode == AML_SCOPE_OP) - { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Ending scope Op=%p State=%p\n", Op, WalkState)); - } - - ObjectType = WalkState->OpInfo->ObjectType; - - /* - * Get the Node/name from the earlier lookup - * (It was saved in the *op structure) - */ - Node = Op->Common.Node; - - /* - * Put the Node on the object stack (Contains the ACPI Name of - * this object) - */ - WalkState->Operands[0] = (void *) Node; - WalkState->NumOperands = 1; - - /* Pop the scope stack */ - - if (AcpiNsOpensScope (ObjectType) && - (Op->Common.AmlOpcode != AML_INT_METHODCALL_OP)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n", - AcpiUtGetTypeName (ObjectType), Op)); - - Status = AcpiDsScopeStackPop (WalkState); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - } - - /* - * Named operations are as follows: - * - * AML_ALIAS - * AML_BANKFIELD - * AML_CREATEBITFIELD - * AML_CREATEBYTEFIELD - * AML_CREATEDWORDFIELD - * AML_CREATEFIELD - * AML_CREATEQWORDFIELD - * AML_CREATEWORDFIELD - * AML_DATA_REGION - * AML_DEVICE - * AML_EVENT - * AML_FIELD - * AML_INDEXFIELD - * AML_METHOD - * AML_METHODCALL - * AML_MUTEX - * AML_NAME - * AML_NAMEDFIELD - * AML_OPREGION - * AML_POWERRES - * AML_PROCESSOR - * AML_SCOPE - * AML_THERMALZONE - */ - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Create-Load [%s] State=%p Op=%p NamedObj=%p\n", - AcpiPsGetOpcodeName (Op->Common.AmlOpcode), WalkState, Op, Node)); - - /* Decode the opcode */ - - Arg = Op->Common.Value.Arg; - - switch (WalkState->OpInfo->Type) - { - - case AML_TYPE_CREATE_FIELD: - /* - * Create the field object, but the field buffer and index must - * be evaluated later during the execution phase - */ - Status = AcpiDsCreateBufferField (Op, WalkState); - if ACPI_FAILURE (Status) - { - ACPI_EXCEPTION ((AE_INFO, Status, "CreateBufferField failure")); - goto Cleanup; - } - break; - - case AML_TYPE_NAMED_FIELD: - /* - * If we are executing a method, initialize the field - */ - if (WalkState->MethodNode) - { - Status = AcpiDsInitFieldObjects (Op, WalkState); - } - - switch (Op->Common.AmlOpcode) - { - case AML_INDEX_FIELD_OP: - - Status = AcpiDsCreateIndexField ( - Op, (ACPI_HANDLE) Arg->Common.Node, WalkState); - break; - - case AML_BANK_FIELD_OP: - - Status = AcpiDsCreateBankField (Op, Arg->Common.Node, WalkState); - break; - - case AML_FIELD_OP: - - Status = AcpiDsCreateField (Op, Arg->Common.Node, WalkState); - break; - - default: - - /* All NAMED_FIELD opcodes must be handled above */ - break; - } - break; - - case AML_TYPE_NAMED_SIMPLE: - - Status = AcpiDsCreateOperands (WalkState, Arg); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - switch (Op->Common.AmlOpcode) - { - case AML_PROCESSOR_OP: - - Status = AcpiExCreateProcessor (WalkState); - break; - - case AML_POWER_RESOURCE_OP: - - Status = AcpiExCreatePowerResource (WalkState); - break; - - case AML_MUTEX_OP: - - Status = AcpiExCreateMutex (WalkState); - break; - - case AML_EVENT_OP: - - Status = AcpiExCreateEvent (WalkState); - break; - - case AML_ALIAS_OP: - - Status = AcpiExCreateAlias (WalkState); - break; - - default: - - /* Unknown opcode */ - - Status = AE_OK; - goto Cleanup; - } - - /* Delete operands */ - - for (i = 1; i < WalkState->NumOperands; i++) - { - AcpiUtRemoveReference (WalkState->Operands[i]); - WalkState->Operands[i] = NULL; - } - - break; - - case AML_TYPE_NAMED_COMPLEX: - - switch (Op->Common.AmlOpcode) - { - case AML_REGION_OP: - case AML_DATA_REGION_OP: - - if (Op->Common.AmlOpcode == AML_REGION_OP) - { - RegionSpace = (ACPI_ADR_SPACE_TYPE) - ((Op->Common.Value.Arg)->Common.Value.Integer); - } - else - { - RegionSpace = ACPI_ADR_SPACE_DATA_TABLE; - } - - /* - * The OpRegion is not fully parsed at this time. The only valid - * argument is the SpaceId. (We must save the address of the - * AML of the address and length operands) - * - * If we have a valid region, initialize it. The namespace is - * unlocked at this point. - * - * Need to unlock interpreter if it is locked (if we are running - * a control method), in order to allow _REG methods to be run - * during AcpiEvInitializeRegion. - */ - if (WalkState->MethodNode) - { - /* - * Executing a method: initialize the region and unlock - * the interpreter - */ - Status = AcpiExCreateRegion (Op->Named.Data, - Op->Named.Length, RegionSpace, WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - Status = AcpiEvInitializeRegion ( - AcpiNsGetAttachedObject (Node)); - break; - - case AML_NAME_OP: - - Status = AcpiDsCreateNode (WalkState, Node, Op); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - -#ifdef ACPI_EXEC_APP - /* - * AcpiExec support for namespace initialization file (initialize - * Name opcodes in this code.) - */ - Namepath = AcpiNsGetExternalPathname (Node); - Status = AeLookupInitFileEntry (Namepath, &ObjDesc); - if (ACPI_SUCCESS (Status)) - { - /* Detach any existing object, attach new object */ - - if (Node->Object) - { - AcpiNsDetachObject (Node); - } - AcpiNsAttachObject (Node, ObjDesc, ObjDesc->Common.Type); - } - ACPI_FREE (Namepath); - Status = AE_OK; -#endif - break; - - case AML_METHOD_OP: - /* - * MethodOp PkgLength NameString MethodFlags TermList - * - * Note: We must create the method node/object pair as soon as we - * see the method declaration. This allows later pass1 parsing - * of invocations of the method (need to know the number of - * arguments.) - */ - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "LOADING-Method: State=%p Op=%p NamedObj=%p\n", - WalkState, Op, Op->Named.Node)); - - if (!AcpiNsGetAttachedObject (Op->Named.Node)) - { - WalkState->Operands[0] = ACPI_CAST_PTR (void, Op->Named.Node); - WalkState->NumOperands = 1; - - Status = AcpiDsCreateOperands ( - WalkState, Op->Common.Value.Arg); - if (ACPI_SUCCESS (Status)) - { - Status = AcpiExCreateMethod ( - Op->Named.Data, Op->Named.Length, WalkState); - } - - WalkState->Operands[0] = NULL; - WalkState->NumOperands = 0; - - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - break; - - - default: - - /* All NAMED_COMPLEX opcodes must be handled above */ - break; - } - break; - - case AML_CLASS_INTERNAL: - - /* case AML_INT_NAMEPATH_OP: */ - break; - - case AML_CLASS_METHOD_CALL: - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n", - WalkState, Op, Node)); - - /* - * Lookup the method name and save the Node - */ - Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, - ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS2, - ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, - WalkState, &(NewNode)); - if (ACPI_SUCCESS (Status)) - { - /* - * Make sure that what we found is indeed a method - * We didn't search for a method on purpose, to see if the name - * would resolve - */ - if (NewNode->Type != ACPI_TYPE_METHOD) - { - Status = AE_AML_OPERAND_TYPE; - } - - /* We could put the returned object (Node) on the object stack for - * later, but for now, we will put it in the "op" object that the - * parser uses, so we can get it again at the end of this scope - */ - Op->Common.Node = NewNode; - } - else - { - ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, - Arg->Common.Value.String, Status); - } - break; - - - default: - - break; - } - -Cleanup: - - /* Remove the Node pushed at the very beginning */ - - WalkState->Operands[0] = NULL; - WalkState->NumOperands = 0; - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/dswscope.c b/drivers/acpica/dswscope.c deleted file mode 100644 index 58cc755..0000000 --- a/drivers/acpica/dswscope.c +++ /dev/null @@ -1,341 +0,0 @@ -/****************************************************************************** - * - * Module Name: dswscope - Scope stack manipulation - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acdispat.h" - - -#define _COMPONENT ACPI_DISPATCHER - ACPI_MODULE_NAME ("dswscope") - - -/**************************************************************************** - * - * FUNCTION: AcpiDsScopeStackClear - * - * PARAMETERS: WalkState - Current state - * - * RETURN: None - * - * DESCRIPTION: Pop (and free) everything on the scope stack except the - * root scope object (which remains at the stack top.) - * - ***************************************************************************/ - -void -AcpiDsScopeStackClear ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_GENERIC_STATE *ScopeInfo; - - ACPI_FUNCTION_NAME (DsScopeStackClear); - - - while (WalkState->ScopeInfo) - { - /* Pop a scope off the stack */ - - ScopeInfo = WalkState->ScopeInfo; - WalkState->ScopeInfo = ScopeInfo->Scope.Next; - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Popped object type (%s)\n", - AcpiUtGetTypeName (ScopeInfo->Common.Value))); - - AcpiUtDeleteGenericState (ScopeInfo); - } -} - - -/**************************************************************************** - * - * FUNCTION: AcpiDsScopeStackPush - * - * PARAMETERS: Node - Name to be made current - * Type - Type of frame being pushed - * WalkState - Current state - * - * RETURN: Status - * - * DESCRIPTION: Push the current scope on the scope stack, and make the - * passed Node current. - * - ***************************************************************************/ - -ACPI_STATUS -AcpiDsScopeStackPush ( - ACPI_NAMESPACE_NODE *Node, - ACPI_OBJECT_TYPE Type, - ACPI_WALK_STATE *WalkState) -{ - ACPI_GENERIC_STATE *ScopeInfo; - ACPI_GENERIC_STATE *OldScopeInfo; - - - ACPI_FUNCTION_TRACE (DsScopeStackPush); - - - if (!Node) - { - /* Invalid scope */ - - ACPI_ERROR ((AE_INFO, "Null scope parameter")); - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* Make sure object type is valid */ - - if (!AcpiUtValidObjectType (Type)) - { - ACPI_WARNING ((AE_INFO, - "Invalid object type: 0x%X", Type)); - } - - /* Allocate a new scope object */ - - ScopeInfo = AcpiUtCreateGenericState (); - if (!ScopeInfo) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Init new scope object */ - - ScopeInfo->Common.DescriptorType = ACPI_DESC_TYPE_STATE_WSCOPE; - ScopeInfo->Scope.Node = Node; - ScopeInfo->Common.Value = (UINT16) Type; - - WalkState->ScopeDepth++; - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "[%.2d] Pushed scope ", (UINT32) WalkState->ScopeDepth)); - - OldScopeInfo = WalkState->ScopeInfo; - if (OldScopeInfo) - { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, - "[%4.4s] (%s)", - AcpiUtGetNodeName (OldScopeInfo->Scope.Node), - AcpiUtGetTypeName (OldScopeInfo->Common.Value))); - } - else - { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, ACPI_NAMESPACE_ROOT)); - } - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, - ", New scope -> [%4.4s] (%s)\n", - AcpiUtGetNodeName (ScopeInfo->Scope.Node), - AcpiUtGetTypeName (ScopeInfo->Common.Value))); - - /* Push new scope object onto stack */ - - AcpiUtPushGenericState (&WalkState->ScopeInfo, ScopeInfo); - return_ACPI_STATUS (AE_OK); -} - - -/**************************************************************************** - * - * FUNCTION: AcpiDsScopeStackPop - * - * PARAMETERS: WalkState - Current state - * - * RETURN: Status - * - * DESCRIPTION: Pop the scope stack once. - * - ***************************************************************************/ - -ACPI_STATUS -AcpiDsScopeStackPop ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_GENERIC_STATE *ScopeInfo; - ACPI_GENERIC_STATE *NewScopeInfo; - - - ACPI_FUNCTION_TRACE (DsScopeStackPop); - - - /* - * Pop scope info object off the stack. - */ - ScopeInfo = AcpiUtPopGenericState (&WalkState->ScopeInfo); - if (!ScopeInfo) - { - return_ACPI_STATUS (AE_STACK_UNDERFLOW); - } - - WalkState->ScopeDepth--; - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "[%.2d] Popped scope [%4.4s] (%s), New scope -> ", - (UINT32) WalkState->ScopeDepth, - AcpiUtGetNodeName (ScopeInfo->Scope.Node), - AcpiUtGetTypeName (ScopeInfo->Common.Value))); - - NewScopeInfo = WalkState->ScopeInfo; - if (NewScopeInfo) - { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "[%4.4s] (%s)\n", - AcpiUtGetNodeName (NewScopeInfo->Scope.Node), - AcpiUtGetTypeName (NewScopeInfo->Common.Value))); - } - else - { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "%s\n", ACPI_NAMESPACE_ROOT)); - } - - AcpiUtDeleteGenericState (ScopeInfo); - return_ACPI_STATUS (AE_OK); -} diff --git a/drivers/acpica/dswstate.c b/drivers/acpica/dswstate.c deleted file mode 100644 index a5a63d0..0000000 --- a/drivers/acpica/dswstate.c +++ /dev/null @@ -1,955 +0,0 @@ -/****************************************************************************** - * - * Module Name: dswstate - Dispatcher parse tree walk management routines - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acparser.h" -#include "acdispat.h" -#include "acnamesp.h" - -#define _COMPONENT ACPI_DISPATCHER - ACPI_MODULE_NAME ("dswstate") - -/* Local prototypes */ - -static ACPI_STATUS -AcpiDsResultStackPush ( - ACPI_WALK_STATE *WalkState); - -static ACPI_STATUS -AcpiDsResultStackPop ( - ACPI_WALK_STATE *WalkState); - - -/******************************************************************************* - * - * FUNCTION: AcpiDsResultPop - * - * PARAMETERS: Object - Where to return the popped object - * WalkState - Current Walk state - * - * RETURN: Status - * - * DESCRIPTION: Pop an object off the top of this walk's result stack - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsResultPop ( - ACPI_OPERAND_OBJECT **Object, - ACPI_WALK_STATE *WalkState) -{ - UINT32 Index; - ACPI_GENERIC_STATE *State; - ACPI_STATUS Status; - - - ACPI_FUNCTION_NAME (DsResultPop); - - - State = WalkState->Results; - - /* Incorrect state of result stack */ - - if (State && !WalkState->ResultCount) - { - ACPI_ERROR ((AE_INFO, "No results on result stack")); - return (AE_AML_INTERNAL); - } - - if (!State && WalkState->ResultCount) - { - ACPI_ERROR ((AE_INFO, "No result state for result stack")); - return (AE_AML_INTERNAL); - } - - /* Empty result stack */ - - if (!State) - { - ACPI_ERROR ((AE_INFO, "Result stack is empty! State=%p", WalkState)); - return (AE_AML_NO_RETURN_VALUE); - } - - /* Return object of the top element and clean that top element result stack */ - - WalkState->ResultCount--; - Index = (UINT32) WalkState->ResultCount % ACPI_RESULTS_FRAME_OBJ_NUM; - - *Object = State->Results.ObjDesc [Index]; - if (!*Object) - { - ACPI_ERROR ((AE_INFO, "No result objects on result stack, State=%p", - WalkState)); - return (AE_AML_NO_RETURN_VALUE); - } - - State->Results.ObjDesc [Index] = NULL; - if (Index == 0) - { - Status = AcpiDsResultStackPop (WalkState); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Obj=%p [%s] Index=%X State=%p Num=%X\n", *Object, - AcpiUtGetObjectTypeName (*Object), - Index, WalkState, WalkState->ResultCount)); - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsResultPush - * - * PARAMETERS: Object - Where to return the popped object - * WalkState - Current Walk state - * - * RETURN: Status - * - * DESCRIPTION: Push an object onto the current result stack - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsResultPush ( - ACPI_OPERAND_OBJECT *Object, - ACPI_WALK_STATE *WalkState) -{ - ACPI_GENERIC_STATE *State; - ACPI_STATUS Status; - UINT32 Index; - - - ACPI_FUNCTION_NAME (DsResultPush); - - - if (WalkState->ResultCount > WalkState->ResultSize) - { - ACPI_ERROR ((AE_INFO, "Result stack is full")); - return (AE_AML_INTERNAL); - } - else if (WalkState->ResultCount == WalkState->ResultSize) - { - /* Extend the result stack */ - - Status = AcpiDsResultStackPush (WalkState); - if (ACPI_FAILURE (Status)) - { - ACPI_ERROR ((AE_INFO, "Failed to extend the result stack")); - return (Status); - } - } - - if (!(WalkState->ResultCount < WalkState->ResultSize)) - { - ACPI_ERROR ((AE_INFO, "No free elements in result stack")); - return (AE_AML_INTERNAL); - } - - State = WalkState->Results; - if (!State) - { - ACPI_ERROR ((AE_INFO, "No result stack frame during push")); - return (AE_AML_INTERNAL); - } - - if (!Object) - { - ACPI_ERROR ((AE_INFO, - "Null Object! State=%p Num=%u", - WalkState, WalkState->ResultCount)); - return (AE_BAD_PARAMETER); - } - - /* Assign the address of object to the top free element of result stack */ - - Index = (UINT32) WalkState->ResultCount % ACPI_RESULTS_FRAME_OBJ_NUM; - State->Results.ObjDesc [Index] = Object; - WalkState->ResultCount++; - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p Num=%X Cur=%X\n", - Object, AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object), - WalkState, WalkState->ResultCount, WalkState->CurrentResult)); - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsResultStackPush - * - * PARAMETERS: WalkState - Current Walk state - * - * RETURN: Status - * - * DESCRIPTION: Push an object onto the WalkState result stack - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDsResultStackPush ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_GENERIC_STATE *State; - - - ACPI_FUNCTION_NAME (DsResultStackPush); - - - /* Check for stack overflow */ - - if (((UINT32) WalkState->ResultSize + ACPI_RESULTS_FRAME_OBJ_NUM) > - ACPI_RESULTS_OBJ_NUM_MAX) - { - ACPI_ERROR ((AE_INFO, "Result stack overflow: State=%p Num=%u", - WalkState, WalkState->ResultSize)); - return (AE_STACK_OVERFLOW); - } - - State = AcpiUtCreateGenericState (); - if (!State) - { - return (AE_NO_MEMORY); - } - - State->Common.DescriptorType = ACPI_DESC_TYPE_STATE_RESULT; - AcpiUtPushGenericState (&WalkState->Results, State); - - /* Increase the length of the result stack by the length of frame */ - - WalkState->ResultSize += ACPI_RESULTS_FRAME_OBJ_NUM; - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Results=%p State=%p\n", - State, WalkState)); - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsResultStackPop - * - * PARAMETERS: WalkState - Current Walk state - * - * RETURN: Status - * - * DESCRIPTION: Pop an object off of the WalkState result stack - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDsResultStackPop ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_GENERIC_STATE *State; - - - ACPI_FUNCTION_NAME (DsResultStackPop); - - - /* Check for stack underflow */ - - if (WalkState->Results == NULL) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Result stack underflow - State=%p\n", WalkState)); - return (AE_AML_NO_OPERAND); - } - - if (WalkState->ResultSize < ACPI_RESULTS_FRAME_OBJ_NUM) - { - ACPI_ERROR ((AE_INFO, "Insufficient result stack size")); - return (AE_AML_INTERNAL); - } - - State = AcpiUtPopGenericState (&WalkState->Results); - AcpiUtDeleteGenericState (State); - - /* Decrease the length of result stack by the length of frame */ - - WalkState->ResultSize -= ACPI_RESULTS_FRAME_OBJ_NUM; - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Result=%p RemainingResults=%X State=%p\n", - State, WalkState->ResultCount, WalkState)); - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsObjStackPush - * - * PARAMETERS: Object - Object to push - * WalkState - Current Walk state - * - * RETURN: Status - * - * DESCRIPTION: Push an object onto this walk's object/operand stack - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsObjStackPush ( - void *Object, - ACPI_WALK_STATE *WalkState) -{ - ACPI_FUNCTION_NAME (DsObjStackPush); - - - /* Check for stack overflow */ - - if (WalkState->NumOperands >= ACPI_OBJ_NUM_OPERANDS) - { - ACPI_ERROR ((AE_INFO, - "Object stack overflow! Obj=%p State=%p #Ops=%u", - Object, WalkState, WalkState->NumOperands)); - return (AE_STACK_OVERFLOW); - } - - /* Put the object onto the stack */ - - WalkState->Operands [WalkState->OperandIndex] = Object; - WalkState->NumOperands++; - - /* For the usual order of filling the operand stack */ - - WalkState->OperandIndex++; - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n", - Object, AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object), - WalkState, WalkState->NumOperands)); - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsObjStackPop - * - * PARAMETERS: PopCount - Number of objects/entries to pop - * WalkState - Current Walk state - * - * RETURN: Status - * - * DESCRIPTION: Pop this walk's object stack. Objects on the stack are NOT - * deleted by this routine. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsObjStackPop ( - UINT32 PopCount, - ACPI_WALK_STATE *WalkState) -{ - UINT32 i; - - - ACPI_FUNCTION_NAME (DsObjStackPop); - - - for (i = 0; i < PopCount; i++) - { - /* Check for stack underflow */ - - if (WalkState->NumOperands == 0) - { - ACPI_ERROR ((AE_INFO, - "Object stack underflow! Count=%X State=%p #Ops=%u", - PopCount, WalkState, WalkState->NumOperands)); - return (AE_STACK_UNDERFLOW); - } - - /* Just set the stack entry to null */ - - WalkState->NumOperands--; - WalkState->Operands [WalkState->NumOperands] = NULL; - } - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%u\n", - PopCount, WalkState, WalkState->NumOperands)); - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsObjStackPopAndDelete - * - * PARAMETERS: PopCount - Number of objects/entries to pop - * WalkState - Current Walk state - * - * RETURN: Status - * - * DESCRIPTION: Pop this walk's object stack and delete each object that is - * popped off. - * - ******************************************************************************/ - -void -AcpiDsObjStackPopAndDelete ( - UINT32 PopCount, - ACPI_WALK_STATE *WalkState) -{ - INT32 i; - ACPI_OPERAND_OBJECT *ObjDesc; - - - ACPI_FUNCTION_NAME (DsObjStackPopAndDelete); - - - if (PopCount == 0) - { - return; - } - - for (i = (INT32) PopCount - 1; i >= 0; i--) - { - if (WalkState->NumOperands == 0) - { - return; - } - - /* Pop the stack and delete an object if present in this stack entry */ - - WalkState->NumOperands--; - ObjDesc = WalkState->Operands [i]; - if (ObjDesc) - { - AcpiUtRemoveReference (WalkState->Operands [i]); - WalkState->Operands [i] = NULL; - } - } - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n", - PopCount, WalkState, WalkState->NumOperands)); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsGetCurrentWalkState - * - * PARAMETERS: Thread - Get current active state for this Thread - * - * RETURN: Pointer to the current walk state - * - * DESCRIPTION: Get the walk state that is at the head of the list (the "current" - * walk state.) - * - ******************************************************************************/ - -ACPI_WALK_STATE * -AcpiDsGetCurrentWalkState ( - ACPI_THREAD_STATE *Thread) -{ - ACPI_FUNCTION_NAME (DsGetCurrentWalkState); - - - if (!Thread) - { - return (NULL); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Current WalkState %p\n", - Thread->WalkStateList)); - - return (Thread->WalkStateList); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsPushWalkState - * - * PARAMETERS: WalkState - State to push - * Thread - Thread state object - * - * RETURN: None - * - * DESCRIPTION: Place the Thread state at the head of the state list - * - ******************************************************************************/ - -void -AcpiDsPushWalkState ( - ACPI_WALK_STATE *WalkState, - ACPI_THREAD_STATE *Thread) -{ - ACPI_FUNCTION_TRACE (DsPushWalkState); - - - WalkState->Next = Thread->WalkStateList; - Thread->WalkStateList = WalkState; - - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsPopWalkState - * - * PARAMETERS: Thread - Current thread state - * - * RETURN: A WalkState object popped from the thread's stack - * - * DESCRIPTION: Remove and return the walkstate object that is at the head of - * the walk stack for the given walk list. NULL indicates that - * the list is empty. - * - ******************************************************************************/ - -ACPI_WALK_STATE * -AcpiDsPopWalkState ( - ACPI_THREAD_STATE *Thread) -{ - ACPI_WALK_STATE *WalkState; - - - ACPI_FUNCTION_TRACE (DsPopWalkState); - - - WalkState = Thread->WalkStateList; - - if (WalkState) - { - /* Next walk state becomes the current walk state */ - - Thread->WalkStateList = WalkState->Next; - - /* - * Don't clear the NEXT field, this serves as an indicator - * that there is a parent WALK STATE - * Do Not: WalkState->Next = NULL; - */ - } - - return_PTR (WalkState); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsCreateWalkState - * - * PARAMETERS: OwnerId - ID for object creation - * Origin - Starting point for this walk - * MethodDesc - Method object - * Thread - Current thread state - * - * RETURN: Pointer to the new walk state. - * - * DESCRIPTION: Allocate and initialize a new walk state. The current walk - * state is set to this new state. - * - ******************************************************************************/ - -ACPI_WALK_STATE * -AcpiDsCreateWalkState ( - ACPI_OWNER_ID OwnerId, - ACPI_PARSE_OBJECT *Origin, - ACPI_OPERAND_OBJECT *MethodDesc, - ACPI_THREAD_STATE *Thread) -{ - ACPI_WALK_STATE *WalkState; - - - ACPI_FUNCTION_TRACE (DsCreateWalkState); - - - WalkState = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_WALK_STATE)); - if (!WalkState) - { - return_PTR (NULL); - } - - WalkState->DescriptorType = ACPI_DESC_TYPE_WALK; - WalkState->MethodDesc = MethodDesc; - WalkState->OwnerId = OwnerId; - WalkState->Origin = Origin; - WalkState->Thread = Thread; - - WalkState->ParserState.StartOp = Origin; - - /* Init the method args/local */ - -#ifndef ACPI_CONSTANT_EVAL_ONLY - AcpiDsMethodDataInit (WalkState); -#endif - - /* Put the new state at the head of the walk list */ - - if (Thread) - { - AcpiDsPushWalkState (WalkState, Thread); - } - - return_PTR (WalkState); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsInitAmlWalk - * - * PARAMETERS: WalkState - New state to be initialized - * Op - Current parse op - * MethodNode - Control method NS node, if any - * AmlStart - Start of AML - * AmlLength - Length of AML - * Info - Method info block (params, etc.) - * PassNumber - 1, 2, or 3 - * - * RETURN: Status - * - * DESCRIPTION: Initialize a walk state for a pass 1 or 2 parse tree walk - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsInitAmlWalk ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op, - ACPI_NAMESPACE_NODE *MethodNode, - UINT8 *AmlStart, - UINT32 AmlLength, - ACPI_EVALUATE_INFO *Info, - UINT8 PassNumber) -{ - ACPI_STATUS Status; - ACPI_PARSE_STATE *ParserState = &WalkState->ParserState; - ACPI_PARSE_OBJECT *ExtraOp; - - - ACPI_FUNCTION_TRACE (DsInitAmlWalk); - - - WalkState->ParserState.Aml = - WalkState->ParserState.AmlStart = - WalkState->ParserState.AmlEnd = - WalkState->ParserState.PkgEnd = AmlStart; - /* Avoid undefined behavior: applying zero offset to null pointer */ - if (AmlLength != 0) { - WalkState->ParserState.AmlEnd += AmlLength; - WalkState->ParserState.PkgEnd += AmlLength; - } - - /* The NextOp of the NextWalk will be the beginning of the method */ - - WalkState->NextOp = NULL; - WalkState->PassNumber = PassNumber; - - if (Info) - { - WalkState->Params = Info->Parameters; - WalkState->CallerReturnDesc = &Info->ReturnObject; - } - - Status = AcpiPsInitScope (&WalkState->ParserState, Op); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - if (MethodNode) - { - WalkState->ParserState.StartNode = MethodNode; - WalkState->WalkType = ACPI_WALK_METHOD; - WalkState->MethodNode = MethodNode; - WalkState->MethodDesc = AcpiNsGetAttachedObject (MethodNode); - - /* Push start scope on scope stack and make it current */ - - Status = AcpiDsScopeStackPush ( - MethodNode, ACPI_TYPE_METHOD, WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Init the method arguments */ - - Status = AcpiDsMethodDataInitArgs (WalkState->Params, - ACPI_METHOD_NUM_ARGS, WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - else - { - /* - * Setup the current scope. - * Find a Named Op that has a namespace node associated with it. - * search upwards from this Op. Current scope is the first - * Op with a namespace node. - */ - ExtraOp = ParserState->StartOp; - while (ExtraOp && !ExtraOp->Common.Node) - { - ExtraOp = ExtraOp->Common.Parent; - } - - if (!ExtraOp) - { - ParserState->StartNode = NULL; - } - else - { - ParserState->StartNode = ExtraOp->Common.Node; - } - - if (ParserState->StartNode) - { - /* Push start scope on scope stack and make it current */ - - Status = AcpiDsScopeStackPush (ParserState->StartNode, - ParserState->StartNode->Type, WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - } - - Status = AcpiDsInitCallbacks (WalkState, PassNumber); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsDeleteWalkState - * - * PARAMETERS: WalkState - State to delete - * - * RETURN: Status - * - * DESCRIPTION: Delete a walk state including all internal data structures - * - ******************************************************************************/ - -void -AcpiDsDeleteWalkState ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_GENERIC_STATE *State; - - - ACPI_FUNCTION_TRACE_PTR (DsDeleteWalkState, WalkState); - - - if (!WalkState) - { - return_VOID; - } - - if (WalkState->DescriptorType != ACPI_DESC_TYPE_WALK) - { - ACPI_ERROR ((AE_INFO, "%p is not a valid walk state", - WalkState)); - return_VOID; - } - - /* There should not be any open scopes */ - - if (WalkState->ParserState.Scope) - { - ACPI_ERROR ((AE_INFO, "%p walk still has a scope list", - WalkState)); - AcpiPsCleanupScope (&WalkState->ParserState); - } - - /* Always must free any linked control states */ - - while (WalkState->ControlState) - { - State = WalkState->ControlState; - WalkState->ControlState = State->Common.Next; - - AcpiUtDeleteGenericState (State); - } - - /* Always must free any linked parse states */ - - while (WalkState->ScopeInfo) - { - State = WalkState->ScopeInfo; - WalkState->ScopeInfo = State->Common.Next; - - AcpiUtDeleteGenericState (State); - } - - /* Always must free any stacked result states */ - - while (WalkState->Results) - { - State = WalkState->Results; - WalkState->Results = State->Common.Next; - - AcpiUtDeleteGenericState (State); - } - - ACPI_FREE (WalkState); - return_VOID; -} diff --git a/drivers/acpica/evevent.c b/drivers/acpica/evevent.c deleted file mode 100644 index b2dd444..0000000 --- a/drivers/acpica/evevent.c +++ /dev/null @@ -1,449 +0,0 @@ -/****************************************************************************** - * - * Module Name: evevent - Fixed Event handling and dispatch - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acevents.h" - -#define _COMPONENT ACPI_EVENTS - ACPI_MODULE_NAME ("evevent") - -#if (!ACPI_REDUCED_HARDWARE) /* Entire module */ - -/* Local prototypes */ - -static ACPI_STATUS -AcpiEvFixedEventInitialize ( - void); - -static UINT32 -AcpiEvFixedEventDispatch ( - UINT32 Event); - - -/******************************************************************************* - * - * FUNCTION: AcpiEvInitializeEvents - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Initialize global data structures for ACPI events (Fixed, GPE) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvInitializeEvents ( - void) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (EvInitializeEvents); - - - /* If Hardware Reduced flag is set, there are no fixed events */ - - if (AcpiGbl_ReducedHardware) - { - return_ACPI_STATUS (AE_OK); - } - - /* - * Initialize the Fixed and General Purpose Events. This is done prior to - * enabling SCIs to prevent interrupts from occurring before the handlers - * are installed. - */ - Status = AcpiEvFixedEventInitialize (); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Unable to initialize fixed events")); - return_ACPI_STATUS (Status); - } - - Status = AcpiEvGpeInitialize (); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Unable to initialize general purpose events")); - return_ACPI_STATUS (Status); - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvInstallXruptHandlers - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Install interrupt handlers for the SCI and Global Lock - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvInstallXruptHandlers ( - void) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (EvInstallXruptHandlers); - - - /* If Hardware Reduced flag is set, there is no ACPI h/w */ - - if (AcpiGbl_ReducedHardware) - { - return_ACPI_STATUS (AE_OK); - } - - /* Install the SCI handler */ - - Status = AcpiEvInstallSciHandler (); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Unable to install System Control Interrupt handler")); - return_ACPI_STATUS (Status); - } - - /* Install the handler for the Global Lock */ - - Status = AcpiEvInitGlobalLockHandler (); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Unable to initialize Global Lock handler")); - return_ACPI_STATUS (Status); - } - - AcpiGbl_EventsInitialized = TRUE; - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvFixedEventInitialize - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Install the fixed event handlers and disable all fixed events. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiEvFixedEventInitialize ( - void) -{ - UINT32 i; - ACPI_STATUS Status; - - - /* - * Initialize the structure that keeps track of fixed event handlers and - * disable all of the fixed events. - */ - for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) - { - AcpiGbl_FixedEventHandlers[i].Handler = NULL; - AcpiGbl_FixedEventHandlers[i].Context = NULL; - - /* Disable the fixed event */ - - if (AcpiGbl_FixedEventInfo[i].EnableRegisterId != 0xFF) - { - Status = AcpiWriteBitRegister ( - AcpiGbl_FixedEventInfo[i].EnableRegisterId, - ACPI_DISABLE_EVENT); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvFixedEventDetect - * - * PARAMETERS: None - * - * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED - * - * DESCRIPTION: Checks the PM status register for active fixed events - * - ******************************************************************************/ - -UINT32 -AcpiEvFixedEventDetect ( - void) -{ - UINT32 IntStatus = ACPI_INTERRUPT_NOT_HANDLED; - UINT32 FixedStatus; - UINT32 FixedEnable; - UINT32 i; - ACPI_STATUS Status; - - - ACPI_FUNCTION_NAME (EvFixedEventDetect); - - - /* - * Read the fixed feature status and enable registers, as all the cases - * depend on their values. Ignore errors here. - */ - Status = AcpiHwRegisterRead (ACPI_REGISTER_PM1_STATUS, &FixedStatus); - Status |= AcpiHwRegisterRead (ACPI_REGISTER_PM1_ENABLE, &FixedEnable); - if (ACPI_FAILURE (Status)) - { - return (IntStatus); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS, - "Fixed Event Block: Enable %08X Status %08X\n", - FixedEnable, FixedStatus)); - - /* - * Check for all possible Fixed Events and dispatch those that are active - */ - for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) - { - /* Both the status and enable bits must be on for this event */ - - if ((FixedStatus & AcpiGbl_FixedEventInfo[i].StatusBitMask) && - (FixedEnable & AcpiGbl_FixedEventInfo[i].EnableBitMask)) - { - /* - * Found an active (signalled) event. Invoke global event - * handler if present. - */ - AcpiFixedEventCount[i]++; - if (AcpiGbl_GlobalEventHandler) - { - AcpiGbl_GlobalEventHandler (ACPI_EVENT_TYPE_FIXED, NULL, - i, AcpiGbl_GlobalEventHandlerContext); - } - - IntStatus |= AcpiEvFixedEventDispatch (i); - } - } - - return (IntStatus); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvFixedEventDispatch - * - * PARAMETERS: Event - Event type - * - * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED - * - * DESCRIPTION: Clears the status bit for the requested event, calls the - * handler that previously registered for the event. - * NOTE: If there is no handler for the event, the event is - * disabled to prevent further interrupts. - * - ******************************************************************************/ - -static UINT32 -AcpiEvFixedEventDispatch ( - UINT32 Event) -{ - - ACPI_FUNCTION_ENTRY (); - - - /* Clear the status bit */ - - (void) AcpiWriteBitRegister ( - AcpiGbl_FixedEventInfo[Event].StatusRegisterId, - ACPI_CLEAR_STATUS); - - /* - * Make sure that a handler exists. If not, report an error - * and disable the event to prevent further interrupts. - */ - if (!AcpiGbl_FixedEventHandlers[Event].Handler) - { - (void) AcpiWriteBitRegister ( - AcpiGbl_FixedEventInfo[Event].EnableRegisterId, - ACPI_DISABLE_EVENT); - - ACPI_ERROR ((AE_INFO, - "No installed handler for fixed event - %s (%u), disabling", - AcpiUtGetEventName (Event), Event)); - - return (ACPI_INTERRUPT_NOT_HANDLED); - } - - /* Invoke the Fixed Event handler */ - - return ((AcpiGbl_FixedEventHandlers[Event].Handler)( - AcpiGbl_FixedEventHandlers[Event].Context)); -} - -#endif /* !ACPI_REDUCED_HARDWARE */ diff --git a/drivers/acpica/evglock.c b/drivers/acpica/evglock.c deleted file mode 100644 index 153a7ff..0000000 --- a/drivers/acpica/evglock.c +++ /dev/null @@ -1,492 +0,0 @@ -/****************************************************************************** - * - * Module Name: evglock - Global Lock support - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acevents.h" -#include "acinterp.h" - -#define _COMPONENT ACPI_EVENTS - ACPI_MODULE_NAME ("evglock") - -#if (!ACPI_REDUCED_HARDWARE) /* Entire module */ - -/* Local prototypes */ - -static UINT32 -AcpiEvGlobalLockHandler ( - void *Context); - - -/******************************************************************************* - * - * FUNCTION: AcpiEvInitGlobalLockHandler - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Install a handler for the global lock release event - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvInitGlobalLockHandler ( - void) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (EvInitGlobalLockHandler); - - - /* If Hardware Reduced flag is set, there is no global lock */ - - if (AcpiGbl_ReducedHardware) - { - return_ACPI_STATUS (AE_OK); - } - - if (!AcpiGbl_UseGlobalLock) - { - return_ACPI_STATUS (AE_OK); - } - - /* Attempt installation of the global lock handler */ - - Status = AcpiInstallFixedEventHandler (ACPI_EVENT_GLOBAL, - AcpiEvGlobalLockHandler, NULL); - - /* - * If the global lock does not exist on this platform, the attempt to - * enable GBL_STATUS will fail (the GBL_ENABLE bit will not stick). - * Map to AE_OK, but mark global lock as not present. Any attempt to - * actually use the global lock will be flagged with an error. - */ - AcpiGbl_GlobalLockPresent = FALSE; - if (Status == AE_NO_HARDWARE_RESPONSE) - { - ACPI_ERROR ((AE_INFO, - "No response from Global Lock hardware, disabling lock")); - - return_ACPI_STATUS (AE_OK); - } - - Status = AcpiOsCreateLock (&AcpiGbl_GlobalLockPendingLock); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - AcpiGbl_GlobalLockPending = FALSE; - AcpiGbl_GlobalLockPresent = TRUE; - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvRemoveGlobalLockHandler - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Remove the handler for the Global Lock - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvRemoveGlobalLockHandler ( - void) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (EvRemoveGlobalLockHandler); - - - AcpiGbl_GlobalLockPresent = FALSE; - Status = AcpiRemoveFixedEventHandler (ACPI_EVENT_GLOBAL, - AcpiEvGlobalLockHandler); - - AcpiOsDeleteLock (AcpiGbl_GlobalLockPendingLock); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvGlobalLockHandler - * - * PARAMETERS: Context - From thread interface, not used - * - * RETURN: ACPI_INTERRUPT_HANDLED - * - * DESCRIPTION: Invoked directly from the SCI handler when a global lock - * release interrupt occurs. If there is actually a pending - * request for the lock, signal the waiting thread. - * - ******************************************************************************/ - -static UINT32 -AcpiEvGlobalLockHandler ( - void *Context) -{ - ACPI_STATUS Status; - ACPI_CPU_FLAGS Flags; - - - Flags = AcpiOsAcquireLock (AcpiGbl_GlobalLockPendingLock); - - /* - * If a request for the global lock is not actually pending, - * we are done. This handles "spurious" global lock interrupts - * which are possible (and have been seen) with bad BIOSs. - */ - if (!AcpiGbl_GlobalLockPending) - { - goto CleanupAndExit; - } - - /* - * Send a unit to the global lock semaphore. The actual acquisition - * of the global lock will be performed by the waiting thread. - */ - Status = AcpiOsSignalSemaphore (AcpiGbl_GlobalLockSemaphore, 1); - if (ACPI_FAILURE (Status)) - { - ACPI_ERROR ((AE_INFO, "Could not signal Global Lock semaphore")); - } - - AcpiGbl_GlobalLockPending = FALSE; - - -CleanupAndExit: - - AcpiOsReleaseLock (AcpiGbl_GlobalLockPendingLock, Flags); - return (ACPI_INTERRUPT_HANDLED); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiEvAcquireGlobalLock - * - * PARAMETERS: Timeout - Max time to wait for the lock, in millisec. - * - * RETURN: Status - * - * DESCRIPTION: Attempt to gain ownership of the Global Lock. - * - * MUTEX: Interpreter must be locked - * - * Note: The original implementation allowed multiple threads to "acquire" the - * Global Lock, and the OS would hold the lock until the last thread had - * released it. However, this could potentially starve the BIOS out of the - * lock, especially in the case where there is a tight handshake between the - * Embedded Controller driver and the BIOS. Therefore, this implementation - * allows only one thread to acquire the HW Global Lock at a time, and makes - * the global lock appear as a standard mutex on the OS side. - * - *****************************************************************************/ - -ACPI_STATUS -AcpiEvAcquireGlobalLock ( - UINT16 Timeout) -{ - ACPI_CPU_FLAGS Flags; - ACPI_STATUS Status; - BOOLEAN Acquired = FALSE; - - - ACPI_FUNCTION_TRACE (EvAcquireGlobalLock); - - - /* - * Only one thread can acquire the GL at a time, the GlobalLockMutex - * enforces this. This interface releases the interpreter if we must wait. - */ - Status = AcpiExSystemWaitMutex (AcpiGbl_GlobalLockMutex->Mutex.OsMutex, - Timeout); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* - * Update the global lock handle and check for wraparound. The handle is - * only used for the external global lock interfaces, but it is updated - * here to properly handle the case where a single thread may acquire the - * lock via both the AML and the AcpiAcquireGlobalLock interfaces. The - * handle is therefore updated on the first acquire from a given thread - * regardless of where the acquisition request originated. - */ - AcpiGbl_GlobalLockHandle++; - if (AcpiGbl_GlobalLockHandle == 0) - { - AcpiGbl_GlobalLockHandle = 1; - } - - /* - * Make sure that a global lock actually exists. If not, just - * treat the lock as a standard mutex. - */ - if (!AcpiGbl_GlobalLockPresent) - { - AcpiGbl_GlobalLockAcquired = TRUE; - return_ACPI_STATUS (AE_OK); - } - - Flags = AcpiOsAcquireLock (AcpiGbl_GlobalLockPendingLock); - - do - { - /* Attempt to acquire the actual hardware lock */ - - ACPI_ACQUIRE_GLOBAL_LOCK (AcpiGbl_FACS, Acquired); - if (Acquired) - { - AcpiGbl_GlobalLockAcquired = TRUE; - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Acquired hardware Global Lock\n")); - break; - } - - /* - * Did not get the lock. The pending bit was set above, and - * we must now wait until we receive the global lock - * released interrupt. - */ - AcpiGbl_GlobalLockPending = TRUE; - AcpiOsReleaseLock (AcpiGbl_GlobalLockPendingLock, Flags); - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Waiting for hardware Global Lock\n")); - - /* - * Wait for handshake with the global lock interrupt handler. - * This interface releases the interpreter if we must wait. - */ - Status = AcpiExSystemWaitSemaphore ( - AcpiGbl_GlobalLockSemaphore, ACPI_WAIT_FOREVER); - - Flags = AcpiOsAcquireLock (AcpiGbl_GlobalLockPendingLock); - - } while (ACPI_SUCCESS (Status)); - - AcpiGbl_GlobalLockPending = FALSE; - AcpiOsReleaseLock (AcpiGbl_GlobalLockPendingLock, Flags); - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvReleaseGlobalLock - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Releases ownership of the Global Lock. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvReleaseGlobalLock ( - void) -{ - BOOLEAN Pending = FALSE; - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE (EvReleaseGlobalLock); - - - /* Lock must be already acquired */ - - if (!AcpiGbl_GlobalLockAcquired) - { - ACPI_WARNING ((AE_INFO, - "Cannot release the ACPI Global Lock, it has not been acquired")); - return_ACPI_STATUS (AE_NOT_ACQUIRED); - } - - if (AcpiGbl_GlobalLockPresent) - { - /* Allow any thread to release the lock */ - - ACPI_RELEASE_GLOBAL_LOCK (AcpiGbl_FACS, Pending); - - /* - * If the pending bit was set, we must write GBL_RLS to the control - * register - */ - if (Pending) - { - Status = AcpiWriteBitRegister ( - ACPI_BITREG_GLOBAL_LOCK_RELEASE, ACPI_ENABLE_EVENT); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Released hardware Global Lock\n")); - } - - AcpiGbl_GlobalLockAcquired = FALSE; - - /* Release the local GL mutex */ - - AcpiOsReleaseMutex (AcpiGbl_GlobalLockMutex->Mutex.OsMutex); - return_ACPI_STATUS (Status); -} - -#endif /* !ACPI_REDUCED_HARDWARE */ diff --git a/drivers/acpica/evgpe.c b/drivers/acpica/evgpe.c deleted file mode 100644 index 01e628a..0000000 --- a/drivers/acpica/evgpe.c +++ /dev/null @@ -1,1070 +0,0 @@ -/****************************************************************************** - * - * Module Name: evgpe - General Purpose Event handling and dispatch - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acevents.h" -#include "acnamesp.h" - -#define _COMPONENT ACPI_EVENTS - ACPI_MODULE_NAME ("evgpe") - -#if (!ACPI_REDUCED_HARDWARE) /* Entire module */ - -/* Local prototypes */ - -static void ACPI_SYSTEM_XFACE -AcpiEvAsynchExecuteGpeMethod ( - void *Context); - -static void ACPI_SYSTEM_XFACE -AcpiEvAsynchEnableGpe ( - void *Context); - - -/******************************************************************************* - * - * FUNCTION: AcpiEvUpdateGpeEnableMask - * - * PARAMETERS: GpeEventInfo - GPE to update - * - * RETURN: Status - * - * DESCRIPTION: Updates GPE register enable mask based upon whether there are - * runtime references to this GPE - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvUpdateGpeEnableMask ( - ACPI_GPE_EVENT_INFO *GpeEventInfo) -{ - ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; - UINT32 RegisterBit; - - - ACPI_FUNCTION_TRACE (EvUpdateGpeEnableMask); - - - GpeRegisterInfo = GpeEventInfo->RegisterInfo; - if (!GpeRegisterInfo) - { - return_ACPI_STATUS (AE_NOT_EXIST); - } - - RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo); - - /* Clear the run bit up front */ - - ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForRun, RegisterBit); - - /* Set the mask bit only if there are references to this GPE */ - - if (GpeEventInfo->RuntimeCount) - { - ACPI_SET_BIT (GpeRegisterInfo->EnableForRun, (UINT8) RegisterBit); - } - - GpeRegisterInfo->EnableMask = GpeRegisterInfo->EnableForRun; - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvEnableGpe - * - * PARAMETERS: GpeEventInfo - GPE to enable - * - * RETURN: Status - * - * DESCRIPTION: Enable a GPE. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvEnableGpe ( - ACPI_GPE_EVENT_INFO *GpeEventInfo) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (EvEnableGpe); - - - /* Enable the requested GPE */ - - Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_ENABLE); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvMaskGpe - * - * PARAMETERS: GpeEventInfo - GPE to be blocked/unblocked - * IsMasked - Whether the GPE is masked or not - * - * RETURN: Status - * - * DESCRIPTION: Unconditionally mask/unmask a GPE during runtime. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvMaskGpe ( - ACPI_GPE_EVENT_INFO *GpeEventInfo, - BOOLEAN IsMasked) -{ - ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; - UINT32 RegisterBit; - - - ACPI_FUNCTION_TRACE (EvMaskGpe); - - - GpeRegisterInfo = GpeEventInfo->RegisterInfo; - if (!GpeRegisterInfo) - { - return_ACPI_STATUS (AE_NOT_EXIST); - } - - RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo); - - /* Perform the action */ - - if (IsMasked) - { - if (RegisterBit & GpeRegisterInfo->MaskForRun) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - (void) AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE); - ACPI_SET_BIT (GpeRegisterInfo->MaskForRun, (UINT8) RegisterBit); - } - else - { - if (!(RegisterBit & GpeRegisterInfo->MaskForRun)) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - ACPI_CLEAR_BIT (GpeRegisterInfo->MaskForRun, (UINT8) RegisterBit); - if (GpeEventInfo->RuntimeCount && - !GpeEventInfo->DisableForDispatch) - { - (void) AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_ENABLE); - } - } - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvAddGpeReference - * - * PARAMETERS: GpeEventInfo - Add a reference to this GPE - * ClearOnEnable - Clear GPE status before enabling it - * - * RETURN: Status - * - * DESCRIPTION: Add a reference to a GPE. On the first reference, the GPE is - * hardware-enabled. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvAddGpeReference ( - ACPI_GPE_EVENT_INFO *GpeEventInfo, - BOOLEAN ClearOnEnable) -{ - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE (EvAddGpeReference); - - - if (GpeEventInfo->RuntimeCount == ACPI_UINT8_MAX) - { - return_ACPI_STATUS (AE_LIMIT); - } - - GpeEventInfo->RuntimeCount++; - if (GpeEventInfo->RuntimeCount == 1) - { - /* Enable on first reference */ - - if (ClearOnEnable) - { - (void) AcpiHwClearGpe (GpeEventInfo); - } - - Status = AcpiEvUpdateGpeEnableMask (GpeEventInfo); - if (ACPI_SUCCESS (Status)) - { - Status = AcpiEvEnableGpe (GpeEventInfo); - } - - if (ACPI_FAILURE (Status)) - { - GpeEventInfo->RuntimeCount--; - } - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvRemoveGpeReference - * - * PARAMETERS: GpeEventInfo - Remove a reference to this GPE - * - * RETURN: Status - * - * DESCRIPTION: Remove a reference to a GPE. When the last reference is - * removed, the GPE is hardware-disabled. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvRemoveGpeReference ( - ACPI_GPE_EVENT_INFO *GpeEventInfo) -{ - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE (EvRemoveGpeReference); - - - if (!GpeEventInfo->RuntimeCount) - { - return_ACPI_STATUS (AE_LIMIT); - } - - GpeEventInfo->RuntimeCount--; - if (!GpeEventInfo->RuntimeCount) - { - /* Disable on last reference */ - - Status = AcpiEvUpdateGpeEnableMask (GpeEventInfo); - if (ACPI_SUCCESS (Status)) - { - Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE); - } - - if (ACPI_FAILURE (Status)) - { - GpeEventInfo->RuntimeCount++; - } - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvLowGetGpeInfo - * - * PARAMETERS: GpeNumber - Raw GPE number - * GpeBlock - A GPE info block - * - * RETURN: A GPE EventInfo struct. NULL if not a valid GPE (The GpeNumber - * is not within the specified GPE block) - * - * DESCRIPTION: Returns the EventInfo struct associated with this GPE. This is - * the low-level implementation of EvGetGpeEventInfo. - * - ******************************************************************************/ - -ACPI_GPE_EVENT_INFO * -AcpiEvLowGetGpeInfo ( - UINT32 GpeNumber, - ACPI_GPE_BLOCK_INFO *GpeBlock) -{ - UINT32 GpeIndex; - - - /* - * Validate that the GpeNumber is within the specified GpeBlock. - * (Two steps) - */ - if (!GpeBlock || - (GpeNumber < GpeBlock->BlockBaseNumber)) - { - return (NULL); - } - - GpeIndex = GpeNumber - GpeBlock->BlockBaseNumber; - if (GpeIndex >= GpeBlock->GpeCount) - { - return (NULL); - } - - return (&GpeBlock->EventInfo[GpeIndex]); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvGetGpeEventInfo - * - * PARAMETERS: GpeDevice - Device node. NULL for GPE0/GPE1 - * GpeNumber - Raw GPE number - * - * RETURN: A GPE EventInfo struct. NULL if not a valid GPE - * - * DESCRIPTION: Returns the EventInfo struct associated with this GPE. - * Validates the GpeBlock and the GpeNumber - * - * Should be called only when the GPE lists are semaphore locked - * and not subject to change. - * - ******************************************************************************/ - -ACPI_GPE_EVENT_INFO * -AcpiEvGetGpeEventInfo ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_GPE_EVENT_INFO *GpeInfo; - UINT32 i; - - - ACPI_FUNCTION_ENTRY (); - - - /* A NULL GpeDevice means use the FADT-defined GPE block(s) */ - - if (!GpeDevice) - { - /* Examine GPE Block 0 and 1 (These blocks are permanent) */ - - for (i = 0; i < ACPI_MAX_GPE_BLOCKS; i++) - { - GpeInfo = AcpiEvLowGetGpeInfo (GpeNumber, - AcpiGbl_GpeFadtBlocks[i]); - if (GpeInfo) - { - return (GpeInfo); - } - } - - /* The GpeNumber was not in the range of either FADT GPE block */ - - return (NULL); - } - - /* A Non-NULL GpeDevice means this is a GPE Block Device */ - - ObjDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) GpeDevice); - if (!ObjDesc || - !ObjDesc->Device.GpeBlock) - { - return (NULL); - } - - return (AcpiEvLowGetGpeInfo (GpeNumber, ObjDesc->Device.GpeBlock)); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvGpeDetect - * - * PARAMETERS: GpeXruptList - Interrupt block for this interrupt. - * Can have multiple GPE blocks attached. - * - * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED - * - * DESCRIPTION: Detect if any GP events have occurred. This function is - * executed at interrupt level. - * - ******************************************************************************/ - -UINT32 -AcpiEvGpeDetect ( - ACPI_GPE_XRUPT_INFO *GpeXruptList) -{ - ACPI_GPE_BLOCK_INFO *GpeBlock; - ACPI_NAMESPACE_NODE *GpeDevice; - ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; - ACPI_GPE_EVENT_INFO *GpeEventInfo; - UINT32 GpeNumber; - UINT32 IntStatus = ACPI_INTERRUPT_NOT_HANDLED; - ACPI_CPU_FLAGS Flags; - UINT32 i; - UINT32 j; - - - ACPI_FUNCTION_NAME (EvGpeDetect); - - /* Check for the case where there are no GPEs */ - - if (!GpeXruptList) - { - return (IntStatus); - } - - /* - * We need to obtain the GPE lock for both the data structs and registers - * Note: Not necessary to obtain the hardware lock, since the GPE - * registers are owned by the GpeLock. - */ - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - - /* Examine all GPE blocks attached to this interrupt level */ - - GpeBlock = GpeXruptList->GpeBlockListHead; - while (GpeBlock) - { - GpeDevice = GpeBlock->Node; - - /* - * Read all of the 8-bit GPE status and enable registers in this GPE - * block, saving all of them. Find all currently active GP events. - */ - for (i = 0; i < GpeBlock->RegisterCount; i++) - { - /* Get the next status/enable pair */ - - GpeRegisterInfo = &GpeBlock->RegisterInfo[i]; - - /* - * Optimization: If there are no GPEs enabled within this - * register, we can safely ignore the entire register. - */ - if (!(GpeRegisterInfo->EnableForRun | - GpeRegisterInfo->EnableForWake)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS, - "Ignore disabled registers for GPE %02X-%02X: " - "RunEnable=%02X, WakeEnable=%02X\n", - GpeRegisterInfo->BaseGpeNumber, - GpeRegisterInfo->BaseGpeNumber + (ACPI_GPE_REGISTER_WIDTH - 1), - GpeRegisterInfo->EnableForRun, - GpeRegisterInfo->EnableForWake)); - continue; - } - - /* Now look at the individual GPEs in this byte register */ - - for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) - { - /* Detect and dispatch one GPE bit */ - - GpeEventInfo = &GpeBlock->EventInfo[((ACPI_SIZE) i * - ACPI_GPE_REGISTER_WIDTH) + j]; - GpeNumber = j + GpeRegisterInfo->BaseGpeNumber; - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - IntStatus |= AcpiEvDetectGpe ( - GpeDevice, GpeEventInfo, GpeNumber); - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - } - } - - GpeBlock = GpeBlock->Next; - } - - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - return (IntStatus); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvAsynchExecuteGpeMethod - * - * PARAMETERS: Context (GpeEventInfo) - Info for this GPE - * - * RETURN: None - * - * DESCRIPTION: Perform the actual execution of a GPE control method. This - * function is called from an invocation of AcpiOsExecute and - * therefore does NOT execute at interrupt level - so that - * the control method itself is not executed in the context of - * an interrupt handler. - * - ******************************************************************************/ - -static void ACPI_SYSTEM_XFACE -AcpiEvAsynchExecuteGpeMethod ( - void *Context) -{ - ACPI_GPE_EVENT_INFO *GpeEventInfo = Context; - ACPI_STATUS Status = AE_OK; - ACPI_EVALUATE_INFO *Info; - ACPI_GPE_NOTIFY_INFO *Notify; - - - ACPI_FUNCTION_TRACE (EvAsynchExecuteGpeMethod); - - - /* Do the correct dispatch - normal method or implicit notify */ - - switch (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags)) - { - case ACPI_GPE_DISPATCH_NOTIFY: - /* - * Implicit notify. - * Dispatch a DEVICE_WAKE notify to the appropriate handler. - * NOTE: the request is queued for execution after this method - * completes. The notify handlers are NOT invoked synchronously - * from this thread -- because handlers may in turn run other - * control methods. - * - * June 2012: Expand implicit notify mechanism to support - * notifies on multiple device objects. - */ - Notify = GpeEventInfo->Dispatch.NotifyList; - while (ACPI_SUCCESS (Status) && Notify) - { - Status = AcpiEvQueueNotifyRequest ( - Notify->DeviceNode, ACPI_NOTIFY_DEVICE_WAKE); - - Notify = Notify->Next; - } - break; - - case ACPI_GPE_DISPATCH_METHOD: - - /* Allocate the evaluation information block */ - - Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO)); - if (!Info) - { - Status = AE_NO_MEMORY; - } - else - { - /* - * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the - * _Lxx/_Exx control method that corresponds to this GPE - */ - Info->PrefixNode = GpeEventInfo->Dispatch.MethodNode; - Info->Flags = ACPI_IGNORE_RETURN_VALUE; - - Status = AcpiNsEvaluate (Info); - ACPI_FREE (Info); - } - - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "while evaluating GPE method [%4.4s]", - AcpiUtGetNodeName (GpeEventInfo->Dispatch.MethodNode))); - } - break; - - default: - - goto ErrorExit; /* Should never happen */ - } - - /* Defer enabling of GPE until all notify handlers are done */ - - Status = AcpiOsExecute (OSL_NOTIFY_HANDLER, - AcpiEvAsynchEnableGpe, GpeEventInfo); - if (ACPI_SUCCESS (Status)) - { - return_VOID; - } - -ErrorExit: - AcpiEvAsynchEnableGpe (GpeEventInfo); - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvAsynchEnableGpe - * - * PARAMETERS: Context (GpeEventInfo) - Info for this GPE - * Callback from AcpiOsExecute - * - * RETURN: None - * - * DESCRIPTION: Asynchronous clear/enable for GPE. This allows the GPE to - * complete (i.e., finish execution of Notify) - * - ******************************************************************************/ - -static void ACPI_SYSTEM_XFACE -AcpiEvAsynchEnableGpe ( - void *Context) -{ - ACPI_GPE_EVENT_INFO *GpeEventInfo = Context; - ACPI_CPU_FLAGS Flags; - - - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - (void) AcpiEvFinishGpe (GpeEventInfo); - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - - return; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvFinishGpe - * - * PARAMETERS: GpeEventInfo - Info for this GPE - * - * RETURN: Status - * - * DESCRIPTION: Clear/Enable a GPE. Common code that is used after execution - * of a GPE method or a synchronous or asynchronous GPE handler. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvFinishGpe ( - ACPI_GPE_EVENT_INFO *GpeEventInfo) -{ - ACPI_STATUS Status; - - - if ((GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK) == - ACPI_GPE_LEVEL_TRIGGERED) - { - /* - * GPE is level-triggered, we clear the GPE status bit after - * handling the event. - */ - Status = AcpiHwClearGpe (GpeEventInfo); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - - /* - * Enable this GPE, conditionally. This means that the GPE will - * only be physically enabled if the EnableMask bit is set - * in the EventInfo. - */ - (void) AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_CONDITIONAL_ENABLE); - GpeEventInfo->DisableForDispatch = FALSE; - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvDetectGpe - * - * PARAMETERS: GpeDevice - Device node. NULL for GPE0/GPE1 - * GpeEventInfo - Info for this GPE - * GpeNumber - Number relative to the parent GPE block - * - * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED - * - * DESCRIPTION: Detect and dispatch a General Purpose Event to either a function - * (e.g. EC) or method (e.g. _Lxx/_Exx) handler. - * NOTE: GPE is W1C, so it is possible to handle a single GPE from both - * task and irq context in parallel as long as the process to - * detect and mask the GPE is atomic. - * However the atomicity of ACPI_GPE_DISPATCH_RAW_HANDLER is - * dependent on the raw handler itself. - * - ******************************************************************************/ - -UINT32 -AcpiEvDetectGpe ( - ACPI_NAMESPACE_NODE *GpeDevice, - ACPI_GPE_EVENT_INFO *GpeEventInfo, - UINT32 GpeNumber) -{ - UINT32 IntStatus = ACPI_INTERRUPT_NOT_HANDLED; - UINT8 EnabledStatusByte; - UINT64 StatusReg; - UINT64 EnableReg; - UINT32 RegisterBit; - ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; - ACPI_GPE_HANDLER_INFO *GpeHandlerInfo; - ACPI_CPU_FLAGS Flags; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (EvGpeDetect); - - - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - - if (!GpeEventInfo) - { - GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); - if (!GpeEventInfo) - { - goto ErrorExit; - } - } - - /* Get the info block for the entire GPE register */ - - GpeRegisterInfo = GpeEventInfo->RegisterInfo; - - /* Get the register bitmask for this GPE */ - - RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo); - - /* GPE currently enabled (enable bit == 1)? */ - - Status = AcpiHwRead (&EnableReg, &GpeRegisterInfo->EnableAddress); - if (ACPI_FAILURE (Status)) - { - goto ErrorExit; - } - - /* GPE currently active (status bit == 1)? */ - - Status = AcpiHwRead (&StatusReg, &GpeRegisterInfo->StatusAddress); - if (ACPI_FAILURE (Status)) - { - goto ErrorExit; - } - - /* Check if there is anything active at all in this GPE */ - - ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS, - "Read registers for GPE %02X: Status=%02X, Enable=%02X, " - "RunEnable=%02X, WakeEnable=%02X\n", - GpeNumber, - (UINT32) (StatusReg & RegisterBit), - (UINT32) (EnableReg & RegisterBit), - GpeRegisterInfo->EnableForRun, - GpeRegisterInfo->EnableForWake)); - - EnabledStatusByte = (UINT8) (StatusReg & EnableReg); - if (!(EnabledStatusByte & RegisterBit)) - { - goto ErrorExit; - } - - /* Invoke global event handler if present */ - - AcpiGpeCount++; - if (AcpiGbl_GlobalEventHandler) - { - AcpiGbl_GlobalEventHandler (ACPI_EVENT_TYPE_GPE, - GpeDevice, GpeNumber, - AcpiGbl_GlobalEventHandlerContext); - } - - /* Found an active GPE */ - - if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == - ACPI_GPE_DISPATCH_RAW_HANDLER) - { - /* Dispatch the event to a raw handler */ - - GpeHandlerInfo = GpeEventInfo->Dispatch.Handler; - - /* - * There is no protection around the namespace node - * and the GPE handler to ensure a safe destruction - * because: - * 1. The namespace node is expected to always - * exist after loading a table. - * 2. The GPE handler is expected to be flushed by - * AcpiOsWaitEventsComplete() before the - * destruction. - */ - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - IntStatus |= GpeHandlerInfo->Address ( - GpeDevice, GpeNumber, GpeHandlerInfo->Context); - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - } - else - { - /* Dispatch the event to a standard handler or method. */ - - IntStatus |= AcpiEvGpeDispatch (GpeDevice, - GpeEventInfo, GpeNumber); - } - -ErrorExit: - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - return (IntStatus); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvGpeDispatch - * - * PARAMETERS: GpeDevice - Device node. NULL for GPE0/GPE1 - * GpeEventInfo - Info for this GPE - * GpeNumber - Number relative to the parent GPE block - * - * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED - * - * DESCRIPTION: Dispatch a General Purpose Event to either a function (e.g. EC) - * or method (e.g. _Lxx/_Exx) handler. - * - ******************************************************************************/ - -UINT32 -AcpiEvGpeDispatch ( - ACPI_NAMESPACE_NODE *GpeDevice, - ACPI_GPE_EVENT_INFO *GpeEventInfo, - UINT32 GpeNumber) -{ - ACPI_STATUS Status; - UINT32 ReturnValue; - - - ACPI_FUNCTION_TRACE (EvGpeDispatch); - - - /* - * Always disable the GPE so that it does not keep firing before - * any asynchronous activity completes (either from the execution - * of a GPE method or an asynchronous GPE handler.) - * - * If there is no handler or method to run, just disable the - * GPE and leave it disabled permanently to prevent further such - * pointless events from firing. - */ - Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Unable to disable GPE %02X", GpeNumber)); - return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED); - } - - /* - * If edge-triggered, clear the GPE status bit now. Note that - * level-triggered events are cleared after the GPE is serviced. - */ - if ((GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK) == - ACPI_GPE_EDGE_TRIGGERED) - { - Status = AcpiHwClearGpe (GpeEventInfo); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Unable to clear GPE %02X", GpeNumber)); - (void) AcpiHwLowSetGpe ( - GpeEventInfo, ACPI_GPE_CONDITIONAL_ENABLE); - return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED); - } - } - - GpeEventInfo->DisableForDispatch = TRUE; - - /* - * Dispatch the GPE to either an installed handler or the control - * method associated with this GPE (_Lxx or _Exx). If a handler - * exists, we invoke it and do not attempt to run the method. - * If there is neither a handler nor a method, leave the GPE - * disabled. - */ - switch (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags)) - { - case ACPI_GPE_DISPATCH_HANDLER: - - /* Invoke the installed handler (at interrupt level) */ - - ReturnValue = GpeEventInfo->Dispatch.Handler->Address ( - GpeDevice, GpeNumber, - GpeEventInfo->Dispatch.Handler->Context); - - /* If requested, clear (if level-triggered) and re-enable the GPE */ - - if (ReturnValue & ACPI_REENABLE_GPE) - { - (void) AcpiEvFinishGpe (GpeEventInfo); - } - break; - - case ACPI_GPE_DISPATCH_METHOD: - case ACPI_GPE_DISPATCH_NOTIFY: - /* - * Execute the method associated with the GPE - * NOTE: Level-triggered GPEs are cleared after the method completes. - */ - Status = AcpiOsExecute (OSL_GPE_HANDLER, - AcpiEvAsynchExecuteGpeMethod, GpeEventInfo); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Unable to queue handler for GPE %02X - event disabled", - GpeNumber)); - } - break; - - default: - /* - * No handler or method to run! - * 03/2010: This case should no longer be possible. We will not allow - * a GPE to be enabled if it has no handler or method. - */ - ACPI_ERROR ((AE_INFO, - "No handler or method for GPE %02X, disabling event", - GpeNumber)); - break; - } - - return_UINT32 (ACPI_INTERRUPT_HANDLED); -} - -#endif /* !ACPI_REDUCED_HARDWARE */ diff --git a/drivers/acpica/evgpeblk.c b/drivers/acpica/evgpeblk.c deleted file mode 100644 index 899e19b..0000000 --- a/drivers/acpica/evgpeblk.c +++ /dev/null @@ -1,677 +0,0 @@ -/****************************************************************************** - * - * Module Name: evgpeblk - GPE block creation and initialization. - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acevents.h" -#include "acnamesp.h" - -#define _COMPONENT ACPI_EVENTS - ACPI_MODULE_NAME ("evgpeblk") - -#if (!ACPI_REDUCED_HARDWARE) /* Entire module */ - -/* Local prototypes */ - -static ACPI_STATUS -AcpiEvInstallGpeBlock ( - ACPI_GPE_BLOCK_INFO *GpeBlock, - UINT32 InterruptNumber); - -static ACPI_STATUS -AcpiEvCreateGpeInfoBlocks ( - ACPI_GPE_BLOCK_INFO *GpeBlock); - - -/******************************************************************************* - * - * FUNCTION: AcpiEvInstallGpeBlock - * - * PARAMETERS: GpeBlock - New GPE block - * InterruptNumber - Xrupt to be associated with this - * GPE block - * - * RETURN: Status - * - * DESCRIPTION: Install new GPE block with mutex support - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiEvInstallGpeBlock ( - ACPI_GPE_BLOCK_INFO *GpeBlock, - UINT32 InterruptNumber) -{ - ACPI_GPE_BLOCK_INFO *NextGpeBlock; - ACPI_GPE_XRUPT_INFO *GpeXruptBlock; - ACPI_STATUS Status; - ACPI_CPU_FLAGS Flags; - - - ACPI_FUNCTION_TRACE (EvInstallGpeBlock); - - - Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Status = AcpiEvGetGpeXruptBlock (InterruptNumber, &GpeXruptBlock); - if (ACPI_FAILURE (Status)) - { - goto UnlockAndExit; - } - - /* Install the new block at the end of the list with lock */ - - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - if (GpeXruptBlock->GpeBlockListHead) - { - NextGpeBlock = GpeXruptBlock->GpeBlockListHead; - while (NextGpeBlock->Next) - { - NextGpeBlock = NextGpeBlock->Next; - } - - NextGpeBlock->Next = GpeBlock; - GpeBlock->Previous = NextGpeBlock; - } - else - { - GpeXruptBlock->GpeBlockListHead = GpeBlock; - } - - GpeBlock->XruptBlock = GpeXruptBlock; - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - - -UnlockAndExit: - (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvDeleteGpeBlock - * - * PARAMETERS: GpeBlock - Existing GPE block - * - * RETURN: Status - * - * DESCRIPTION: Remove a GPE block - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvDeleteGpeBlock ( - ACPI_GPE_BLOCK_INFO *GpeBlock) -{ - ACPI_STATUS Status; - ACPI_CPU_FLAGS Flags; - - - ACPI_FUNCTION_TRACE (EvInstallGpeBlock); - - - Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Disable all GPEs in this block */ - - Status = AcpiHwDisableGpeBlock (GpeBlock->XruptBlock, GpeBlock, NULL); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - if (!GpeBlock->Previous && !GpeBlock->Next) - { - /* This is the last GpeBlock on this interrupt */ - - Status = AcpiEvDeleteGpeXrupt (GpeBlock->XruptBlock); - if (ACPI_FAILURE (Status)) - { - goto UnlockAndExit; - } - } - else - { - /* Remove the block on this interrupt with lock */ - - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - if (GpeBlock->Previous) - { - GpeBlock->Previous->Next = GpeBlock->Next; - } - else - { - GpeBlock->XruptBlock->GpeBlockListHead = GpeBlock->Next; - } - - if (GpeBlock->Next) - { - GpeBlock->Next->Previous = GpeBlock->Previous; - } - - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - } - - AcpiCurrentGpeCount -= GpeBlock->GpeCount; - - /* Free the GpeBlock */ - - ACPI_FREE (GpeBlock->RegisterInfo); - ACPI_FREE (GpeBlock->EventInfo); - ACPI_FREE (GpeBlock); - -UnlockAndExit: - Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvCreateGpeInfoBlocks - * - * PARAMETERS: GpeBlock - New GPE block - * - * RETURN: Status - * - * DESCRIPTION: Create the RegisterInfo and EventInfo blocks for this GPE block - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiEvCreateGpeInfoBlocks ( - ACPI_GPE_BLOCK_INFO *GpeBlock) -{ - ACPI_GPE_REGISTER_INFO *GpeRegisterInfo = NULL; - ACPI_GPE_EVENT_INFO *GpeEventInfo = NULL; - ACPI_GPE_EVENT_INFO *ThisEvent; - ACPI_GPE_REGISTER_INFO *ThisRegister; - UINT32 i; - UINT32 j; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (EvCreateGpeInfoBlocks); - - - /* Allocate the GPE register information block */ - - GpeRegisterInfo = ACPI_ALLOCATE_ZEROED ( - (ACPI_SIZE) GpeBlock->RegisterCount * - sizeof (ACPI_GPE_REGISTER_INFO)); - if (!GpeRegisterInfo) - { - ACPI_ERROR ((AE_INFO, - "Could not allocate the GpeRegisterInfo table")); - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* - * Allocate the GPE EventInfo block. There are eight distinct GPEs - * per register. Initialization to zeros is sufficient. - */ - GpeEventInfo = ACPI_ALLOCATE_ZEROED ((ACPI_SIZE) GpeBlock->GpeCount * - sizeof (ACPI_GPE_EVENT_INFO)); - if (!GpeEventInfo) - { - ACPI_ERROR ((AE_INFO, - "Could not allocate the GpeEventInfo table")); - Status = AE_NO_MEMORY; - goto ErrorExit; - } - - /* Save the new Info arrays in the GPE block */ - - GpeBlock->RegisterInfo = GpeRegisterInfo; - GpeBlock->EventInfo = GpeEventInfo; - - /* - * Initialize the GPE Register and Event structures. A goal of these - * tables is to hide the fact that there are two separate GPE register - * sets in a given GPE hardware block, the status registers occupy the - * first half, and the enable registers occupy the second half. - */ - ThisRegister = GpeRegisterInfo; - ThisEvent = GpeEventInfo; - - for (i = 0; i < GpeBlock->RegisterCount; i++) - { - /* Init the RegisterInfo for this GPE register (8 GPEs) */ - - ThisRegister->BaseGpeNumber = (UINT16) - (GpeBlock->BlockBaseNumber + (i * ACPI_GPE_REGISTER_WIDTH)); - - ThisRegister->StatusAddress.Address = - GpeBlock->Address + i; - - ThisRegister->EnableAddress.Address = - GpeBlock->Address + i + GpeBlock->RegisterCount; - - ThisRegister->StatusAddress.SpaceId = GpeBlock->SpaceId; - ThisRegister->EnableAddress.SpaceId = GpeBlock->SpaceId; - ThisRegister->StatusAddress.BitWidth = ACPI_GPE_REGISTER_WIDTH; - ThisRegister->EnableAddress.BitWidth = ACPI_GPE_REGISTER_WIDTH; - ThisRegister->StatusAddress.BitOffset = 0; - ThisRegister->EnableAddress.BitOffset = 0; - - /* Init the EventInfo for each GPE within this register */ - - for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) - { - ThisEvent->GpeNumber = (UINT8) (ThisRegister->BaseGpeNumber + j); - ThisEvent->RegisterInfo = ThisRegister; - ThisEvent++; - } - - /* Disable all GPEs within this register */ - - Status = AcpiHwWrite (0x00, &ThisRegister->EnableAddress); - if (ACPI_FAILURE (Status)) - { - goto ErrorExit; - } - - /* Clear any pending GPE events within this register */ - - Status = AcpiHwWrite (0xFF, &ThisRegister->StatusAddress); - if (ACPI_FAILURE (Status)) - { - goto ErrorExit; - } - - ThisRegister++; - } - - return_ACPI_STATUS (AE_OK); - - -ErrorExit: - if (GpeRegisterInfo) - { - ACPI_FREE (GpeRegisterInfo); - } - if (GpeEventInfo) - { - ACPI_FREE (GpeEventInfo); - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvCreateGpeBlock - * - * PARAMETERS: GpeDevice - Handle to the parent GPE block - * GpeBlockAddress - Address and SpaceID - * RegisterCount - Number of GPE register pairs in the block - * GpeBlockBaseNumber - Starting GPE number for the block - * InterruptNumber - H/W interrupt for the block - * ReturnGpeBlock - Where the new block descriptor is returned - * - * RETURN: Status - * - * DESCRIPTION: Create and Install a block of GPE registers. All GPEs within - * the block are disabled at exit. - * Note: Assumes namespace is locked. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvCreateGpeBlock ( - ACPI_NAMESPACE_NODE *GpeDevice, - UINT64 Address, - UINT8 SpaceId, - UINT32 RegisterCount, - UINT16 GpeBlockBaseNumber, - UINT32 InterruptNumber, - ACPI_GPE_BLOCK_INFO **ReturnGpeBlock) -{ - ACPI_STATUS Status; - ACPI_GPE_BLOCK_INFO *GpeBlock; - ACPI_GPE_WALK_INFO WalkInfo; - - - ACPI_FUNCTION_TRACE (EvCreateGpeBlock); - - - if (!RegisterCount) - { - return_ACPI_STATUS (AE_OK); - } - - /* Allocate a new GPE block */ - - GpeBlock = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_BLOCK_INFO)); - if (!GpeBlock) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Initialize the new GPE block */ - - GpeBlock->Address = Address; - GpeBlock->SpaceId = SpaceId; - GpeBlock->Node = GpeDevice; - GpeBlock->GpeCount = (UINT16) (RegisterCount * ACPI_GPE_REGISTER_WIDTH); - GpeBlock->Initialized = FALSE; - GpeBlock->RegisterCount = RegisterCount; - GpeBlock->BlockBaseNumber = GpeBlockBaseNumber; - - /* - * Create the RegisterInfo and EventInfo sub-structures - * Note: disables and clears all GPEs in the block - */ - Status = AcpiEvCreateGpeInfoBlocks (GpeBlock); - if (ACPI_FAILURE (Status)) - { - ACPI_FREE (GpeBlock); - return_ACPI_STATUS (Status); - } - - /* Install the new block in the global lists */ - - Status = AcpiEvInstallGpeBlock (GpeBlock, InterruptNumber); - if (ACPI_FAILURE (Status)) - { - ACPI_FREE (GpeBlock->RegisterInfo); - ACPI_FREE (GpeBlock->EventInfo); - ACPI_FREE (GpeBlock); - return_ACPI_STATUS (Status); - } - - AcpiGbl_AllGpesInitialized = FALSE; - - /* Find all GPE methods (_Lxx or_Exx) for this block */ - - WalkInfo.GpeBlock = GpeBlock; - WalkInfo.GpeDevice = GpeDevice; - WalkInfo.ExecuteByOwnerId = FALSE; - - (void) AcpiNsWalkNamespace (ACPI_TYPE_METHOD, GpeDevice, - ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, - AcpiEvMatchGpeMethod, NULL, &WalkInfo, NULL); - - /* Return the new block */ - - if (ReturnGpeBlock) - { - (*ReturnGpeBlock) = GpeBlock; - } - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - " Initialized GPE %02X to %02X [%4.4s] %u regs on interrupt 0x%X%s\n", - (UINT32) GpeBlock->BlockBaseNumber, - (UINT32) (GpeBlock->BlockBaseNumber + (GpeBlock->GpeCount - 1)), - GpeDevice->Name.Ascii, GpeBlock->RegisterCount, InterruptNumber, - InterruptNumber == AcpiGbl_FADT.SciInterrupt ? " (SCI)" : "")); - - /* Update global count of currently available GPEs */ - - AcpiCurrentGpeCount += GpeBlock->GpeCount; - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvInitializeGpeBlock - * - * PARAMETERS: ACPI_GPE_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Initialize and enable a GPE block. Enable GPEs that have - * associated methods. - * Note: Assumes namespace is locked. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvInitializeGpeBlock ( - ACPI_GPE_XRUPT_INFO *GpeXruptInfo, - ACPI_GPE_BLOCK_INFO *GpeBlock, - void *Context) -{ - ACPI_STATUS Status; - ACPI_GPE_EVENT_INFO *GpeEventInfo; - UINT32 GpeEnabledCount; - UINT32 GpeIndex; - UINT32 i; - UINT32 j; - BOOLEAN *IsPollingNeeded = Context; - ACPI_ERROR_ONLY (UINT32 GpeNumber); - - - ACPI_FUNCTION_TRACE (EvInitializeGpeBlock); - - - /* - * Ignore a null GPE block (e.g., if no GPE block 1 exists), and - * any GPE blocks that have been initialized already. - */ - if (!GpeBlock || GpeBlock->Initialized) - { - return_ACPI_STATUS (AE_OK); - } - - /* - * Enable all GPEs that have a corresponding method and have the - * ACPI_GPE_CAN_WAKE flag unset. Any other GPEs within this block - * must be enabled via the acpi_enable_gpe() interface. - */ - GpeEnabledCount = 0; - - for (i = 0; i < GpeBlock->RegisterCount; i++) - { - for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) - { - /* Get the info block for this particular GPE */ - - GpeIndex = (i * ACPI_GPE_REGISTER_WIDTH) + j; - GpeEventInfo = &GpeBlock->EventInfo[GpeIndex]; - ACPI_ERROR_ONLY(GpeNumber = GpeBlock->BlockBaseNumber + GpeIndex); - GpeEventInfo->Flags |= ACPI_GPE_INITIALIZED; - - /* - * Ignore GPEs that have no corresponding _Lxx/_Exx method - * and GPEs that are used to wake the system - */ - if ((ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) != ACPI_GPE_DISPATCH_METHOD) || - (GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE)) - { - continue; - } - - Status = AcpiEvAddGpeReference (GpeEventInfo, FALSE); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Could not enable GPE 0x%02X", - GpeNumber)); - continue; - } - - GpeEventInfo->Flags |= ACPI_GPE_AUTO_ENABLED; - - if (IsPollingNeeded && - ACPI_GPE_IS_POLLING_NEEDED (GpeEventInfo)) - { - *IsPollingNeeded = TRUE; - } - - GpeEnabledCount++; - } - } - - if (GpeEnabledCount) - { - ACPI_INFO (( - "Enabled %u GPEs in block %02X to %02X", GpeEnabledCount, - (UINT32) GpeBlock->BlockBaseNumber, - (UINT32) (GpeBlock->BlockBaseNumber + (GpeBlock->GpeCount - 1)))); - } - - GpeBlock->Initialized = TRUE; - return_ACPI_STATUS (AE_OK); -} - -#endif /* !ACPI_REDUCED_HARDWARE */ diff --git a/drivers/acpica/evgpeinit.c b/drivers/acpica/evgpeinit.c deleted file mode 100644 index 5321950..0000000 --- a/drivers/acpica/evgpeinit.c +++ /dev/null @@ -1,575 +0,0 @@ -/****************************************************************************** - * - * Module Name: evgpeinit - System GPE initialization and update - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acevents.h" -#include "acnamesp.h" - -#define _COMPONENT ACPI_EVENTS - ACPI_MODULE_NAME ("evgpeinit") - -#if (!ACPI_REDUCED_HARDWARE) /* Entire module */ - -/* - * Note: History of _PRW support in ACPICA - * - * Originally (2000 - 2010), the GPE initialization code performed a walk of - * the entire namespace to execute the _PRW methods and detect all GPEs - * capable of waking the system. - * - * As of 10/2010, the _PRW method execution has been removed since it is - * actually unnecessary. The host OS must in fact execute all _PRW methods - * in order to identify the device/power-resource dependencies. We now put - * the onus on the host OS to identify the wake GPEs as part of this process - * and to inform ACPICA of these GPEs via the AcpiSetupGpeForWake interface. This - * not only reduces the complexity of the ACPICA initialization code, but in - * some cases (on systems with very large namespaces) it should reduce the - * kernel boot time as well. - */ - -/******************************************************************************* - * - * FUNCTION: AcpiEvGpeInitialize - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Initialize the GPE data structures and the FADT GPE 0/1 blocks - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvGpeInitialize ( - void) -{ - UINT32 RegisterCount0 = 0; - UINT32 RegisterCount1 = 0; - UINT32 GpeNumberMax = 0; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (EvGpeInitialize); - - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - "Initializing General Purpose Events (GPEs):\n")); - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* - * Initialize the GPE Block(s) defined in the FADT - * - * Why the GPE register block lengths are divided by 2: From the ACPI - * Spec, section "General-Purpose Event Registers", we have: - * - * "Each register block contains two registers of equal length - * GPEx_STS and GPEx_EN (where x is 0 or 1). The length of the - * GPE0_STS and GPE0_EN registers is equal to half the GPE0_LEN - * The length of the GPE1_STS and GPE1_EN registers is equal to - * half the GPE1_LEN. If a generic register block is not supported - * then its respective block pointer and block length values in the - * FADT table contain zeros. The GPE0_LEN and GPE1_LEN do not need - * to be the same size." - */ - - /* - * Determine the maximum GPE number for this machine. - * - * Note: both GPE0 and GPE1 are optional, and either can exist without - * the other. - * - * If EITHER the register length OR the block address are zero, then that - * particular block is not supported. - */ - if (AcpiGbl_FADT.Gpe0BlockLength && - AcpiGbl_FADT.XGpe0Block.Address) - { - /* GPE block 0 exists (has both length and address > 0) */ - - RegisterCount0 = (UINT16) (AcpiGbl_FADT.Gpe0BlockLength / 2); - GpeNumberMax = (RegisterCount0 * ACPI_GPE_REGISTER_WIDTH) - 1; - - /* Install GPE Block 0 */ - - Status = AcpiEvCreateGpeBlock (AcpiGbl_FadtGpeDevice, - AcpiGbl_FADT.XGpe0Block.Address, - AcpiGbl_FADT.XGpe0Block.SpaceId, - RegisterCount0, 0, - AcpiGbl_FADT.SciInterrupt, &AcpiGbl_GpeFadtBlocks[0]); - - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Could not create GPE Block 0")); - } - } - - if (AcpiGbl_FADT.Gpe1BlockLength && - AcpiGbl_FADT.XGpe1Block.Address) - { - /* GPE block 1 exists (has both length and address > 0) */ - - RegisterCount1 = (UINT16) (AcpiGbl_FADT.Gpe1BlockLength / 2); - - /* Check for GPE0/GPE1 overlap (if both banks exist) */ - - if ((RegisterCount0) && - (GpeNumberMax >= AcpiGbl_FADT.Gpe1Base)) - { - ACPI_ERROR ((AE_INFO, - "GPE0 block (GPE 0 to %u) overlaps the GPE1 block " - "(GPE %u to %u) - Ignoring GPE1", - GpeNumberMax, AcpiGbl_FADT.Gpe1Base, - AcpiGbl_FADT.Gpe1Base + - ((RegisterCount1 * ACPI_GPE_REGISTER_WIDTH) - 1))); - - /* Ignore GPE1 block by setting the register count to zero */ - - RegisterCount1 = 0; - } - else - { - /* Install GPE Block 1 */ - - Status = AcpiEvCreateGpeBlock (AcpiGbl_FadtGpeDevice, - AcpiGbl_FADT.XGpe1Block.Address, - AcpiGbl_FADT.XGpe1Block.SpaceId, - RegisterCount1, - AcpiGbl_FADT.Gpe1Base, - AcpiGbl_FADT.SciInterrupt, &AcpiGbl_GpeFadtBlocks[1]); - - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Could not create GPE Block 1")); - } - - /* - * GPE0 and GPE1 do not have to be contiguous in the GPE number - * space. However, GPE0 always starts at GPE number zero. - */ - } - } - - /* Exit if there are no GPE registers */ - - if ((RegisterCount0 + RegisterCount1) == 0) - { - /* GPEs are not required by ACPI, this is OK */ - - ACPI_DEBUG_PRINT ((ACPI_DB_INIT, - "There are no GPE blocks defined in the FADT\n")); - goto Cleanup; - } - - -Cleanup: - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvUpdateGpes - * - * PARAMETERS: TableOwnerId - ID of the newly-loaded ACPI table - * - * RETURN: None - * - * DESCRIPTION: Check for new GPE methods (_Lxx/_Exx) made available as a - * result of a Load() or LoadTable() operation. If new GPE - * methods have been installed, register the new methods. - * - ******************************************************************************/ - -void -AcpiEvUpdateGpes ( - ACPI_OWNER_ID TableOwnerId) -{ - ACPI_GPE_XRUPT_INFO *GpeXruptInfo; - ACPI_GPE_BLOCK_INFO *GpeBlock; - ACPI_GPE_WALK_INFO WalkInfo; - ACPI_STATUS Status = AE_OK; - - - /* - * Find any _Lxx/_Exx GPE methods that have just been loaded. - * - * Any GPEs that correspond to new _Lxx/_Exx methods are immediately - * enabled. - * - * Examine the namespace underneath each GpeDevice within the - * GpeBlock lists. - */ - Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (Status)) - { - return; - } - - WalkInfo.Count = 0; - WalkInfo.OwnerId = TableOwnerId; - WalkInfo.ExecuteByOwnerId = TRUE; - - /* Walk the interrupt level descriptor list */ - - GpeXruptInfo = AcpiGbl_GpeXruptListHead; - while (GpeXruptInfo) - { - /* Walk all Gpe Blocks attached to this interrupt level */ - - GpeBlock = GpeXruptInfo->GpeBlockListHead; - while (GpeBlock) - { - WalkInfo.GpeBlock = GpeBlock; - WalkInfo.GpeDevice = GpeBlock->Node; - - Status = AcpiNsWalkNamespace (ACPI_TYPE_METHOD, - WalkInfo.GpeDevice, ACPI_UINT32_MAX, - ACPI_NS_WALK_NO_UNLOCK, AcpiEvMatchGpeMethod, - NULL, &WalkInfo, NULL); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "While decoding _Lxx/_Exx methods")); - } - - GpeBlock = GpeBlock->Next; - } - - GpeXruptInfo = GpeXruptInfo->Next; - } - - if (WalkInfo.Count) - { - ACPI_INFO (("Enabled %u new GPEs", WalkInfo.Count)); - } - - (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); - return; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvMatchGpeMethod - * - * PARAMETERS: Callback from WalkNamespace - * - * RETURN: Status - * - * DESCRIPTION: Called from AcpiWalkNamespace. Expects each object to be a - * control method under the _GPE portion of the namespace. - * Extract the name and GPE type from the object, saving this - * information for quick lookup during GPE dispatch. Allows a - * per-OwnerId evaluation if ExecuteByOwnerId is TRUE in the - * WalkInfo parameter block. - * - * The name of each GPE control method is of the form: - * "_Lxx" or "_Exx", where: - * L - means that the GPE is level triggered - * E - means that the GPE is edge triggered - * xx - is the GPE number [in HEX] - * - * If WalkInfo->ExecuteByOwnerId is TRUE, we only execute examine GPE methods - * with that owner. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvMatchGpeMethod ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue) -{ - ACPI_NAMESPACE_NODE *MethodNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle); - ACPI_GPE_WALK_INFO *WalkInfo = ACPI_CAST_PTR (ACPI_GPE_WALK_INFO, Context); - ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_STATUS Status; - UINT32 GpeNumber; - UINT8 TempGpeNumber; - char Name[ACPI_NAMESEG_SIZE + 1]; - UINT8 Type; - - - ACPI_FUNCTION_TRACE (EvMatchGpeMethod); - - - /* Check if requested OwnerId matches this OwnerId */ - - if ((WalkInfo->ExecuteByOwnerId) && - (MethodNode->OwnerId != WalkInfo->OwnerId)) - { - return_ACPI_STATUS (AE_OK); - } - - /* - * Match and decode the _Lxx and _Exx GPE method names - * - * 1) Extract the method name and null terminate it - */ - ACPI_MOVE_32_TO_32 (Name, &MethodNode->Name.Integer); - Name[ACPI_NAMESEG_SIZE] = 0; - - /* 2) Name must begin with an underscore */ - - if (Name[0] != '_') - { - return_ACPI_STATUS (AE_OK); /* Ignore this method */ - } - - /* - * 3) Edge/Level determination is based on the 2nd character - * of the method name - */ - switch (Name[1]) - { - case 'L': - - Type = ACPI_GPE_LEVEL_TRIGGERED; - break; - - case 'E': - - Type = ACPI_GPE_EDGE_TRIGGERED; - break; - - default: - - /* Unknown method type, just ignore it */ - - ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, - "Ignoring unknown GPE method type: %s " - "(name not of form _Lxx or _Exx)", Name)); - return_ACPI_STATUS (AE_OK); - } - - /* 4) The last two characters of the name are the hex GPE Number */ - - Status = AcpiUtAsciiToHexByte (&Name[2], &TempGpeNumber); - if (ACPI_FAILURE (Status)) - { - /* Conversion failed; invalid method, just ignore it */ - - ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, - "Could not extract GPE number from name: %s " - "(name is not of form _Lxx or _Exx)", Name)); - return_ACPI_STATUS (AE_OK); - } - - /* Ensure that we have a valid GPE number for this GPE block */ - - GpeNumber = (UINT32) TempGpeNumber; - GpeEventInfo = AcpiEvLowGetGpeInfo (GpeNumber, WalkInfo->GpeBlock); - if (!GpeEventInfo) - { - /* - * This GpeNumber is not valid for this GPE block, just ignore it. - * However, it may be valid for a different GPE block, since GPE0 - * and GPE1 methods both appear under \_GPE. - */ - return_ACPI_STATUS (AE_OK); - } - - if ((ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == - ACPI_GPE_DISPATCH_HANDLER) || - (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == - ACPI_GPE_DISPATCH_RAW_HANDLER)) - { - /* If there is already a handler, ignore this GPE method */ - - return_ACPI_STATUS (AE_OK); - } - - if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == - ACPI_GPE_DISPATCH_METHOD) - { - /* - * If there is already a method, ignore this method. But check - * for a type mismatch (if both the _Lxx AND _Exx exist) - */ - if (Type != (GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK)) - { - ACPI_ERROR ((AE_INFO, - "For GPE 0x%.2X, found both _L%2.2X and _E%2.2X methods", - GpeNumber, GpeNumber, GpeNumber)); - } - return_ACPI_STATUS (AE_OK); - } - - /* Disable the GPE in case it's been enabled already. */ - - (void) AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE); - - /* - * Add the GPE information from above to the GpeEventInfo block for - * use during dispatch of this GPE. - */ - GpeEventInfo->Flags &= ~(ACPI_GPE_DISPATCH_MASK); - GpeEventInfo->Flags |= (UINT8) (Type | ACPI_GPE_DISPATCH_METHOD); - GpeEventInfo->Dispatch.MethodNode = MethodNode; - WalkInfo->Count++; - - ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, - "Registered GPE method %s as GPE number 0x%.2X\n", - Name, GpeNumber)); - return_ACPI_STATUS (AE_OK); -} - -#endif /* !ACPI_REDUCED_HARDWARE */ diff --git a/drivers/acpica/evgpeutil.c b/drivers/acpica/evgpeutil.c deleted file mode 100644 index 32e7c0f..0000000 --- a/drivers/acpica/evgpeutil.c +++ /dev/null @@ -1,506 +0,0 @@ -/****************************************************************************** - * - * Module Name: evgpeutil - GPE utilities - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acevents.h" - -#define _COMPONENT ACPI_EVENTS - ACPI_MODULE_NAME ("evgpeutil") - - -#if (!ACPI_REDUCED_HARDWARE) /* Entire module */ -/******************************************************************************* - * - * FUNCTION: AcpiEvWalkGpeList - * - * PARAMETERS: GpeWalkCallback - Routine called for each GPE block - * Context - Value passed to callback - * - * RETURN: Status - * - * DESCRIPTION: Walk the GPE lists. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvWalkGpeList ( - ACPI_GPE_CALLBACK GpeWalkCallback, - void *Context) -{ - ACPI_GPE_BLOCK_INFO *GpeBlock; - ACPI_GPE_XRUPT_INFO *GpeXruptInfo; - ACPI_STATUS Status = AE_OK; - ACPI_CPU_FLAGS Flags; - - - ACPI_FUNCTION_TRACE (EvWalkGpeList); - - - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - - /* Walk the interrupt level descriptor list */ - - GpeXruptInfo = AcpiGbl_GpeXruptListHead; - while (GpeXruptInfo) - { - /* Walk all Gpe Blocks attached to this interrupt level */ - - GpeBlock = GpeXruptInfo->GpeBlockListHead; - while (GpeBlock) - { - /* One callback per GPE block */ - - Status = GpeWalkCallback (GpeXruptInfo, GpeBlock, Context); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_CTRL_END) /* Callback abort */ - { - Status = AE_OK; - } - goto UnlockAndExit; - } - - GpeBlock = GpeBlock->Next; - } - - GpeXruptInfo = GpeXruptInfo->Next; - } - -UnlockAndExit: - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvGetGpeDevice - * - * PARAMETERS: GPE_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Matches the input GPE index (0-CurrentGpeCount) with a GPE - * block device. NULL if the GPE is one of the FADT-defined GPEs. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvGetGpeDevice ( - ACPI_GPE_XRUPT_INFO *GpeXruptInfo, - ACPI_GPE_BLOCK_INFO *GpeBlock, - void *Context) -{ - ACPI_GPE_DEVICE_INFO *Info = Context; - - - /* Increment Index by the number of GPEs in this block */ - - Info->NextBlockBaseIndex += GpeBlock->GpeCount; - - if (Info->Index < Info->NextBlockBaseIndex) - { - /* - * The GPE index is within this block, get the node. Leave the node - * NULL for the FADT-defined GPEs - */ - if ((GpeBlock->Node)->Type == ACPI_TYPE_DEVICE) - { - Info->GpeDevice = GpeBlock->Node; - } - - Info->Status = AE_OK; - return (AE_CTRL_END); - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvGetGpeXruptBlock - * - * PARAMETERS: InterruptNumber - Interrupt for a GPE block - * GpeXruptBlock - Where the block is returned - * - * RETURN: Status - * - * DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt - * block per unique interrupt level used for GPEs. Should be - * called only when the GPE lists are semaphore locked and not - * subject to change. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvGetGpeXruptBlock ( - UINT32 InterruptNumber, - ACPI_GPE_XRUPT_INFO **GpeXruptBlock) -{ - ACPI_GPE_XRUPT_INFO *NextGpeXrupt; - ACPI_GPE_XRUPT_INFO *GpeXrupt; - ACPI_STATUS Status; - ACPI_CPU_FLAGS Flags; - - - ACPI_FUNCTION_TRACE (EvGetGpeXruptBlock); - - - /* No need for lock since we are not changing any list elements here */ - - NextGpeXrupt = AcpiGbl_GpeXruptListHead; - while (NextGpeXrupt) - { - if (NextGpeXrupt->InterruptNumber == InterruptNumber) - { - *GpeXruptBlock = NextGpeXrupt; - return_ACPI_STATUS (AE_OK); - } - - NextGpeXrupt = NextGpeXrupt->Next; - } - - /* Not found, must allocate a new xrupt descriptor */ - - GpeXrupt = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_XRUPT_INFO)); - if (!GpeXrupt) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - GpeXrupt->InterruptNumber = InterruptNumber; - - /* Install new interrupt descriptor with spin lock */ - - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - if (AcpiGbl_GpeXruptListHead) - { - NextGpeXrupt = AcpiGbl_GpeXruptListHead; - while (NextGpeXrupt->Next) - { - NextGpeXrupt = NextGpeXrupt->Next; - } - - NextGpeXrupt->Next = GpeXrupt; - GpeXrupt->Previous = NextGpeXrupt; - } - else - { - AcpiGbl_GpeXruptListHead = GpeXrupt; - } - - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - - /* Install new interrupt handler if not SCI_INT */ - - if (InterruptNumber != AcpiGbl_FADT.SciInterrupt) - { - Status = AcpiOsInstallInterruptHandler (InterruptNumber, - AcpiEvGpeXruptHandler, GpeXrupt); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Could not install GPE interrupt handler at level 0x%X", - InterruptNumber)); - return_ACPI_STATUS (Status); - } - } - - *GpeXruptBlock = GpeXrupt; - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvDeleteGpeXrupt - * - * PARAMETERS: GpeXrupt - A GPE interrupt info block - * - * RETURN: Status - * - * DESCRIPTION: Remove and free a GpeXrupt block. Remove an associated - * interrupt handler if not the SCI interrupt. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvDeleteGpeXrupt ( - ACPI_GPE_XRUPT_INFO *GpeXrupt) -{ - ACPI_STATUS Status; - ACPI_CPU_FLAGS Flags; - - - ACPI_FUNCTION_TRACE (EvDeleteGpeXrupt); - - - /* We never want to remove the SCI interrupt handler */ - - if (GpeXrupt->InterruptNumber == AcpiGbl_FADT.SciInterrupt) - { - GpeXrupt->GpeBlockListHead = NULL; - return_ACPI_STATUS (AE_OK); - } - - /* Disable this interrupt */ - - Status = AcpiOsRemoveInterruptHandler ( - GpeXrupt->InterruptNumber, AcpiEvGpeXruptHandler); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Unlink the interrupt block with lock */ - - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - if (GpeXrupt->Previous) - { - GpeXrupt->Previous->Next = GpeXrupt->Next; - } - else - { - /* No previous, update list head */ - - AcpiGbl_GpeXruptListHead = GpeXrupt->Next; - } - - if (GpeXrupt->Next) - { - GpeXrupt->Next->Previous = GpeXrupt->Previous; - } - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - - /* Free the block */ - - ACPI_FREE (GpeXrupt); - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvDeleteGpeHandlers - * - * PARAMETERS: GpeXruptInfo - GPE Interrupt info - * GpeBlock - Gpe Block info - * - * RETURN: Status - * - * DESCRIPTION: Delete all Handler objects found in the GPE data structs. - * Used only prior to termination. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvDeleteGpeHandlers ( - ACPI_GPE_XRUPT_INFO *GpeXruptInfo, - ACPI_GPE_BLOCK_INFO *GpeBlock, - void *Context) -{ - ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_GPE_NOTIFY_INFO *Notify; - ACPI_GPE_NOTIFY_INFO *Next; - UINT32 i; - UINT32 j; - - - ACPI_FUNCTION_TRACE (EvDeleteGpeHandlers); - - - /* Examine each GPE Register within the block */ - - for (i = 0; i < GpeBlock->RegisterCount; i++) - { - /* Now look at the individual GPEs in this byte register */ - - for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) - { - GpeEventInfo = &GpeBlock->EventInfo[((ACPI_SIZE) i * - ACPI_GPE_REGISTER_WIDTH) + j]; - - if ((ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == - ACPI_GPE_DISPATCH_HANDLER) || - (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == - ACPI_GPE_DISPATCH_RAW_HANDLER)) - { - /* Delete an installed handler block */ - - ACPI_FREE (GpeEventInfo->Dispatch.Handler); - GpeEventInfo->Dispatch.Handler = NULL; - GpeEventInfo->Flags &= ~ACPI_GPE_DISPATCH_MASK; - } - else if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == - ACPI_GPE_DISPATCH_NOTIFY) - { - /* Delete the implicit notification device list */ - - Notify = GpeEventInfo->Dispatch.NotifyList; - while (Notify) - { - Next = Notify->Next; - ACPI_FREE (Notify); - Notify = Next; - } - - GpeEventInfo->Dispatch.NotifyList = NULL; - GpeEventInfo->Flags &= ~ACPI_GPE_DISPATCH_MASK; - } - } - } - - return_ACPI_STATUS (AE_OK); -} - -#endif /* !ACPI_REDUCED_HARDWARE */ diff --git a/drivers/acpica/evhandler.c b/drivers/acpica/evhandler.c deleted file mode 100644 index efc4664..0000000 --- a/drivers/acpica/evhandler.c +++ /dev/null @@ -1,721 +0,0 @@ -/****************************************************************************** - * - * Module Name: evhandler - Support for Address Space handlers - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acevents.h" -#include "acnamesp.h" -#include "acinterp.h" - -#define _COMPONENT ACPI_EVENTS - ACPI_MODULE_NAME ("evhandler") - - -/* Local prototypes */ - -static ACPI_STATUS -AcpiEvInstallHandler ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue); - - -/* These are the address spaces that will get default handlers */ - -UINT8 AcpiGbl_DefaultAddressSpaces[ACPI_NUM_DEFAULT_SPACES] = -{ - ACPI_ADR_SPACE_SYSTEM_MEMORY, - ACPI_ADR_SPACE_SYSTEM_IO, - ACPI_ADR_SPACE_PCI_CONFIG, - ACPI_ADR_SPACE_DATA_TABLE -}; - - -/******************************************************************************* - * - * FUNCTION: AcpiEvInstallRegionHandlers - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Installs the core subsystem default address space handlers. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvInstallRegionHandlers ( - void) -{ - ACPI_STATUS Status; - UINT32 i; - - - ACPI_FUNCTION_TRACE (EvInstallRegionHandlers); - - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* - * All address spaces (PCI Config, EC, SMBus) are scope dependent and - * registration must occur for a specific device. - * - * In the case of the system memory and IO address spaces there is - * currently no device associated with the address space. For these we - * use the root. - * - * We install the default PCI config space handler at the root so that - * this space is immediately available even though the we have not - * enumerated all the PCI Root Buses yet. This is to conform to the ACPI - * specification which states that the PCI config space must be always - * available -- even though we are nowhere near ready to find the PCI root - * buses at this point. - * - * NOTE: We ignore AE_ALREADY_EXISTS because this means that a handler - * has already been installed (via AcpiInstallAddressSpaceHandler). - * Similar for AE_SAME_HANDLER. - */ - for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) - { - Status = AcpiEvInstallSpaceHandler (AcpiGbl_RootNode, - AcpiGbl_DefaultAddressSpaces[i], - ACPI_DEFAULT_HANDLER, NULL, NULL); - switch (Status) - { - case AE_OK: - case AE_SAME_HANDLER: - case AE_ALREADY_EXISTS: - - /* These exceptions are all OK */ - - Status = AE_OK; - break; - - default: - - goto UnlockAndExit; - } - } - -UnlockAndExit: - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvHasDefaultHandler - * - * PARAMETERS: Node - Namespace node for the device - * SpaceId - The address space ID - * - * RETURN: TRUE if default handler is installed, FALSE otherwise - * - * DESCRIPTION: Check if the default handler is installed for the requested - * space ID. - * - ******************************************************************************/ - -BOOLEAN -AcpiEvHasDefaultHandler ( - ACPI_NAMESPACE_NODE *Node, - ACPI_ADR_SPACE_TYPE SpaceId) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_OPERAND_OBJECT *HandlerObj; - - - /* Must have an existing internal object */ - - ObjDesc = AcpiNsGetAttachedObject (Node); - if (ObjDesc) - { - HandlerObj = ObjDesc->CommonNotify.Handler; - - /* Walk the linked list of handlers for this object */ - - while (HandlerObj) - { - if (HandlerObj->AddressSpace.SpaceId == SpaceId) - { - if (HandlerObj->AddressSpace.HandlerFlags & - ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) - { - return (TRUE); - } - } - - HandlerObj = HandlerObj->AddressSpace.Next; - } - } - - return (FALSE); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvInstallHandler - * - * PARAMETERS: WalkNamespace callback - * - * DESCRIPTION: This routine installs an address handler into objects that are - * of type Region or Device. - * - * If the Object is a Device, and the device has a handler of - * the same type then the search is terminated in that branch. - * - * This is because the existing handler is closer in proximity - * to any more regions than the one we are trying to install. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiEvInstallHandler ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue) -{ - ACPI_OPERAND_OBJECT *HandlerObj; - ACPI_OPERAND_OBJECT *NextHandlerObj; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - - - ACPI_FUNCTION_NAME (EvInstallHandler); - - - HandlerObj = (ACPI_OPERAND_OBJECT *) Context; - - /* Parameter validation */ - - if (!HandlerObj) - { - return (AE_OK); - } - - /* Convert and validate the device handle */ - - Node = AcpiNsValidateHandle (ObjHandle); - if (!Node) - { - return (AE_BAD_PARAMETER); - } - - /* - * We only care about regions and objects that are allowed to have - * address space handlers - */ - if ((Node->Type != ACPI_TYPE_DEVICE) && - (Node->Type != ACPI_TYPE_REGION) && - (Node != AcpiGbl_RootNode)) - { - return (AE_OK); - } - - /* Check for an existing internal object */ - - ObjDesc = AcpiNsGetAttachedObject (Node); - if (!ObjDesc) - { - /* No object, just exit */ - - return (AE_OK); - } - - /* Devices are handled different than regions */ - - if (ObjDesc->Common.Type == ACPI_TYPE_DEVICE) - { - /* Check if this Device already has a handler for this address space */ - - NextHandlerObj = AcpiEvFindRegionHandler ( - HandlerObj->AddressSpace.SpaceId, ObjDesc->CommonNotify.Handler); - if (NextHandlerObj) - { - /* Found a handler, is it for the same address space? */ - - ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, - "Found handler for region [%s] in device %p(%p) handler %p\n", - AcpiUtGetRegionName (HandlerObj->AddressSpace.SpaceId), - ObjDesc, NextHandlerObj, HandlerObj)); - - /* - * Since the object we found it on was a device, then it means - * that someone has already installed a handler for the branch - * of the namespace from this device on. Just bail out telling - * the walk routine to not traverse this branch. This preserves - * the scoping rule for handlers. - */ - return (AE_CTRL_DEPTH); - } - - /* - * As long as the device didn't have a handler for this space we - * don't care about it. We just ignore it and proceed. - */ - return (AE_OK); - } - - /* Object is a Region */ - - if (ObjDesc->Region.SpaceId != HandlerObj->AddressSpace.SpaceId) - { - /* This region is for a different address space, just ignore it */ - - return (AE_OK); - } - - /* - * Now we have a region and it is for the handler's address space type. - * - * First disconnect region for any previous handler (if any) - */ - AcpiEvDetachRegion (ObjDesc, FALSE); - - /* Connect the region to the new handler */ - - Status = AcpiEvAttachRegion (HandlerObj, ObjDesc, FALSE); - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvFindRegionHandler - * - * PARAMETERS: SpaceId - The address space ID - * HandlerObj - Head of the handler object list - * - * RETURN: Matching handler object. NULL if space ID not matched - * - * DESCRIPTION: Search a handler object list for a match on the address - * space ID. - * - ******************************************************************************/ - -ACPI_OPERAND_OBJECT * -AcpiEvFindRegionHandler ( - ACPI_ADR_SPACE_TYPE SpaceId, - ACPI_OPERAND_OBJECT *HandlerObj) -{ - - /* Walk the handler list for this device */ - - while (HandlerObj) - { - /* Same SpaceId indicates a handler is installed */ - - if (HandlerObj->AddressSpace.SpaceId == SpaceId) - { - return (HandlerObj); - } - - /* Next handler object */ - - HandlerObj = HandlerObj->AddressSpace.Next; - } - - return (NULL); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvInstallSpaceHandler - * - * PARAMETERS: Node - Namespace node for the device - * SpaceId - The address space ID - * Handler - Address of the handler - * Setup - Address of the setup function - * Context - Value passed to the handler on each access - * - * RETURN: Status - * - * DESCRIPTION: Install a handler for all OpRegions of a given SpaceId. - * Assumes namespace is locked - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvInstallSpaceHandler ( - ACPI_NAMESPACE_NODE *Node, - ACPI_ADR_SPACE_TYPE SpaceId, - ACPI_ADR_SPACE_HANDLER Handler, - ACPI_ADR_SPACE_SETUP Setup, - void *Context) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_OPERAND_OBJECT *HandlerObj; - ACPI_STATUS Status = AE_OK; - ACPI_OBJECT_TYPE Type; - UINT8 Flags = 0; - - - ACPI_FUNCTION_TRACE (EvInstallSpaceHandler); - - - /* - * This registration is valid for only the types below and the root. - * The root node is where the default handlers get installed. - */ - if ((Node->Type != ACPI_TYPE_DEVICE) && - (Node->Type != ACPI_TYPE_PROCESSOR) && - (Node->Type != ACPI_TYPE_THERMAL) && - (Node != AcpiGbl_RootNode)) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - if (Handler == ACPI_DEFAULT_HANDLER) - { - Flags = ACPI_ADDR_HANDLER_DEFAULT_INSTALLED; - - switch (SpaceId) - { - case ACPI_ADR_SPACE_SYSTEM_MEMORY: - - Handler = AcpiExSystemMemorySpaceHandler; - Setup = AcpiEvSystemMemoryRegionSetup; - break; - - case ACPI_ADR_SPACE_SYSTEM_IO: - - Handler = AcpiExSystemIoSpaceHandler; - Setup = AcpiEvIoSpaceRegionSetup; - break; - - case ACPI_ADR_SPACE_PCI_CONFIG: - - Handler = AcpiExPciConfigSpaceHandler; - Setup = AcpiEvPciConfigRegionSetup; - break; - - case ACPI_ADR_SPACE_CMOS: - - Handler = AcpiExCmosSpaceHandler; - Setup = AcpiEvCmosRegionSetup; - break; - - case ACPI_ADR_SPACE_PCI_BAR_TARGET: - - Handler = AcpiExPciBarSpaceHandler; - Setup = AcpiEvPciBarRegionSetup; - break; - - case ACPI_ADR_SPACE_DATA_TABLE: - - Handler = AcpiExDataTableSpaceHandler; - Setup = AcpiEvDataTableRegionSetup; - break; - - default: - - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - } - - /* If the caller hasn't specified a setup routine, use the default */ - - if (!Setup) - { - Setup = AcpiEvDefaultRegionSetup; - } - - /* Check for an existing internal object */ - - ObjDesc = AcpiNsGetAttachedObject (Node); - if (ObjDesc) - { - /* - * The attached device object already exists. Now make sure - * the handler is not already installed. - */ - HandlerObj = AcpiEvFindRegionHandler (SpaceId, - ObjDesc->CommonNotify.Handler); - - if (HandlerObj) - { - if (HandlerObj->AddressSpace.Handler == Handler) - { - /* - * It is (relatively) OK to attempt to install the SAME - * handler twice. This can easily happen with the - * PCI_Config space. - */ - Status = AE_SAME_HANDLER; - goto UnlockAndExit; - } - else - { - /* A handler is already installed */ - - Status = AE_ALREADY_EXISTS; - } - - goto UnlockAndExit; - } - } - else - { - ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, - "Creating object on Device %p while installing handler\n", - Node)); - - /* ObjDesc does not exist, create one */ - - if (Node->Type == ACPI_TYPE_ANY) - { - Type = ACPI_TYPE_DEVICE; - } - else - { - Type = Node->Type; - } - - ObjDesc = AcpiUtCreateInternalObject (Type); - if (!ObjDesc) - { - Status = AE_NO_MEMORY; - goto UnlockAndExit; - } - - /* Init new descriptor */ - - ObjDesc->Common.Type = (UINT8) Type; - - /* Attach the new object to the Node */ - - Status = AcpiNsAttachObject (Node, ObjDesc, Type); - - /* Remove local reference to the object */ - - AcpiUtRemoveReference (ObjDesc); - - if (ACPI_FAILURE (Status)) - { - goto UnlockAndExit; - } - } - - ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, - "Installing address handler for region %s(%X) " - "on Device %4.4s %p(%p)\n", - AcpiUtGetRegionName (SpaceId), SpaceId, - AcpiUtGetNodeName (Node), Node, ObjDesc)); - - /* - * Install the handler - * - * At this point there is no existing handler. Just allocate the object - * for the handler and link it into the list. - */ - HandlerObj = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_ADDRESS_HANDLER); - if (!HandlerObj) - { - Status = AE_NO_MEMORY; - goto UnlockAndExit; - } - - /* Init handler obj */ - - Status = AcpiOsCreateMutex (&HandlerObj->AddressSpace.ContextMutex); - if (ACPI_FAILURE (Status)) - { - AcpiUtRemoveReference (HandlerObj); - goto UnlockAndExit; - } - - HandlerObj->AddressSpace.SpaceId = (UINT8) SpaceId; - HandlerObj->AddressSpace.HandlerFlags = Flags; - HandlerObj->AddressSpace.RegionList = NULL; - HandlerObj->AddressSpace.Node = Node; - HandlerObj->AddressSpace.Handler = Handler; - HandlerObj->AddressSpace.Context = Context; - HandlerObj->AddressSpace.Setup = Setup; - - /* Install at head of Device.AddressSpace list */ - - HandlerObj->AddressSpace.Next = ObjDesc->CommonNotify.Handler; - - /* - * The Device object is the first reference on the HandlerObj. - * Each region that uses the handler adds a reference. - */ - ObjDesc->CommonNotify.Handler = HandlerObj; - - /* - * Walk the namespace finding all of the regions this handler will - * manage. - * - * Start at the device and search the branch toward the leaf nodes - * until either the leaf is encountered or a device is detected that - * has an address handler of the same type. - * - * In either case, back up and search down the remainder of the branch - */ - Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, Node, - ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, - AcpiEvInstallHandler, NULL, HandlerObj, NULL); - -UnlockAndExit: - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/evmisc.c b/drivers/acpica/evmisc.c deleted file mode 100644 index d2e751d..0000000 --- a/drivers/acpica/evmisc.c +++ /dev/null @@ -1,451 +0,0 @@ -/****************************************************************************** - * - * Module Name: evmisc - Miscellaneous event manager support functions - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acevents.h" -#include "acnamesp.h" - -#define _COMPONENT ACPI_EVENTS - ACPI_MODULE_NAME ("evmisc") - - -/* Local prototypes */ - -static void ACPI_SYSTEM_XFACE -AcpiEvNotifyDispatch ( - void *Context); - - -/******************************************************************************* - * - * FUNCTION: AcpiEvIsNotifyObject - * - * PARAMETERS: Node - Node to check - * - * RETURN: TRUE if notifies allowed on this object - * - * DESCRIPTION: Check type of node for a object that supports notifies. - * - * TBD: This could be replaced by a flag bit in the node. - * - ******************************************************************************/ - -BOOLEAN -AcpiEvIsNotifyObject ( - ACPI_NAMESPACE_NODE *Node) -{ - - switch (Node->Type) - { - case ACPI_TYPE_DEVICE: - case ACPI_TYPE_PROCESSOR: - case ACPI_TYPE_THERMAL: - /* - * These are the ONLY objects that can receive ACPI notifications - */ - return (TRUE); - - default: - - return (FALSE); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvQueueNotifyRequest - * - * PARAMETERS: Node - NS node for the notified object - * NotifyValue - Value from the Notify() request - * - * RETURN: Status - * - * DESCRIPTION: Dispatch a device notification event to a previously - * installed handler. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvQueueNotifyRequest ( - ACPI_NAMESPACE_NODE *Node, - UINT32 NotifyValue) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_OPERAND_OBJECT *HandlerListHead = NULL; - ACPI_GENERIC_STATE *Info; - UINT8 HandlerListId = 0; - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_NAME (EvQueueNotifyRequest); - - - /* Are Notifies allowed on this object? */ - - if (!AcpiEvIsNotifyObject (Node)) - { - return (AE_TYPE); - } - - /* Get the correct notify list type (System or Device) */ - - if (NotifyValue <= ACPI_MAX_SYS_NOTIFY) - { - HandlerListId = ACPI_SYSTEM_HANDLER_LIST; - } - else - { - HandlerListId = ACPI_DEVICE_HANDLER_LIST; - } - - /* Get the notify object attached to the namespace Node */ - - ObjDesc = AcpiNsGetAttachedObject (Node); - if (ObjDesc) - { - /* We have an attached object, Get the correct handler list */ - - HandlerListHead = ObjDesc->CommonNotify.NotifyList[HandlerListId]; - } - - /* - * If there is no notify handler (Global or Local) - * for this object, just ignore the notify - */ - if (!AcpiGbl_GlobalNotify[HandlerListId].Handler && !HandlerListHead) - { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "No notify handler for Notify, ignoring (%4.4s, %X) node %p\n", - AcpiUtGetNodeName (Node), NotifyValue, Node)); - - return (AE_OK); - } - - /* Setup notify info and schedule the notify dispatcher */ - - Info = AcpiUtCreateGenericState (); - if (!Info) - { - return (AE_NO_MEMORY); - } - - Info->Common.DescriptorType = ACPI_DESC_TYPE_STATE_NOTIFY; - - Info->Notify.Node = Node; - Info->Notify.Value = (UINT16) NotifyValue; - Info->Notify.HandlerListId = HandlerListId; - Info->Notify.HandlerListHead = HandlerListHead; - Info->Notify.Global = &AcpiGbl_GlobalNotify[HandlerListId]; - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Dispatching Notify on [%4.4s] (%s) Value 0x%2.2X (%s) Node %p\n", - AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type), - NotifyValue, AcpiUtGetNotifyName (NotifyValue, ACPI_TYPE_ANY), Node)); - - Status = AcpiOsExecute (OSL_NOTIFY_HANDLER, - AcpiEvNotifyDispatch, Info); - if (ACPI_FAILURE (Status)) - { - AcpiUtDeleteGenericState (Info); - } - - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvNotifyDispatch - * - * PARAMETERS: Context - To be passed to the notify handler - * - * RETURN: None. - * - * DESCRIPTION: Dispatch a device notification event to a previously - * installed handler. - * - ******************************************************************************/ - -static void ACPI_SYSTEM_XFACE -AcpiEvNotifyDispatch ( - void *Context) -{ - ACPI_GENERIC_STATE *Info = (ACPI_GENERIC_STATE *) Context; - ACPI_OPERAND_OBJECT *HandlerObj; - - - ACPI_FUNCTION_ENTRY (); - - - /* Invoke a global notify handler if installed */ - - if (Info->Notify.Global->Handler) - { - Info->Notify.Global->Handler (Info->Notify.Node, - Info->Notify.Value, - Info->Notify.Global->Context); - } - - /* Now invoke the local notify handler(s) if any are installed */ - - HandlerObj = Info->Notify.HandlerListHead; - while (HandlerObj) - { - HandlerObj->Notify.Handler (Info->Notify.Node, - Info->Notify.Value, - HandlerObj->Notify.Context); - - HandlerObj = HandlerObj->Notify.Next[Info->Notify.HandlerListId]; - } - - /* All done with the info object */ - - AcpiUtDeleteGenericState (Info); -} - - -#if (!ACPI_REDUCED_HARDWARE) -/****************************************************************************** - * - * FUNCTION: AcpiEvTerminate - * - * PARAMETERS: none - * - * RETURN: none - * - * DESCRIPTION: Disable events and free memory allocated for table storage. - * - ******************************************************************************/ - -void -AcpiEvTerminate ( - void) -{ - UINT32 i; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (EvTerminate); - - - if (AcpiGbl_EventsInitialized) - { - /* - * Disable all event-related functionality. In all cases, on error, - * print a message but obviously we don't abort. - */ - - /* Disable all fixed events */ - - for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) - { - Status = AcpiDisableEvent (i, 0); - if (ACPI_FAILURE (Status)) - { - ACPI_ERROR ((AE_INFO, - "Could not disable fixed event %u", (UINT32) i)); - } - } - - /* Disable all GPEs in all GPE blocks */ - - Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock, NULL); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Could not disable GPEs in GPE block")); - } - - Status = AcpiEvRemoveGlobalLockHandler (); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Could not remove Global Lock handler")); - } - - AcpiGbl_EventsInitialized = FALSE; - } - - /* Remove SCI handlers */ - - Status = AcpiEvRemoveAllSciHandlers (); - if (ACPI_FAILURE (Status)) - { - ACPI_ERROR ((AE_INFO, - "Could not remove SCI handler")); - } - - /* Deallocate all handler objects installed within GPE info structs */ - - Status = AcpiEvWalkGpeList (AcpiEvDeleteGpeHandlers, NULL); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Could not delete GPE handlers")); - } - - - /* Return to original mode if necessary */ - - if (AcpiGbl_OriginalMode == ACPI_SYS_MODE_LEGACY) - { - Status = AcpiDisable (); - if (ACPI_FAILURE (Status)) - { - ACPI_WARNING ((AE_INFO, "AcpiDisable failed")); - } - } - return_VOID; -} - -#endif /* !ACPI_REDUCED_HARDWARE */ diff --git a/drivers/acpica/evregion.c b/drivers/acpica/evregion.c deleted file mode 100644 index 757983b..0000000 --- a/drivers/acpica/evregion.c +++ /dev/null @@ -1,1084 +0,0 @@ -/****************************************************************************** - * - * Module Name: evregion - Operation Region support - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acevents.h" -#include "acnamesp.h" -#include "acinterp.h" - -#define _COMPONENT ACPI_EVENTS - ACPI_MODULE_NAME ("evregion") - - -extern UINT8 AcpiGbl_DefaultAddressSpaces[]; - -/* Local prototypes */ - -static void -AcpiEvExecuteOrphanRegMethod ( - ACPI_NAMESPACE_NODE *DeviceNode, - ACPI_ADR_SPACE_TYPE SpaceId); - - -static ACPI_STATUS -AcpiEvRegRun ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue); - - -/******************************************************************************* - * - * FUNCTION: AcpiEvInitializeOpRegions - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Execute _REG methods for all Operation Regions that have - * an installed default region handler. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvInitializeOpRegions ( - void) -{ - ACPI_STATUS Status; - UINT32 i; - - - ACPI_FUNCTION_TRACE (EvInitializeOpRegions); - - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Run the _REG methods for OpRegions in each default address space */ - - for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) - { - /* - * Make sure the installed handler is the DEFAULT handler. If not the - * default, the _REG methods will have already been run (when the - * handler was installed) - */ - if (AcpiEvHasDefaultHandler (AcpiGbl_RootNode, - AcpiGbl_DefaultAddressSpaces[i])) - { - AcpiEvExecuteRegMethods (AcpiGbl_RootNode, - AcpiGbl_DefaultAddressSpaces[i], ACPI_REG_CONNECT); - } - } - - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvAddressSpaceDispatch - * - * PARAMETERS: RegionObj - Internal region object - * FieldObj - Corresponding field. Can be NULL. - * Function - Read or Write operation - * RegionOffset - Where in the region to read or write - * BitWidth - Field width in bits (8, 16, 32, or 64) - * Value - Pointer to in or out value, must be - * a full 64-bit integer - * - * RETURN: Status - * - * DESCRIPTION: Dispatch an address space or operation region access to - * a previously installed handler. - * - * NOTE: During early initialization, we always install the default region - * handlers for Memory, I/O and PCI_Config. This ensures that these operation - * region address spaces are always available as per the ACPI specification. - * This is especially needed in order to support the execution of - * module-level AML code during loading of the ACPI tables. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvAddressSpaceDispatch ( - ACPI_OPERAND_OBJECT *RegionObj, - ACPI_OPERAND_OBJECT *FieldObj, - UINT32 Function, - UINT32 RegionOffset, - UINT32 BitWidth, - UINT64 *Value) -{ - ACPI_STATUS Status; - ACPI_ADR_SPACE_HANDLER Handler; - ACPI_ADR_SPACE_SETUP RegionSetup; - ACPI_OPERAND_OBJECT *HandlerDesc; - ACPI_OPERAND_OBJECT *RegionObj2; - void *RegionContext = NULL; - ACPI_CONNECTION_INFO *Context; - ACPI_MUTEX ContextMutex; - BOOLEAN ContextLocked; - ACPI_PHYSICAL_ADDRESS Address; - - - ACPI_FUNCTION_TRACE (EvAddressSpaceDispatch); - - - RegionObj2 = AcpiNsGetSecondaryObject (RegionObj); - if (!RegionObj2) - { - return_ACPI_STATUS (AE_NOT_EXIST); - } - - /* Ensure that there is a handler associated with this region */ - - HandlerDesc = RegionObj->Region.Handler; - if (!HandlerDesc) - { - ACPI_ERROR ((AE_INFO, - "No handler for Region [%4.4s] (%p) [%s]", - AcpiUtGetNodeName (RegionObj->Region.Node), - RegionObj, AcpiUtGetRegionName (RegionObj->Region.SpaceId))); - - return_ACPI_STATUS (AE_NOT_EXIST); - } - - Context = HandlerDesc->AddressSpace.Context; - ContextMutex = HandlerDesc->AddressSpace.ContextMutex; - ContextLocked = FALSE; - - /* - * It may be the case that the region has never been initialized. - * Some types of regions require special init code - */ - if (!(RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE)) - { - /* This region has not been initialized yet, do it */ - - RegionSetup = HandlerDesc->AddressSpace.Setup; - if (!RegionSetup) - { - /* No initialization routine, exit with error */ - - ACPI_ERROR ((AE_INFO, - "No init routine for region(%p) [%s]", - RegionObj, AcpiUtGetRegionName (RegionObj->Region.SpaceId))); - return_ACPI_STATUS (AE_NOT_EXIST); - } - - if (FieldObj && RegionObj->Region.SpaceId == ACPI_ADR_SPACE_PLATFORM_COMM) - { - ACPI_PCC_INFO *Ctx = HandlerDesc->AddressSpace.Context; - - Ctx->InternalBuffer = FieldObj->Field.InternalPccBuffer; - Ctx->Length = (UINT16) RegionObj->Region.Length; - Ctx->SubspaceId = (UINT8) RegionObj->Region.Address; - } - - if (RegionObj->Region.SpaceId == ACPI_ADR_SPACE_FIXED_HARDWARE) - { - ACPI_FFH_INFO *Ctx = HandlerDesc->AddressSpace.Context; - - Ctx->Length = RegionObj->Region.Length; - Ctx->Offset = RegionObj->Region.Address; - } - - /* - * We must exit the interpreter because the region setup will - * potentially execute control methods (for example, the _REG method - * for this region) - */ - AcpiExExitInterpreter (); - - Status = RegionSetup (RegionObj, ACPI_REGION_ACTIVATE, - Context, &RegionContext); - - /* Re-enter the interpreter */ - - AcpiExEnterInterpreter (); - - /* Check for failure of the Region Setup */ - - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "During region initialization: [%s]", - AcpiUtGetRegionName (RegionObj->Region.SpaceId))); - return_ACPI_STATUS (Status); - } - - /* Region initialization may have been completed by RegionSetup */ - - if (!(RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE)) - { - RegionObj->Region.Flags |= AOPOBJ_SETUP_COMPLETE; - - /* - * Save the returned context for use in all accesses to - * the handler for this particular region - */ - if (!(RegionObj2->Extra.RegionContext)) - { - RegionObj2->Extra.RegionContext = RegionContext; - } - } - } - - /* We have everything we need, we can invoke the address space handler */ - - Handler = HandlerDesc->AddressSpace.Handler; - Address = (RegionObj->Region.Address + RegionOffset); - - ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, - "Handler %p (@%p) Address %8.8X%8.8X [%s]\n", - &RegionObj->Region.Handler->AddressSpace, Handler, - ACPI_FORMAT_UINT64 (Address), - AcpiUtGetRegionName (RegionObj->Region.SpaceId))); - - if (!(HandlerDesc->AddressSpace.HandlerFlags & - ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) - { - /* - * For handlers other than the default (supplied) handlers, we must - * exit the interpreter because the handler *might* block -- we don't - * know what it will do, so we can't hold the lock on the interpreter. - */ - AcpiExExitInterpreter(); - } - - /* - * Special handling for GenericSerialBus and GeneralPurposeIo: - * There are three extra parameters that must be passed to the - * handler via the context: - * 1) Connection buffer, a resource template from Connection() op - * 2) Length of the above buffer - * 3) Actual access length from the AccessAs() op - * - * Since we pass these extra parameters via the context, which is - * shared between threads, we must lock the context to avoid these - * parameters being changed from another thread before the handler - * has completed running. - * - * In addition, for GeneralPurposeIo, the Address and BitWidth fields - * are defined as follows: - * 1) Address is the pin number index of the field (bit offset from - * the previous Connection) - * 2) BitWidth is the actual bit length of the field (number of pins) - */ - if ((RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS || - RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GPIO) && - Context && - FieldObj) - { - - Status = AcpiOsAcquireMutex (ContextMutex, ACPI_WAIT_FOREVER); - if (ACPI_FAILURE (Status)) - { - goto ReEnterInterpreter; - } - - ContextLocked = TRUE; - - /* Get the Connection (ResourceTemplate) buffer */ - - Context->Connection = FieldObj->Field.ResourceBuffer; - Context->Length = FieldObj->Field.ResourceLength; - Context->AccessLength = FieldObj->Field.AccessLength; - - if (RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GPIO) - { - Address = FieldObj->Field.PinNumberIndex; - BitWidth = FieldObj->Field.BitLength; - } - } - - /* Call the handler */ - - Status = Handler (Function, Address, BitWidth, Value, Context, - RegionObj2->Extra.RegionContext); - - if (ContextLocked) - { - AcpiOsReleaseMutex (ContextMutex); - } - - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, "Returned by Handler for [%s]", - AcpiUtGetRegionName (RegionObj->Region.SpaceId))); - - /* - * Special case for an EC timeout. These are seen so frequently - * that an additional error message is helpful - */ - if ((RegionObj->Region.SpaceId == ACPI_ADR_SPACE_EC) && - (Status == AE_TIME)) - { - ACPI_ERROR ((AE_INFO, - "Timeout from EC hardware or EC device driver")); - } - } - -ReEnterInterpreter: - if (!(HandlerDesc->AddressSpace.HandlerFlags & - ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) - { - /* - * We just returned from a non-default handler, we must re-enter the - * interpreter - */ - AcpiExEnterInterpreter (); - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvDetachRegion - * - * PARAMETERS: RegionObj - Region Object - * AcpiNsIsLocked - Namespace Region Already Locked? - * - * RETURN: None - * - * DESCRIPTION: Break the association between the handler and the region - * this is a two way association. - * - ******************************************************************************/ - -void -AcpiEvDetachRegion ( - ACPI_OPERAND_OBJECT *RegionObj, - BOOLEAN AcpiNsIsLocked) -{ - ACPI_OPERAND_OBJECT *HandlerObj; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_OPERAND_OBJECT *StartDesc; - ACPI_OPERAND_OBJECT **LastObjPtr; - ACPI_ADR_SPACE_SETUP RegionSetup; - void **RegionContext; - ACPI_OPERAND_OBJECT *RegionObj2; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (EvDetachRegion); - - - RegionObj2 = AcpiNsGetSecondaryObject (RegionObj); - if (!RegionObj2) - { - return_VOID; - } - RegionContext = &RegionObj2->Extra.RegionContext; - - /* Get the address handler from the region object */ - - HandlerObj = RegionObj->Region.Handler; - if (!HandlerObj) - { - /* This region has no handler, all done */ - - return_VOID; - } - - /* Find this region in the handler's list */ - - ObjDesc = HandlerObj->AddressSpace.RegionList; - StartDesc = ObjDesc; - LastObjPtr = &HandlerObj->AddressSpace.RegionList; - - while (ObjDesc) - { - /* Is this the correct Region? */ - - if (ObjDesc == RegionObj) - { - ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, - "Removing Region %p from address handler %p\n", - RegionObj, HandlerObj)); - - /* This is it, remove it from the handler's list */ - - *LastObjPtr = ObjDesc->Region.Next; - ObjDesc->Region.Next = NULL; /* Must clear field */ - - if (AcpiNsIsLocked) - { - Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return_VOID; - } - } - - /* Now stop region accesses by executing the _REG method */ - - Status = AcpiEvExecuteRegMethod (RegionObj, ACPI_REG_DISCONNECT); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, "from region _REG, [%s]", - AcpiUtGetRegionName (RegionObj->Region.SpaceId))); - } - - if (AcpiNsIsLocked) - { - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return_VOID; - } - } - - /* - * If the region has been activated, call the setup handler with - * the deactivate notification - */ - if (RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE) - { - RegionSetup = HandlerObj->AddressSpace.Setup; - Status = RegionSetup (RegionObj, ACPI_REGION_DEACTIVATE, - HandlerObj->AddressSpace.Context, RegionContext); - - /* - * RegionContext should have been released by the deactivate - * operation. We don't need access to it anymore here. - */ - if (RegionContext) - { - *RegionContext = NULL; - } - - /* Init routine may fail, Just ignore errors */ - - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "from region handler - deactivate, [%s]", - AcpiUtGetRegionName (RegionObj->Region.SpaceId))); - } - - RegionObj->Region.Flags &= ~(AOPOBJ_SETUP_COMPLETE); - } - - /* - * Remove handler reference in the region - * - * NOTE: this doesn't mean that the region goes away, the region - * is just inaccessible as indicated to the _REG method - * - * If the region is on the handler's list, this must be the - * region's handler - */ - RegionObj->Region.Handler = NULL; - AcpiUtRemoveReference (HandlerObj); - - return_VOID; - } - - /* Walk the linked list of handlers */ - - LastObjPtr = &ObjDesc->Region.Next; - ObjDesc = ObjDesc->Region.Next; - - /* Prevent infinite loop if list is corrupted */ - - if (ObjDesc == StartDesc) - { - ACPI_ERROR ((AE_INFO, - "Circular handler list in region object %p", - RegionObj)); - return_VOID; - } - } - - /* If we get here, the region was not in the handler's region list */ - - ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, - "Cannot remove region %p from address handler %p\n", - RegionObj, HandlerObj)); - - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvAttachRegion - * - * PARAMETERS: HandlerObj - Handler Object - * RegionObj - Region Object - * AcpiNsIsLocked - Namespace Region Already Locked? - * - * RETURN: None - * - * DESCRIPTION: Create the association between the handler and the region - * this is a two way association. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvAttachRegion ( - ACPI_OPERAND_OBJECT *HandlerObj, - ACPI_OPERAND_OBJECT *RegionObj, - BOOLEAN AcpiNsIsLocked) -{ - - ACPI_FUNCTION_TRACE (EvAttachRegion); - - - /* Install the region's handler */ - - if (RegionObj->Region.Handler) - { - return_ACPI_STATUS (AE_ALREADY_EXISTS); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, - "Adding Region [%4.4s] %p to address handler %p [%s]\n", - AcpiUtGetNodeName (RegionObj->Region.Node), - RegionObj, HandlerObj, - AcpiUtGetRegionName (RegionObj->Region.SpaceId))); - - /* Link this region to the front of the handler's list */ - - RegionObj->Region.Next = HandlerObj->AddressSpace.RegionList; - HandlerObj->AddressSpace.RegionList = RegionObj; - RegionObj->Region.Handler = HandlerObj; - AcpiUtAddReference (HandlerObj); - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvExecuteRegMethod - * - * PARAMETERS: RegionObj - Region object - * Function - Passed to _REG: On (1) or Off (0) - * - * RETURN: Status - * - * DESCRIPTION: Execute _REG method for a region - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvExecuteRegMethod ( - ACPI_OPERAND_OBJECT *RegionObj, - UINT32 Function) -{ - ACPI_EVALUATE_INFO *Info; - ACPI_OPERAND_OBJECT *Args[3]; - ACPI_OPERAND_OBJECT *RegionObj2; - const ACPI_NAME *RegNamePtr = ACPI_CAST_PTR (ACPI_NAME, METHOD_NAME__REG); - ACPI_NAMESPACE_NODE *MethodNode; - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (EvExecuteRegMethod); - - - if (!AcpiGbl_NamespaceInitialized || - RegionObj->Region.Handler == NULL) - { - return_ACPI_STATUS (AE_OK); - } - - RegionObj2 = AcpiNsGetSecondaryObject (RegionObj); - if (!RegionObj2) - { - return_ACPI_STATUS (AE_NOT_EXIST); - } - - /* - * Find any "_REG" method associated with this region definition. - * The method should always be updated as this function may be - * invoked after a namespace change. - */ - Node = RegionObj->Region.Node->Parent; - Status = AcpiNsSearchOneScope ( - *RegNamePtr, Node, ACPI_TYPE_METHOD, &MethodNode); - if (ACPI_SUCCESS (Status)) - { - /* - * The _REG method is optional and there can be only one per - * region definition. This will be executed when the handler is - * attached or removed. - */ - RegionObj2->Extra.Method_REG = MethodNode; - } - if (RegionObj2->Extra.Method_REG == NULL) - { - return_ACPI_STATUS (AE_OK); - } - - /* _REG(DISCONNECT) should be paired with _REG(CONNECT) */ - - if ((Function == ACPI_REG_CONNECT && - RegionObj->Common.Flags & AOPOBJ_REG_CONNECTED) || - (Function == ACPI_REG_DISCONNECT && - !(RegionObj->Common.Flags & AOPOBJ_REG_CONNECTED))) - { - return_ACPI_STATUS (AE_OK); - } - - /* Allocate and initialize the evaluation information block */ - - Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO)); - if (!Info) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - Info->PrefixNode = RegionObj2->Extra.Method_REG; - Info->RelativePathname = NULL; - Info->Parameters = Args; - Info->Flags = ACPI_IGNORE_RETURN_VALUE; - - /* - * The _REG method has two arguments: - * - * Arg0 - Integer: - * Operation region space ID Same value as RegionObj->Region.SpaceId - * - * Arg1 - Integer: - * connection status 1 for connecting the handler, 0 for disconnecting - * the handler (Passed as a parameter) - */ - Args[0] = AcpiUtCreateIntegerObject ((UINT64) RegionObj->Region.SpaceId); - if (!Args[0]) - { - Status = AE_NO_MEMORY; - goto Cleanup1; - } - - Args[1] = AcpiUtCreateIntegerObject ((UINT64) Function); - if (!Args[1]) - { - Status = AE_NO_MEMORY; - goto Cleanup2; - } - - Args[2] = NULL; /* Terminate list */ - - /* Execute the method, no return value */ - - ACPI_DEBUG_EXEC ( - AcpiUtDisplayInitPathname (ACPI_TYPE_METHOD, Info->PrefixNode, NULL)); - - Status = AcpiNsEvaluate (Info); - AcpiUtRemoveReference (Args[1]); - - if (ACPI_FAILURE (Status)) - { - goto Cleanup2; - } - - if (Function == ACPI_REG_CONNECT) - { - RegionObj->Common.Flags |= AOPOBJ_REG_CONNECTED; - } - else - { - RegionObj->Common.Flags &= ~AOPOBJ_REG_CONNECTED; - } - -Cleanup2: - AcpiUtRemoveReference (Args[0]); - -Cleanup1: - ACPI_FREE (Info); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvExecuteRegMethods - * - * PARAMETERS: Node - Namespace node for the device - * SpaceId - The address space ID - * Function - Passed to _REG: On (1) or Off (0) - * - * RETURN: None - * - * DESCRIPTION: Run all _REG methods for the input Space ID; - * Note: assumes namespace is locked, or system init time. - * - ******************************************************************************/ - -void -AcpiEvExecuteRegMethods ( - ACPI_NAMESPACE_NODE *Node, - ACPI_ADR_SPACE_TYPE SpaceId, - UINT32 Function) -{ - ACPI_REG_WALK_INFO Info; - - - ACPI_FUNCTION_TRACE (EvExecuteRegMethods); - - /* - * These address spaces do not need a call to _REG, since the ACPI - * specification defines them as: "must always be accessible". Since - * they never change state (never become unavailable), no need to ever - * call _REG on them. Also, a DataTable is not a "real" address space, - * so do not call _REG. September 2018. - */ - if ((SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY) || - (SpaceId == ACPI_ADR_SPACE_SYSTEM_IO) || - (SpaceId == ACPI_ADR_SPACE_DATA_TABLE)) - { - return_VOID; - } - - Info.SpaceId = SpaceId; - Info.Function = Function; - Info.RegRunCount = 0; - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_NAMES, - " Running _REG methods for SpaceId %s\n", - AcpiUtGetRegionName (Info.SpaceId))); - - /* - * Run all _REG methods for all Operation Regions for this space ID. This - * is a separate walk in order to handle any interdependencies between - * regions and _REG methods. (i.e. handlers must be installed for all - * regions of this Space ID before we can run any _REG methods) - */ - (void) AcpiNsWalkNamespace (ACPI_TYPE_ANY, Node, ACPI_UINT32_MAX, - ACPI_NS_WALK_UNLOCK, AcpiEvRegRun, NULL, &Info, NULL); - - /* - * Special case for EC and GPIO: handle "orphan" _REG methods with - * no region. - */ - if (SpaceId == ACPI_ADR_SPACE_EC || SpaceId == ACPI_ADR_SPACE_GPIO) - { - AcpiEvExecuteOrphanRegMethod (Node, SpaceId); - } - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_NAMES, - " Executed %u _REG methods for SpaceId %s\n", - Info.RegRunCount, AcpiUtGetRegionName (Info.SpaceId))); - - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvRegRun - * - * PARAMETERS: WalkNamespace callback - * - * DESCRIPTION: Run _REG method for region objects of the requested spaceID - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiEvRegRun ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - ACPI_REG_WALK_INFO *Info; - - - Info = ACPI_CAST_PTR (ACPI_REG_WALK_INFO, Context); - - /* Convert and validate the device handle */ - - Node = AcpiNsValidateHandle (ObjHandle); - if (!Node) - { - return (AE_BAD_PARAMETER); - } - - /* - * We only care about regions and objects that are allowed to have - * address space handlers - */ - if ((Node->Type != ACPI_TYPE_REGION) && - (Node != AcpiGbl_RootNode)) - { - return (AE_OK); - } - - /* Check for an existing internal object */ - - ObjDesc = AcpiNsGetAttachedObject (Node); - if (!ObjDesc) - { - /* No object, just exit */ - - return (AE_OK); - } - - /* Object is a Region */ - - if (ObjDesc->Region.SpaceId != Info->SpaceId) - { - /* This region is for a different address space, just ignore it */ - - return (AE_OK); - } - - Info->RegRunCount++; - Status = AcpiEvExecuteRegMethod (ObjDesc, Info->Function); - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvExecuteOrphanRegMethod - * - * PARAMETERS: DeviceNode - Namespace node for an ACPI device - * SpaceId - The address space ID - * - * RETURN: None - * - * DESCRIPTION: Execute an "orphan" _REG method that appears under an ACPI - * device. This is a _REG method that has no corresponding region - * within the device's scope. ACPI tables depending on these - * "orphan" _REG methods have been seen for both EC and GPIO - * Operation Regions. Presumably the Windows ACPI implementation - * always calls the _REG method independent of the presence of - * an actual Operation Region with the correct address space ID. - * - * MUTEX: Assumes the namespace is locked - * - ******************************************************************************/ - -static void -AcpiEvExecuteOrphanRegMethod ( - ACPI_NAMESPACE_NODE *DeviceNode, - ACPI_ADR_SPACE_TYPE SpaceId) -{ - ACPI_HANDLE RegMethod; - ACPI_NAMESPACE_NODE *NextNode; - ACPI_STATUS Status; - ACPI_OBJECT_LIST Args; - ACPI_OBJECT Objects[2]; - - - ACPI_FUNCTION_TRACE (EvExecuteOrphanRegMethod); - - - if (!DeviceNode) - { - return_VOID; - } - - /* Namespace is currently locked, must release */ - - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - - /* Get a handle to a _REG method immediately under the EC device */ - - Status = AcpiGetHandle (DeviceNode, METHOD_NAME__REG, &RegMethod); - if (ACPI_FAILURE (Status)) - { - goto Exit; /* There is no _REG method present */ - } - - /* - * Execute the _REG method only if there is no Operation Region in - * this scope with the Embedded Controller space ID. Otherwise, it - * will already have been executed. Note, this allows for Regions - * with other space IDs to be present; but the code below will then - * execute the _REG method with the EmbeddedControl SpaceID argument. - */ - NextNode = AcpiNsGetNextNode (DeviceNode, NULL); - while (NextNode) - { - if ((NextNode->Type == ACPI_TYPE_REGION) && - (NextNode->Object) && - (NextNode->Object->Region.SpaceId == SpaceId)) - { - goto Exit; /* Do not execute the _REG */ - } - - NextNode = AcpiNsGetNextNode (DeviceNode, NextNode); - } - - /* Evaluate the _REG(SpaceId,Connect) method */ - - Args.Count = 2; - Args.Pointer = Objects; - Objects[0].Type = ACPI_TYPE_INTEGER; - Objects[0].Integer.Value = SpaceId; - Objects[1].Type = ACPI_TYPE_INTEGER; - Objects[1].Integer.Value = ACPI_REG_CONNECT; - - (void) AcpiEvaluateObject (RegMethod, NULL, &Args, NULL); - -Exit: - /* We ignore all errors from above, don't care */ - - (void) AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - return_VOID; -} diff --git a/drivers/acpica/evrgnini.c b/drivers/acpica/evrgnini.c deleted file mode 100644 index d8d09cd..0000000 --- a/drivers/acpica/evrgnini.c +++ /dev/null @@ -1,831 +0,0 @@ -/****************************************************************************** - * - * Module Name: evrgnini- ACPI AddressSpace (OpRegion) init - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acevents.h" -#include "acnamesp.h" -#include "acinterp.h" - -#define _COMPONENT ACPI_EVENTS - ACPI_MODULE_NAME ("evrgnini") - - -/******************************************************************************* - * - * FUNCTION: AcpiEvSystemMemoryRegionSetup - * - * PARAMETERS: Handle - Region we are interested in - * Function - Start or stop - * HandlerContext - Address space handler context - * RegionContext - Region specific context - * - * RETURN: Status - * - * DESCRIPTION: Setup a SystemMemory operation region - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvSystemMemoryRegionSetup ( - ACPI_HANDLE Handle, - UINT32 Function, - void *HandlerContext, - void **RegionContext) -{ - ACPI_OPERAND_OBJECT *RegionDesc = (ACPI_OPERAND_OBJECT *) Handle; - ACPI_MEM_SPACE_CONTEXT *LocalRegionContext; - ACPI_MEM_MAPPING *Mm; - - - ACPI_FUNCTION_TRACE (EvSystemMemoryRegionSetup); - - - if (Function == ACPI_REGION_DEACTIVATE) - { - if (*RegionContext) - { - LocalRegionContext = (ACPI_MEM_SPACE_CONTEXT *) *RegionContext; - - /* Delete memory mappings if present */ - - while (LocalRegionContext->FirstMm) - { - Mm = LocalRegionContext->FirstMm; - LocalRegionContext->FirstMm = Mm->NextMm; - AcpiOsUnmapMemory(Mm->LogicalAddress, Mm->Length); - ACPI_FREE(Mm); - } - ACPI_FREE (LocalRegionContext); - *RegionContext = NULL; - } - return_ACPI_STATUS (AE_OK); - } - - /* Create a new context */ - - LocalRegionContext = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_MEM_SPACE_CONTEXT)); - if (!(LocalRegionContext)) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Save the region length and address for use in the handler */ - - LocalRegionContext->Length = RegionDesc->Region.Length; - LocalRegionContext->Address = RegionDesc->Region.Address; - - *RegionContext = LocalRegionContext; - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvIoSpaceRegionSetup - * - * PARAMETERS: Handle - Region we are interested in - * Function - Start or stop - * HandlerContext - Address space handler context - * RegionContext - Region specific context - * - * RETURN: Status - * - * DESCRIPTION: Setup a IO operation region - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvIoSpaceRegionSetup ( - ACPI_HANDLE Handle, - UINT32 Function, - void *HandlerContext, - void **RegionContext) -{ - ACPI_FUNCTION_TRACE (EvIoSpaceRegionSetup); - - - if (Function == ACPI_REGION_DEACTIVATE) - { - *RegionContext = NULL; - } - else - { - *RegionContext = HandlerContext; - } - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvPciConfigRegionSetup - * - * PARAMETERS: Handle - Region we are interested in - * Function - Start or stop - * HandlerContext - Address space handler context - * RegionContext - Region specific context - * - * RETURN: Status - * - * DESCRIPTION: Setup a PCI_Config operation region - * - * MUTEX: Assumes namespace is not locked - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvPciConfigRegionSetup ( - ACPI_HANDLE Handle, - UINT32 Function, - void *HandlerContext, - void **RegionContext) -{ - ACPI_STATUS Status = AE_OK; - UINT64 PciValue; - ACPI_PCI_ID *PciId = *RegionContext; - ACPI_OPERAND_OBJECT *HandlerObj; - ACPI_NAMESPACE_NODE *ParentNode; - ACPI_NAMESPACE_NODE *PciRootNode; - ACPI_NAMESPACE_NODE *PciDeviceNode; - ACPI_OPERAND_OBJECT *RegionObj = (ACPI_OPERAND_OBJECT *) Handle; - - - ACPI_FUNCTION_TRACE (EvPciConfigRegionSetup); - - - HandlerObj = RegionObj->Region.Handler; - if (!HandlerObj) - { - /* - * No installed handler. This shouldn't happen because the dispatch - * routine checks before we get here, but we check again just in case. - */ - ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, - "Attempting to init a region %p, with no handler\n", RegionObj)); - return_ACPI_STATUS (AE_NOT_EXIST); - } - - *RegionContext = NULL; - if (Function == ACPI_REGION_DEACTIVATE) - { - if (PciId) - { - ACPI_FREE (PciId); - } - return_ACPI_STATUS (Status); - } - - ParentNode = RegionObj->Region.Node->Parent; - - /* - * Get the _SEG and _BBN values from the device upon which the handler - * is installed. - * - * We need to get the _SEG and _BBN objects relative to the PCI BUS device. - * This is the device the handler has been registered to handle. - */ - - /* - * If the AddressSpace.Node is still pointing to the root, we need - * to scan upward for a PCI Root bridge and re-associate the OpRegion - * handlers with that device. - */ - if (HandlerObj->AddressSpace.Node == AcpiGbl_RootNode) - { - /* Start search from the parent object */ - - PciRootNode = ParentNode; - while (PciRootNode != AcpiGbl_RootNode) - { - /* Get the _HID/_CID in order to detect a RootBridge */ - - if (AcpiEvIsPciRootBridge (PciRootNode)) - { - /* Install a handler for this PCI root bridge */ - - Status = AcpiInstallAddressSpaceHandler ( - (ACPI_HANDLE) PciRootNode, - ACPI_ADR_SPACE_PCI_CONFIG, - ACPI_DEFAULT_HANDLER, NULL, NULL); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_SAME_HANDLER) - { - /* - * It is OK if the handler is already installed on the - * root bridge. Still need to return a context object - * for the new PCI_Config operation region, however. - */ - } - else - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Could not install PciConfig handler " - "for Root Bridge %4.4s", - AcpiUtGetNodeName (PciRootNode))); - } - } - break; - } - - PciRootNode = PciRootNode->Parent; - } - - /* PCI root bridge not found, use namespace root node */ - } - else - { - PciRootNode = HandlerObj->AddressSpace.Node; - } - - /* - * If this region is now initialized, we are done. - * (InstallAddressSpaceHandler could have initialized it) - */ - if (RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE) - { - return_ACPI_STATUS (AE_OK); - } - - /* Region is still not initialized. Create a new context */ - - PciId = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_PCI_ID)); - if (!PciId) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* - * For PCI_Config space access, we need the segment, bus, device and - * function numbers. Acquire them here. - * - * Find the parent device object. (This allows the operation region to be - * within a subscope under the device, such as a control method.) - */ - PciDeviceNode = RegionObj->Region.Node; - while (PciDeviceNode && (PciDeviceNode->Type != ACPI_TYPE_DEVICE)) - { - PciDeviceNode = PciDeviceNode->Parent; - } - - if (!PciDeviceNode) - { - ACPI_FREE (PciId); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - - /* - * Get the PCI device and function numbers from the _ADR object - * contained in the parent's scope. - */ - Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, - PciDeviceNode, &PciValue); - - /* - * The default is zero, and since the allocation above zeroed the data, - * just do nothing on failure. - */ - if (ACPI_SUCCESS (Status)) - { - PciId->Device = ACPI_HIWORD (ACPI_LODWORD (PciValue)); - PciId->Function = ACPI_LOWORD (ACPI_LODWORD (PciValue)); - } - - /* The PCI segment number comes from the _SEG method */ - - Status = AcpiUtEvaluateNumericObject (METHOD_NAME__SEG, - PciRootNode, &PciValue); - if (ACPI_SUCCESS (Status)) - { - PciId->Segment = ACPI_LOWORD (PciValue); - } - - /* The PCI bus number comes from the _BBN method */ - - Status = AcpiUtEvaluateNumericObject (METHOD_NAME__BBN, - PciRootNode, &PciValue); - if (ACPI_SUCCESS (Status)) - { - PciId->Bus = ACPI_LOWORD (PciValue); - } - - /* Complete/update the PCI ID for this device */ - - Status = AcpiHwDerivePciId (PciId, PciRootNode, RegionObj->Region.Node); - if (ACPI_FAILURE (Status)) - { - ACPI_FREE (PciId); - return_ACPI_STATUS (Status); - } - - *RegionContext = PciId; - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvIsPciRootBridge - * - * PARAMETERS: Node - Device node being examined - * - * RETURN: TRUE if device is a PCI/PCI-Express Root Bridge - * - * DESCRIPTION: Determine if the input device represents a PCI Root Bridge by - * examining the _HID and _CID for the device. - * - ******************************************************************************/ - -BOOLEAN -AcpiEvIsPciRootBridge ( - ACPI_NAMESPACE_NODE *Node) -{ - ACPI_STATUS Status; - ACPI_PNP_DEVICE_ID *Hid; - ACPI_PNP_DEVICE_ID_LIST *Cid; - UINT32 i; - BOOLEAN Match; - - - /* Get the _HID and check for a PCI Root Bridge */ - - Status = AcpiUtExecute_HID (Node, &Hid); - if (ACPI_FAILURE (Status)) - { - return (FALSE); - } - - Match = AcpiUtIsPciRootBridge (Hid->String); - ACPI_FREE (Hid); - - if (Match) - { - return (TRUE); - } - - /* The _HID did not match. Get the _CID and check for a PCI Root Bridge */ - - Status = AcpiUtExecute_CID (Node, &Cid); - if (ACPI_FAILURE (Status)) - { - return (FALSE); - } - - /* Check all _CIDs in the returned list */ - - for (i = 0; i < Cid->Count; i++) - { - if (AcpiUtIsPciRootBridge (Cid->Ids[i].String)) - { - ACPI_FREE (Cid); - return (TRUE); - } - } - - ACPI_FREE (Cid); - return (FALSE); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvPciBarRegionSetup - * - * PARAMETERS: Handle - Region we are interested in - * Function - Start or stop - * HandlerContext - Address space handler context - * RegionContext - Region specific context - * - * RETURN: Status - * - * DESCRIPTION: Setup a PciBAR operation region - * - * MUTEX: Assumes namespace is not locked - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvPciBarRegionSetup ( - ACPI_HANDLE Handle, - UINT32 Function, - void *HandlerContext, - void **RegionContext) -{ - ACPI_FUNCTION_TRACE (EvPciBarRegionSetup); - - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvCmosRegionSetup - * - * PARAMETERS: Handle - Region we are interested in - * Function - Start or stop - * HandlerContext - Address space handler context - * RegionContext - Region specific context - * - * RETURN: Status - * - * DESCRIPTION: Setup a CMOS operation region - * - * MUTEX: Assumes namespace is not locked - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvCmosRegionSetup ( - ACPI_HANDLE Handle, - UINT32 Function, - void *HandlerContext, - void **RegionContext) -{ - ACPI_FUNCTION_TRACE (EvCmosRegionSetup); - - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvDataTableRegionSetup - * - * PARAMETERS: Handle - Region we are interested in - * Function - Start or stop - * HandlerContext - Address space handler context - * RegionContext - Region specific context - * - * RETURN: Status - * - * DESCRIPTION: Setup a DataTableRegion - * - * MUTEX: Assumes namespace is not locked - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvDataTableRegionSetup ( - ACPI_HANDLE Handle, - UINT32 Function, - void *HandlerContext, - void **RegionContext) -{ - ACPI_OPERAND_OBJECT *RegionDesc = (ACPI_OPERAND_OBJECT *) Handle; - ACPI_DATA_TABLE_MAPPING *LocalRegionContext; - - - ACPI_FUNCTION_TRACE (EvDataTableRegionSetup); - - - if (Function == ACPI_REGION_DEACTIVATE) - { - if (*RegionContext) - { - ACPI_FREE (*RegionContext); - *RegionContext = NULL; - } - return_ACPI_STATUS (AE_OK); - } - - /* Create a new context */ - - LocalRegionContext = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_DATA_TABLE_MAPPING)); - if (!(LocalRegionContext)) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Save the data table pointer for use in the handler */ - - LocalRegionContext->Pointer = RegionDesc->Region.Pointer; - - *RegionContext = LocalRegionContext; - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvDefaultRegionSetup - * - * PARAMETERS: Handle - Region we are interested in - * Function - Start or stop - * HandlerContext - Address space handler context - * RegionContext - Region specific context - * - * RETURN: Status - * - * DESCRIPTION: Default region initialization - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvDefaultRegionSetup ( - ACPI_HANDLE Handle, - UINT32 Function, - void *HandlerContext, - void **RegionContext) -{ - ACPI_FUNCTION_TRACE (EvDefaultRegionSetup); - - - if (Function == ACPI_REGION_DEACTIVATE) - { - *RegionContext = NULL; - } - else - { - *RegionContext = HandlerContext; - } - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvInitializeRegion - * - * PARAMETERS: RegionObj - Region we are initializing - * - * RETURN: Status - * - * DESCRIPTION: Initializes the region, finds any _REG methods and saves them - * for execution at a later time - * - * Get the appropriate address space handler for a newly - * created region. - * - * This also performs address space specific initialization. For - * example, PCI regions must have an _ADR object that contains - * a PCI address in the scope of the definition. This address is - * required to perform an access to PCI config space. - * - * MUTEX: Interpreter should be unlocked, because we may run the _REG - * method for this region. - * - * NOTE: Possible incompliance: - * There is a behavior conflict in automatic _REG execution: - * 1. When the interpreter is evaluating a method, we can only - * automatically run _REG for the following case: - * Method(_REG, 2) {} - * OperationRegion (OPR1, 0x80, 0x1000010, 0x4) - * 2. When the interpreter is loading a table, we can also - * automatically run _REG for the following case: - * OperationRegion (OPR1, 0x80, 0x1000010, 0x4) - * Method(_REG, 2) {} - * Though this may not be compliant to the de-facto standard, the - * logic is kept in order not to trigger regressions. And keeping - * this logic should be taken care by the caller of this function. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvInitializeRegion ( - ACPI_OPERAND_OBJECT *RegionObj) -{ - ACPI_OPERAND_OBJECT *HandlerObj; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_ADR_SPACE_TYPE SpaceId; - ACPI_NAMESPACE_NODE *Node; - - - ACPI_FUNCTION_TRACE (EvInitializeRegion); - - - if (!RegionObj) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - if (RegionObj->Common.Flags & AOPOBJ_OBJECT_INITIALIZED) - { - return_ACPI_STATUS (AE_OK); - } - - RegionObj->Common.Flags |= AOPOBJ_OBJECT_INITIALIZED; - - Node = RegionObj->Region.Node->Parent; - SpaceId = RegionObj->Region.SpaceId; - - /* - * The following loop depends upon the root Node having no parent - * ie: AcpiGbl_RootNode->Parent being set to NULL - */ - while (Node) - { - /* Check to see if a handler exists */ - - HandlerObj = NULL; - ObjDesc = AcpiNsGetAttachedObject (Node); - if (ObjDesc) - { - /* Can only be a handler if the object exists */ - - switch (Node->Type) - { - case ACPI_TYPE_DEVICE: - case ACPI_TYPE_PROCESSOR: - case ACPI_TYPE_THERMAL: - - HandlerObj = ObjDesc->CommonNotify.Handler; - break; - - default: - - /* Ignore other objects */ - - break; - } - - HandlerObj = AcpiEvFindRegionHandler (SpaceId, HandlerObj); - if (HandlerObj) - { - /* Found correct handler */ - - ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, - "Found handler %p for region %p in obj %p\n", - HandlerObj, RegionObj, ObjDesc)); - - (void) AcpiEvAttachRegion (HandlerObj, RegionObj, FALSE); - - /* - * Tell all users that this region is usable by - * running the _REG method - */ - AcpiExExitInterpreter (); - (void) AcpiEvExecuteRegMethod (RegionObj, ACPI_REG_CONNECT); - AcpiExEnterInterpreter (); - return_ACPI_STATUS (AE_OK); - } - } - - /* This node does not have the handler we need; Pop up one level */ - - Node = Node->Parent; - } - - /* - * If we get here, there is no handler for this region. This is not - * fatal because many regions get created before a handler is installed - * for said region. - */ - ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, - "No handler for RegionType %s(%X) (RegionObj %p)\n", - AcpiUtGetRegionName (SpaceId), SpaceId, RegionObj)); - - return_ACPI_STATUS (AE_OK); -} diff --git a/drivers/acpica/evsci.c b/drivers/acpica/evsci.c deleted file mode 100644 index 1c8352f..0000000 --- a/drivers/acpica/evsci.c +++ /dev/null @@ -1,391 +0,0 @@ -/******************************************************************************* - * - * Module Name: evsci - System Control Interrupt configuration and - * legacy to ACPI mode state transition functions - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acevents.h" - - -#define _COMPONENT ACPI_EVENTS - ACPI_MODULE_NAME ("evsci") - -#if (!ACPI_REDUCED_HARDWARE) /* Entire module */ - -/* Local prototypes */ - -static UINT32 ACPI_SYSTEM_XFACE -AcpiEvSciXruptHandler ( - void *Context); - - -/******************************************************************************* - * - * FUNCTION: AcpiEvSciDispatch - * - * PARAMETERS: None - * - * RETURN: Status code indicates whether interrupt was handled. - * - * DESCRIPTION: Dispatch the SCI to all host-installed SCI handlers. - * - ******************************************************************************/ - -UINT32 -AcpiEvSciDispatch ( - void) -{ - ACPI_SCI_HANDLER_INFO *SciHandler; - ACPI_CPU_FLAGS Flags; - UINT32 IntStatus = ACPI_INTERRUPT_NOT_HANDLED; - - - ACPI_FUNCTION_NAME (EvSciDispatch); - - - /* Are there any host-installed SCI handlers? */ - - if (!AcpiGbl_SciHandlerList) - { - return (IntStatus); - } - - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - - /* Invoke all host-installed SCI handlers */ - - SciHandler = AcpiGbl_SciHandlerList; - while (SciHandler) - { - /* Invoke the installed handler (at interrupt level) */ - - IntStatus |= SciHandler->Address ( - SciHandler->Context); - - SciHandler = SciHandler->Next; - } - - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - return (IntStatus); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvSciXruptHandler - * - * PARAMETERS: Context - Calling Context - * - * RETURN: Status code indicates whether interrupt was handled. - * - * DESCRIPTION: Interrupt handler that will figure out what function or - * control method to call to deal with a SCI. - * - ******************************************************************************/ - -static UINT32 ACPI_SYSTEM_XFACE -AcpiEvSciXruptHandler ( - void *Context) -{ - ACPI_GPE_XRUPT_INFO *GpeXruptList = Context; - UINT32 InterruptHandled = ACPI_INTERRUPT_NOT_HANDLED; - - - ACPI_FUNCTION_TRACE (EvSciXruptHandler); - - - /* - * We are guaranteed by the ACPICA initialization/shutdown code that - * if this interrupt handler is installed, ACPI is enabled. - */ - - /* - * Fixed Events: - * Check for and dispatch any Fixed Events that have occurred - */ - InterruptHandled |= AcpiEvFixedEventDetect (); - - /* - * General Purpose Events: - * Check for and dispatch any GPEs that have occurred - */ - InterruptHandled |= AcpiEvGpeDetect (GpeXruptList); - - /* Invoke all host-installed SCI handlers */ - - InterruptHandled |= AcpiEvSciDispatch (); - - AcpiSciCount++; - return_UINT32 (InterruptHandled); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvGpeXruptHandler - * - * PARAMETERS: Context - Calling Context - * - * RETURN: Status code indicates whether interrupt was handled. - * - * DESCRIPTION: Handler for GPE Block Device interrupts - * - ******************************************************************************/ - -UINT32 ACPI_SYSTEM_XFACE -AcpiEvGpeXruptHandler ( - void *Context) -{ - ACPI_GPE_XRUPT_INFO *GpeXruptList = Context; - UINT32 InterruptHandled = ACPI_INTERRUPT_NOT_HANDLED; - - - ACPI_FUNCTION_TRACE (EvGpeXruptHandler); - - - /* - * We are guaranteed by the ACPICA initialization/shutdown code that - * if this interrupt handler is installed, ACPI is enabled. - */ - - /* GPEs: Check for and dispatch any GPEs that have occurred */ - - InterruptHandled |= AcpiEvGpeDetect (GpeXruptList); - return_UINT32 (InterruptHandled); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiEvInstallSciHandler - * - * PARAMETERS: none - * - * RETURN: Status - * - * DESCRIPTION: Installs SCI handler. - * - ******************************************************************************/ - -UINT32 -AcpiEvInstallSciHandler ( - void) -{ - UINT32 Status = AE_OK; - - - ACPI_FUNCTION_TRACE (EvInstallSciHandler); - - - Status = AcpiOsInstallInterruptHandler ((UINT32) AcpiGbl_FADT.SciInterrupt, - AcpiEvSciXruptHandler, AcpiGbl_GpeXruptListHead); - return_ACPI_STATUS (Status); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiEvRemoveAllSciHandlers - * - * PARAMETERS: none - * - * RETURN: AE_OK if handler uninstalled, AE_ERROR if handler was not - * installed to begin with - * - * DESCRIPTION: Remove the SCI interrupt handler. No further SCIs will be - * taken. Remove all host-installed SCI handlers. - * - * Note: It doesn't seem important to disable all events or set the event - * enable registers to their original values. The OS should disable - * the SCI interrupt level when the handler is removed, so no more - * events will come in. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvRemoveAllSciHandlers ( - void) -{ - ACPI_SCI_HANDLER_INFO *SciHandler; - ACPI_CPU_FLAGS Flags; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (EvRemoveAllSciHandlers); - - - /* Just let the OS remove the handler and disable the level */ - - Status = AcpiOsRemoveInterruptHandler ((UINT32) AcpiGbl_FADT.SciInterrupt, - AcpiEvSciXruptHandler); - - if (!AcpiGbl_SciHandlerList) - { - return (Status); - } - - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - - /* Free all host-installed SCI handlers */ - - while (AcpiGbl_SciHandlerList) - { - SciHandler = AcpiGbl_SciHandlerList; - AcpiGbl_SciHandlerList = SciHandler->Next; - ACPI_FREE (SciHandler); - } - - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - return_ACPI_STATUS (Status); -} - -#endif /* !ACPI_REDUCED_HARDWARE */ diff --git a/drivers/acpica/evxface.c b/drivers/acpica/evxface.c deleted file mode 100644 index 2d334fd..0000000 --- a/drivers/acpica/evxface.c +++ /dev/null @@ -1,1376 +0,0 @@ -/****************************************************************************** - * - * Module Name: evxface - External interfaces for ACPI events - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#define EXPORT_ACPI_INTERFACES - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" -#include "acevents.h" -#include "acinterp.h" - -#define _COMPONENT ACPI_EVENTS - ACPI_MODULE_NAME ("evxface") - -#if (!ACPI_REDUCED_HARDWARE) - -/* Local prototypes */ - -static ACPI_STATUS -AcpiEvInstallGpeHandler ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber, - UINT32 Type, - BOOLEAN IsRawHandler, - ACPI_GPE_HANDLER Address, - void *Context); - -#endif - - -/******************************************************************************* - * - * FUNCTION: AcpiInstallNotifyHandler - * - * PARAMETERS: Device - The device for which notifies will be handled - * HandlerType - The type of handler: - * ACPI_SYSTEM_NOTIFY: System Handler (00-7F) - * ACPI_DEVICE_NOTIFY: Device Handler (80-FF) - * ACPI_ALL_NOTIFY: Both System and Device - * Handler - Address of the handler - * Context - Value passed to the handler on each GPE - * - * RETURN: Status - * - * DESCRIPTION: Install a handler for notifications on an ACPI Device, - * ThermalZone, or Processor object. - * - * NOTES: The Root namespace object may have only one handler for each - * type of notify (System/Device). Device/Thermal/Processor objects - * may have one device notify handler, and multiple system notify - * handlers. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiInstallNotifyHandler ( - ACPI_HANDLE Device, - UINT32 HandlerType, - ACPI_NOTIFY_HANDLER Handler, - void *Context) -{ - ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Device); - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_OPERAND_OBJECT *HandlerObj; - ACPI_STATUS Status; - UINT32 i; - - - ACPI_FUNCTION_TRACE (AcpiInstallNotifyHandler); - - - /* Parameter validation */ - - if ((!Device) || (!Handler) || (!HandlerType) || - (HandlerType > ACPI_MAX_NOTIFY_HANDLER_TYPE)) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* - * Root Object: - * Registering a notify handler on the root object indicates that the - * caller wishes to receive notifications for all objects. Note that - * only one global handler can be registered per notify type. - * Ensure that a handler is not already installed. - */ - if (Device == ACPI_ROOT_OBJECT) - { - for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++) - { - if (HandlerType & (i+1)) - { - if (AcpiGbl_GlobalNotify[i].Handler) - { - Status = AE_ALREADY_EXISTS; - goto UnlockAndExit; - } - - AcpiGbl_GlobalNotify[i].Handler = Handler; - AcpiGbl_GlobalNotify[i].Context = Context; - } - } - - goto UnlockAndExit; /* Global notify handler installed, all done */ - } - - /* - * All Other Objects: - * Caller will only receive notifications specific to the target - * object. Note that only certain object types are allowed to - * receive notifications. - */ - - /* Are Notifies allowed on this object? */ - - if (!AcpiEvIsNotifyObject (Node)) - { - Status = AE_TYPE; - goto UnlockAndExit; - } - - /* Check for an existing internal object, might not exist */ - - ObjDesc = AcpiNsGetAttachedObject (Node); - if (!ObjDesc) - { - /* Create a new object */ - - ObjDesc = AcpiUtCreateInternalObject (Node->Type); - if (!ObjDesc) - { - Status = AE_NO_MEMORY; - goto UnlockAndExit; - } - - /* Attach new object to the Node, remove local reference */ - - Status = AcpiNsAttachObject (Device, ObjDesc, Node->Type); - AcpiUtRemoveReference (ObjDesc); - if (ACPI_FAILURE (Status)) - { - goto UnlockAndExit; - } - } - - /* Ensure that the handler is not already installed in the lists */ - - for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++) - { - if (HandlerType & (i+1)) - { - HandlerObj = ObjDesc->CommonNotify.NotifyList[i]; - while (HandlerObj) - { - if (HandlerObj->Notify.Handler == Handler) - { - Status = AE_ALREADY_EXISTS; - goto UnlockAndExit; - } - - HandlerObj = HandlerObj->Notify.Next[i]; - } - } - } - - /* Create and populate a new notify handler object */ - - HandlerObj = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_NOTIFY); - if (!HandlerObj) - { - Status = AE_NO_MEMORY; - goto UnlockAndExit; - } - - HandlerObj->Notify.Node = Node; - HandlerObj->Notify.HandlerType = HandlerType; - HandlerObj->Notify.Handler = Handler; - HandlerObj->Notify.Context = Context; - - /* Install the handler at the list head(s) */ - - for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++) - { - if (HandlerType & (i+1)) - { - HandlerObj->Notify.Next[i] = - ObjDesc->CommonNotify.NotifyList[i]; - - ObjDesc->CommonNotify.NotifyList[i] = HandlerObj; - } - } - - /* Add an extra reference if handler was installed in both lists */ - - if (HandlerType == ACPI_ALL_NOTIFY) - { - AcpiUtAddReference (HandlerObj); - } - - -UnlockAndExit: - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiInstallNotifyHandler) - - -/******************************************************************************* - * - * FUNCTION: AcpiRemoveNotifyHandler - * - * PARAMETERS: Device - The device for which the handler is installed - * HandlerType - The type of handler: - * ACPI_SYSTEM_NOTIFY: System Handler (00-7F) - * ACPI_DEVICE_NOTIFY: Device Handler (80-FF) - * ACPI_ALL_NOTIFY: Both System and Device - * Handler - Address of the handler - * - * RETURN: Status - * - * DESCRIPTION: Remove a handler for notifies on an ACPI device - * - ******************************************************************************/ - -ACPI_STATUS -AcpiRemoveNotifyHandler ( - ACPI_HANDLE Device, - UINT32 HandlerType, - ACPI_NOTIFY_HANDLER Handler) -{ - ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Device); - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_OPERAND_OBJECT *HandlerObj; - ACPI_OPERAND_OBJECT *PreviousHandlerObj; - ACPI_STATUS Status = AE_OK; - UINT32 i; - - - ACPI_FUNCTION_TRACE (AcpiRemoveNotifyHandler); - - - /* Parameter validation */ - - if ((!Device) || (!Handler) || (!HandlerType) || - (HandlerType > ACPI_MAX_NOTIFY_HANDLER_TYPE)) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* Root Object. Global handlers are removed here */ - - if (Device == ACPI_ROOT_OBJECT) - { - for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++) - { - if (HandlerType & (i+1)) - { - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - if (!AcpiGbl_GlobalNotify[i].Handler || - (AcpiGbl_GlobalNotify[i].Handler != Handler)) - { - Status = AE_NOT_EXIST; - goto UnlockAndExit; - } - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Removing global notify handler\n")); - - AcpiGbl_GlobalNotify[i].Handler = NULL; - AcpiGbl_GlobalNotify[i].Context = NULL; - - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - - /* Make sure all deferred notify tasks are completed */ - - AcpiOsWaitEventsComplete (); - } - } - - return_ACPI_STATUS (AE_OK); - } - - /* All other objects: Are Notifies allowed on this object? */ - - if (!AcpiEvIsNotifyObject (Node)) - { - return_ACPI_STATUS (AE_TYPE); - } - - /* Must have an existing internal object */ - - ObjDesc = AcpiNsGetAttachedObject (Node); - if (!ObjDesc) - { - return_ACPI_STATUS (AE_NOT_EXIST); - } - - /* Internal object exists. Find the handler and remove it */ - - for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++) - { - if (HandlerType & (i+1)) - { - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - HandlerObj = ObjDesc->CommonNotify.NotifyList[i]; - PreviousHandlerObj = NULL; - - /* Attempt to find the handler in the handler list */ - - while (HandlerObj && - (HandlerObj->Notify.Handler != Handler)) - { - PreviousHandlerObj = HandlerObj; - HandlerObj = HandlerObj->Notify.Next[i]; - } - - if (!HandlerObj) - { - Status = AE_NOT_EXIST; - goto UnlockAndExit; - } - - /* Remove the handler object from the list */ - - if (PreviousHandlerObj) /* Handler is not at the list head */ - { - PreviousHandlerObj->Notify.Next[i] = - HandlerObj->Notify.Next[i]; - } - else /* Handler is at the list head */ - { - ObjDesc->CommonNotify.NotifyList[i] = - HandlerObj->Notify.Next[i]; - } - - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - - /* Make sure all deferred notify tasks are completed */ - - AcpiOsWaitEventsComplete (); - AcpiUtRemoveReference (HandlerObj); - } - } - - return_ACPI_STATUS (Status); - - -UnlockAndExit: - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiRemoveNotifyHandler) - - -/******************************************************************************* - * - * FUNCTION: AcpiInstallExceptionHandler - * - * PARAMETERS: Handler - Pointer to the handler function for the - * event - * - * RETURN: Status - * - * DESCRIPTION: Saves the pointer to the handler function - * - ******************************************************************************/ - -ACPI_STATUS -AcpiInstallExceptionHandler ( - ACPI_EXCEPTION_HANDLER Handler) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiInstallExceptionHandler); - - - Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Don't allow two handlers. */ - - if (AcpiGbl_ExceptionHandler) - { - Status = AE_ALREADY_EXISTS; - goto Cleanup; - } - - /* Install the handler */ - - AcpiGbl_ExceptionHandler = Handler; - -Cleanup: - (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiInstallExceptionHandler) - - -#if (!ACPI_REDUCED_HARDWARE) -/******************************************************************************* - * - * FUNCTION: AcpiInstallSciHandler - * - * PARAMETERS: Address - Address of the handler - * Context - Value passed to the handler on each SCI - * - * RETURN: Status - * - * DESCRIPTION: Install a handler for a System Control Interrupt. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiInstallSciHandler ( - ACPI_SCI_HANDLER Address, - void *Context) -{ - ACPI_SCI_HANDLER_INFO *NewSciHandler; - ACPI_SCI_HANDLER_INFO *SciHandler; - ACPI_CPU_FLAGS Flags; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiInstallSciHandler); - - - if (!Address) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* Allocate and init a handler object */ - - NewSciHandler = ACPI_ALLOCATE (sizeof (ACPI_SCI_HANDLER_INFO)); - if (!NewSciHandler) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - NewSciHandler->Address = Address; - NewSciHandler->Context = Context; - - Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (Status)) - { - goto Exit; - } - - /* Lock list during installation */ - - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - SciHandler = AcpiGbl_SciHandlerList; - - /* Ensure handler does not already exist */ - - while (SciHandler) - { - if (Address == SciHandler->Address) - { - Status = AE_ALREADY_EXISTS; - goto UnlockAndExit; - } - - SciHandler = SciHandler->Next; - } - - /* Install the new handler into the global list (at head) */ - - NewSciHandler->Next = AcpiGbl_SciHandlerList; - AcpiGbl_SciHandlerList = NewSciHandler; - - -UnlockAndExit: - - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); - -Exit: - if (ACPI_FAILURE (Status)) - { - ACPI_FREE (NewSciHandler); - } - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiInstallSciHandler) - - -/******************************************************************************* - * - * FUNCTION: AcpiRemoveSciHandler - * - * PARAMETERS: Address - Address of the handler - * - * RETURN: Status - * - * DESCRIPTION: Remove a handler for a System Control Interrupt. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiRemoveSciHandler ( - ACPI_SCI_HANDLER Address) -{ - ACPI_SCI_HANDLER_INFO *PrevSciHandler; - ACPI_SCI_HANDLER_INFO *NextSciHandler; - ACPI_CPU_FLAGS Flags; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiRemoveSciHandler); - - - if (!Address) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Remove the SCI handler with lock */ - - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - - PrevSciHandler = NULL; - NextSciHandler = AcpiGbl_SciHandlerList; - while (NextSciHandler) - { - if (NextSciHandler->Address == Address) - { - /* Unlink and free the SCI handler info block */ - - if (PrevSciHandler) - { - PrevSciHandler->Next = NextSciHandler->Next; - } - else - { - AcpiGbl_SciHandlerList = NextSciHandler->Next; - } - - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - ACPI_FREE (NextSciHandler); - goto UnlockAndExit; - } - - PrevSciHandler = NextSciHandler; - NextSciHandler = NextSciHandler->Next; - } - - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - Status = AE_NOT_EXIST; - - -UnlockAndExit: - (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiRemoveSciHandler) - - -/******************************************************************************* - * - * FUNCTION: AcpiInstallGlobalEventHandler - * - * PARAMETERS: Handler - Pointer to the global event handler function - * Context - Value passed to the handler on each event - * - * RETURN: Status - * - * DESCRIPTION: Saves the pointer to the handler function. The global handler - * is invoked upon each incoming GPE and Fixed Event. It is - * invoked at interrupt level at the time of the event dispatch. - * Can be used to update event counters, etc. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiInstallGlobalEventHandler ( - ACPI_GBL_EVENT_HANDLER Handler, - void *Context) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiInstallGlobalEventHandler); - - - /* Parameter validation */ - - if (!Handler) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Don't allow two handlers. */ - - if (AcpiGbl_GlobalEventHandler) - { - Status = AE_ALREADY_EXISTS; - goto Cleanup; - } - - AcpiGbl_GlobalEventHandler = Handler; - AcpiGbl_GlobalEventHandlerContext = Context; - - -Cleanup: - (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiInstallGlobalEventHandler) - - -/******************************************************************************* - * - * FUNCTION: AcpiInstallFixedEventHandler - * - * PARAMETERS: Event - Event type to enable. - * Handler - Pointer to the handler function for the - * event - * Context - Value passed to the handler on each GPE - * - * RETURN: Status - * - * DESCRIPTION: Saves the pointer to the handler function and then enables the - * event. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiInstallFixedEventHandler ( - UINT32 Event, - ACPI_EVENT_HANDLER Handler, - void *Context) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiInstallFixedEventHandler); - - - /* Parameter validation */ - - if (Event > ACPI_EVENT_MAX) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Do not allow multiple handlers */ - - if (AcpiGbl_FixedEventHandlers[Event].Handler) - { - Status = AE_ALREADY_EXISTS; - goto Cleanup; - } - - /* Install the handler before enabling the event */ - - AcpiGbl_FixedEventHandlers[Event].Handler = Handler; - AcpiGbl_FixedEventHandlers[Event].Context = Context; - - Status = AcpiEnableEvent (Event, 0); - if (ACPI_FAILURE (Status)) - { - ACPI_WARNING ((AE_INFO, - "Could not enable fixed event - %s (%u)", - AcpiUtGetEventName (Event), Event)); - - /* Remove the handler */ - - AcpiGbl_FixedEventHandlers[Event].Handler = NULL; - AcpiGbl_FixedEventHandlers[Event].Context = NULL; - } - else - { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Enabled fixed event %s (%X), Handler=%p\n", - AcpiUtGetEventName (Event), Event, Handler)); - } - - -Cleanup: - (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiInstallFixedEventHandler) - - -/******************************************************************************* - * - * FUNCTION: AcpiRemoveFixedEventHandler - * - * PARAMETERS: Event - Event type to disable. - * Handler - Address of the handler - * - * RETURN: Status - * - * DESCRIPTION: Disables the event and unregisters the event handler. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiRemoveFixedEventHandler ( - UINT32 Event, - ACPI_EVENT_HANDLER Handler) -{ - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE (AcpiRemoveFixedEventHandler); - - - /* Parameter validation */ - - if (Event > ACPI_EVENT_MAX) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Disable the event before removing the handler */ - - Status = AcpiDisableEvent (Event, 0); - - /* Always Remove the handler */ - - AcpiGbl_FixedEventHandlers[Event].Handler = NULL; - AcpiGbl_FixedEventHandlers[Event].Context = NULL; - - if (ACPI_FAILURE (Status)) - { - ACPI_WARNING ((AE_INFO, - "Could not disable fixed event - %s (%u)", - AcpiUtGetEventName (Event), Event)); - } - else - { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Disabled fixed event - %s (%X)\n", - AcpiUtGetEventName (Event), Event)); - } - - (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiRemoveFixedEventHandler) - - -/******************************************************************************* - * - * FUNCTION: AcpiEvInstallGpeHandler - * - * PARAMETERS: GpeDevice - Namespace node for the GPE (NULL for FADT - * defined GPEs) - * GpeNumber - The GPE number within the GPE block - * Type - Whether this GPE should be treated as an - * edge- or level-triggered interrupt. - * IsRawHandler - Whether this GPE should be handled using - * the special GPE handler mode. - * Address - Address of the handler - * Context - Value passed to the handler on each GPE - * - * RETURN: Status - * - * DESCRIPTION: Internal function to install a handler for a General Purpose - * Event. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiEvInstallGpeHandler ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber, - UINT32 Type, - BOOLEAN IsRawHandler, - ACPI_GPE_HANDLER Address, - void *Context) -{ - ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_GPE_HANDLER_INFO *Handler; - ACPI_STATUS Status; - ACPI_CPU_FLAGS Flags; - - - ACPI_FUNCTION_TRACE (EvInstallGpeHandler); - - - /* Parameter validation */ - - if ((!Address) || (Type & ~ACPI_GPE_XRUPT_TYPE_MASK)) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Allocate and init handler object (before lock) */ - - Handler = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_HANDLER_INFO)); - if (!Handler) - { - Status = AE_NO_MEMORY; - goto UnlockAndExit; - } - - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - - /* Ensure that we have a valid GPE number */ - - GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); - if (!GpeEventInfo) - { - Status = AE_BAD_PARAMETER; - goto FreeAndExit; - } - - /* Make sure that there isn't a handler there already */ - - if ((ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == - ACPI_GPE_DISPATCH_HANDLER) || - (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == - ACPI_GPE_DISPATCH_RAW_HANDLER)) - { - Status = AE_ALREADY_EXISTS; - goto FreeAndExit; - } - - Handler->Address = Address; - Handler->Context = Context; - Handler->MethodNode = GpeEventInfo->Dispatch.MethodNode; - Handler->OriginalFlags = (UINT8) (GpeEventInfo->Flags & - (ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK)); - - /* - * If the GPE is associated with a method, it may have been enabled - * automatically during initialization, in which case it has to be - * disabled now to avoid spurious execution of the handler. - */ - if (((ACPI_GPE_DISPATCH_TYPE (Handler->OriginalFlags) == - ACPI_GPE_DISPATCH_METHOD) || - (ACPI_GPE_DISPATCH_TYPE (Handler->OriginalFlags) == - ACPI_GPE_DISPATCH_NOTIFY)) && - GpeEventInfo->RuntimeCount) - { - Handler->OriginallyEnabled = TRUE; - (void) AcpiEvRemoveGpeReference (GpeEventInfo); - - /* Sanity check of original type against new type */ - - if (Type != (UINT32) (GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK)) - { - ACPI_WARNING ((AE_INFO, "GPE type mismatch (level/edge)")); - } - } - - /* Install the handler */ - - GpeEventInfo->Dispatch.Handler = Handler; - - /* Setup up dispatch flags to indicate handler (vs. method/notify) */ - - GpeEventInfo->Flags &= ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); - GpeEventInfo->Flags |= (UINT8) (Type | (IsRawHandler ? - ACPI_GPE_DISPATCH_RAW_HANDLER : ACPI_GPE_DISPATCH_HANDLER)); - - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - - -UnlockAndExit: - (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); - return_ACPI_STATUS (Status); - -FreeAndExit: - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - ACPI_FREE (Handler); - goto UnlockAndExit; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiInstallGpeHandler - * - * PARAMETERS: GpeDevice - Namespace node for the GPE (NULL for FADT - * defined GPEs) - * GpeNumber - The GPE number within the GPE block - * Type - Whether this GPE should be treated as an - * edge- or level-triggered interrupt. - * Address - Address of the handler - * Context - Value passed to the handler on each GPE - * - * RETURN: Status - * - * DESCRIPTION: Install a handler for a General Purpose Event. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiInstallGpeHandler ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber, - UINT32 Type, - ACPI_GPE_HANDLER Address, - void *Context) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiInstallGpeHandler); - - - Status = AcpiEvInstallGpeHandler (GpeDevice, GpeNumber, Type, - FALSE, Address, Context); - - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiInstallGpeHandler) - - -/******************************************************************************* - * - * FUNCTION: AcpiInstallGpeRawHandler - * - * PARAMETERS: GpeDevice - Namespace node for the GPE (NULL for FADT - * defined GPEs) - * GpeNumber - The GPE number within the GPE block - * Type - Whether this GPE should be treated as an - * edge- or level-triggered interrupt. - * Address - Address of the handler - * Context - Value passed to the handler on each GPE - * - * RETURN: Status - * - * DESCRIPTION: Install a handler for a General Purpose Event. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiInstallGpeRawHandler ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber, - UINT32 Type, - ACPI_GPE_HANDLER Address, - void *Context) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiInstallGpeRawHandler); - - - Status = AcpiEvInstallGpeHandler (GpeDevice, GpeNumber, Type, - TRUE, Address, Context); - - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiInstallGpeRawHandler) - - -/******************************************************************************* - * - * FUNCTION: AcpiRemoveGpeHandler - * - * PARAMETERS: GpeDevice - Namespace node for the GPE (NULL for FADT - * defined GPEs) - * GpeNumber - The event to remove a handler - * Address - Address of the handler - * - * RETURN: Status - * - * DESCRIPTION: Remove a handler for a General Purpose AcpiEvent. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiRemoveGpeHandler ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber, - ACPI_GPE_HANDLER Address) -{ - ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_GPE_HANDLER_INFO *Handler; - ACPI_STATUS Status; - ACPI_CPU_FLAGS Flags; - - - ACPI_FUNCTION_TRACE (AcpiRemoveGpeHandler); - - - /* Parameter validation */ - - if (!Address) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - - /* Ensure that we have a valid GPE number */ - - GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); - if (!GpeEventInfo) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - /* Make sure that a handler is indeed installed */ - - if ((ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) != - ACPI_GPE_DISPATCH_HANDLER) && - (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) != - ACPI_GPE_DISPATCH_RAW_HANDLER)) - { - Status = AE_NOT_EXIST; - goto UnlockAndExit; - } - - /* Make sure that the installed handler is the same */ - - if (GpeEventInfo->Dispatch.Handler->Address != Address) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - /* Remove the handler */ - - Handler = GpeEventInfo->Dispatch.Handler; - GpeEventInfo->Dispatch.Handler = NULL; - - /* Restore Method node (if any), set dispatch flags */ - - GpeEventInfo->Dispatch.MethodNode = Handler->MethodNode; - GpeEventInfo->Flags &= - ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); - GpeEventInfo->Flags |= Handler->OriginalFlags; - - /* - * If the GPE was previously associated with a method and it was - * enabled, it should be enabled at this point to restore the - * post-initialization configuration. - */ - if (((ACPI_GPE_DISPATCH_TYPE (Handler->OriginalFlags) == - ACPI_GPE_DISPATCH_METHOD) || - (ACPI_GPE_DISPATCH_TYPE (Handler->OriginalFlags) == - ACPI_GPE_DISPATCH_NOTIFY)) && - Handler->OriginallyEnabled) - { - (void) AcpiEvAddGpeReference (GpeEventInfo, FALSE); - if (ACPI_GPE_IS_POLLING_NEEDED (GpeEventInfo)) - { - /* Poll edge triggered GPEs to handle existing events */ - - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - (void) AcpiEvDetectGpe ( - GpeDevice, GpeEventInfo, GpeNumber); - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - } - } - - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); - - /* Make sure all deferred GPE tasks are completed */ - - AcpiOsWaitEventsComplete (); - - /* Now we can free the handler object */ - - ACPI_FREE (Handler); - return_ACPI_STATUS (Status); - -UnlockAndExit: - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiRemoveGpeHandler) - - -/******************************************************************************* - * - * FUNCTION: AcpiAcquireGlobalLock - * - * PARAMETERS: Timeout - How long the caller is willing to wait - * Handle - Where the handle to the lock is returned - * (if acquired) - * - * RETURN: Status - * - * DESCRIPTION: Acquire the ACPI Global Lock - * - * Note: Allows callers with the same thread ID to acquire the global lock - * multiple times. In other words, externally, the behavior of the global lock - * is identical to an AML mutex. On the first acquire, a new handle is - * returned. On any subsequent calls to acquire by the same thread, the same - * handle is returned. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiAcquireGlobalLock ( - UINT16 Timeout, - UINT32 *Handle) -{ - ACPI_STATUS Status; - - - if (!Handle) - { - return (AE_BAD_PARAMETER); - } - - /* Must lock interpreter to prevent race conditions */ - - AcpiExEnterInterpreter (); - - Status = AcpiExAcquireMutexObject (Timeout, - AcpiGbl_GlobalLockMutex, AcpiOsGetThreadId ()); - - if (ACPI_SUCCESS (Status)) - { - /* Return the global lock handle (updated in AcpiEvAcquireGlobalLock) */ - - *Handle = AcpiGbl_GlobalLockHandle; - } - - AcpiExExitInterpreter (); - return (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiAcquireGlobalLock) - - -/******************************************************************************* - * - * FUNCTION: AcpiReleaseGlobalLock - * - * PARAMETERS: Handle - Returned from AcpiAcquireGlobalLock - * - * RETURN: Status - * - * DESCRIPTION: Release the ACPI Global Lock. The handle must be valid. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiReleaseGlobalLock ( - UINT32 Handle) -{ - ACPI_STATUS Status; - - - if (!Handle || (Handle != AcpiGbl_GlobalLockHandle)) - { - return (AE_NOT_ACQUIRED); - } - - Status = AcpiExReleaseMutexObject (AcpiGbl_GlobalLockMutex); - return (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiReleaseGlobalLock) - -#endif /* !ACPI_REDUCED_HARDWARE */ diff --git a/drivers/acpica/evxfevnt.c b/drivers/acpica/evxfevnt.c deleted file mode 100644 index 9e7972e..0000000 --- a/drivers/acpica/evxfevnt.c +++ /dev/null @@ -1,559 +0,0 @@ -/****************************************************************************** - * - * Module Name: evxfevnt - External Interfaces, ACPI event disable/enable - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#define EXPORT_ACPI_INTERFACES - -#include "acpi.h" -#include "accommon.h" -#include "actables.h" - -#define _COMPONENT ACPI_EVENTS - ACPI_MODULE_NAME ("evxfevnt") - - -#if (!ACPI_REDUCED_HARDWARE) /* Entire module */ -/******************************************************************************* - * - * FUNCTION: AcpiEnable - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Transfers the system into ACPI mode. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEnable ( - void) -{ - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE (AcpiEnable); - - - /* ACPI tables must be present */ - - if (AcpiGbl_FadtIndex == ACPI_INVALID_TABLE_INDEX) - { - return_ACPI_STATUS (AE_NO_ACPI_TABLES); - } - - /* If the Hardware Reduced flag is set, machine is always in acpi mode */ - - if (AcpiGbl_ReducedHardware) - { - return_ACPI_STATUS (AE_OK); - } - - /* Check current mode */ - - if (AcpiHwGetMode() == ACPI_SYS_MODE_ACPI) - { - ACPI_DEBUG_PRINT ((ACPI_DB_INIT, - "System is already in ACPI mode\n")); - } - else - { - /* Transition to ACPI mode */ - - Status = AcpiHwSetMode (ACPI_SYS_MODE_ACPI); - if (ACPI_FAILURE (Status)) - { - ACPI_ERROR ((AE_INFO, "Could not transition to ACPI mode")); - return_ACPI_STATUS (Status); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_INIT, - "Transition to ACPI mode successful\n")); - } - - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiEnable) - - -/******************************************************************************* - * - * FUNCTION: AcpiDisable - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Transfers the system into LEGACY (non-ACPI) mode. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDisable ( - void) -{ - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE (AcpiDisable); - - - /* If the Hardware Reduced flag is set, machine is always in acpi mode */ - - if (AcpiGbl_ReducedHardware) - { - return_ACPI_STATUS (AE_OK); - } - - if (AcpiHwGetMode() == ACPI_SYS_MODE_LEGACY) - { - ACPI_DEBUG_PRINT ((ACPI_DB_INIT, - "System is already in legacy (non-ACPI) mode\n")); - } - else - { - /* Transition to LEGACY mode */ - - Status = AcpiHwSetMode (ACPI_SYS_MODE_LEGACY); - - if (ACPI_FAILURE (Status)) - { - ACPI_ERROR ((AE_INFO, - "Could not exit ACPI mode to legacy mode")); - return_ACPI_STATUS (Status); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_INIT, - "ACPI mode disabled\n")); - } - - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiDisable) - - -/******************************************************************************* - * - * FUNCTION: AcpiEnableEvent - * - * PARAMETERS: Event - The fixed eventto be enabled - * Flags - Reserved - * - * RETURN: Status - * - * DESCRIPTION: Enable an ACPI event (fixed) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEnableEvent ( - UINT32 Event, - UINT32 Flags) -{ - ACPI_STATUS Status = AE_OK; - UINT32 Value; - - - ACPI_FUNCTION_TRACE (AcpiEnableEvent); - - - /* If Hardware Reduced flag is set, there are no fixed events */ - - if (AcpiGbl_ReducedHardware) - { - return_ACPI_STATUS (AE_OK); - } - - /* Decode the Fixed Event */ - - if (Event > ACPI_EVENT_MAX) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* - * Enable the requested fixed event (by writing a one to the enable - * register bit) - */ - Status = AcpiWriteBitRegister ( - AcpiGbl_FixedEventInfo[Event].EnableRegisterId, - ACPI_ENABLE_EVENT); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Make sure that the hardware responded */ - - Status = AcpiReadBitRegister ( - AcpiGbl_FixedEventInfo[Event].EnableRegisterId, &Value); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - if (Value != 1) - { - ACPI_ERROR ((AE_INFO, - "Could not enable %s event", AcpiUtGetEventName (Event))); - return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE); - } - - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiEnableEvent) - - -/******************************************************************************* - * - * FUNCTION: AcpiDisableEvent - * - * PARAMETERS: Event - The fixed event to be disabled - * Flags - Reserved - * - * RETURN: Status - * - * DESCRIPTION: Disable an ACPI event (fixed) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDisableEvent ( - UINT32 Event, - UINT32 Flags) -{ - ACPI_STATUS Status = AE_OK; - UINT32 Value; - - - ACPI_FUNCTION_TRACE (AcpiDisableEvent); - - - /* If Hardware Reduced flag is set, there are no fixed events */ - - if (AcpiGbl_ReducedHardware) - { - return_ACPI_STATUS (AE_OK); - } - - /* Decode the Fixed Event */ - - if (Event > ACPI_EVENT_MAX) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* - * Disable the requested fixed event (by writing a zero to the enable - * register bit) - */ - Status = AcpiWriteBitRegister ( - AcpiGbl_FixedEventInfo[Event].EnableRegisterId, - ACPI_DISABLE_EVENT); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Status = AcpiReadBitRegister ( - AcpiGbl_FixedEventInfo[Event].EnableRegisterId, &Value); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - if (Value != 0) - { - ACPI_ERROR ((AE_INFO, - "Could not disable %s events", AcpiUtGetEventName (Event))); - return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE); - } - - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiDisableEvent) - - -/******************************************************************************* - * - * FUNCTION: AcpiClearEvent - * - * PARAMETERS: Event - The fixed event to be cleared - * - * RETURN: Status - * - * DESCRIPTION: Clear an ACPI event (fixed) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiClearEvent ( - UINT32 Event) -{ - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE (AcpiClearEvent); - - - /* If Hardware Reduced flag is set, there are no fixed events */ - - if (AcpiGbl_ReducedHardware) - { - return_ACPI_STATUS (AE_OK); - } - - /* Decode the Fixed Event */ - - if (Event > ACPI_EVENT_MAX) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* - * Clear the requested fixed event (By writing a one to the status - * register bit) - */ - Status = AcpiWriteBitRegister ( - AcpiGbl_FixedEventInfo[Event].StatusRegisterId, - ACPI_CLEAR_STATUS); - - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiClearEvent) - - -/******************************************************************************* - * - * FUNCTION: AcpiGetEventStatus - * - * PARAMETERS: Event - The fixed event - * EventStatus - Where the current status of the event will - * be returned - * - * RETURN: Status - * - * DESCRIPTION: Obtains and returns the current status of the event - * - ******************************************************************************/ - -ACPI_STATUS -AcpiGetEventStatus ( - UINT32 Event, - ACPI_EVENT_STATUS *EventStatus) -{ - ACPI_STATUS Status; - ACPI_EVENT_STATUS LocalEventStatus = 0; - UINT32 InByte; - - - ACPI_FUNCTION_TRACE (AcpiGetEventStatus); - - - if (!EventStatus) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* Decode the Fixed Event */ - - if (Event > ACPI_EVENT_MAX) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* Fixed event currently can be dispatched? */ - - if (AcpiGbl_FixedEventHandlers[Event].Handler) - { - LocalEventStatus |= ACPI_EVENT_FLAG_HAS_HANDLER; - } - - /* Fixed event currently enabled? */ - - Status = AcpiReadBitRegister ( - AcpiGbl_FixedEventInfo[Event].EnableRegisterId, &InByte); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - if (InByte) - { - LocalEventStatus |= - (ACPI_EVENT_FLAG_ENABLED | ACPI_EVENT_FLAG_ENABLE_SET); - } - - /* Fixed event currently active? */ - - Status = AcpiReadBitRegister ( - AcpiGbl_FixedEventInfo[Event].StatusRegisterId, &InByte); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - if (InByte) - { - LocalEventStatus |= ACPI_EVENT_FLAG_STATUS_SET; - } - - (*EventStatus) = LocalEventStatus; - return_ACPI_STATUS (AE_OK); -} - -ACPI_EXPORT_SYMBOL (AcpiGetEventStatus) - -#endif /* !ACPI_REDUCED_HARDWARE */ diff --git a/drivers/acpica/evxfgpe.c b/drivers/acpica/evxfgpe.c deleted file mode 100644 index bda4e6e..0000000 --- a/drivers/acpica/evxfgpe.c +++ /dev/null @@ -1,1355 +0,0 @@ -/****************************************************************************** - * - * Module Name: evxfgpe - External Interfaces for General Purpose Events (GPEs) - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#define EXPORT_ACPI_INTERFACES - -#include "acpi.h" -#include "accommon.h" -#include "acevents.h" -#include "acnamesp.h" - -#define _COMPONENT ACPI_EVENTS - ACPI_MODULE_NAME ("evxfgpe") - - -#if (!ACPI_REDUCED_HARDWARE) /* Entire module */ -/******************************************************************************* - * - * FUNCTION: AcpiUpdateAllGpes - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Complete GPE initialization and enable all GPEs that have - * associated _Lxx or _Exx methods and are not pointed to by any - * device _PRW methods (this indicates that these GPEs are - * generally intended for system or device wakeup. Such GPEs - * have to be enabled directly when the devices whose _PRW - * methods point to them are set up for wakeup signaling.) - * - * NOTE: Should be called after any GPEs are added to the system. Primarily, - * after the system _PRW methods have been run, but also after a GPE Block - * Device has been added or if any new GPE methods have been added via a - * dynamic table load. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUpdateAllGpes ( - void) -{ - ACPI_STATUS Status; - BOOLEAN IsPollingNeeded = FALSE; - - - ACPI_FUNCTION_TRACE (AcpiUpdateAllGpes); - - - Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - if (AcpiGbl_AllGpesInitialized) - { - goto UnlockAndExit; - } - - Status = AcpiEvWalkGpeList (AcpiEvInitializeGpeBlock, - &IsPollingNeeded); - if (ACPI_SUCCESS (Status)) - { - AcpiGbl_AllGpesInitialized = TRUE; - } - -UnlockAndExit: - (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); - - if (IsPollingNeeded && AcpiGbl_AllGpesInitialized) - { - /* Poll GPEs to handle already triggered events */ - - AcpiEvGpeDetect (AcpiGbl_GpeXruptListHead); - } - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiUpdateAllGpes) - - -/******************************************************************************* - * - * FUNCTION: AcpiEnableGpe - * - * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 - * GpeNumber - GPE level within the GPE block - * - * RETURN: Status - * - * DESCRIPTION: Add a reference to a GPE. On the first reference, the GPE is - * hardware-enabled. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEnableGpe ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber) -{ - ACPI_STATUS Status = AE_BAD_PARAMETER; - ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_CPU_FLAGS Flags; - - - ACPI_FUNCTION_TRACE (AcpiEnableGpe); - - - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - - /* - * Ensure that we have a valid GPE number and that there is some way - * of handling the GPE (handler or a GPE method). In other words, we - * won't allow a valid GPE to be enabled if there is no way to handle it. - */ - GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); - if (GpeEventInfo) - { - if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) != - ACPI_GPE_DISPATCH_NONE) - { - Status = AcpiEvAddGpeReference (GpeEventInfo, TRUE); - if (ACPI_SUCCESS (Status) && - ACPI_GPE_IS_POLLING_NEEDED (GpeEventInfo)) - { - /* Poll edge-triggered GPEs to handle existing events */ - - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - (void) AcpiEvDetectGpe ( - GpeDevice, GpeEventInfo, GpeNumber); - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - } - } - else - { - Status = AE_NO_HANDLER; - } - } - - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiEnableGpe) - - -/******************************************************************************* - * - * FUNCTION: AcpiDisableGpe - * - * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 - * GpeNumber - GPE level within the GPE block - * - * RETURN: Status - * - * DESCRIPTION: Remove a reference to a GPE. When the last reference is - * removed, only then is the GPE disabled (for runtime GPEs), or - * the GPE mask bit disabled (for wake GPEs) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDisableGpe ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber) -{ - ACPI_STATUS Status = AE_BAD_PARAMETER; - ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_CPU_FLAGS Flags; - - - ACPI_FUNCTION_TRACE (AcpiDisableGpe); - - - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - - /* Ensure that we have a valid GPE number */ - - GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); - if (GpeEventInfo) - { - Status = AcpiEvRemoveGpeReference (GpeEventInfo); - } - - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiDisableGpe) - - -/******************************************************************************* - * - * FUNCTION: AcpiSetGpe - * - * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 - * GpeNumber - GPE level within the GPE block - * Action - ACPI_GPE_ENABLE or ACPI_GPE_DISABLE - * - * RETURN: Status - * - * DESCRIPTION: Enable or disable an individual GPE. This function bypasses - * the reference count mechanism used in the AcpiEnableGpe(), - * AcpiDisableGpe() interfaces. - * This API is typically used by the GPE raw handler mode driver - * to switch between the polling mode and the interrupt mode after - * the driver has enabled the GPE. - * The APIs should be invoked in this order: - * AcpiEnableGpe() <- Ensure the reference count > 0 - * AcpiSetGpe(ACPI_GPE_DISABLE) <- Enter polling mode - * AcpiSetGpe(ACPI_GPE_ENABLE) <- Leave polling mode - * AcpiDisableGpe() <- Decrease the reference count - * - * Note: If a GPE is shared by 2 silicon components, then both the drivers - * should support GPE polling mode or disabling the GPE for long period - * for one driver may break the other. So use it with care since all - * firmware _Lxx/_Exx handlers currently rely on the GPE interrupt mode. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiSetGpe ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber, - UINT8 Action) -{ - ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_STATUS Status; - ACPI_CPU_FLAGS Flags; - - - ACPI_FUNCTION_TRACE (AcpiSetGpe); - - - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - - /* Ensure that we have a valid GPE number */ - - GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); - if (!GpeEventInfo) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - /* Perform the action */ - - switch (Action) - { - case ACPI_GPE_ENABLE: - - Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_ENABLE); - GpeEventInfo->DisableForDispatch = FALSE; - break; - - case ACPI_GPE_DISABLE: - - Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE); - GpeEventInfo->DisableForDispatch = TRUE; - break; - - default: - - Status = AE_BAD_PARAMETER; - break; - } - -UnlockAndExit: - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiSetGpe) - - -/******************************************************************************* - * - * FUNCTION: AcpiMaskGpe - * - * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 - * GpeNumber - GPE level within the GPE block - * IsMasked - Whether the GPE is masked or not - * - * RETURN: Status - * - * DESCRIPTION: Unconditionally mask/unmask the an individual GPE, ex., to - * prevent a GPE flooding. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiMaskGpe ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber, - BOOLEAN IsMasked) -{ - ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_STATUS Status; - ACPI_CPU_FLAGS Flags; - - - ACPI_FUNCTION_TRACE (AcpiMaskGpe); - - - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - - /* Ensure that we have a valid GPE number */ - - GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); - if (!GpeEventInfo) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - Status = AcpiEvMaskGpe (GpeEventInfo, IsMasked); - -UnlockAndExit: - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiMaskGpe) - - -/******************************************************************************* - * - * FUNCTION: AcpiMarkGpeForWake - * - * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 - * GpeNumber - GPE level within the GPE block - * - * RETURN: Status - * - * DESCRIPTION: Mark a GPE as having the ability to wake the system. Simply - * sets the ACPI_GPE_CAN_WAKE flag. - * - * Some potential callers of AcpiSetupGpeForWake may know in advance that - * there won't be any notify handlers installed for device wake notifications - * from the given GPE (one example is a button GPE in Linux). For these cases, - * AcpiMarkGpeForWake should be used instead of AcpiSetupGpeForWake. - * This will set the ACPI_GPE_CAN_WAKE flag for the GPE without trying to - * setup implicit wake notification for it (since there's no handler method). - * - ******************************************************************************/ - -ACPI_STATUS -AcpiMarkGpeForWake ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber) -{ - ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_STATUS Status = AE_BAD_PARAMETER; - ACPI_CPU_FLAGS Flags; - - - ACPI_FUNCTION_TRACE (AcpiMarkGpeForWake); - - - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - - /* Ensure that we have a valid GPE number */ - - GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); - if (GpeEventInfo) - { - /* Mark the GPE as a possible wake event */ - - GpeEventInfo->Flags |= ACPI_GPE_CAN_WAKE; - Status = AE_OK; - } - - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiMarkGpeForWake) - - -/******************************************************************************* - * - * FUNCTION: AcpiSetupGpeForWake - * - * PARAMETERS: WakeDevice - Device associated with the GPE (via _PRW) - * GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 - * GpeNumber - GPE level within the GPE block - * - * RETURN: Status - * - * DESCRIPTION: Mark a GPE as having the ability to wake the system. This - * interface is intended to be used as the host executes the - * _PRW methods (Power Resources for Wake) in the system tables. - * Each _PRW appears under a Device Object (The WakeDevice), and - * contains the info for the wake GPE associated with the - * WakeDevice. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiSetupGpeForWake ( - ACPI_HANDLE WakeDevice, - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber) -{ - ACPI_STATUS Status; - ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_NAMESPACE_NODE *DeviceNode; - ACPI_GPE_NOTIFY_INFO *Notify; - ACPI_GPE_NOTIFY_INFO *NewNotify; - ACPI_CPU_FLAGS Flags; - - - ACPI_FUNCTION_TRACE (AcpiSetupGpeForWake); - - - /* Parameter Validation */ - - if (!WakeDevice) - { - /* - * By forcing WakeDevice to be valid, we automatically enable the - * implicit notify feature on all hosts. - */ - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* Handle root object case */ - - if (WakeDevice == ACPI_ROOT_OBJECT) - { - DeviceNode = AcpiGbl_RootNode; - } - else - { - DeviceNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, WakeDevice); - } - - /* Validate WakeDevice is of type Device */ - - if (DeviceNode->Type != ACPI_TYPE_DEVICE) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* - * Allocate a new notify object up front, in case it is needed. - * Memory allocation while holding a spinlock is a big no-no - * on some hosts. - */ - NewNotify = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_NOTIFY_INFO)); - if (!NewNotify) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - - /* Ensure that we have a valid GPE number */ - - GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); - if (!GpeEventInfo) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - /* - * If there is no method or handler for this GPE, then the - * WakeDevice will be notified whenever this GPE fires. This is - * known as an "implicit notify". Note: The GPE is assumed to be - * level-triggered (for windows compatibility). - */ - if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == - ACPI_GPE_DISPATCH_NONE) - { - /* - * This is the first device for implicit notify on this GPE. - * Just set the flags here, and enter the NOTIFY block below. - */ - GpeEventInfo->Flags = - (ACPI_GPE_DISPATCH_NOTIFY | ACPI_GPE_LEVEL_TRIGGERED); - } - else if (GpeEventInfo->Flags & ACPI_GPE_AUTO_ENABLED) - { - /* - * A reference to this GPE has been added during the GPE block - * initialization, so drop it now to prevent the GPE from being - * permanently enabled and clear its ACPI_GPE_AUTO_ENABLED flag. - */ - (void) AcpiEvRemoveGpeReference (GpeEventInfo); - GpeEventInfo->Flags &= ~ACPI_GPE_AUTO_ENABLED; - } - - /* - * If we already have an implicit notify on this GPE, add - * this device to the notify list. - */ - if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == - ACPI_GPE_DISPATCH_NOTIFY) - { - /* Ensure that the device is not already in the list */ - - Notify = GpeEventInfo->Dispatch.NotifyList; - while (Notify) - { - if (Notify->DeviceNode == DeviceNode) - { - Status = AE_ALREADY_EXISTS; - goto UnlockAndExit; - } - Notify = Notify->Next; - } - - /* Add this device to the notify list for this GPE */ - - NewNotify->DeviceNode = DeviceNode; - NewNotify->Next = GpeEventInfo->Dispatch.NotifyList; - GpeEventInfo->Dispatch.NotifyList = NewNotify; - NewNotify = NULL; - } - - /* Mark the GPE as a possible wake event */ - - GpeEventInfo->Flags |= ACPI_GPE_CAN_WAKE; - Status = AE_OK; - - -UnlockAndExit: - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - - /* Delete the notify object if it was not used above */ - - if (NewNotify) - { - ACPI_FREE (NewNotify); - } - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiSetupGpeForWake) - - -/******************************************************************************* - * - * FUNCTION: AcpiSetGpeWakeMask - * - * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 - * GpeNumber - GPE level within the GPE block - * Action - Enable or Disable - * - * RETURN: Status - * - * DESCRIPTION: Set or clear the GPE's wakeup enable mask bit. The GPE must - * already be marked as a WAKE GPE. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiSetGpeWakeMask ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber, - UINT8 Action) -{ - ACPI_STATUS Status = AE_OK; - ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; - ACPI_CPU_FLAGS Flags; - UINT32 RegisterBit; - - - ACPI_FUNCTION_TRACE (AcpiSetGpeWakeMask); - - - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - - /* - * Ensure that we have a valid GPE number and that this GPE is in - * fact a wake GPE - */ - GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); - if (!GpeEventInfo) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - if (!(GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE)) - { - Status = AE_TYPE; - goto UnlockAndExit; - } - - GpeRegisterInfo = GpeEventInfo->RegisterInfo; - if (!GpeRegisterInfo) - { - Status = AE_NOT_EXIST; - goto UnlockAndExit; - } - - RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo); - - /* Perform the action */ - - switch (Action) - { - case ACPI_GPE_ENABLE: - - ACPI_SET_BIT (GpeRegisterInfo->EnableForWake, (UINT8) RegisterBit); - break; - - case ACPI_GPE_DISABLE: - - ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForWake, (UINT8) RegisterBit); - break; - - default: - - ACPI_ERROR ((AE_INFO, "%u, Invalid action", Action)); - Status = AE_BAD_PARAMETER; - break; - } - -UnlockAndExit: - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiSetGpeWakeMask) - - -/******************************************************************************* - * - * FUNCTION: AcpiClearGpe - * - * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 - * GpeNumber - GPE level within the GPE block - * - * RETURN: Status - * - * DESCRIPTION: Clear an ACPI event (general purpose) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiClearGpe ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber) -{ - ACPI_STATUS Status = AE_OK; - ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_CPU_FLAGS Flags; - - - ACPI_FUNCTION_TRACE (AcpiClearGpe); - - - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - - /* Ensure that we have a valid GPE number */ - - GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); - if (!GpeEventInfo) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - Status = AcpiHwClearGpe (GpeEventInfo); - -UnlockAndExit: - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiClearGpe) - - -/******************************************************************************* - * - * FUNCTION: AcpiGetGpeStatus - * - * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 - * GpeNumber - GPE level within the GPE block - * EventStatus - Where the current status of the event - * will be returned - * - * RETURN: Status - * - * DESCRIPTION: Get the current status of a GPE (signalled/not_signalled) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiGetGpeStatus ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber, - ACPI_EVENT_STATUS *EventStatus) -{ - ACPI_STATUS Status = AE_OK; - ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_CPU_FLAGS Flags; - - - ACPI_FUNCTION_TRACE (AcpiGetGpeStatus); - - - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - - /* Ensure that we have a valid GPE number */ - - GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); - if (!GpeEventInfo) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - /* Obtain status on the requested GPE number */ - - Status = AcpiHwGetGpeStatus (GpeEventInfo, EventStatus); - -UnlockAndExit: - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiGetGpeStatus) - - -/******************************************************************************* - * - * FUNCTION: AcpiDispatchGpe - * - * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 - * GpeNumber - GPE level within the GPE block - * - * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED - * - * DESCRIPTION: Detect and dispatch a General Purpose Event to either a function - * (e.g. EC) or method (e.g. _Lxx/_Exx) handler. - * - ******************************************************************************/ - -UINT32 -AcpiDispatchGpe( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber) -{ - ACPI_FUNCTION_TRACE(acpi_dispatch_gpe); - - return (AcpiEvDetectGpe (GpeDevice, NULL, GpeNumber)); -} - -ACPI_EXPORT_SYMBOL (AcpiDispatchGpe) - - -/******************************************************************************* - * - * FUNCTION: AcpiFinishGpe - * - * PARAMETERS: GpeDevice - Namespace node for the GPE Block - * (NULL for FADT defined GPEs) - * GpeNumber - GPE level within the GPE block - * - * RETURN: Status - * - * DESCRIPTION: Clear and conditionally re-enable a GPE. This completes the GPE - * processing. Intended for use by asynchronous host-installed - * GPE handlers. The GPE is only re-enabled if the EnableForRun bit - * is set in the GPE info. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiFinishGpe ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber) -{ - ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_STATUS Status; - ACPI_CPU_FLAGS Flags; - - - ACPI_FUNCTION_TRACE (AcpiFinishGpe); - - - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - - /* Ensure that we have a valid GPE number */ - - GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); - if (!GpeEventInfo) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - Status = AcpiEvFinishGpe (GpeEventInfo); - -UnlockAndExit: - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiFinishGpe) - - -/****************************************************************************** - * - * FUNCTION: AcpiDisableAllGpes - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Disable and clear all GPEs in all GPE blocks - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDisableAllGpes ( - void) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiDisableAllGpes); - - - Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Status = AcpiHwDisableAllGpes (); - (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); - - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiDisableAllGpes) - - -/****************************************************************************** - * - * FUNCTION: AcpiEnableAllRuntimeGpes - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Enable all "runtime" GPEs, in all GPE blocks - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEnableAllRuntimeGpes ( - void) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiEnableAllRuntimeGpes); - - - Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Status = AcpiHwEnableAllRuntimeGpes (); - (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); - - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiEnableAllRuntimeGpes) - - -/****************************************************************************** - * - * FUNCTION: AcpiEnableAllWakeupGpes - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Enable all "wakeup" GPEs and disable all of the other GPEs, in - * all GPE blocks. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEnableAllWakeupGpes ( - void) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiEnableAllWakeupGpes); - - - Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Status = AcpiHwEnableAllWakeupGpes (); - (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); - - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiEnableAllWakeupGpes) - - -/****************************************************************************** - * - * FUNCTION: AcpiAnyGpeStatusSet - * - * PARAMETERS: None - * - * RETURN: Whether or not the status bit is set for any GPE - * - * DESCRIPTION: Check the status bits of all enabled GPEs and return TRUE if any - * of them is set or FALSE otherwise. - * - ******************************************************************************/ - -UINT32 -AcpiAnyGpeStatusSet ( - void) -{ - ACPI_STATUS Status; - UINT8 Ret; - - - ACPI_FUNCTION_TRACE (AcpiAnyGpeStatusSet); - - Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (Status)) - { - return (FALSE); - } - - Ret = AcpiHwCheckAllGpes (); - (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); - - return (Ret); -} - -ACPI_EXPORT_SYMBOL(AcpiAnyGpeStatusSet) - - -/******************************************************************************* - * - * FUNCTION: AcpiInstallGpeBlock - * - * PARAMETERS: GpeDevice - Handle to the parent GPE Block Device - * GpeBlockAddress - Address and SpaceID - * RegisterCount - Number of GPE register pairs in the block - * InterruptNumber - H/W interrupt for the block - * - * RETURN: Status - * - * DESCRIPTION: Create and Install a block of GPE registers. The GPEs are not - * enabled here. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiInstallGpeBlock ( - ACPI_HANDLE GpeDevice, - ACPI_GENERIC_ADDRESS *GpeBlockAddress, - UINT32 RegisterCount, - UINT32 InterruptNumber) -{ - ACPI_STATUS Status; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_NAMESPACE_NODE *Node; - ACPI_GPE_BLOCK_INFO *GpeBlock; - - - ACPI_FUNCTION_TRACE (AcpiInstallGpeBlock); - - - if ((!GpeDevice) || - (!GpeBlockAddress) || - (!RegisterCount)) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Node = AcpiNsValidateHandle (GpeDevice); - if (!Node) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - /* Validate the parent device */ - - if (Node->Type != ACPI_TYPE_DEVICE) - { - Status = AE_TYPE; - goto UnlockAndExit; - } - - if (Node->Object) - { - Status = AE_ALREADY_EXISTS; - goto UnlockAndExit; - } - - /* - * For user-installed GPE Block Devices, the GpeBlockBaseNumber - * is always zero - */ - Status = AcpiEvCreateGpeBlock (Node, GpeBlockAddress->Address, - GpeBlockAddress->SpaceId, RegisterCount, - 0, InterruptNumber, &GpeBlock); - if (ACPI_FAILURE (Status)) - { - goto UnlockAndExit; - } - - /* Install block in the DeviceObject attached to the node */ - - ObjDesc = AcpiNsGetAttachedObject (Node); - if (!ObjDesc) - { - /* - * No object, create a new one (Device nodes do not always have - * an attached object) - */ - ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_DEVICE); - if (!ObjDesc) - { - Status = AE_NO_MEMORY; - goto UnlockAndExit; - } - - Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_DEVICE); - - /* Remove local reference to the object */ - - AcpiUtRemoveReference (ObjDesc); - if (ACPI_FAILURE (Status)) - { - goto UnlockAndExit; - } - } - - /* Now install the GPE block in the DeviceObject */ - - ObjDesc->Device.GpeBlock = GpeBlock; - - -UnlockAndExit: - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiInstallGpeBlock) - - -/******************************************************************************* - * - * FUNCTION: AcpiRemoveGpeBlock - * - * PARAMETERS: GpeDevice - Handle to the parent GPE Block Device - * - * RETURN: Status - * - * DESCRIPTION: Remove a previously installed block of GPE registers - * - ******************************************************************************/ - -ACPI_STATUS -AcpiRemoveGpeBlock ( - ACPI_HANDLE GpeDevice) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node; - - - ACPI_FUNCTION_TRACE (AcpiRemoveGpeBlock); - - - if (!GpeDevice) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Node = AcpiNsValidateHandle (GpeDevice); - if (!Node) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - /* Validate the parent device */ - - if (Node->Type != ACPI_TYPE_DEVICE) - { - Status = AE_TYPE; - goto UnlockAndExit; - } - - /* Get the DeviceObject attached to the node */ - - ObjDesc = AcpiNsGetAttachedObject (Node); - if (!ObjDesc || - !ObjDesc->Device.GpeBlock) - { - return_ACPI_STATUS (AE_NULL_OBJECT); - } - - /* Delete the GPE block (but not the DeviceObject) */ - - Status = AcpiEvDeleteGpeBlock (ObjDesc->Device.GpeBlock); - if (ACPI_SUCCESS (Status)) - { - ObjDesc->Device.GpeBlock = NULL; - } - -UnlockAndExit: - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiRemoveGpeBlock) - - -/******************************************************************************* - * - * FUNCTION: AcpiGetGpeDevice - * - * PARAMETERS: Index - System GPE index (0-CurrentGpeCount) - * GpeDevice - Where the parent GPE Device is returned - * - * RETURN: Status - * - * DESCRIPTION: Obtain the GPE device associated with the input index. A NULL - * gpe device indicates that the gpe number is contained in one of - * the FADT-defined gpe blocks. Otherwise, the GPE block device. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiGetGpeDevice ( - UINT32 Index, - ACPI_HANDLE *GpeDevice) -{ - ACPI_GPE_DEVICE_INFO Info; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiGetGpeDevice); - - - if (!GpeDevice) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - if (Index >= AcpiCurrentGpeCount) - { - return_ACPI_STATUS (AE_NOT_EXIST); - } - - /* Setup and walk the GPE list */ - - Info.Index = Index; - Info.Status = AE_NOT_EXIST; - Info.GpeDevice = NULL; - Info.NextBlockBaseIndex = 0; - - Status = AcpiEvWalkGpeList (AcpiEvGetGpeDevice, &Info); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - *GpeDevice = ACPI_CAST_PTR (ACPI_HANDLE, Info.GpeDevice); - return_ACPI_STATUS (Info.Status); -} - -ACPI_EXPORT_SYMBOL (AcpiGetGpeDevice) - -#endif /* !ACPI_REDUCED_HARDWARE */ diff --git a/drivers/acpica/evxfregn.c b/drivers/acpica/evxfregn.c deleted file mode 100644 index 04c8801..0000000 --- a/drivers/acpica/evxfregn.c +++ /dev/null @@ -1,477 +0,0 @@ -/****************************************************************************** - * - * Module Name: evxfregn - External Interfaces, ACPI Operation Regions and - * Address Spaces. - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#define EXPORT_ACPI_INTERFACES - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" -#include "acevents.h" - -#define _COMPONENT ACPI_EVENTS - ACPI_MODULE_NAME ("evxfregn") - - -/******************************************************************************* - * - * FUNCTION: AcpiInstallAddressSpaceHandlerInternal - * - * PARAMETERS: Device - Handle for the device - * SpaceId - The address space ID - * Handler - Address of the handler - * Setup - Address of the setup function - * Context - Value passed to the handler on each access - * Run_Reg - Run _REG methods for this address space? - * - * RETURN: Status - * - * DESCRIPTION: Install a handler for all OpRegions of a given SpaceId. - * - * NOTE: This function should only be called after AcpiEnableSubsystem has - * been called. This is because any _REG methods associated with the Space ID - * are executed here, and these methods can only be safely executed after - * the default handlers have been installed and the hardware has been - * initialized (via AcpiEnableSubsystem.) - * To avoid this problem pass FALSE for Run_Reg and later on call - * AcpiExecuteRegMethods() to execute _REG. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiInstallAddressSpaceHandlerInternal ( - ACPI_HANDLE Device, - ACPI_ADR_SPACE_TYPE SpaceId, - ACPI_ADR_SPACE_HANDLER Handler, - ACPI_ADR_SPACE_SETUP Setup, - void *Context, - BOOLEAN Run_Reg) -{ - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiInstallAddressSpaceHandler); - - - /* Parameter validation */ - - if (!Device) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Convert and validate the device handle */ - - Node = AcpiNsValidateHandle (Device); - if (!Node) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - /* Install the handler for all Regions for this Space ID */ - - Status = AcpiEvInstallSpaceHandler ( - Node, SpaceId, Handler, Setup, Context); - if (ACPI_FAILURE (Status)) - { - goto UnlockAndExit; - } - - /* Run all _REG methods for this address space */ - - if (Run_Reg) - { - AcpiEvExecuteRegMethods (Node, SpaceId, ACPI_REG_CONNECT); - } - -UnlockAndExit: - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return_ACPI_STATUS (Status); -} - -ACPI_STATUS -AcpiInstallAddressSpaceHandler ( - ACPI_HANDLE Device, - ACPI_ADR_SPACE_TYPE SpaceId, - ACPI_ADR_SPACE_HANDLER Handler, - ACPI_ADR_SPACE_SETUP Setup, - void *Context) -{ - return AcpiInstallAddressSpaceHandlerInternal (Device, SpaceId, Handler, Setup, Context, TRUE); -} - -ACPI_EXPORT_SYMBOL (AcpiInstallAddressSpaceHandler) - -ACPI_STATUS -AcpiInstallAddressSpaceHandlerNo_Reg ( - ACPI_HANDLE Device, - ACPI_ADR_SPACE_TYPE SpaceId, - ACPI_ADR_SPACE_HANDLER Handler, - ACPI_ADR_SPACE_SETUP Setup, - void *Context) -{ - return AcpiInstallAddressSpaceHandlerInternal (Device, SpaceId, Handler, Setup, Context, FALSE); -} - -ACPI_EXPORT_SYMBOL (AcpiInstallAddressSpaceHandlerNo_Reg) - - -/******************************************************************************* - * - * FUNCTION: AcpiRemoveAddressSpaceHandler - * - * PARAMETERS: Device - Handle for the device - * SpaceId - The address space ID - * Handler - Address of the handler - * - * RETURN: Status - * - * DESCRIPTION: Remove a previously installed handler. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiRemoveAddressSpaceHandler ( - ACPI_HANDLE Device, - ACPI_ADR_SPACE_TYPE SpaceId, - ACPI_ADR_SPACE_HANDLER Handler) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_OPERAND_OBJECT *HandlerObj; - ACPI_OPERAND_OBJECT *RegionObj; - ACPI_OPERAND_OBJECT **LastObjPtr; - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiRemoveAddressSpaceHandler); - - - /* Parameter validation */ - - if (!Device) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Convert and validate the device handle */ - - Node = AcpiNsValidateHandle (Device); - if (!Node || - ((Node->Type != ACPI_TYPE_DEVICE) && - (Node->Type != ACPI_TYPE_PROCESSOR) && - (Node->Type != ACPI_TYPE_THERMAL) && - (Node != AcpiGbl_RootNode))) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - /* Make sure the internal object exists */ - - ObjDesc = AcpiNsGetAttachedObject (Node); - if (!ObjDesc) - { - Status = AE_NOT_EXIST; - goto UnlockAndExit; - } - - /* Find the address handler the user requested */ - - HandlerObj = ObjDesc->CommonNotify.Handler; - LastObjPtr = &ObjDesc->CommonNotify.Handler; - while (HandlerObj) - { - /* We have a handler, see if user requested this one */ - - if (HandlerObj->AddressSpace.SpaceId == SpaceId) - { - /* Handler must be the same as the installed handler */ - - if (HandlerObj->AddressSpace.Handler != Handler) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - /* Matched SpaceId, first dereference this in the Regions */ - - ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, - "Removing address handler %p(%p) for region %s " - "on Device %p(%p)\n", - HandlerObj, Handler, AcpiUtGetRegionName (SpaceId), - Node, ObjDesc)); - - RegionObj = HandlerObj->AddressSpace.RegionList; - - /* Walk the handler's region list */ - - while (RegionObj) - { - /* - * First disassociate the handler from the region. - * - * NOTE: this doesn't mean that the region goes away - * The region is just inaccessible as indicated to - * the _REG method - */ - AcpiEvDetachRegion (RegionObj, TRUE); - - /* - * Walk the list: Just grab the head because the - * DetachRegion removed the previous head. - */ - RegionObj = HandlerObj->AddressSpace.RegionList; - } - - /* Remove this Handler object from the list */ - - *LastObjPtr = HandlerObj->AddressSpace.Next; - - /* Now we can delete the handler object */ - - AcpiUtRemoveReference (HandlerObj); - goto UnlockAndExit; - } - - /* Walk the linked list of handlers */ - - LastObjPtr = &HandlerObj->AddressSpace.Next; - HandlerObj = HandlerObj->AddressSpace.Next; - } - - /* The handler does not exist */ - - ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, - "Unable to remove address handler %p for %s(%X), DevNode %p, obj %p\n", - Handler, AcpiUtGetRegionName (SpaceId), SpaceId, Node, ObjDesc)); - - Status = AE_NOT_EXIST; - -UnlockAndExit: - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiRemoveAddressSpaceHandler) - - -/******************************************************************************* - * - * FUNCTION: AcpiExecuteRegMethods - * - * PARAMETERS: Device - Handle for the device - * SpaceId - The address space ID - * - * RETURN: Status - * - * DESCRIPTION: Execute _REG for all OpRegions of a given SpaceId. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExecuteRegMethods ( - ACPI_HANDLE Device, - ACPI_ADR_SPACE_TYPE SpaceId) -{ - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiExecuteRegMethods); - - - /* Parameter validation */ - - if (!Device) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Convert and validate the device handle */ - - Node = AcpiNsValidateHandle (Device); - if (Node) - { - /* Run all _REG methods for this address space */ - - AcpiEvExecuteRegMethods (Node, SpaceId, ACPI_REG_CONNECT); - } - else - { - Status = AE_BAD_PARAMETER; - } - - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiExecuteRegMethods) diff --git a/drivers/acpica/exconcat.c b/drivers/acpica/exconcat.c deleted file mode 100644 index 3010d9d..0000000 --- a/drivers/acpica/exconcat.c +++ /dev/null @@ -1,570 +0,0 @@ -/****************************************************************************** - * - * Module Name: exconcat - Concatenate-type AML operators - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acinterp.h" -#include "amlresrc.h" - - -#define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exconcat") - -/* Local Prototypes */ - -static ACPI_STATUS -AcpiExConvertToObjectTypeString ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT **ResultDesc); - - -/******************************************************************************* - * - * FUNCTION: AcpiExDoConcatenate - * - * PARAMETERS: Operand0 - First source object - * Operand1 - Second source object - * ActualReturnDesc - Where to place the return object - * WalkState - Current walk state - * - * RETURN: Status - * - * DESCRIPTION: Concatenate two objects with the ACPI-defined conversion - * rules as necessary. - * NOTE: - * Per the ACPI spec (up to 6.1), Concatenate only supports Integer, - * String, and Buffer objects. However, we support all objects here - * as an extension. This improves the usefulness of both Concatenate - * and the Printf/Fprintf macros. The extension returns a string - * describing the object type for the other objects. - * 02/2016. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExDoConcatenate ( - ACPI_OPERAND_OBJECT *Operand0, - ACPI_OPERAND_OBJECT *Operand1, - ACPI_OPERAND_OBJECT **ActualReturnDesc, - ACPI_WALK_STATE *WalkState) -{ - ACPI_OPERAND_OBJECT *LocalOperand0 = Operand0; - ACPI_OPERAND_OBJECT *LocalOperand1 = Operand1; - ACPI_OPERAND_OBJECT *TempOperand1 = NULL; - ACPI_OPERAND_OBJECT *ReturnDesc; - char *Buffer; - ACPI_OBJECT_TYPE Operand0Type; - ACPI_OBJECT_TYPE Operand1Type; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (ExDoConcatenate); - - - /* Operand 0 preprocessing */ - - switch (Operand0->Common.Type) - { - case ACPI_TYPE_INTEGER: - case ACPI_TYPE_STRING: - case ACPI_TYPE_BUFFER: - - Operand0Type = Operand0->Common.Type; - break; - - default: - - /* For all other types, get the "object type" string */ - - Status = AcpiExConvertToObjectTypeString ( - Operand0, &LocalOperand0); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - Operand0Type = ACPI_TYPE_STRING; - break; - } - - /* Operand 1 preprocessing */ - - switch (Operand1->Common.Type) - { - case ACPI_TYPE_INTEGER: - case ACPI_TYPE_STRING: - case ACPI_TYPE_BUFFER: - - Operand1Type = Operand1->Common.Type; - break; - - default: - - /* For all other types, get the "object type" string */ - - Status = AcpiExConvertToObjectTypeString ( - Operand1, &LocalOperand1); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - Operand1Type = ACPI_TYPE_STRING; - break; - } - - /* - * Convert the second operand if necessary. The first operand (0) - * determines the type of the second operand (1) (See the Data Types - * section of the ACPI specification). Both object types are - * guaranteed to be either Integer/String/Buffer by the operand - * resolution mechanism. - */ - switch (Operand0Type) - { - case ACPI_TYPE_INTEGER: - - Status = AcpiExConvertToInteger (LocalOperand1, &TempOperand1, - ACPI_IMPLICIT_CONVERSION); - break; - - case ACPI_TYPE_BUFFER: - - Status = AcpiExConvertToBuffer (LocalOperand1, &TempOperand1); - break; - - case ACPI_TYPE_STRING: - - switch (Operand1Type) - { - case ACPI_TYPE_INTEGER: - case ACPI_TYPE_STRING: - case ACPI_TYPE_BUFFER: - - /* Other types have already been converted to string */ - - Status = AcpiExConvertToString ( - LocalOperand1, &TempOperand1, ACPI_IMPLICIT_CONVERT_HEX); - break; - - default: - - Status = AE_OK; - break; - } - break; - - default: - - ACPI_ERROR ((AE_INFO, "Invalid object type: 0x%X", - Operand0->Common.Type)); - Status = AE_AML_INTERNAL; - } - - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - /* Take care with any newly created operand objects */ - - if ((LocalOperand1 != Operand1) && - (LocalOperand1 != TempOperand1)) - { - AcpiUtRemoveReference (LocalOperand1); - } - - LocalOperand1 = TempOperand1; - - /* - * Both operands are now known to be the same object type - * (Both are Integer, String, or Buffer), and we can now perform - * the concatenation. - * - * There are three cases to handle, as per the ACPI spec: - * - * 1) Two Integers concatenated to produce a new Buffer - * 2) Two Strings concatenated to produce a new String - * 3) Two Buffers concatenated to produce a new Buffer - */ - switch (Operand0Type) - { - case ACPI_TYPE_INTEGER: - - /* Result of two Integers is a Buffer */ - /* Need enough buffer space for two integers */ - - ReturnDesc = AcpiUtCreateBufferObject ( - (ACPI_SIZE) ACPI_MUL_2 (AcpiGbl_IntegerByteWidth)); - if (!ReturnDesc) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - Buffer = (char *) ReturnDesc->Buffer.Pointer; - - /* Copy the first integer, LSB first */ - - memcpy (Buffer, &Operand0->Integer.Value, - AcpiGbl_IntegerByteWidth); - - /* Copy the second integer (LSB first) after the first */ - - memcpy (Buffer + AcpiGbl_IntegerByteWidth, - &LocalOperand1->Integer.Value, AcpiGbl_IntegerByteWidth); - break; - - case ACPI_TYPE_STRING: - - /* Result of two Strings is a String */ - - ReturnDesc = AcpiUtCreateStringObject ( - ((ACPI_SIZE) LocalOperand0->String.Length + - LocalOperand1->String.Length)); - if (!ReturnDesc) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - Buffer = ReturnDesc->String.Pointer; - - /* Concatenate the strings */ - - strcpy (Buffer, LocalOperand0->String.Pointer); - strcat (Buffer, LocalOperand1->String.Pointer); - break; - - case ACPI_TYPE_BUFFER: - - /* Result of two Buffers is a Buffer */ - - ReturnDesc = AcpiUtCreateBufferObject ( - ((ACPI_SIZE) Operand0->Buffer.Length + - LocalOperand1->Buffer.Length)); - if (!ReturnDesc) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - Buffer = (char *) ReturnDesc->Buffer.Pointer; - - /* Concatenate the buffers */ - - memcpy (Buffer, Operand0->Buffer.Pointer, - Operand0->Buffer.Length); - memcpy (Buffer + Operand0->Buffer.Length, - LocalOperand1->Buffer.Pointer, - LocalOperand1->Buffer.Length); - break; - - default: - - /* Invalid object type, should not happen here */ - - ACPI_ERROR ((AE_INFO, "Invalid object type: 0x%X", - Operand0->Common.Type)); - Status = AE_AML_INTERNAL; - goto Cleanup; - } - - *ActualReturnDesc = ReturnDesc; - -Cleanup: - if (LocalOperand0 != Operand0) - { - AcpiUtRemoveReference (LocalOperand0); - } - - if (LocalOperand1 != Operand1) - { - AcpiUtRemoveReference (LocalOperand1); - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExConvertToObjectTypeString - * - * PARAMETERS: ObjDesc - Object to be converted - * ReturnDesc - Where to place the return object - * - * RETURN: Status - * - * DESCRIPTION: Convert an object of arbitrary type to a string object that - * contains the namestring for the object. Used for the - * concatenate operator. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiExConvertToObjectTypeString ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT **ResultDesc) -{ - ACPI_OPERAND_OBJECT *ReturnDesc; - const char *TypeString; - - - TypeString = AcpiUtGetTypeName (ObjDesc->Common.Type); - - ReturnDesc = AcpiUtCreateStringObject ( - ((ACPI_SIZE) strlen (TypeString) + 9)); /* 9 For "[ Object]" */ - if (!ReturnDesc) - { - return (AE_NO_MEMORY); - } - - strcpy (ReturnDesc->String.Pointer, "["); - strcat (ReturnDesc->String.Pointer, TypeString); - strcat (ReturnDesc->String.Pointer, " Object]"); - - *ResultDesc = ReturnDesc; - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExConcatTemplate - * - * PARAMETERS: Operand0 - First source object - * Operand1 - Second source object - * ActualReturnDesc - Where to place the return object - * WalkState - Current walk state - * - * RETURN: Status - * - * DESCRIPTION: Concatenate two resource templates - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExConcatTemplate ( - ACPI_OPERAND_OBJECT *Operand0, - ACPI_OPERAND_OBJECT *Operand1, - ACPI_OPERAND_OBJECT **ActualReturnDesc, - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status; - ACPI_OPERAND_OBJECT *ReturnDesc; - UINT8 *NewBuf; - UINT8 *EndTag; - ACPI_SIZE Length0; - ACPI_SIZE Length1; - ACPI_SIZE NewLength; - - - ACPI_FUNCTION_TRACE (ExConcatTemplate); - - - /* - * Find the EndTag descriptor in each resource template. - * Note1: returned pointers point TO the EndTag, not past it. - * Note2: zero-length buffers are allowed; treated like one EndTag - */ - - /* Get the length of the first resource template */ - - Status = AcpiUtGetResourceEndTag (Operand0, &EndTag); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Length0 = ACPI_PTR_DIFF (EndTag, Operand0->Buffer.Pointer); - - /* Get the length of the second resource template */ - - Status = AcpiUtGetResourceEndTag (Operand1, &EndTag); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Length1 = ACPI_PTR_DIFF (EndTag, Operand1->Buffer.Pointer); - - /* Combine both lengths, minimum size will be 2 for EndTag */ - - NewLength = Length0 + Length1 + sizeof (AML_RESOURCE_END_TAG); - - /* Create a new buffer object for the result (with one EndTag) */ - - ReturnDesc = AcpiUtCreateBufferObject (NewLength); - if (!ReturnDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* - * Copy the templates to the new buffer, 0 first, then 1 follows. One - * EndTag descriptor is copied from Operand1. - */ - NewBuf = ReturnDesc->Buffer.Pointer; - memcpy (NewBuf, Operand0->Buffer.Pointer, Length0); - memcpy (NewBuf + Length0, Operand1->Buffer.Pointer, Length1); - - /* Insert EndTag and set the checksum to zero, means "ignore checksum" */ - - NewBuf[NewLength - 1] = 0; - NewBuf[NewLength - 2] = ACPI_RESOURCE_NAME_END_TAG | 1; - - /* Return the completed resource template */ - - *ActualReturnDesc = ReturnDesc; - return_ACPI_STATUS (AE_OK); -} diff --git a/drivers/acpica/exconfig.c b/drivers/acpica/exconfig.c deleted file mode 100644 index 2edf157..0000000 --- a/drivers/acpica/exconfig.c +++ /dev/null @@ -1,743 +0,0 @@ -/****************************************************************************** - * - * Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes) - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acinterp.h" -#include "acnamesp.h" -#include "actables.h" -#include "acdispat.h" -#include "acevents.h" -#include "amlcode.h" - - -#define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exconfig") - -/* Local prototypes */ - -static ACPI_STATUS -AcpiExAddTable ( - UINT32 TableIndex, - ACPI_OPERAND_OBJECT **DdbHandle); - -static ACPI_STATUS -AcpiExRegionRead ( - ACPI_OPERAND_OBJECT *ObjDesc, - UINT32 Length, - UINT8 *Buffer); - - -/******************************************************************************* - * - * FUNCTION: AcpiExAddTable - * - * PARAMETERS: Table - Pointer to raw table - * ParentNode - Where to load the table (scope) - * DdbHandle - Where to return the table handle. - * - * RETURN: Status - * - * DESCRIPTION: Common function to Install and Load an ACPI table with a - * returned table handle. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiExAddTable ( - UINT32 TableIndex, - ACPI_OPERAND_OBJECT **DdbHandle) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - - - ACPI_FUNCTION_TRACE (ExAddTable); - - - /* Create an object to be the table handle */ - - ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_REFERENCE); - if (!ObjDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Init the table handle */ - - ObjDesc->Common.Flags |= AOPOBJ_DATA_VALID; - ObjDesc->Reference.Class = ACPI_REFCLASS_TABLE; - ObjDesc->Reference.Value = TableIndex; - *DdbHandle = ObjDesc; - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExLoadTableOp - * - * PARAMETERS: WalkState - Current state with operands - * ReturnDesc - Where to store the return object - * - * RETURN: Status - * - * DESCRIPTION: Load an ACPI table from the RSDT/XSDT - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExLoadTableOp ( - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT **ReturnDesc) -{ - ACPI_STATUS Status; - ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; - ACPI_NAMESPACE_NODE *ParentNode; - ACPI_NAMESPACE_NODE *StartNode; - ACPI_NAMESPACE_NODE *ParameterNode = NULL; - ACPI_OPERAND_OBJECT *ReturnObj; - ACPI_OPERAND_OBJECT *DdbHandle; - UINT32 TableIndex; - - - ACPI_FUNCTION_TRACE (ExLoadTableOp); - - - /* Create the return object */ - - ReturnObj = AcpiUtCreateIntegerObject ((UINT64) 0); - if (!ReturnObj) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - *ReturnDesc = ReturnObj; - - /* Find the ACPI table in the RSDT/XSDT */ - - AcpiExExitInterpreter (); - Status = AcpiTbFindTable ( - Operand[0]->String.Pointer, - Operand[1]->String.Pointer, - Operand[2]->String.Pointer, &TableIndex); - AcpiExEnterInterpreter (); - if (ACPI_FAILURE (Status)) - { - if (Status != AE_NOT_FOUND) - { - return_ACPI_STATUS (Status); - } - - /* Table not found, return an Integer=0 and AE_OK */ - - return_ACPI_STATUS (AE_OK); - } - - /* Default nodes */ - - StartNode = WalkState->ScopeInfo->Scope.Node; - ParentNode = AcpiGbl_RootNode; - - /* RootPath (optional parameter) */ - - if (Operand[3]->String.Length > 0) - { - /* - * Find the node referenced by the RootPathString. This is the - * location within the namespace where the table will be loaded. - */ - Status = AcpiNsGetNodeUnlocked (StartNode, - Operand[3]->String.Pointer, ACPI_NS_SEARCH_PARENT, - &ParentNode); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - /* ParameterPath (optional parameter) */ - - if (Operand[4]->String.Length > 0) - { - if ((Operand[4]->String.Pointer[0] != AML_ROOT_PREFIX) && - (Operand[4]->String.Pointer[0] != AML_PARENT_PREFIX)) - { - /* - * Path is not absolute, so it will be relative to the node - * referenced by the RootPathString (or the NS root if omitted) - */ - StartNode = ParentNode; - } - - /* Find the node referenced by the ParameterPathString */ - - Status = AcpiNsGetNodeUnlocked (StartNode, - Operand[4]->String.Pointer, ACPI_NS_SEARCH_PARENT, - &ParameterNode); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - /* Load the table into the namespace */ - - ACPI_INFO (("Dynamic OEM Table Load:")); - AcpiExExitInterpreter (); - Status = AcpiTbLoadTable (TableIndex, ParentNode); - AcpiExEnterInterpreter (); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Status = AcpiExAddTable (TableIndex, &DdbHandle); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Complete the initialization/resolution of new objects */ - - AcpiExExitInterpreter(); - AcpiNsInitializeObjects(); - AcpiExEnterInterpreter(); - - /* Parameter Data (optional) */ - - if (ParameterNode) - { - /* Store the parameter data into the optional parameter object */ - - Status = AcpiExStore (Operand[5], - ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, ParameterNode), WalkState); - if (ACPI_FAILURE (Status)) - { - (void) AcpiExUnloadTable (DdbHandle); - - AcpiUtRemoveReference (DdbHandle); - return_ACPI_STATUS (Status); - } - } - - /* Remove the reference to DdbHandle created by AcpiExAddTable above */ - - AcpiUtRemoveReference (DdbHandle); - - /* Return -1 (non-zero) indicates success */ - - ReturnObj->Integer.Value = 0xFFFFFFFFFFFFFFFF; - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExRegionRead - * - * PARAMETERS: ObjDesc - Region descriptor - * Length - Number of bytes to read - * Buffer - Pointer to where to put the data - * - * RETURN: Status - * - * DESCRIPTION: Read data from an operation region. The read starts from the - * beginning of the region. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiExRegionRead ( - ACPI_OPERAND_OBJECT *ObjDesc, - UINT32 Length, - UINT8 *Buffer) -{ - ACPI_STATUS Status; - UINT64 Value; - UINT32 RegionOffset = 0; - UINT32 i; - - - /* Bytewise reads */ - - for (i = 0; i < Length; i++) - { - Status = AcpiEvAddressSpaceDispatch (ObjDesc, NULL, ACPI_READ, - RegionOffset, 8, &Value); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - *Buffer = (UINT8) Value; - Buffer++; - RegionOffset++; - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExLoadOp - * - * PARAMETERS: ObjDesc - Region or Buffer/Field where the table will be - * obtained - * Target - Where the status of the load will be stored - * WalkState - Current state - * - * RETURN: Status - * - * DESCRIPTION: Load an ACPI table from a field or operation region - * - * NOTE: Region Fields (Field, BankField, IndexFields) are resolved to buffer - * objects before this code is reached. - * - * If source is an operation region, it must refer to SystemMemory, as - * per the ACPI specification. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExLoadOp ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT *Target, - ACPI_WALK_STATE *WalkState) -{ - ACPI_OPERAND_OBJECT *DdbHandle; - ACPI_TABLE_HEADER *TableHeader; - ACPI_TABLE_HEADER *Table; - UINT32 TableIndex; - ACPI_STATUS Status; - UINT32 Length; - - - ACPI_FUNCTION_TRACE (ExLoadOp); - - - if (Target->Common.DescriptorType == ACPI_DESC_TYPE_NAMED) - { - Target = AcpiNsGetAttachedObject (ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Target)); - } - if (Target->Common.Type != ACPI_TYPE_INTEGER) - { - ACPI_ERROR ((AE_INFO, "Type not integer: %X", Target->Common.Type)); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - - Target->Integer.Value = 0; - - /* Source Object can be either an OpRegion or a Buffer/Field */ - - switch (ObjDesc->Common.Type) - { - case ACPI_TYPE_REGION: - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Load table from Region %p\n", ObjDesc)); - - /* Region must be SystemMemory (from ACPI spec) */ - - if (ObjDesc->Region.SpaceId != ACPI_ADR_SPACE_SYSTEM_MEMORY) - { - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - - /* - * If the Region Address and Length have not been previously - * evaluated, evaluate them now and save the results. - */ - if (!(ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)) - { - Status = AcpiDsGetRegionArguments (ObjDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - /* Get the table header first so we can get the table length */ - - TableHeader = ACPI_ALLOCATE (sizeof (ACPI_TABLE_HEADER)); - if (!TableHeader) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - Status = AcpiExRegionRead (ObjDesc, sizeof (ACPI_TABLE_HEADER), - ACPI_CAST_PTR (UINT8, TableHeader)); - Length = TableHeader->Length; - ACPI_FREE (TableHeader); - - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Must have at least an ACPI table header */ - - if (Length < sizeof (ACPI_TABLE_HEADER)) - { - return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); - } - - /* - * The original implementation simply mapped the table, with no copy. - * However, the memory region is not guaranteed to remain stable and - * we must copy the table to a local buffer. For example, the memory - * region is corrupted after suspend on some machines. Dynamically - * loaded tables are usually small, so this overhead is minimal. - * - * The latest implementation (5/2009) does not use a mapping at all. - * We use the low-level operation region interface to read the table - * instead of the obvious optimization of using a direct mapping. - * This maintains a consistent use of operation regions across the - * entire subsystem. This is important if additional processing must - * be performed in the (possibly user-installed) operation region - * handler. For example, AcpiExec and ASLTS depend on this. - */ - - /* Allocate a buffer for the table */ - - Table = ACPI_ALLOCATE (Length); - if (!Table) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Read the entire table */ - - Status = AcpiExRegionRead (ObjDesc, Length, - ACPI_CAST_PTR (UINT8, Table)); - if (ACPI_FAILURE (Status)) - { - ACPI_FREE (Table); - return_ACPI_STATUS (Status); - } - break; - - case ACPI_TYPE_BUFFER: /* Buffer or resolved RegionField */ - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Load table from Buffer or Field %p\n", ObjDesc)); - - /* Must have at least an ACPI table header */ - - if (ObjDesc->Buffer.Length < sizeof (ACPI_TABLE_HEADER)) - { - return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); - } - - /* Get the actual table length from the table header */ - - TableHeader = ACPI_CAST_PTR ( - ACPI_TABLE_HEADER, ObjDesc->Buffer.Pointer); - Length = TableHeader->Length; - - /* Table cannot extend beyond the buffer */ - - if (Length > ObjDesc->Buffer.Length) - { - return_ACPI_STATUS (AE_AML_BUFFER_LIMIT); - } - if (Length < sizeof (ACPI_TABLE_HEADER)) - { - return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); - } - - /* - * Copy the table from the buffer because the buffer could be - * modified or even deleted in the future - */ - Table = ACPI_ALLOCATE (Length); - if (!Table) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - memcpy (Table, TableHeader, Length); - break; - - default: - - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - - /* Install the new table into the local data structures */ - - ACPI_INFO (("Dynamic OEM Table Load:")); - AcpiExExitInterpreter (); - Status = AcpiTbInstallAndLoadTable (ACPI_PTR_TO_PHYSADDR (Table), - ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL, Table, TRUE, &TableIndex); - AcpiExEnterInterpreter (); - if (ACPI_FAILURE (Status)) - { - /* Delete allocated table buffer */ - - ACPI_FREE (Table); - return_ACPI_STATUS (Status); - } - - /* - * Add the table to the namespace. - * - * Note: Load the table objects relative to the root of the namespace. - * This appears to go against the ACPI specification, but we do it for - * compatibility with other ACPI implementations. - */ - Status = AcpiExAddTable (TableIndex, &DdbHandle); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Complete the initialization/resolution of new objects */ - - AcpiExExitInterpreter (); - AcpiNsInitializeObjects (); - AcpiExEnterInterpreter (); - - /* Remove the reference to DdbHandle created by AcpiExAddTable above */ - - AcpiUtRemoveReference (DdbHandle); - - /* Return -1 (non-zero) indicates success */ - - Target->Integer.Value = 0xFFFFFFFFFFFFFFFF; - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExUnloadTable - * - * PARAMETERS: DdbHandle - Handle to a previously loaded table - * - * RETURN: Status - * - * DESCRIPTION: Unload an ACPI table - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExUnloadTable ( - ACPI_OPERAND_OBJECT *DdbHandle) -{ - ACPI_STATUS Status = AE_OK; - ACPI_OPERAND_OBJECT *TableDesc = DdbHandle; - UINT32 TableIndex; - - - ACPI_FUNCTION_TRACE (ExUnloadTable); - - - /* - * Temporarily emit a warning so that the ASL for the machine can be - * hopefully obtained. This is to say that the Unload() operator is - * extremely rare if not completely unused. - */ - ACPI_WARNING ((AE_INFO, - "Received request to unload an ACPI table")); - - /* - * May 2018: Unload is no longer supported for the following reasons: - * 1) A correct implementation on some hosts may not be possible. - * 2) Other ACPI implementations do not correctly/fully support it. - * 3) It requires host device driver support which does not exist. - * (To properly support namespace unload out from underneath.) - * 4) This AML operator has never been seen in the field. - */ - ACPI_EXCEPTION ((AE_INFO, AE_NOT_IMPLEMENTED, - "AML Unload operator is not supported")); - - /* - * Validate the handle - * Although the handle is partially validated in AcpiExReconfiguration() - * when it calls AcpiExResolveOperands(), the handle is more completely - * validated here. - * - * Handle must be a valid operand object of type reference. Also, the - * DdbHandle must still be marked valid (table has not been previously - * unloaded) - */ - if ((!DdbHandle) || - (ACPI_GET_DESCRIPTOR_TYPE (DdbHandle) != ACPI_DESC_TYPE_OPERAND) || - (DdbHandle->Common.Type != ACPI_TYPE_LOCAL_REFERENCE) || - (!(DdbHandle->Common.Flags & AOPOBJ_DATA_VALID))) - { - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - - /* Get the table index from the DdbHandle */ - - TableIndex = TableDesc->Reference.Value; - - /* - * Release the interpreter lock so that the table lock won't have - * strict order requirement against it. - */ - AcpiExExitInterpreter (); - Status = AcpiTbUnloadTable (TableIndex); - AcpiExEnterInterpreter (); - - /* - * Invalidate the handle. We do this because the handle may be stored - * in a named object and may not be actually deleted until much later. - */ - if (ACPI_SUCCESS (Status)) - { - DdbHandle->Common.Flags &= ~AOPOBJ_DATA_VALID; - } - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/exconvrt.c b/drivers/acpica/exconvrt.c deleted file mode 100644 index 3166687..0000000 --- a/drivers/acpica/exconvrt.c +++ /dev/null @@ -1,924 +0,0 @@ -/****************************************************************************** - * - * Module Name: exconvrt - Object conversion routines - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acinterp.h" -#include "amlcode.h" - - -#define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exconvrt") - -/* Local prototypes */ - -static UINT32 -AcpiExConvertToAscii ( - UINT64 Integer, - UINT16 Base, - UINT8 *String, - UINT8 MaxLength, - BOOLEAN LeadingZeros); - - -/******************************************************************************* - * - * FUNCTION: AcpiExConvertToInteger - * - * PARAMETERS: ObjDesc - Object to be converted. Must be an - * Integer, Buffer, or String - * ResultDesc - Where the new Integer object is returned - * ImplicitConversion - Used for string conversion - * - * RETURN: Status - * - * DESCRIPTION: Convert an ACPI Object to an integer. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExConvertToInteger ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT **ResultDesc, - UINT32 ImplicitConversion) -{ - ACPI_OPERAND_OBJECT *ReturnDesc; - UINT8 *Pointer; - UINT64 Result; - UINT32 i; - UINT32 Count; - - - ACPI_FUNCTION_TRACE_PTR (ExConvertToInteger, ObjDesc); - - - switch (ObjDesc->Common.Type) - { - case ACPI_TYPE_INTEGER: - - /* No conversion necessary */ - - *ResultDesc = ObjDesc; - return_ACPI_STATUS (AE_OK); - - case ACPI_TYPE_BUFFER: - case ACPI_TYPE_STRING: - - /* Note: Takes advantage of common buffer/string fields */ - - Pointer = ObjDesc->Buffer.Pointer; - Count = ObjDesc->Buffer.Length; - break; - - default: - - return_ACPI_STATUS (AE_TYPE); - } - - /* - * Convert the buffer/string to an integer. Note that both buffers and - * strings are treated as raw data - we don't convert ascii to hex for - * strings. - * - * There are two terminating conditions for the loop: - * 1) The size of an integer has been reached, or - * 2) The end of the buffer or string has been reached - */ - Result = 0; - - /* String conversion is different than Buffer conversion */ - - switch (ObjDesc->Common.Type) - { - case ACPI_TYPE_STRING: - /* - * Convert string to an integer - for most cases, the string must be - * hexadecimal as per the ACPI specification. The only exception (as - * of ACPI 3.0) is that the ToInteger() operator allows both decimal - * and hexadecimal strings (hex prefixed with "0x"). - * - * Explicit conversion is used only by ToInteger. - * All other string-to-integer conversions are implicit conversions. - */ - if (ImplicitConversion) - { - Result = AcpiUtImplicitStrtoul64 (ACPI_CAST_PTR (char, Pointer)); - } - else - { - Result = AcpiUtExplicitStrtoul64 (ACPI_CAST_PTR (char, Pointer)); - } - break; - - case ACPI_TYPE_BUFFER: - - /* Check for zero-length buffer */ - - if (!Count) - { - return_ACPI_STATUS (AE_AML_BUFFER_LIMIT); - } - - /* Transfer no more than an integer's worth of data */ - - if (Count > AcpiGbl_IntegerByteWidth) - { - Count = AcpiGbl_IntegerByteWidth; - } - - /* - * Convert buffer to an integer - we simply grab enough raw data - * from the buffer to fill an integer - */ - for (i = 0; i < Count; i++) - { - /* - * Get next byte and shift it into the Result. - * Little endian is used, meaning that the first byte of the buffer - * is the LSB of the integer - */ - Result |= (((UINT64) Pointer[i]) << (i * 8)); - } - break; - - default: - - /* No other types can get here */ - - break; - } - - /* Create a new integer */ - - ReturnDesc = AcpiUtCreateIntegerObject (Result); - if (!ReturnDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Converted value: %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (Result))); - - /* Save the Result */ - - (void) AcpiExTruncateFor32bitTable (ReturnDesc); - *ResultDesc = ReturnDesc; - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExConvertToBuffer - * - * PARAMETERS: ObjDesc - Object to be converted. Must be an - * Integer, Buffer, or String - * ResultDesc - Where the new buffer object is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert an ACPI Object to a Buffer - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExConvertToBuffer ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT **ResultDesc) -{ - ACPI_OPERAND_OBJECT *ReturnDesc; - UINT8 *NewBuf; - - - ACPI_FUNCTION_TRACE_PTR (ExConvertToBuffer, ObjDesc); - - - switch (ObjDesc->Common.Type) - { - case ACPI_TYPE_BUFFER: - - /* No conversion necessary */ - - *ResultDesc = ObjDesc; - return_ACPI_STATUS (AE_OK); - - - case ACPI_TYPE_INTEGER: - /* - * Create a new Buffer object. - * Need enough space for one integer - */ - ReturnDesc = AcpiUtCreateBufferObject (AcpiGbl_IntegerByteWidth); - if (!ReturnDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Copy the integer to the buffer, LSB first */ - - NewBuf = ReturnDesc->Buffer.Pointer; - memcpy (NewBuf, &ObjDesc->Integer.Value, AcpiGbl_IntegerByteWidth); - break; - - case ACPI_TYPE_STRING: - /* - * Create a new Buffer object - * Size will be the string length - * - * NOTE: Add one to the string length to include the null terminator. - * The ACPI spec is unclear on this subject, but there is existing - * ASL/AML code that depends on the null being transferred to the new - * buffer. - */ - ReturnDesc = AcpiUtCreateBufferObject ((ACPI_SIZE) - ObjDesc->String.Length + 1); - if (!ReturnDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Copy the string to the buffer */ - - NewBuf = ReturnDesc->Buffer.Pointer; - memcpy ((char *) NewBuf, (char *) ObjDesc->String.Pointer, - ObjDesc->String.Length); - break; - - default: - - return_ACPI_STATUS (AE_TYPE); - } - - /* Mark buffer initialized */ - - ReturnDesc->Common.Flags |= AOPOBJ_DATA_VALID; - *ResultDesc = ReturnDesc; - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExConvertToAscii - * - * PARAMETERS: Integer - Value to be converted - * Base - ACPI_STRING_DECIMAL or ACPI_STRING_HEX - * String - Where the string is returned - * DataWidth - Size of data item to be converted, in bytes - * LeadingZeros - Allow leading zeros - * - * RETURN: Actual string length - * - * DESCRIPTION: Convert an ACPI Integer to a hex or decimal string - * - ******************************************************************************/ - -static UINT32 -AcpiExConvertToAscii ( - UINT64 Integer, - UINT16 Base, - UINT8 *String, - UINT8 DataWidth, - BOOLEAN LeadingZeros) -{ - UINT64 Digit; - UINT32 i; - UINT32 j; - UINT32 k = 0; - UINT32 HexLength; - UINT32 DecimalLength; - UINT32 Remainder; - BOOLEAN SupressZeros = !LeadingZeros; - UINT8 HexChar; - - - ACPI_FUNCTION_ENTRY (); - - - switch (Base) - { - case 10: - - /* Setup max length for the decimal number */ - - switch (DataWidth) - { - case 1: - - DecimalLength = ACPI_MAX8_DECIMAL_DIGITS; - break; - - case 4: - - DecimalLength = ACPI_MAX32_DECIMAL_DIGITS; - break; - - case 8: - default: - - DecimalLength = ACPI_MAX64_DECIMAL_DIGITS; - break; - } - - Remainder = 0; - - for (i = DecimalLength; i > 0; i--) - { - /* Divide by nth factor of 10 */ - - Digit = Integer; - for (j = 0; j < i; j++) - { - (void) AcpiUtShortDivide (Digit, 10, &Digit, &Remainder); - } - - /* Handle leading zeros */ - - if (Remainder != 0) - { - SupressZeros = FALSE; - } - - if (!SupressZeros) - { - String[k] = (UINT8) (ACPI_ASCII_ZERO + Remainder); - k++; - } - } - break; - - case 16: - - /* HexLength: 2 ascii hex chars per data byte */ - - HexLength = (DataWidth * 2); - for (i = 0, j = (HexLength-1); i < HexLength; i++, j--) - { - /* Get one hex digit, most significant digits first */ - - HexChar = (UINT8) - AcpiUtHexToAsciiChar (Integer, ACPI_MUL_4 (j)); - - /* Supress leading zeros until the first non-zero character */ - - if (HexChar == ACPI_ASCII_ZERO && SupressZeros) - { - continue; - } - - SupressZeros = FALSE; - String[k] = HexChar; - k++; - } - break; - - default: - return (0); - } - - /* - * Since leading zeros are suppressed, we must check for the case where - * the integer equals 0 - * - * Finally, null terminate the string and return the length - */ - if (!k) - { - String [0] = ACPI_ASCII_ZERO; - k = 1; - } - - String [k] = 0; - return ((UINT32) k); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExConvertToString - * - * PARAMETERS: ObjDesc - Object to be converted. Must be an - * Integer, Buffer, or String - * ResultDesc - Where the string object is returned - * Type - String flags (base and conversion type) - * - * RETURN: Status - * - * DESCRIPTION: Convert an ACPI Object to a string. Supports both implicit - * and explicit conversions and related rules. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExConvertToString ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT **ResultDesc, - UINT32 Type) -{ - ACPI_OPERAND_OBJECT *ReturnDesc; - UINT8 *NewBuf; - UINT32 i; - UINT32 StringLength = 0; - UINT16 Base = 16; - UINT8 Separator = ','; - BOOLEAN LeadingZeros; - - - ACPI_FUNCTION_TRACE_PTR (ExConvertToString, ObjDesc); - - - switch (ObjDesc->Common.Type) - { - case ACPI_TYPE_STRING: - - /* No conversion necessary */ - - *ResultDesc = ObjDesc; - return_ACPI_STATUS (AE_OK); - - case ACPI_TYPE_INTEGER: - - switch (Type) - { - case ACPI_EXPLICIT_CONVERT_DECIMAL: - /* - * From ToDecimalString, integer source. - * - * Make room for the maximum decimal number size - */ - StringLength = ACPI_MAX_DECIMAL_DIGITS; - LeadingZeros = FALSE; - Base = 10; - break; - - case ACPI_EXPLICIT_CONVERT_HEX: - /* - * From ToHexString. - * - * Supress leading zeros and append "0x" - */ - StringLength = ACPI_MUL_2 (AcpiGbl_IntegerByteWidth) + 2; - LeadingZeros = FALSE; - break; - default: - - /* Two hex string characters for each integer byte */ - - StringLength = ACPI_MUL_2 (AcpiGbl_IntegerByteWidth); - LeadingZeros = TRUE; - break; - } - - /* - * Create a new String - * Need enough space for one ASCII integer (plus null terminator) - */ - ReturnDesc = AcpiUtCreateStringObject ((ACPI_SIZE) StringLength); - if (!ReturnDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - NewBuf = ReturnDesc->Buffer.Pointer; - if (Type == ACPI_EXPLICIT_CONVERT_HEX) - { - /* Append "0x" prefix for explicit hex conversion */ - - *NewBuf++ = '0'; - *NewBuf++ = 'x'; - } - - /* Convert integer to string */ - - StringLength = AcpiExConvertToAscii ( - ObjDesc->Integer.Value, Base, NewBuf, AcpiGbl_IntegerByteWidth, LeadingZeros); - - /* Null terminate at the correct place */ - - ReturnDesc->String.Length = StringLength; - if (Type == ACPI_EXPLICIT_CONVERT_HEX) - { - /* Take "0x" prefix into account */ - - ReturnDesc->String.Length += 2; - } - - NewBuf [StringLength] = 0; - break; - - case ACPI_TYPE_BUFFER: - - /* Setup string length, base, and separator */ - - switch (Type) - { - case ACPI_EXPLICIT_CONVERT_DECIMAL: /* Used by ToDecimalString */ - /* - * Explicit conversion from the ToDecimalString ASL operator. - * - * From ACPI: "If the input is a buffer, it is converted to a - * a string of decimal values separated by commas." - */ - LeadingZeros = FALSE; - Base = 10; - - /* - * Calculate the final string length. Individual string values - * are variable length (include separator for each) - */ - for (i = 0; i < ObjDesc->Buffer.Length; i++) - { - if (ObjDesc->Buffer.Pointer[i] >= 100) - { - StringLength += 4; - } - else if (ObjDesc->Buffer.Pointer[i] >= 10) - { - StringLength += 3; - } - else - { - StringLength += 2; - } - } - break; - - case ACPI_IMPLICIT_CONVERT_HEX: - /* - * Implicit buffer-to-string conversion - * - * From the ACPI spec: - * "The entire contents of the buffer are converted to a string of - * two-character hexadecimal numbers, each separated by a space." - * - * Each hex number is prefixed with 0x (11/2018) - */ - LeadingZeros = TRUE; - Separator = ' '; - StringLength = (ObjDesc->Buffer.Length * 5); - break; - - case ACPI_EXPLICIT_CONVERT_HEX: - /* - * Explicit conversion from the ToHexString ASL operator. - * - * From ACPI: "If Data is a buffer, it is converted to a string of - * hexadecimal values separated by commas." - * - * Each hex number is prefixed with 0x (11/2018) - */ - LeadingZeros = TRUE; - Separator = ','; - StringLength = (ObjDesc->Buffer.Length * 5); - break; - - default: - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* - * Create a new string object and string buffer - * (-1 because of extra separator included in StringLength from above) - * Allow creation of zero-length strings from zero-length buffers. - */ - if (StringLength) - { - StringLength--; - } - - ReturnDesc = AcpiUtCreateStringObject ((ACPI_SIZE) StringLength); - if (!ReturnDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - NewBuf = ReturnDesc->Buffer.Pointer; - - /* - * Convert buffer bytes to hex or decimal values - * (separated by commas or spaces) - */ - for (i = 0; i < ObjDesc->Buffer.Length; i++) - { - if (Base == 16) - { - /* Emit 0x prefix for explicit/implicit hex conversion */ - - *NewBuf++ = '0'; - *NewBuf++ = 'x'; - } - - NewBuf += AcpiExConvertToAscii ( - (UINT64) ObjDesc->Buffer.Pointer[i], Base, NewBuf, 1, LeadingZeros); - - /* Each digit is separated by either a comma or space */ - - *NewBuf++ = Separator; - } - - /* - * Null terminate the string - * (overwrites final comma/space from above) - */ - if (ObjDesc->Buffer.Length) - { - NewBuf--; - } - *NewBuf = 0; - break; - - default: - - return_ACPI_STATUS (AE_TYPE); - } - - *ResultDesc = ReturnDesc; - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExConvertToTargetType - * - * PARAMETERS: DestinationType - Current type of the destination - * SourceDesc - Source object to be converted. - * ResultDesc - Where the converted object is returned - * WalkState - Current method state - * - * RETURN: Status - * - * DESCRIPTION: Implements "implicit conversion" rules for storing an object. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExConvertToTargetType ( - ACPI_OBJECT_TYPE DestinationType, - ACPI_OPERAND_OBJECT *SourceDesc, - ACPI_OPERAND_OBJECT **ResultDesc, - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE (ExConvertToTargetType); - - - /* Default behavior */ - - *ResultDesc = SourceDesc; - - /* - * If required by the target, - * perform implicit conversion on the source before we store it. - */ - switch (GET_CURRENT_ARG_TYPE (WalkState->OpInfo->RuntimeArgs)) - { - case ARGI_SIMPLE_TARGET: - case ARGI_FIXED_TARGET: - case ARGI_INTEGER_REF: /* Handles Increment, Decrement cases */ - - switch (DestinationType) - { - case ACPI_TYPE_LOCAL_REGION_FIELD: - /* - * Named field can always handle conversions - */ - break; - - default: - - /* No conversion allowed for these types */ - - if (DestinationType != SourceDesc->Common.Type) - { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Explicit operator, will store (%s) over existing type (%s)\n", - AcpiUtGetObjectTypeName (SourceDesc), - AcpiUtGetTypeName (DestinationType))); - Status = AE_TYPE; - } - } - break; - - case ARGI_TARGETREF: - case ARGI_STORE_TARGET: - - switch (DestinationType) - { - case ACPI_TYPE_INTEGER: - case ACPI_TYPE_BUFFER_FIELD: - case ACPI_TYPE_LOCAL_BANK_FIELD: - case ACPI_TYPE_LOCAL_INDEX_FIELD: - /* - * These types require an Integer operand. We can convert - * a Buffer or a String to an Integer if necessary. - */ - Status = AcpiExConvertToInteger (SourceDesc, ResultDesc, - ACPI_IMPLICIT_CONVERSION); - break; - - case ACPI_TYPE_STRING: - /* - * The operand must be a String. We can convert an - * Integer or Buffer if necessary - */ - Status = AcpiExConvertToString (SourceDesc, ResultDesc, - ACPI_IMPLICIT_CONVERT_HEX); - break; - - case ACPI_TYPE_BUFFER: - /* - * The operand must be a Buffer. We can convert an - * Integer or String if necessary - */ - Status = AcpiExConvertToBuffer (SourceDesc, ResultDesc); - break; - - default: - - ACPI_ERROR ((AE_INFO, - "Bad destination type during conversion: 0x%X", - DestinationType)); - Status = AE_AML_INTERNAL; - break; - } - break; - - case ARGI_REFERENCE: - /* - * CreateXxxxField cases - we are storing the field object into the name - */ - break; - - default: - - ACPI_ERROR ((AE_INFO, - "Unknown Target type ID 0x%X AmlOpcode 0x%X DestType %s", - GET_CURRENT_ARG_TYPE (WalkState->OpInfo->RuntimeArgs), - WalkState->Opcode, AcpiUtGetTypeName (DestinationType))); - Status = AE_AML_INTERNAL; - } - - /* - * Source-to-Target conversion semantics: - * - * If conversion to the target type cannot be performed, then simply - * overwrite the target with the new object and type. - */ - if (Status == AE_TYPE) - { - Status = AE_OK; - } - - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/excreate.c b/drivers/acpica/excreate.c deleted file mode 100644 index de0bf9e..0000000 --- a/drivers/acpica/excreate.c +++ /dev/null @@ -1,660 +0,0 @@ -/****************************************************************************** - * - * Module Name: excreate - Named object creation - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acinterp.h" -#include "amlcode.h" -#include "acnamesp.h" - - -#define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("excreate") - - -/******************************************************************************* - * - * FUNCTION: AcpiExCreateAlias - * - * PARAMETERS: WalkState - Current state, contains operands - * - * RETURN: Status - * - * DESCRIPTION: Create a new named alias - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExCreateAlias ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_NAMESPACE_NODE *TargetNode; - ACPI_NAMESPACE_NODE *AliasNode; - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE (ExCreateAlias); - - - /* Get the source/alias operands (both namespace nodes) */ - - AliasNode = (ACPI_NAMESPACE_NODE *) WalkState->Operands[0]; - TargetNode = (ACPI_NAMESPACE_NODE *) WalkState->Operands[1]; - - if ((TargetNode->Type == ACPI_TYPE_LOCAL_ALIAS) || - (TargetNode->Type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) - { - /* - * Dereference an existing alias so that we don't create a chain - * of aliases. With this code, we guarantee that an alias is - * always exactly one level of indirection away from the - * actual aliased name. - */ - TargetNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, TargetNode->Object); - } - - /* Ensure that the target node is valid */ - - if (!TargetNode) - { - return_ACPI_STATUS (AE_NULL_OBJECT); - } - - /* Construct the alias object (a namespace node) */ - - switch (TargetNode->Type) - { - case ACPI_TYPE_METHOD: - /* - * Control method aliases need to be differentiated with - * a special type - */ - AliasNode->Type = ACPI_TYPE_LOCAL_METHOD_ALIAS; - break; - - default: - /* - * All other object types. - * - * The new alias has the type ALIAS and points to the original - * NS node, not the object itself. - */ - AliasNode->Type = ACPI_TYPE_LOCAL_ALIAS; - AliasNode->Object = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, TargetNode); - break; - } - - /* Since both operands are Nodes, we don't need to delete them */ - - AliasNode->Object = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, TargetNode); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExCreateEvent - * - * PARAMETERS: WalkState - Current state - * - * RETURN: Status - * - * DESCRIPTION: Create a new event object - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExCreateEvent ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status; - ACPI_OPERAND_OBJECT *ObjDesc; - - - ACPI_FUNCTION_TRACE (ExCreateEvent); - - - ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_EVENT); - if (!ObjDesc) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - /* - * Create the actual OS semaphore, with zero initial units -- meaning - * that the event is created in an unsignalled state - */ - Status = AcpiOsCreateSemaphore (ACPI_NO_UNIT_LIMIT, 0, - &ObjDesc->Event.OsSemaphore); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - /* Attach object to the Node */ - - Status = AcpiNsAttachObject ( - (ACPI_NAMESPACE_NODE *) WalkState->Operands[0], - ObjDesc, ACPI_TYPE_EVENT); - -Cleanup: - /* - * Remove local reference to the object (on error, will cause deletion - * of both object and semaphore if present.) - */ - AcpiUtRemoveReference (ObjDesc); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExCreateMutex - * - * PARAMETERS: WalkState - Current state - * - * RETURN: Status - * - * DESCRIPTION: Create a new mutex object - * - * Mutex (Name[0], SyncLevel[1]) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExCreateMutex ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status = AE_OK; - ACPI_OPERAND_OBJECT *ObjDesc; - - - ACPI_FUNCTION_TRACE_PTR (ExCreateMutex, ACPI_WALK_OPERANDS); - - - /* Create the new mutex object */ - - ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_MUTEX); - if (!ObjDesc) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - /* Create the actual OS Mutex */ - - Status = AcpiOsCreateMutex (&ObjDesc->Mutex.OsMutex); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - /* Init object and attach to NS node */ - - ObjDesc->Mutex.SyncLevel = (UINT8) WalkState->Operands[1]->Integer.Value; - ObjDesc->Mutex.Node = (ACPI_NAMESPACE_NODE *) WalkState->Operands[0]; - - Status = AcpiNsAttachObject ( - ObjDesc->Mutex.Node, ObjDesc, ACPI_TYPE_MUTEX); - - -Cleanup: - /* - * Remove local reference to the object (on error, will cause deletion - * of both object and semaphore if present.) - */ - AcpiUtRemoveReference (ObjDesc); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExCreateRegion - * - * PARAMETERS: AmlStart - Pointer to the region declaration AML - * AmlLength - Max length of the declaration AML - * SpaceId - Address space ID for the region - * WalkState - Current state - * - * RETURN: Status - * - * DESCRIPTION: Create a new operation region object - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExCreateRegion ( - UINT8 *AmlStart, - UINT32 AmlLength, - UINT8 SpaceId, - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_NAMESPACE_NODE *Node; - ACPI_OPERAND_OBJECT *RegionObj2; - - - ACPI_FUNCTION_TRACE (ExCreateRegion); - - - /* Get the Namespace Node */ - - Node = WalkState->Op->Common.Node; - - /* - * If the region object is already attached to this node, - * just return - */ - if (AcpiNsGetAttachedObject (Node)) - { - return_ACPI_STATUS (AE_OK); - } - - /* - * Space ID must be one of the predefined IDs, or in the user-defined - * range - */ - if (!AcpiIsValidSpaceId (SpaceId)) - { - /* - * Print an error message, but continue. We don't want to abort - * a table load for this exception. Instead, if the region is - * actually used at runtime, abort the executing method. - */ - ACPI_ERROR ((AE_INFO, - "Invalid/unknown Address Space ID: 0x%2.2X", SpaceId)); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (0x%X)\n", - AcpiUtGetRegionName (SpaceId), SpaceId)); - - /* Create the region descriptor */ - - ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_REGION); - if (!ObjDesc) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - /* - * Remember location in AML stream of address & length - * operands since they need to be evaluated at run time. - */ - RegionObj2 = AcpiNsGetSecondaryObject (ObjDesc); - RegionObj2->Extra.AmlStart = AmlStart; - RegionObj2->Extra.AmlLength = AmlLength; - RegionObj2->Extra.Method_REG = NULL; - if (WalkState->ScopeInfo) - { - RegionObj2->Extra.ScopeNode = WalkState->ScopeInfo->Scope.Node; - } - else - { - RegionObj2->Extra.ScopeNode = Node; - } - - /* Init the region from the operands */ - - ObjDesc->Region.SpaceId = SpaceId; - ObjDesc->Region.Address = 0; - ObjDesc->Region.Length = 0; - ObjDesc->Region.Pointer = NULL; - ObjDesc->Region.Node = Node; - ObjDesc->Region.Handler = NULL; - ObjDesc->Common.Flags &= - ~(AOPOBJ_SETUP_COMPLETE | AOPOBJ_REG_CONNECTED | - AOPOBJ_OBJECT_INITIALIZED); - - /* Install the new region object in the parent Node */ - - Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_REGION); - - -Cleanup: - - /* Remove local reference to the object */ - - AcpiUtRemoveReference (ObjDesc); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExCreateProcessor - * - * PARAMETERS: WalkState - Current state - * - * RETURN: Status - * - * DESCRIPTION: Create a new processor object and populate the fields - * - * Processor (Name[0], CpuID[1], PblockAddr[2], PblockLength[3]) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExCreateProcessor ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE_PTR (ExCreateProcessor, WalkState); - - - /* Create the processor object */ - - ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_PROCESSOR); - if (!ObjDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Initialize the processor object from the operands */ - - ObjDesc->Processor.ProcId = (UINT8) Operand[1]->Integer.Value; - ObjDesc->Processor.Length = (UINT8) Operand[3]->Integer.Value; - ObjDesc->Processor.Address = (ACPI_IO_ADDRESS) Operand[2]->Integer.Value; - - /* Install the processor object in the parent Node */ - - Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) Operand[0], - ObjDesc, ACPI_TYPE_PROCESSOR); - - /* Remove local reference to the object */ - - AcpiUtRemoveReference (ObjDesc); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExCreatePowerResource - * - * PARAMETERS: WalkState - Current state - * - * RETURN: Status - * - * DESCRIPTION: Create a new PowerResource object and populate the fields - * - * PowerResource (Name[0], SystemLevel[1], ResourceOrder[2]) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExCreatePowerResource ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; - ACPI_STATUS Status; - ACPI_OPERAND_OBJECT *ObjDesc; - - - ACPI_FUNCTION_TRACE_PTR (ExCreatePowerResource, WalkState); - - - /* Create the power resource object */ - - ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_POWER); - if (!ObjDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Initialize the power object from the operands */ - - ObjDesc->PowerResource.SystemLevel = (UINT8) Operand[1]->Integer.Value; - ObjDesc->PowerResource.ResourceOrder = (UINT16) Operand[2]->Integer.Value; - - /* Install the power resource object in the parent Node */ - - Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) Operand[0], - ObjDesc, ACPI_TYPE_POWER); - - /* Remove local reference to the object */ - - AcpiUtRemoveReference (ObjDesc); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExCreateMethod - * - * PARAMETERS: AmlStart - First byte of the method's AML - * AmlLength - AML byte count for this method - * WalkState - Current state - * - * RETURN: Status - * - * DESCRIPTION: Create a new method object - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExCreateMethod ( - UINT8 *AmlStart, - UINT32 AmlLength, - ACPI_WALK_STATE *WalkState) -{ - ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_STATUS Status; - UINT8 MethodFlags; - - - ACPI_FUNCTION_TRACE_PTR (ExCreateMethod, WalkState); - - - /* Create a new method object */ - - ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_METHOD); - if (!ObjDesc) - { - Status = AE_NO_MEMORY; - goto Exit; - } - - /* Save the method's AML pointer and length */ - - ObjDesc->Method.AmlStart = AmlStart; - ObjDesc->Method.AmlLength = AmlLength; - ObjDesc->Method.Node = Operand[0]; - - /* - * Disassemble the method flags. Split off the ArgCount, Serialized - * flag, and SyncLevel for efficiency. - */ - MethodFlags = (UINT8) Operand[1]->Integer.Value; - ObjDesc->Method.ParamCount = (UINT8) - (MethodFlags & AML_METHOD_ARG_COUNT); - - /* - * Get the SyncLevel. If method is serialized, a mutex will be - * created for this method when it is parsed. - */ - if (MethodFlags & AML_METHOD_SERIALIZED) - { - ObjDesc->Method.InfoFlags = ACPI_METHOD_SERIALIZED; - - /* - * ACPI 1.0: SyncLevel = 0 - * ACPI 2.0: SyncLevel = SyncLevel in method declaration - */ - ObjDesc->Method.SyncLevel = (UINT8) - ((MethodFlags & AML_METHOD_SYNC_LEVEL) >> 4); - } - - /* Attach the new object to the method Node */ - - Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) Operand[0], - ObjDesc, ACPI_TYPE_METHOD); - - /* Remove local reference to the object */ - - AcpiUtRemoveReference (ObjDesc); - -Exit: - /* Remove a reference to the operand */ - - AcpiUtRemoveReference (Operand[1]); - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/exdebug.c b/drivers/acpica/exdebug.c deleted file mode 100644 index 17e14d8..0000000 --- a/drivers/acpica/exdebug.c +++ /dev/null @@ -1,461 +0,0 @@ -/****************************************************************************** - * - * Module Name: exdebug - Support for stores to the AML Debug Object - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acinterp.h" - - -#define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exdebug") - - -#ifndef ACPI_NO_ERROR_MESSAGES -/******************************************************************************* - * - * FUNCTION: AcpiExDoDebugObject - * - * PARAMETERS: SourceDesc - Object to be output to "Debug Object" - * Level - Indentation level (used for packages) - * Index - Current package element, zero if not pkg - * - * RETURN: None - * - * DESCRIPTION: Handles stores to the AML Debug Object. For example: - * Store(INT1, Debug) - * - * This function is not compiled if ACPI_NO_ERROR_MESSAGES is set. - * - * This function is only enabled if AcpiGbl_EnableAmlDebugObject is set, or - * if ACPI_LV_DEBUG_OBJECT is set in the AcpiDbgLevel. Thus, in the normal - * operational case, stores to the debug object are ignored but can be easily - * enabled if necessary. - * - ******************************************************************************/ - -void -AcpiExDoDebugObject ( - ACPI_OPERAND_OBJECT *SourceDesc, - UINT32 Level, - UINT32 Index) -{ - UINT32 i; - UINT32 Timer; - ACPI_OPERAND_OBJECT *ObjectDesc; - UINT32 Value; - - - ACPI_FUNCTION_TRACE_PTR (ExDoDebugObject, SourceDesc); - - - /* Output must be enabled via the DebugObject global or the DbgLevel */ - - if (!AcpiGbl_EnableAmlDebugObject && - !(AcpiDbgLevel & ACPI_LV_DEBUG_OBJECT)) - { - return_VOID; - } - - /* Newline -- don't emit the line header */ - - if (SourceDesc && - (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc) == ACPI_DESC_TYPE_OPERAND) && - (SourceDesc->Common.Type == ACPI_TYPE_STRING)) - { - if ((SourceDesc->String.Length == 1) && - (*SourceDesc->String.Pointer == '\n')) - { - AcpiOsPrintf ("\n"); - return_VOID; - } - } - - /* - * Print line header as long as we are not in the middle of an - * object display - */ - if (!((Level > 0) && Index == 0)) - { - if (AcpiGbl_DisplayDebugTimer) - { - /* - * We will emit the current timer value (in microseconds) with each - * debug output. Only need the lower 26 bits. This allows for 67 - * million microseconds or 67 seconds before rollover. - * - * Convert 100 nanosecond units to microseconds - */ - Timer = ((UINT32) AcpiOsGetTimer () / 10); - Timer &= 0x03FFFFFF; - - AcpiOsPrintf ("ACPI Debug: T=0x%8.8X %*s", Timer, Level, " "); - } - else - { - AcpiOsPrintf ("ACPI Debug: %*s", Level, " "); - } - } - - /* Display the index for package output only */ - - if (Index > 0) - { - AcpiOsPrintf ("(%.2u) ", Index - 1); - } - - if (!SourceDesc) - { - AcpiOsPrintf ("[Null Object]\n"); - return_VOID; - } - - if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc) == ACPI_DESC_TYPE_OPERAND) - { - /* No object type prefix needed for integers and strings */ - - if ((SourceDesc->Common.Type != ACPI_TYPE_INTEGER) && - (SourceDesc->Common.Type != ACPI_TYPE_STRING)) - { - AcpiOsPrintf ("%s ", AcpiUtGetObjectTypeName (SourceDesc)); - } - - if (!AcpiUtValidInternalObject (SourceDesc)) - { - AcpiOsPrintf ("%p, Invalid Internal Object!\n", SourceDesc); - return_VOID; - } - } - else if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc) == ACPI_DESC_TYPE_NAMED) - { - AcpiOsPrintf ("%s (Node %p)\n", - AcpiUtGetTypeName (((ACPI_NAMESPACE_NODE *) SourceDesc)->Type), - SourceDesc); - return_VOID; - } - else - { - return_VOID; - } - - /* SourceDesc is of type ACPI_DESC_TYPE_OPERAND */ - - switch (SourceDesc->Common.Type) - { - case ACPI_TYPE_INTEGER: - - /* Output correct integer width */ - - if (AcpiGbl_IntegerByteWidth == 4) - { - AcpiOsPrintf ("0x%8.8X\n", - (UINT32) SourceDesc->Integer.Value); - } - else - { - AcpiOsPrintf ("0x%8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (SourceDesc->Integer.Value)); - } - break; - - case ACPI_TYPE_BUFFER: - - AcpiOsPrintf ("[0x%.2X]\n", (UINT32) SourceDesc->Buffer.Length); - AcpiUtDumpBuffer (SourceDesc->Buffer.Pointer, - (SourceDesc->Buffer.Length < 256) ? - SourceDesc->Buffer.Length : 256, DB_BYTE_DISPLAY, 0); - break; - - case ACPI_TYPE_STRING: - - AcpiOsPrintf ("\"%s\"\n", SourceDesc->String.Pointer); - break; - - case ACPI_TYPE_PACKAGE: - - AcpiOsPrintf ("(Contains 0x%.2X Elements):\n", - SourceDesc->Package.Count); - - /* Output the entire contents of the package */ - - for (i = 0; i < SourceDesc->Package.Count; i++) - { - AcpiExDoDebugObject (SourceDesc->Package.Elements[i], - Level + 4, i + 1); - } - break; - - case ACPI_TYPE_LOCAL_REFERENCE: - - AcpiOsPrintf ("[%s] ", AcpiUtGetReferenceName (SourceDesc)); - - /* Decode the reference */ - - switch (SourceDesc->Reference.Class) - { - case ACPI_REFCLASS_INDEX: - - AcpiOsPrintf ("0x%X\n", SourceDesc->Reference.Value); - break; - - case ACPI_REFCLASS_TABLE: - - /* Case for DdbHandle */ - - AcpiOsPrintf ("Table Index 0x%X\n", SourceDesc->Reference.Value); - return_VOID; - - default: - - break; - } - - AcpiOsPrintf (" "); - - /* Check for valid node first, then valid object */ - - if (SourceDesc->Reference.Node) - { - if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc->Reference.Node) != - ACPI_DESC_TYPE_NAMED) - { - AcpiOsPrintf (" %p - Not a valid namespace node\n", - SourceDesc->Reference.Node); - } - else - { - AcpiOsPrintf ("Node %p [%4.4s] ", SourceDesc->Reference.Node, - (SourceDesc->Reference.Node)->Name.Ascii); - - switch ((SourceDesc->Reference.Node)->Type) - { - /* These types have no attached object */ - - case ACPI_TYPE_DEVICE: - AcpiOsPrintf ("Device\n"); - break; - - case ACPI_TYPE_THERMAL: - AcpiOsPrintf ("Thermal Zone\n"); - break; - - default: - - AcpiExDoDebugObject ((SourceDesc->Reference.Node)->Object, - Level + 4, 0); - break; - } - } - } - else if (SourceDesc->Reference.Object) - { - if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc->Reference.Object) == - ACPI_DESC_TYPE_NAMED) - { - /* Reference object is a namespace node */ - - AcpiExDoDebugObject (ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, - SourceDesc->Reference.Object), - Level + 4, 0); - } - else - { - ObjectDesc = SourceDesc->Reference.Object; - Value = SourceDesc->Reference.Value; - - switch (ObjectDesc->Common.Type) - { - case ACPI_TYPE_BUFFER: - - AcpiOsPrintf ("Buffer[%u] = 0x%2.2X\n", - Value, *SourceDesc->Reference.IndexPointer); - break; - - case ACPI_TYPE_STRING: - - AcpiOsPrintf ("String[%u] = \"%c\" (0x%2.2X)\n", - Value, *SourceDesc->Reference.IndexPointer, - *SourceDesc->Reference.IndexPointer); - break; - - case ACPI_TYPE_PACKAGE: - - AcpiOsPrintf ("Package[%u] = ", Value); - if (!(*SourceDesc->Reference.Where)) - { - AcpiOsPrintf ("[Uninitialized Package Element]\n"); - } - else - { - AcpiExDoDebugObject (*SourceDesc->Reference.Where, - Level+4, 0); - } - break; - - default: - - AcpiOsPrintf ("Unknown Reference object type %X\n", - ObjectDesc->Common.Type); - break; - } - } - } - break; - - default: - - AcpiOsPrintf ("(Descriptor %p)\n", SourceDesc); - break; - } - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "\n")); - return_VOID; -} -#endif diff --git a/drivers/acpica/exdump.c b/drivers/acpica/exdump.c deleted file mode 100644 index a6d1e42..0000000 --- a/drivers/acpica/exdump.c +++ /dev/null @@ -1,1420 +0,0 @@ -/****************************************************************************** - * - * Module Name: exdump - Interpreter debug output routines - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acinterp.h" -#include "amlcode.h" -#include "acnamesp.h" - - -#define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exdump") - -/* - * The following routines are used for debug output only - */ -#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) - -/* Local prototypes */ - -static void -AcpiExOutString ( - const char *Title, - const char *Value); - -static void -AcpiExOutPointer ( - const char *Title, - const void *Value); - -static void -AcpiExDumpObject ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_EXDUMP_INFO *Info); - -static void -AcpiExDumpReferenceObj ( - ACPI_OPERAND_OBJECT *ObjDesc); - -static void -AcpiExDumpPackageObj ( - ACPI_OPERAND_OBJECT *ObjDesc, - UINT32 Level, - UINT32 Index); - - -/******************************************************************************* - * - * Object Descriptor info tables - * - * Note: The first table entry must be an INIT opcode and must contain - * the table length (number of table entries) - * - ******************************************************************************/ - -static ACPI_EXDUMP_INFO AcpiExDumpInteger[2] = -{ - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpInteger), NULL}, - {ACPI_EXD_UINT64, ACPI_EXD_OFFSET (Integer.Value), "Value"} -}; - -static ACPI_EXDUMP_INFO AcpiExDumpString[4] = -{ - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpString), NULL}, - {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (String.Length), "Length"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (String.Pointer), "Pointer"}, - {ACPI_EXD_STRING, 0, NULL} -}; - -static ACPI_EXDUMP_INFO AcpiExDumpBuffer[5] = -{ - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpBuffer), NULL}, - {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Buffer.Length), "Length"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Buffer.Pointer), "Pointer"}, - {ACPI_EXD_NODE, ACPI_EXD_OFFSET (Buffer.Node), "Parent Node"}, - {ACPI_EXD_BUFFER, 0, NULL} -}; - -static ACPI_EXDUMP_INFO AcpiExDumpPackage[6] = -{ - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpPackage), NULL}, - {ACPI_EXD_NODE, ACPI_EXD_OFFSET (Package.Node), "Parent Node"}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Package.Flags), "Flags"}, - {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Package.Count), "Element Count"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Package.Elements), "Element List"}, - {ACPI_EXD_PACKAGE, 0, NULL} -}; - -static ACPI_EXDUMP_INFO AcpiExDumpDevice[4] = -{ - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpDevice), NULL}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.NotifyList[0]), "System Notify"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.NotifyList[1]), "Device Notify"}, - {ACPI_EXD_HDLR_LIST,ACPI_EXD_OFFSET (Device.Handler), "Handler"} -}; - -static ACPI_EXDUMP_INFO AcpiExDumpEvent[2] = -{ - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpEvent), NULL}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Event.OsSemaphore), "OsSemaphore"} -}; - -static ACPI_EXDUMP_INFO AcpiExDumpMethod[9] = -{ - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpMethod), NULL}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.InfoFlags), "Info Flags"}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.ParamCount), "Parameter Count"}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.SyncLevel), "Sync Level"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Method.Mutex), "Mutex"}, - {ACPI_EXD_UINT16, ACPI_EXD_OFFSET (Method.OwnerId), "Owner Id"}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.ThreadCount), "Thread Count"}, - {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Method.AmlLength), "Aml Length"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Method.AmlStart), "Aml Start"} -}; - -static ACPI_EXDUMP_INFO AcpiExDumpMutex[6] = -{ - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpMutex), NULL}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Mutex.SyncLevel), "Sync Level"}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Mutex.OriginalSyncLevel), "Original Sync Level"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Mutex.OwnerThread), "Owner Thread"}, - {ACPI_EXD_UINT16, ACPI_EXD_OFFSET (Mutex.AcquisitionDepth), "Acquire Depth"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Mutex.OsMutex), "OsMutex"} -}; - -static ACPI_EXDUMP_INFO AcpiExDumpRegion[8] = -{ - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpRegion), NULL}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Region.SpaceId), "Space Id"}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Region.Flags), "Flags"}, - {ACPI_EXD_NODE, ACPI_EXD_OFFSET (Region.Node), "Parent Node"}, - {ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET (Region.Address), "Address"}, - {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Region.Length), "Length"}, - {ACPI_EXD_HDLR_LIST,ACPI_EXD_OFFSET (Region.Handler), "Handler"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Region.Next), "Next"} -}; - -static ACPI_EXDUMP_INFO AcpiExDumpPower[6] = -{ - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpPower), NULL}, - {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (PowerResource.SystemLevel), "System Level"}, - {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (PowerResource.ResourceOrder), "Resource Order"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (PowerResource.NotifyList[0]), "System Notify"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (PowerResource.NotifyList[1]), "Device Notify"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (PowerResource.Handler), "Handler"} -}; - -static ACPI_EXDUMP_INFO AcpiExDumpProcessor[7] = -{ - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpProcessor), NULL}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Processor.ProcId), "Processor ID"}, - {ACPI_EXD_UINT8 , ACPI_EXD_OFFSET (Processor.Length), "Length"}, - {ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET (Processor.Address), "Address"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Processor.NotifyList[0]), "System Notify"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Processor.NotifyList[1]), "Device Notify"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Processor.Handler), "Handler"} -}; - -static ACPI_EXDUMP_INFO AcpiExDumpThermal[4] = -{ - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpThermal), NULL}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (ThermalZone.NotifyList[0]), "System Notify"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (ThermalZone.NotifyList[1]), "Device Notify"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (ThermalZone.Handler), "Handler"} -}; - -static ACPI_EXDUMP_INFO AcpiExDumpBufferField[3] = -{ - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpBufferField), NULL}, - {ACPI_EXD_FIELD, 0, NULL}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (BufferField.BufferObj), "Buffer Object"} -}; - -static ACPI_EXDUMP_INFO AcpiExDumpRegionField[5] = -{ - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpRegionField), NULL}, - {ACPI_EXD_FIELD, 0, NULL}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Field.AccessLength), "AccessLength"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Field.RegionObj), "Region Object"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Field.ResourceBuffer), "ResourceBuffer"} -}; - -static ACPI_EXDUMP_INFO AcpiExDumpBankField[5] = -{ - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpBankField), NULL}, - {ACPI_EXD_FIELD, 0, NULL}, - {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (BankField.Value), "Value"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (BankField.RegionObj), "Region Object"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (BankField.BankObj), "Bank Object"} -}; - -static ACPI_EXDUMP_INFO AcpiExDumpIndexField[5] = -{ - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpBankField), NULL}, - {ACPI_EXD_FIELD, 0, NULL}, - {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (IndexField.Value), "Value"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (IndexField.IndexObj), "Index Object"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (IndexField.DataObj), "Data Object"} -}; - -static ACPI_EXDUMP_INFO AcpiExDumpReference[9] = -{ - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpReference), NULL}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Reference.Class), "Class"}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Reference.TargetType), "Target Type"}, - {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Reference.Value), "Value"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Object), "Object Desc"}, - {ACPI_EXD_NODE, ACPI_EXD_OFFSET (Reference.Node), "Node"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Where), "Where"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.IndexPointer), "Index Pointer"}, - {ACPI_EXD_REFERENCE,0, NULL} -}; - -static ACPI_EXDUMP_INFO AcpiExDumpAddressHandler[6] = -{ - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpAddressHandler), NULL}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (AddressSpace.SpaceId), "Space Id"}, - {ACPI_EXD_HDLR_LIST,ACPI_EXD_OFFSET (AddressSpace.Next), "Next"}, - {ACPI_EXD_RGN_LIST, ACPI_EXD_OFFSET (AddressSpace.RegionList), "Region List"}, - {ACPI_EXD_NODE, ACPI_EXD_OFFSET (AddressSpace.Node), "Node"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (AddressSpace.Context), "Context"} -}; - -static ACPI_EXDUMP_INFO AcpiExDumpNotify[7] = -{ - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpNotify), NULL}, - {ACPI_EXD_NODE, ACPI_EXD_OFFSET (Notify.Node), "Node"}, - {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Notify.HandlerType), "Handler Type"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Handler), "Handler"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Context), "Context"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Next[0]), "Next System Notify"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Next[1]), "Next Device Notify"} -}; - -static ACPI_EXDUMP_INFO AcpiExDumpExtra[6] = -{ - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpExtra), NULL}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Extra.Method_REG), "_REG Method"}, - {ACPI_EXD_NODE, ACPI_EXD_OFFSET (Extra.ScopeNode), "Scope Node"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Extra.RegionContext), "Region Context"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Extra.AmlStart), "Aml Start"}, - {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Extra.AmlLength), "Aml Length"} -}; - -static ACPI_EXDUMP_INFO AcpiExDumpData[3] = -{ - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpData), NULL}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Data.Handler), "Handler"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Data.Pointer), "Raw Data"} -}; - -/* Miscellaneous tables */ - -static ACPI_EXDUMP_INFO AcpiExDumpCommon[5] = -{ - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpCommon), NULL}, - {ACPI_EXD_TYPE , 0, NULL}, - {ACPI_EXD_UINT16, ACPI_EXD_OFFSET (Common.ReferenceCount), "Reference Count"}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Common.Flags), "Flags"}, - {ACPI_EXD_LIST, ACPI_EXD_OFFSET (Common.NextObject), "Object List"} -}; - -static ACPI_EXDUMP_INFO AcpiExDumpFieldCommon[7] = -{ - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpFieldCommon), NULL}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (CommonField.FieldFlags), "Field Flags"}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (CommonField.AccessByteWidth), "Access Byte Width"}, - {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (CommonField.BitLength), "Bit Length"}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (CommonField.StartFieldBitOffset),"Field Bit Offset"}, - {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (CommonField.BaseByteOffset), "Base Byte Offset"}, - {ACPI_EXD_NODE, ACPI_EXD_OFFSET (CommonField.Node), "Parent Node"} -}; - -static ACPI_EXDUMP_INFO AcpiExDumpNode[7] = -{ - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpNode), NULL}, - {ACPI_EXD_UINT16, ACPI_EXD_NSOFFSET (Flags), "Flags"}, - {ACPI_EXD_UINT16, ACPI_EXD_NSOFFSET (OwnerId), "Owner Id"}, - {ACPI_EXD_LIST, ACPI_EXD_NSOFFSET (Object), "Object List"}, - {ACPI_EXD_NODE, ACPI_EXD_NSOFFSET (Parent), "Parent"}, - {ACPI_EXD_NODE, ACPI_EXD_NSOFFSET (Child), "Child"}, - {ACPI_EXD_NODE, ACPI_EXD_NSOFFSET (Peer), "Peer"} -}; - - -/* Dispatch table, indexed by object type */ - -static ACPI_EXDUMP_INFO *AcpiExDumpInfo[] = -{ - NULL, - AcpiExDumpInteger, - AcpiExDumpString, - AcpiExDumpBuffer, - AcpiExDumpPackage, - NULL, - AcpiExDumpDevice, - AcpiExDumpEvent, - AcpiExDumpMethod, - AcpiExDumpMutex, - AcpiExDumpRegion, - AcpiExDumpPower, - AcpiExDumpProcessor, - AcpiExDumpThermal, - AcpiExDumpBufferField, - NULL, - NULL, - AcpiExDumpRegionField, - AcpiExDumpBankField, - AcpiExDumpIndexField, - AcpiExDumpReference, - NULL, - NULL, - AcpiExDumpNotify, - AcpiExDumpAddressHandler, - NULL, - NULL, - NULL, - AcpiExDumpExtra, - AcpiExDumpData -}; - - -/******************************************************************************* - * - * FUNCTION: AcpiExDumpObject - * - * PARAMETERS: ObjDesc - Descriptor to dump - * Info - Info table corresponding to this object - * type - * - * RETURN: None - * - * DESCRIPTION: Walk the info table for this object - * - ******************************************************************************/ - -static void -AcpiExDumpObject ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_EXDUMP_INFO *Info) -{ - UINT8 *Target; - const char *Name; - UINT8 Count; - ACPI_OPERAND_OBJECT *Start; - ACPI_OPERAND_OBJECT *Data = NULL; - ACPI_OPERAND_OBJECT *Next; - ACPI_NAMESPACE_NODE *Node; - - - if (!Info) - { - AcpiOsPrintf ( - "ExDumpObject: Display not implemented for object type %s\n", - AcpiUtGetObjectTypeName (ObjDesc)); - return; - } - - /* First table entry must contain the table length (# of table entries) */ - - Count = Info->Offset; - - while (Count) - { - if (!ObjDesc) - { - return; - } - - Target = ACPI_ADD_PTR (UINT8, ObjDesc, Info->Offset); - Name = Info->Name; - - switch (Info->Opcode) - { - case ACPI_EXD_INIT: - - break; - - case ACPI_EXD_TYPE: - - AcpiOsPrintf ("%20s : %2.2X [%s]\n", "Type", - ObjDesc->Common.Type, - AcpiUtGetObjectTypeName (ObjDesc)); - break; - - case ACPI_EXD_UINT8: - - AcpiOsPrintf ("%20s : %2.2X\n", Name, *Target); - break; - - case ACPI_EXD_UINT16: - - AcpiOsPrintf ("%20s : %4.4X\n", Name, ACPI_GET16 (Target)); - break; - - case ACPI_EXD_UINT32: - - AcpiOsPrintf ("%20s : %8.8X\n", Name, ACPI_GET32 (Target)); - break; - - case ACPI_EXD_UINT64: - - AcpiOsPrintf ("%20s : %8.8X%8.8X\n", "Value", - ACPI_FORMAT_UINT64 (ACPI_GET64 (Target))); - break; - - case ACPI_EXD_POINTER: - case ACPI_EXD_ADDRESS: - - AcpiExOutPointer (Name, *ACPI_CAST_PTR (void *, Target)); - break; - - case ACPI_EXD_STRING: - - AcpiUtPrintString (ObjDesc->String.Pointer, ACPI_UINT8_MAX); - AcpiOsPrintf ("\n"); - break; - - case ACPI_EXD_BUFFER: - - ACPI_DUMP_BUFFER ( - ObjDesc->Buffer.Pointer, ObjDesc->Buffer.Length); - break; - - case ACPI_EXD_PACKAGE: - - /* Dump the package contents */ - - AcpiOsPrintf ("\nPackage Contents:\n"); - AcpiExDumpPackageObj (ObjDesc, 0, 0); - break; - - case ACPI_EXD_FIELD: - - AcpiExDumpObject (ObjDesc, AcpiExDumpFieldCommon); - break; - - case ACPI_EXD_REFERENCE: - - AcpiExOutString ("Class Name", AcpiUtGetReferenceName (ObjDesc)); - AcpiExDumpReferenceObj (ObjDesc); - break; - - case ACPI_EXD_LIST: - - Start = *ACPI_CAST_PTR (void *, Target); - Next = Start; - - AcpiOsPrintf ("%20s : %p ", Name, Next); - if (Next) - { - AcpiOsPrintf ("%s (Type %2.2X)", - AcpiUtGetObjectTypeName (Next), Next->Common.Type); - - while (Next->Common.NextObject) - { - if ((Next->Common.Type == ACPI_TYPE_LOCAL_DATA) && - !Data) - { - Data = Next; - } - - Next = Next->Common.NextObject; - AcpiOsPrintf ("->%p(%s %2.2X)", Next, - AcpiUtGetObjectTypeName (Next), Next->Common.Type); - - if ((Next == Start) || (Next == Data)) - { - AcpiOsPrintf ( - "\n**** Error: Object list appears to be circular linked"); - break; - } - } - } - else - { - AcpiOsPrintf ("- No attached objects"); - } - - AcpiOsPrintf ("\n"); - break; - - case ACPI_EXD_HDLR_LIST: - - Start = *ACPI_CAST_PTR (void *, Target); - Next = Start; - - AcpiOsPrintf ("%20s : %p", Name, Next); - if (Next) - { - AcpiOsPrintf ("(%s %2.2X)", - AcpiUtGetObjectTypeName (Next), - Next->AddressSpace.SpaceId); - - while (Next->AddressSpace.Next) - { - if ((Next->Common.Type == ACPI_TYPE_LOCAL_DATA) && - !Data) - { - Data = Next; - } - - Next = Next->AddressSpace.Next; - AcpiOsPrintf ("->%p(%s %2.2X)", Next, - AcpiUtGetObjectTypeName (Next), - Next->AddressSpace.SpaceId); - - if ((Next == Start) || (Next == Data)) - { - AcpiOsPrintf ( - "\n**** Error: Handler list appears to be circular linked"); - break; - } - } - } - - AcpiOsPrintf ("\n"); - break; - - case ACPI_EXD_RGN_LIST: - - Start = *ACPI_CAST_PTR (void *, Target); - Next = Start; - - AcpiOsPrintf ("%20s : %p", Name, Next); - if (Next) - { - AcpiOsPrintf ("(%s %2.2X)", - AcpiUtGetObjectTypeName (Next), Next->Common.Type); - - while (Next->Region.Next) - { - if ((Next->Common.Type == ACPI_TYPE_LOCAL_DATA) && - !Data) - { - Data = Next; - } - - Next = Next->Region.Next; - AcpiOsPrintf ("->%p(%s %2.2X)", Next, - AcpiUtGetObjectTypeName (Next), Next->Common.Type); - - if ((Next == Start) || (Next == Data)) - { - AcpiOsPrintf ( - "\n**** Error: Region list appears to be circular linked"); - break; - } - } - } - - AcpiOsPrintf ("\n"); - break; - - case ACPI_EXD_NODE: - - Node = *ACPI_CAST_PTR (ACPI_NAMESPACE_NODE *, Target); - - AcpiOsPrintf ("%20s : %p", Name, Node); - if (Node) - { - AcpiOsPrintf (" [%4.4s]", Node->Name.Ascii); - } - AcpiOsPrintf ("\n"); - break; - - default: - - AcpiOsPrintf ("**** Invalid table opcode [%X] ****\n", - Info->Opcode); - return; - } - - Info++; - Count--; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExDumpOperand - * - * PARAMETERS: *ObjDesc - Pointer to entry to be dumped - * Depth - Current nesting depth - * - * RETURN: None - * - * DESCRIPTION: Dump an operand object - * - ******************************************************************************/ - -void -AcpiExDumpOperand ( - ACPI_OPERAND_OBJECT *ObjDesc, - UINT32 Depth) -{ - UINT32 Length; - UINT32 Index; - - - ACPI_FUNCTION_NAME (ExDumpOperand); - - - /* Check if debug output enabled */ - - if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_EXEC, _COMPONENT)) - { - return; - } - - if (!ObjDesc) - { - /* This could be a null element of a package */ - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Null Object Descriptor\n")); - return; - } - - if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p Namespace Node: ", ObjDesc)); - ACPI_DUMP_ENTRY (ObjDesc, ACPI_LV_EXEC); - return; - } - - if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "%p is not a node or operand object: [%s]\n", - ObjDesc, AcpiUtGetDescriptorName (ObjDesc))); - ACPI_DUMP_BUFFER (ObjDesc, sizeof (ACPI_OPERAND_OBJECT)); - return; - } - - /* ObjDesc is a valid object */ - - if (Depth > 0) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%*s[%u] %p Refs=%u ", - Depth, " ", Depth, ObjDesc, ObjDesc->Common.ReferenceCount)); - } - else - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p Refs=%u ", - ObjDesc, ObjDesc->Common.ReferenceCount)); - } - - /* Decode object type */ - - switch (ObjDesc->Common.Type) - { - case ACPI_TYPE_LOCAL_REFERENCE: - - AcpiOsPrintf ("Reference: [%s] ", - AcpiUtGetReferenceName (ObjDesc)); - - switch (ObjDesc->Reference.Class) - { - case ACPI_REFCLASS_DEBUG: - - AcpiOsPrintf ("\n"); - break; - - case ACPI_REFCLASS_INDEX: - - AcpiOsPrintf ("%p\n", ObjDesc->Reference.Object); - break; - - case ACPI_REFCLASS_TABLE: - - AcpiOsPrintf ("Table Index %X\n", ObjDesc->Reference.Value); - break; - - case ACPI_REFCLASS_REFOF: - - AcpiOsPrintf ("%p [%s]\n", ObjDesc->Reference.Object, - AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *) - ObjDesc->Reference.Object)->Common.Type)); - break; - - case ACPI_REFCLASS_NAME: - - AcpiUtRepairName (ObjDesc->Reference.Node->Name.Ascii); - AcpiOsPrintf ("- [%4.4s] (Node %p)\n", - ObjDesc->Reference.Node->Name.Ascii, - ObjDesc->Reference.Node); - break; - - case ACPI_REFCLASS_ARG: - case ACPI_REFCLASS_LOCAL: - - AcpiOsPrintf ("%X\n", ObjDesc->Reference.Value); - break; - - default: /* Unknown reference class */ - - AcpiOsPrintf ("%2.2X\n", ObjDesc->Reference.Class); - break; - } - break; - - case ACPI_TYPE_BUFFER: - - AcpiOsPrintf ("Buffer length %.2X @ %p\n", - ObjDesc->Buffer.Length, ObjDesc->Buffer.Pointer); - - /* Debug only -- dump the buffer contents */ - - if (ObjDesc->Buffer.Pointer) - { - Length = ObjDesc->Buffer.Length; - if (Length > 128) - { - Length = 128; - } - - AcpiOsPrintf ( - "Buffer Contents: (displaying length 0x%.2X)\n", Length); - ACPI_DUMP_BUFFER (ObjDesc->Buffer.Pointer, Length); - } - break; - - case ACPI_TYPE_INTEGER: - - AcpiOsPrintf ("Integer %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); - break; - - case ACPI_TYPE_PACKAGE: - - AcpiOsPrintf ("Package [Len %X] ElementArray %p\n", - ObjDesc->Package.Count, ObjDesc->Package.Elements); - - /* - * If elements exist, package element pointer is valid, - * and debug_level exceeds 1, dump package's elements. - */ - if (ObjDesc->Package.Count && - ObjDesc->Package.Elements && - AcpiDbgLevel > 1) - { - for (Index = 0; Index < ObjDesc->Package.Count; Index++) - { - AcpiExDumpOperand ( - ObjDesc->Package.Elements[Index], Depth + 1); - } - } - break; - - case ACPI_TYPE_REGION: - - AcpiOsPrintf ("Region %s (%X)", - AcpiUtGetRegionName (ObjDesc->Region.SpaceId), - ObjDesc->Region.SpaceId); - - /* - * If the address and length have not been evaluated, - * don't print them. - */ - if (!(ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)) - { - AcpiOsPrintf ("\n"); - } - else - { - AcpiOsPrintf (" base %8.8X%8.8X Length %X\n", - ACPI_FORMAT_UINT64 (ObjDesc->Region.Address), - ObjDesc->Region.Length); - } - break; - - case ACPI_TYPE_STRING: - - AcpiOsPrintf ("String length %X @ %p ", - ObjDesc->String.Length, - ObjDesc->String.Pointer); - - AcpiUtPrintString (ObjDesc->String.Pointer, ACPI_UINT8_MAX); - AcpiOsPrintf ("\n"); - break; - - case ACPI_TYPE_LOCAL_BANK_FIELD: - - AcpiOsPrintf ("BankField\n"); - break; - - case ACPI_TYPE_LOCAL_REGION_FIELD: - - AcpiOsPrintf ("RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at " - "byte=%X bit=%X of below:\n", - ObjDesc->Field.BitLength, - ObjDesc->Field.AccessByteWidth, - ObjDesc->Field.FieldFlags & AML_FIELD_LOCK_RULE_MASK, - ObjDesc->Field.FieldFlags & AML_FIELD_UPDATE_RULE_MASK, - ObjDesc->Field.BaseByteOffset, - ObjDesc->Field.StartFieldBitOffset); - - AcpiExDumpOperand (ObjDesc->Field.RegionObj, Depth + 1); - break; - - case ACPI_TYPE_LOCAL_INDEX_FIELD: - - AcpiOsPrintf ("IndexField\n"); - break; - - case ACPI_TYPE_BUFFER_FIELD: - - AcpiOsPrintf ("BufferField: %X bits at byte %X bit %X of\n", - ObjDesc->BufferField.BitLength, - ObjDesc->BufferField.BaseByteOffset, - ObjDesc->BufferField.StartFieldBitOffset); - - if (!ObjDesc->BufferField.BufferObj) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL*\n")); - } - else if ((ObjDesc->BufferField.BufferObj)->Common.Type != - ACPI_TYPE_BUFFER) - { - AcpiOsPrintf ("*not a Buffer*\n"); - } - else - { - AcpiExDumpOperand (ObjDesc->BufferField.BufferObj, Depth + 1); - } - break; - - case ACPI_TYPE_EVENT: - - AcpiOsPrintf ("Event\n"); - break; - - case ACPI_TYPE_METHOD: - - AcpiOsPrintf ("Method(%X) @ %p:%X\n", - ObjDesc->Method.ParamCount, - ObjDesc->Method.AmlStart, - ObjDesc->Method.AmlLength); - break; - - case ACPI_TYPE_MUTEX: - - AcpiOsPrintf ("Mutex\n"); - break; - - case ACPI_TYPE_DEVICE: - - AcpiOsPrintf ("Device\n"); - break; - - case ACPI_TYPE_POWER: - - AcpiOsPrintf ("Power\n"); - break; - - case ACPI_TYPE_PROCESSOR: - - AcpiOsPrintf ("Processor\n"); - break; - - case ACPI_TYPE_THERMAL: - - AcpiOsPrintf ("Thermal\n"); - break; - - default: - - /* Unknown Type */ - - AcpiOsPrintf ("Unknown Type %X\n", ObjDesc->Common.Type); - break; - } - - return; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExDumpOperands - * - * PARAMETERS: Operands - A list of Operand objects - * OpcodeName - AML opcode name - * NumOperands - Operand count for this opcode - * - * DESCRIPTION: Dump the operands associated with the opcode - * - ******************************************************************************/ - -void -AcpiExDumpOperands ( - ACPI_OPERAND_OBJECT **Operands, - const char *OpcodeName, - UINT32 NumOperands) -{ - ACPI_FUNCTION_TRACE (ExDumpOperands); - - - if (!OpcodeName) - { - OpcodeName = "UNKNOWN"; - } - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "**** Start operand dump for opcode [%s], %u operands\n", - OpcodeName, NumOperands)); - - if (NumOperands == 0) - { - NumOperands = 1; - } - - /* Dump the individual operands */ - - while (NumOperands) - { - AcpiExDumpOperand (*Operands, 0); - Operands++; - NumOperands--; - } - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "**** End operand dump for [%s]\n", OpcodeName)); - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExOut* functions - * - * PARAMETERS: Title - Descriptive text - * Value - Value to be displayed - * - * DESCRIPTION: Object dump output formatting functions. These functions - * reduce the number of format strings required and keeps them - * all in one place for easy modification. - * - ******************************************************************************/ - -static void -AcpiExOutString ( - const char *Title, - const char *Value) -{ - AcpiOsPrintf ("%20s : %s\n", Title, Value); -} - -static void -AcpiExOutPointer ( - const char *Title, - const void *Value) -{ - AcpiOsPrintf ("%20s : %p\n", Title, Value); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExDumpNamespaceNode - * - * PARAMETERS: Node - Descriptor to dump - * Flags - Force display if TRUE - * - * DESCRIPTION: Dumps the members of the given.Node - * - ******************************************************************************/ - -void -AcpiExDumpNamespaceNode ( - ACPI_NAMESPACE_NODE *Node, - UINT32 Flags) -{ - - ACPI_FUNCTION_ENTRY (); - - - if (!Flags) - { - /* Check if debug output enabled */ - - if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_OBJECTS, _COMPONENT)) - { - return; - } - } - - AcpiOsPrintf ("%20s : %4.4s\n", "Name", AcpiUtGetNodeName (Node)); - AcpiOsPrintf ("%20s : %2.2X [%s]\n", "Type", - Node->Type, AcpiUtGetTypeName (Node->Type)); - - AcpiExDumpObject (ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Node), - AcpiExDumpNode); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExDumpReferenceObj - * - * PARAMETERS: Object - Descriptor to dump - * - * DESCRIPTION: Dumps a reference object - * - ******************************************************************************/ - -static void -AcpiExDumpReferenceObj ( - ACPI_OPERAND_OBJECT *ObjDesc) -{ - ACPI_BUFFER RetBuf; - ACPI_STATUS Status; - - - RetBuf.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - - if (ObjDesc->Reference.Class == ACPI_REFCLASS_NAME) - { - AcpiOsPrintf (" %p ", ObjDesc->Reference.Node); - - Status = AcpiNsHandleToPathname (ObjDesc->Reference.Node, - &RetBuf, TRUE); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf (" Could not convert name to pathname: %s\n", - AcpiFormatException (Status)); - } - else - { - AcpiOsPrintf ("%s: %s\n", - AcpiUtGetTypeName (ObjDesc->Reference.Node->Type), - (char *) RetBuf.Pointer); - ACPI_FREE (RetBuf.Pointer); - } - } - else if (ObjDesc->Reference.Object) - { - if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND) - { - AcpiOsPrintf ("%22s %p", "Target :", - ObjDesc->Reference.Object); - if (ObjDesc->Reference.Class == ACPI_REFCLASS_TABLE) - { - AcpiOsPrintf (" Table Index: %X\n", - ObjDesc->Reference.Value); - } - else - { - AcpiOsPrintf (" [%s]\n", - AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *) - ObjDesc->Reference.Object)->Common.Type)); - } - } - else - { - AcpiOsPrintf (" Target: %p\n", ObjDesc->Reference.Object); - } - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExDumpPackageObj - * - * PARAMETERS: ObjDesc - Descriptor to dump - * Level - Indentation Level - * Index - Package index for this object - * - * DESCRIPTION: Dumps the elements of the package - * - ******************************************************************************/ - -static void -AcpiExDumpPackageObj ( - ACPI_OPERAND_OBJECT *ObjDesc, - UINT32 Level, - UINT32 Index) -{ - UINT32 i; - - - /* Indentation and index output */ - - if (Level > 0) - { - for (i = 0; i < Level; i++) - { - AcpiOsPrintf (" "); - } - - AcpiOsPrintf ("[%.2d] ", Index); - } - - AcpiOsPrintf ("%p ", ObjDesc); - - /* Null package elements are allowed */ - - if (!ObjDesc) - { - AcpiOsPrintf ("[Null Object]\n"); - return; - } - - /* Packages may only contain a few object types */ - - switch (ObjDesc->Common.Type) - { - case ACPI_TYPE_INTEGER: - - AcpiOsPrintf ("[Integer] = %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); - break; - - case ACPI_TYPE_STRING: - - AcpiOsPrintf ("[String] Value: "); - AcpiUtPrintString (ObjDesc->String.Pointer, ACPI_UINT8_MAX); - AcpiOsPrintf ("\n"); - break; - - case ACPI_TYPE_BUFFER: - - AcpiOsPrintf ("[Buffer] Length %.2X = ", ObjDesc->Buffer.Length); - if (ObjDesc->Buffer.Length) - { - AcpiUtDebugDumpBuffer ( - ACPI_CAST_PTR (UINT8, ObjDesc->Buffer.Pointer), - ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT); - } - else - { - AcpiOsPrintf ("\n"); - } - break; - - case ACPI_TYPE_PACKAGE: - - AcpiOsPrintf ("[Package] Contains %u Elements:\n", - ObjDesc->Package.Count); - - for (i = 0; i < ObjDesc->Package.Count; i++) - { - AcpiExDumpPackageObj ( - ObjDesc->Package.Elements[i], Level + 1, i); - } - break; - - case ACPI_TYPE_LOCAL_REFERENCE: - - AcpiOsPrintf ("[Object Reference] Class [%s]", - AcpiUtGetReferenceName (ObjDesc)); - AcpiExDumpReferenceObj (ObjDesc); - break; - - default: - - AcpiOsPrintf ("[%s] Type: %2.2X\n", - AcpiUtGetTypeName (ObjDesc->Common.Type), ObjDesc->Common.Type); - break; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExDumpObjectDescriptor - * - * PARAMETERS: ObjDesc - Descriptor to dump - * Flags - Force display if TRUE - * - * DESCRIPTION: Dumps the members of the object descriptor given. - * - ******************************************************************************/ - -void -AcpiExDumpObjectDescriptor ( - ACPI_OPERAND_OBJECT *ObjDesc, - UINT32 Flags) -{ - ACPI_FUNCTION_TRACE (ExDumpObjectDescriptor); - - - if (!ObjDesc) - { - return_VOID; - } - - if (!Flags) - { - /* Check if debug output enabled */ - - if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_OBJECTS, _COMPONENT)) - { - return_VOID; - } - } - - if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED) - { - AcpiExDumpNamespaceNode ((ACPI_NAMESPACE_NODE *) ObjDesc, Flags); - - ObjDesc = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Object; - if (!ObjDesc) - { - return_VOID; - } - - AcpiOsPrintf ("\nAttached Object %p", ObjDesc); - if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED) - { - AcpiOsPrintf (" - Namespace Node"); - } - - AcpiOsPrintf (":\n"); - goto DumpObject; - } - - if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) - { - AcpiOsPrintf ( - "%p is not an ACPI operand object: [%s]\n", - ObjDesc, AcpiUtGetDescriptorName (ObjDesc)); - return_VOID; - } - - /* Validate the object type */ - - if (ObjDesc->Common.Type > ACPI_TYPE_LOCAL_MAX) - { - AcpiOsPrintf ("Not a known object type: %2.2X\n", - ObjDesc->Common.Type); - return_VOID; - } - - -DumpObject: - - if (!ObjDesc) - { - return_VOID; - } - - /* Common Fields */ - - AcpiExDumpObject (ObjDesc, AcpiExDumpCommon); - - /* Object-specific fields */ - - AcpiExDumpObject (ObjDesc, AcpiExDumpInfo[ObjDesc->Common.Type]); - - if (ObjDesc->Common.Type == ACPI_TYPE_REGION) - { - ObjDesc = ObjDesc->Common.NextObject; - if (ObjDesc->Common.Type > ACPI_TYPE_LOCAL_MAX) - { - AcpiOsPrintf ( - "Secondary object is not a known object type: %2.2X\n", - ObjDesc->Common.Type); - - return_VOID; - } - - AcpiOsPrintf ("\nExtra attached Object (%p):\n", ObjDesc); - AcpiExDumpObject (ObjDesc, AcpiExDumpInfo[ObjDesc->Common.Type]); - } - - return_VOID; -} - -#endif diff --git a/drivers/acpica/exfield.c b/drivers/acpica/exfield.c deleted file mode 100644 index 4f4e704..0000000 --- a/drivers/acpica/exfield.c +++ /dev/null @@ -1,561 +0,0 @@ -/****************************************************************************** - * - * Module Name: exfield - AML execution - FieldUnit read/write - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acdispat.h" -#include "acinterp.h" -#include "amlcode.h" - - -#define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exfield") - - -/* - * This table maps the various Attrib protocols to the byte transfer - * length. Used for the generic serial bus. - */ -#define ACPI_INVALID_PROTOCOL_ID 0x80 -#define ACPI_MAX_PROTOCOL_ID 0x0F - -static const UINT8 AcpiProtocolLengths[] = -{ - ACPI_INVALID_PROTOCOL_ID, /* 0 - reserved */ - ACPI_INVALID_PROTOCOL_ID, /* 1 - reserved */ - 0x00, /* 2 - ATTRIB_QUICK */ - ACPI_INVALID_PROTOCOL_ID, /* 3 - reserved */ - 0x01, /* 4 - ATTRIB_SEND_RECEIVE */ - ACPI_INVALID_PROTOCOL_ID, /* 5 - reserved */ - 0x01, /* 6 - ATTRIB_BYTE */ - ACPI_INVALID_PROTOCOL_ID, /* 7 - reserved */ - 0x02, /* 8 - ATTRIB_WORD */ - ACPI_INVALID_PROTOCOL_ID, /* 9 - reserved */ - 0xFF, /* A - ATTRIB_BLOCK */ - 0xFF, /* B - ATTRIB_BYTES */ - 0x02, /* C - ATTRIB_PROCESS_CALL */ - 0xFF, /* D - ATTRIB_BLOCK_PROCESS_CALL */ - 0xFF, /* E - ATTRIB_RAW_BYTES */ - 0xFF /* F - ATTRIB_RAW_PROCESS_BYTES */ -}; - -#define PCC_MASTER_SUBSPACE 3 - -/* - * The following macros determine a given offset is a COMD field. - * According to the specification, generic subspaces (types 0-2) contains a - * 2-byte COMD field at offset 4 and master subspaces (type 3) contains a 4-byte - * COMD field starting at offset 12. - */ -#define GENERIC_SUBSPACE_COMMAND(a) (4 == a || a == 5) -#define MASTER_SUBSPACE_COMMAND(a) (12 <= a && a <= 15) - - -/******************************************************************************* - * - * FUNCTION: AcpiExGetProtocolBufferLength - * - * PARAMETERS: ProtocolId - The type of the protocol indicated by region - * field access attributes - * ReturnLength - Where the protocol byte transfer length is - * returned - * - * RETURN: Status and decoded byte transfer length - * - * DESCRIPTION: This routine returns the length of the GenericSerialBus - * protocol bytes - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExGetProtocolBufferLength ( - UINT32 ProtocolId, - UINT32 *ReturnLength) -{ - - if ((ProtocolId > ACPI_MAX_PROTOCOL_ID) || - (AcpiProtocolLengths[ProtocolId] == ACPI_INVALID_PROTOCOL_ID)) - { - ACPI_ERROR ((AE_INFO, - "Invalid Field/AccessAs protocol ID: 0x%4.4X", ProtocolId)); - - return (AE_AML_PROTOCOL); - } - - *ReturnLength = AcpiProtocolLengths[ProtocolId]; - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExReadDataFromField - * - * PARAMETERS: WalkState - Current execution state - * ObjDesc - The named field - * RetBufferDesc - Where the return data object is stored - * - * RETURN: Status - * - * DESCRIPTION: Read from a named field. Returns either an Integer or a - * Buffer, depending on the size of the field and whether if a - * field is created by the CreateField() operator. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExReadDataFromField ( - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT **RetBufferDesc) -{ - ACPI_STATUS Status; - ACPI_OPERAND_OBJECT *BufferDesc; - void *Buffer; - UINT32 BufferLength; - - - ACPI_FUNCTION_TRACE_PTR (ExReadDataFromField, ObjDesc); - - - /* Parameter validation */ - - if (!ObjDesc) - { - return_ACPI_STATUS (AE_AML_NO_OPERAND); - } - if (!RetBufferDesc) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - if (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD) - { - /* - * If the BufferField arguments have not been previously evaluated, - * evaluate them now and save the results. - */ - if (!(ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)) - { - Status = AcpiDsGetBufferFieldArguments (ObjDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - } - else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) && - (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS || - ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS || - ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_IPMI || - ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_PLATFORM_RT || - ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_FIXED_HARDWARE)) - { - /* SMBus, GSBus, IPMI serial */ - - Status = AcpiExReadSerialBus (ObjDesc, RetBufferDesc); - return_ACPI_STATUS (Status); - } - - /* - * Allocate a buffer for the contents of the field. - * - * If the field is larger than the current integer width, create - * a BUFFER to hold it. Otherwise, use an INTEGER. This allows - * the use of arithmetic operators on the returned value if the - * field size is equal or smaller than an Integer. - * - * However, all buffer fields created by CreateField operator needs to - * remain as a buffer to match other AML interpreter implementations. - * - * Note: Field.length is in bits. - */ - BufferLength = (ACPI_SIZE) ACPI_ROUND_BITS_UP_TO_BYTES ( - ObjDesc->Field.BitLength); - - if (BufferLength > AcpiGbl_IntegerByteWidth || - (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD && - ObjDesc->BufferField.IsCreateField)) - { - /* Field is too large for an Integer, create a Buffer instead */ - - BufferDesc = AcpiUtCreateBufferObject (BufferLength); - if (!BufferDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - Buffer = BufferDesc->Buffer.Pointer; - } - else - { - /* Field will fit within an Integer (normal case) */ - - BufferDesc = AcpiUtCreateIntegerObject ((UINT64) 0); - if (!BufferDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - BufferLength = AcpiGbl_IntegerByteWidth; - Buffer = &BufferDesc->Integer.Value; - } - - if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) && - (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GPIO)) - { - /* General Purpose I/O */ - - Status = AcpiExReadGpio (ObjDesc, Buffer); - goto Exit; - } - else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) && - (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_PLATFORM_COMM)) - { - /* - * Reading from a PCC field unit does not require the handler because - * it only requires reading from the InternalPccBuffer. - */ - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "PCC FieldRead bits %u\n", ObjDesc->Field.BitLength)); - - memcpy (Buffer, ObjDesc->Field.RegionObj->Field.InternalPccBuffer + - ObjDesc->Field.BaseByteOffset, (ACPI_SIZE) ACPI_ROUND_BITS_UP_TO_BYTES ( - ObjDesc->Field.BitLength)); - - *RetBufferDesc = BufferDesc; - return AE_OK; - } - - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "FieldRead [TO]: Obj %p, Type %X, Buf %p, ByteLen %X\n", - ObjDesc, ObjDesc->Common.Type, Buffer, BufferLength)); - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "FieldRead [FROM]: BitLen %X, BitOff %X, ByteOff %X\n", - ObjDesc->CommonField.BitLength, - ObjDesc->CommonField.StartFieldBitOffset, - ObjDesc->CommonField.BaseByteOffset)); - - /* Lock entire transaction if requested */ - - AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); - - /* Read from the field */ - - Status = AcpiExExtractFromField (ObjDesc, Buffer, BufferLength); - AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); - - -Exit: - if (ACPI_FAILURE (Status)) - { - AcpiUtRemoveReference (BufferDesc); - } - else - { - *RetBufferDesc = BufferDesc; - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExWriteDataToField - * - * PARAMETERS: SourceDesc - Contains data to write - * ObjDesc - The named field - * ResultDesc - Where the return value is returned, if any - * - * RETURN: Status - * - * DESCRIPTION: Write to a named field - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExWriteDataToField ( - ACPI_OPERAND_OBJECT *SourceDesc, - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT **ResultDesc) -{ - ACPI_STATUS Status; - UINT32 BufferLength; - UINT32 DataLength; - void *Buffer; - - - ACPI_FUNCTION_TRACE_PTR (ExWriteDataToField, ObjDesc); - - - /* Parameter validation */ - - if (!SourceDesc || !ObjDesc) - { - return_ACPI_STATUS (AE_AML_NO_OPERAND); - } - - if (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD) - { - /* - * If the BufferField arguments have not been previously evaluated, - * evaluate them now and save the results. - */ - if (!(ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)) - { - Status = AcpiDsGetBufferFieldArguments (ObjDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - } - else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) && - (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GPIO)) - { - /* General Purpose I/O */ - - Status = AcpiExWriteGpio (SourceDesc, ObjDesc, ResultDesc); - return_ACPI_STATUS (Status); - } - else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) && - (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS || - ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS || - ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_IPMI || - ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_PLATFORM_RT || - ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_FIXED_HARDWARE)) - { - /* SMBus, GSBus, IPMI serial */ - - Status = AcpiExWriteSerialBus (SourceDesc, ObjDesc, ResultDesc); - return_ACPI_STATUS (Status); - } - else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) && - (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_PLATFORM_COMM)) - { - /* - * According to the spec a write to the COMD field will invoke the - * region handler. Otherwise, write to the PccInternal buffer. This - * implementation will use the offsets specified rather than the name - * of the field. This is considered safer because some firmware tools - * are known to obfiscate named objects. - */ - DataLength = (ACPI_SIZE) ACPI_ROUND_BITS_UP_TO_BYTES ( - ObjDesc->Field.BitLength); - memcpy (ObjDesc->Field.RegionObj->Field.InternalPccBuffer + - ObjDesc->Field.BaseByteOffset, - SourceDesc->Buffer.Pointer, DataLength); - - if (MASTER_SUBSPACE_COMMAND (ObjDesc->Field.BaseByteOffset)) - { - /* Perform the write */ - - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "PCC COMD field has been written. Invoking PCC handler now.\n")); - - Status = AcpiExAccessRegion ( - ObjDesc, 0, (UINT64 *) ObjDesc->Field.RegionObj->Field.InternalPccBuffer, - ACPI_WRITE); - return_ACPI_STATUS (Status); - } - return (AE_OK); - } - - - /* Get a pointer to the data to be written */ - - switch (SourceDesc->Common.Type) - { - case ACPI_TYPE_INTEGER: - - Buffer = &SourceDesc->Integer.Value; - BufferLength = sizeof (SourceDesc->Integer.Value); - break; - - case ACPI_TYPE_BUFFER: - - Buffer = SourceDesc->Buffer.Pointer; - BufferLength = SourceDesc->Buffer.Length; - break; - - case ACPI_TYPE_STRING: - - Buffer = SourceDesc->String.Pointer; - BufferLength = SourceDesc->String.Length; - break; - - default: - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "FieldWrite [FROM]: Obj %p (%s:%X), Buf %p, ByteLen %X\n", - SourceDesc, AcpiUtGetTypeName (SourceDesc->Common.Type), - SourceDesc->Common.Type, Buffer, BufferLength)); - - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "FieldWrite [TO]: Obj %p (%s:%X), BitLen %X, BitOff %X, ByteOff %X\n", - ObjDesc, AcpiUtGetTypeName (ObjDesc->Common.Type), - ObjDesc->Common.Type, - ObjDesc->CommonField.BitLength, - ObjDesc->CommonField.StartFieldBitOffset, - ObjDesc->CommonField.BaseByteOffset)); - - /* Lock entire transaction if requested */ - - AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); - - /* Write to the field */ - - Status = AcpiExInsertIntoField (ObjDesc, Buffer, BufferLength); - AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/exfldio.c b/drivers/acpica/exfldio.c deleted file mode 100644 index b81235c..0000000 --- a/drivers/acpica/exfldio.c +++ /dev/null @@ -1,1156 +0,0 @@ -/****************************************************************************** - * - * Module Name: exfldio - Aml Field I/O - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acinterp.h" -#include "amlcode.h" -#include "acevents.h" -#include "acdispat.h" - - -#define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exfldio") - -/* Local prototypes */ - -static ACPI_STATUS -AcpiExFieldDatumIo ( - ACPI_OPERAND_OBJECT *ObjDesc, - UINT32 FieldDatumByteOffset, - UINT64 *Value, - UINT32 ReadWrite); - -static BOOLEAN -AcpiExRegisterOverflow ( - ACPI_OPERAND_OBJECT *ObjDesc, - UINT64 Value); - -static ACPI_STATUS -AcpiExSetupRegion ( - ACPI_OPERAND_OBJECT *ObjDesc, - UINT32 FieldDatumByteOffset); - - -/******************************************************************************* - * - * FUNCTION: AcpiExSetupRegion - * - * PARAMETERS: ObjDesc - Field to be read or written - * FieldDatumByteOffset - Byte offset of this datum within the - * parent field - * - * RETURN: Status - * - * DESCRIPTION: Common processing for AcpiExExtractFromField and - * AcpiExInsertIntoField. Initialize the Region if necessary and - * validate the request. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiExSetupRegion ( - ACPI_OPERAND_OBJECT *ObjDesc, - UINT32 FieldDatumByteOffset) -{ - ACPI_STATUS Status = AE_OK; - ACPI_OPERAND_OBJECT *RgnDesc; - UINT8 SpaceId; - - - ACPI_FUNCTION_TRACE_U32 (ExSetupRegion, FieldDatumByteOffset); - - - RgnDesc = ObjDesc->CommonField.RegionObj; - - /* We must have a valid region */ - - if (RgnDesc->Common.Type != ACPI_TYPE_REGION) - { - ACPI_ERROR ((AE_INFO, "Needed Region, found type 0x%X (%s)", - RgnDesc->Common.Type, - AcpiUtGetObjectTypeName (RgnDesc))); - - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - - SpaceId = RgnDesc->Region.SpaceId; - - /* Validate the Space ID */ - - if (!AcpiIsValidSpaceId (SpaceId)) - { - ACPI_ERROR ((AE_INFO, - "Invalid/unknown Address Space ID: 0x%2.2X", SpaceId)); - return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID); - } - - /* - * If the Region Address and Length have not been previously evaluated, - * evaluate them now and save the results. - */ - if (!(RgnDesc->Common.Flags & AOPOBJ_DATA_VALID)) - { - Status = AcpiDsGetRegionArguments (RgnDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - /* - * Exit now for SMBus, GSBus or IPMI address space, it has a non-linear - * address space and the request cannot be directly validated - */ - if (SpaceId == ACPI_ADR_SPACE_SMBUS || - SpaceId == ACPI_ADR_SPACE_GSBUS || - SpaceId == ACPI_ADR_SPACE_IPMI) - { - /* SMBus or IPMI has a non-linear address space */ - - return_ACPI_STATUS (AE_OK); - } - -#ifdef ACPI_UNDER_DEVELOPMENT - /* - * If the Field access is AnyAcc, we can now compute the optimal - * access (because we know the length of the parent region) - */ - if (!(ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)) - { - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } -#endif - - /* - * Validate the request. The entire request from the byte offset for a - * length of one field datum (access width) must fit within the region. - * (Region length is specified in bytes) - */ - if (RgnDesc->Region.Length < - (ObjDesc->CommonField.BaseByteOffset + FieldDatumByteOffset + - ObjDesc->CommonField.AccessByteWidth)) - { - if (AcpiGbl_EnableInterpreterSlack) - { - /* - * Slack mode only: We will go ahead and allow access to this - * field if it is within the region length rounded up to the next - * access width boundary. ACPI_SIZE cast for 64-bit compile. - */ - if (ACPI_ROUND_UP (RgnDesc->Region.Length, - ObjDesc->CommonField.AccessByteWidth) >= - ((ACPI_SIZE) ObjDesc->CommonField.BaseByteOffset + - ObjDesc->CommonField.AccessByteWidth + - FieldDatumByteOffset)) - { - return_ACPI_STATUS (AE_OK); - } - } - - if (RgnDesc->Region.Length < ObjDesc->CommonField.AccessByteWidth) - { - /* - * This is the case where the AccessType (AccWord, etc.) is wider - * than the region itself. For example, a region of length one - * byte, and a field with Dword access specified. - */ - ACPI_ERROR ((AE_INFO, - "Field [%4.4s] access width (%u bytes) " - "too large for region [%4.4s] (length %u)", - AcpiUtGetNodeName (ObjDesc->CommonField.Node), - ObjDesc->CommonField.AccessByteWidth, - AcpiUtGetNodeName (RgnDesc->Region.Node), - RgnDesc->Region.Length)); - } - - /* - * Offset rounded up to next multiple of field width - * exceeds region length, indicate an error - */ - ACPI_ERROR ((AE_INFO, - "Field [%4.4s] Base+Offset+Width %u+%u+%u " - "is beyond end of region [%4.4s] (length %u)", - AcpiUtGetNodeName (ObjDesc->CommonField.Node), - ObjDesc->CommonField.BaseByteOffset, - FieldDatumByteOffset, ObjDesc->CommonField.AccessByteWidth, - AcpiUtGetNodeName (RgnDesc->Region.Node), - RgnDesc->Region.Length)); - - return_ACPI_STATUS (AE_AML_REGION_LIMIT); - } - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExAccessRegion - * - * PARAMETERS: ObjDesc - Field to be read - * FieldDatumByteOffset - Byte offset of this datum within the - * parent field - * Value - Where to store value (must at least - * 64 bits) - * Function - Read or Write flag plus other region- - * dependent flags - * - * RETURN: Status - * - * DESCRIPTION: Read or Write a single field datum to an Operation Region. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExAccessRegion ( - ACPI_OPERAND_OBJECT *ObjDesc, - UINT32 FieldDatumByteOffset, - UINT64 *Value, - UINT32 Function) -{ - ACPI_STATUS Status; - ACPI_OPERAND_OBJECT *RgnDesc; - UINT32 RegionOffset; - - - ACPI_FUNCTION_TRACE (ExAccessRegion); - - - /* - * Ensure that the region operands are fully evaluated and verify - * the validity of the request - */ - Status = AcpiExSetupRegion (ObjDesc, FieldDatumByteOffset); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* - * The physical address of this field datum is: - * - * 1) The base of the region, plus - * 2) The base offset of the field, plus - * 3) The current offset into the field - */ - RgnDesc = ObjDesc->CommonField.RegionObj; - RegionOffset = - ObjDesc->CommonField.BaseByteOffset + - FieldDatumByteOffset; - - if ((Function & ACPI_IO_MASK) == ACPI_READ) - { - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "[READ]")); - } - else - { - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "[WRITE]")); - } - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_BFIELD, - " Region [%s:%X], Width %X, ByteBase %X, Offset %X at %8.8X%8.8X\n", - AcpiUtGetRegionName (RgnDesc->Region.SpaceId), - RgnDesc->Region.SpaceId, - ObjDesc->CommonField.AccessByteWidth, - ObjDesc->CommonField.BaseByteOffset, - FieldDatumByteOffset, - ACPI_FORMAT_UINT64 (RgnDesc->Region.Address + RegionOffset))); - - /* Invoke the appropriate AddressSpace/OpRegion handler */ - - Status = AcpiEvAddressSpaceDispatch (RgnDesc, ObjDesc, - Function, RegionOffset, - ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth), Value); - - if (ACPI_FAILURE (Status)) - { - if (Status == AE_NOT_IMPLEMENTED) - { - ACPI_ERROR ((AE_INFO, - "Region %s (ID=%u) not implemented", - AcpiUtGetRegionName (RgnDesc->Region.SpaceId), - RgnDesc->Region.SpaceId)); - } - else if (Status == AE_NOT_EXIST) - { - ACPI_ERROR ((AE_INFO, - "Region %s (ID=%u) has no handler", - AcpiUtGetRegionName (RgnDesc->Region.SpaceId), - RgnDesc->Region.SpaceId)); - } - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExRegisterOverflow - * - * PARAMETERS: ObjDesc - Register(Field) to be written - * Value - Value to be stored - * - * RETURN: TRUE if value overflows the field, FALSE otherwise - * - * DESCRIPTION: Check if a value is out of range of the field being written. - * Used to check if the values written to Index and Bank registers - * are out of range. Normally, the value is simply truncated - * to fit the field, but this case is most likely a serious - * coding error in the ASL. - * - ******************************************************************************/ - -static BOOLEAN -AcpiExRegisterOverflow ( - ACPI_OPERAND_OBJECT *ObjDesc, - UINT64 Value) -{ - - if (ObjDesc->CommonField.BitLength >= ACPI_INTEGER_BIT_SIZE) - { - /* - * The field is large enough to hold the maximum integer, so we can - * never overflow it. - */ - return (FALSE); - } - - if (Value >= ((UINT64) 1 << ObjDesc->CommonField.BitLength)) - { - /* - * The Value is larger than the maximum value that can fit into - * the register. - */ - ACPI_ERROR ((AE_INFO, - "Index value 0x%8.8X%8.8X overflows field width 0x%X", - ACPI_FORMAT_UINT64 (Value), - ObjDesc->CommonField.BitLength)); - - return (TRUE); - } - - /* The Value will fit into the field with no truncation */ - - return (FALSE); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExFieldDatumIo - * - * PARAMETERS: ObjDesc - Field to be read - * FieldDatumByteOffset - Byte offset of this datum within the - * parent field - * Value - Where to store value (must be 64 bits) - * ReadWrite - Read or Write flag - * - * RETURN: Status - * - * DESCRIPTION: Read or Write a single datum of a field. The FieldType is - * demultiplexed here to handle the different types of fields - * (BufferField, RegionField, IndexField, BankField) - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiExFieldDatumIo ( - ACPI_OPERAND_OBJECT *ObjDesc, - UINT32 FieldDatumByteOffset, - UINT64 *Value, - UINT32 ReadWrite) -{ - ACPI_STATUS Status; - UINT64 LocalValue; - - - ACPI_FUNCTION_TRACE_U32 (ExFieldDatumIo, FieldDatumByteOffset); - - - if (ReadWrite == ACPI_READ) - { - if (!Value) - { - LocalValue = 0; - - /* To support reads without saving return value */ - Value = &LocalValue; - } - - /* Clear the entire return buffer first, [Very Important!] */ - - *Value = 0; - } - - /* - * The four types of fields are: - * - * BufferField - Read/write from/to a Buffer - * RegionField - Read/write from/to a Operation Region. - * BankField - Write to a Bank Register, then read/write from/to an - * OperationRegion - * IndexField - Write to an Index Register, then read/write from/to a - * Data Register - */ - switch (ObjDesc->Common.Type) - { - case ACPI_TYPE_BUFFER_FIELD: - /* - * If the BufferField arguments have not been previously evaluated, - * evaluate them now and save the results. - */ - if (!(ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)) - { - Status = AcpiDsGetBufferFieldArguments (ObjDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - if (ReadWrite == ACPI_READ) - { - /* - * Copy the data from the source buffer. - * Length is the field width in bytes. - */ - memcpy (Value, - (ObjDesc->BufferField.BufferObj)->Buffer.Pointer + - ObjDesc->BufferField.BaseByteOffset + - FieldDatumByteOffset, - ObjDesc->CommonField.AccessByteWidth); - } - else - { - /* - * Copy the data to the target buffer. - * Length is the field width in bytes. - */ - memcpy ((ObjDesc->BufferField.BufferObj)->Buffer.Pointer + - ObjDesc->BufferField.BaseByteOffset + - FieldDatumByteOffset, - Value, ObjDesc->CommonField.AccessByteWidth); - } - - Status = AE_OK; - break; - - case ACPI_TYPE_LOCAL_BANK_FIELD: - /* - * Ensure that the BankValue is not beyond the capacity of - * the register - */ - if (AcpiExRegisterOverflow (ObjDesc->BankField.BankObj, - (UINT64) ObjDesc->BankField.Value)) - { - return_ACPI_STATUS (AE_AML_REGISTER_LIMIT); - } - - /* - * For BankFields, we must write the BankValue to the BankRegister - * (itself a RegionField) before we can access the data. - */ - Status = AcpiExInsertIntoField (ObjDesc->BankField.BankObj, - &ObjDesc->BankField.Value, - sizeof (ObjDesc->BankField.Value)); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* - * Now that the Bank has been selected, fall through to the - * RegionField case and write the datum to the Operation Region - */ - - ACPI_FALLTHROUGH; - - case ACPI_TYPE_LOCAL_REGION_FIELD: - /* - * For simple RegionFields, we just directly access the owning - * Operation Region. - */ - Status = AcpiExAccessRegion ( - ObjDesc, FieldDatumByteOffset, Value, ReadWrite); - break; - - case ACPI_TYPE_LOCAL_INDEX_FIELD: - /* - * Ensure that the IndexValue is not beyond the capacity of - * the register - */ - if (AcpiExRegisterOverflow (ObjDesc->IndexField.IndexObj, - (UINT64) ObjDesc->IndexField.Value)) - { - return_ACPI_STATUS (AE_AML_REGISTER_LIMIT); - } - - /* Write the index value to the IndexRegister (itself a RegionField) */ - - FieldDatumByteOffset += ObjDesc->IndexField.Value; - - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Write to Index Register: Value %8.8X\n", - FieldDatumByteOffset)); - - Status = AcpiExInsertIntoField (ObjDesc->IndexField.IndexObj, - &FieldDatumByteOffset, sizeof (FieldDatumByteOffset)); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - if (ReadWrite == ACPI_READ) - { - /* Read the datum from the DataRegister */ - - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Read from Data Register\n")); - - Status = AcpiExExtractFromField ( - ObjDesc->IndexField.DataObj, Value, sizeof (UINT64)); - } - else - { - /* Write the datum to the DataRegister */ - - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Write to Data Register: Value %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (*Value))); - - Status = AcpiExInsertIntoField ( - ObjDesc->IndexField.DataObj, Value, sizeof (UINT64)); - } - break; - - default: - - ACPI_ERROR ((AE_INFO, "Wrong object type in field I/O %u", - ObjDesc->Common.Type)); - Status = AE_AML_INTERNAL; - break; - } - - if (ACPI_SUCCESS (Status)) - { - if (ReadWrite == ACPI_READ) - { - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Value Read %8.8X%8.8X, Width %u\n", - ACPI_FORMAT_UINT64 (*Value), - ObjDesc->CommonField.AccessByteWidth)); - } - else - { - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Value Written %8.8X%8.8X, Width %u\n", - ACPI_FORMAT_UINT64 (*Value), - ObjDesc->CommonField.AccessByteWidth)); - } - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExWriteWithUpdateRule - * - * PARAMETERS: ObjDesc - Field to be written - * Mask - bitmask within field datum - * FieldValue - Value to write - * FieldDatumByteOffset - Offset of datum within field - * - * RETURN: Status - * - * DESCRIPTION: Apply the field update rule to a field write - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExWriteWithUpdateRule ( - ACPI_OPERAND_OBJECT *ObjDesc, - UINT64 Mask, - UINT64 FieldValue, - UINT32 FieldDatumByteOffset) -{ - ACPI_STATUS Status = AE_OK; - UINT64 MergedValue; - UINT64 CurrentValue; - - - ACPI_FUNCTION_TRACE_U32 (ExWriteWithUpdateRule, Mask); - - - /* Start with the new bits */ - - MergedValue = FieldValue; - - /* If the mask is all ones, we don't need to worry about the update rule */ - - if (Mask != ACPI_UINT64_MAX) - { - /* Decode the update rule */ - - switch (ObjDesc->CommonField.FieldFlags & AML_FIELD_UPDATE_RULE_MASK) - { - case AML_FIELD_UPDATE_PRESERVE: - /* - * Check if update rule needs to be applied (not if mask is all - * ones) The left shift drops the bits we want to ignore. - */ - if ((~Mask << (ACPI_MUL_8 (sizeof (Mask)) - - ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth))) != 0) - { - /* - * Read the current contents of the byte/word/dword containing - * the field, and merge with the new field value. - */ - Status = AcpiExFieldDatumIo ( - ObjDesc, FieldDatumByteOffset, &CurrentValue, ACPI_READ); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - MergedValue |= (CurrentValue & ~Mask); - } - break; - - case AML_FIELD_UPDATE_WRITE_AS_ONES: - - /* Set positions outside the field to all ones */ - - MergedValue |= ~Mask; - break; - - case AML_FIELD_UPDATE_WRITE_AS_ZEROS: - - /* Set positions outside the field to all zeros */ - - MergedValue &= Mask; - break; - - default: - - ACPI_ERROR ((AE_INFO, - "Unknown UpdateRule value: 0x%X", - (ObjDesc->CommonField.FieldFlags & - AML_FIELD_UPDATE_RULE_MASK))); - return_ACPI_STATUS (AE_AML_OPERAND_VALUE); - } - } - - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Mask %8.8X%8.8X, DatumOffset %X, Width %X, " - "Value %8.8X%8.8X, MergedValue %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (Mask), - FieldDatumByteOffset, - ObjDesc->CommonField.AccessByteWidth, - ACPI_FORMAT_UINT64 (FieldValue), - ACPI_FORMAT_UINT64 (MergedValue))); - - /* Write the merged value */ - - Status = AcpiExFieldDatumIo ( - ObjDesc, FieldDatumByteOffset, &MergedValue, ACPI_WRITE); - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExExtractFromField - * - * PARAMETERS: ObjDesc - Field to be read - * Buffer - Where to store the field data - * BufferLength - Length of Buffer - * - * RETURN: Status - * - * DESCRIPTION: Retrieve the current value of the given field - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExExtractFromField ( - ACPI_OPERAND_OBJECT *ObjDesc, - void *Buffer, - UINT32 BufferLength) -{ - ACPI_STATUS Status; - UINT64 RawDatum; - UINT64 MergedDatum; - UINT32 FieldOffset = 0; - UINT32 BufferOffset = 0; - UINT32 BufferTailBits; - UINT32 DatumCount; - UINT32 FieldDatumCount; - UINT32 AccessBitWidth; - UINT32 i; - - - ACPI_FUNCTION_TRACE (ExExtractFromField); - - - /* Validate target buffer and clear it */ - - if (BufferLength < - ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength)) - { - ACPI_ERROR ((AE_INFO, - "Field size %u (bits) is too large for buffer (%u)", - ObjDesc->CommonField.BitLength, BufferLength)); - - return_ACPI_STATUS (AE_BUFFER_OVERFLOW); - } - - memset (Buffer, 0, BufferLength); - AccessBitWidth = ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth); - - /* Handle the simple case here */ - - if ((ObjDesc->CommonField.StartFieldBitOffset == 0) && - (ObjDesc->CommonField.BitLength == AccessBitWidth)) - { - if (BufferLength >= sizeof (UINT64)) - { - Status = AcpiExFieldDatumIo (ObjDesc, 0, Buffer, ACPI_READ); - } - else - { - /* Use RawDatum (UINT64) to handle buffers < 64 bits */ - - Status = AcpiExFieldDatumIo (ObjDesc, 0, &RawDatum, ACPI_READ); - memcpy (Buffer, &RawDatum, BufferLength); - } - - return_ACPI_STATUS (Status); - } - -/* TBD: Move to common setup code */ - - /* Field algorithm is limited to sizeof(UINT64), truncate if needed */ - - if (ObjDesc->CommonField.AccessByteWidth > sizeof (UINT64)) - { - ObjDesc->CommonField.AccessByteWidth = sizeof (UINT64); - AccessBitWidth = sizeof (UINT64) * 8; - } - - /* Compute the number of datums (access width data items) */ - - DatumCount = ACPI_ROUND_UP_TO ( - ObjDesc->CommonField.BitLength, AccessBitWidth); - - FieldDatumCount = ACPI_ROUND_UP_TO ( - ObjDesc->CommonField.BitLength + - ObjDesc->CommonField.StartFieldBitOffset, AccessBitWidth); - - /* Priming read from the field */ - - Status = AcpiExFieldDatumIo (ObjDesc, FieldOffset, &RawDatum, ACPI_READ); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - MergedDatum = RawDatum >> ObjDesc->CommonField.StartFieldBitOffset; - - /* Read the rest of the field */ - - for (i = 1; i < FieldDatumCount; i++) - { - /* Get next input datum from the field */ - - FieldOffset += ObjDesc->CommonField.AccessByteWidth; - Status = AcpiExFieldDatumIo ( - ObjDesc, FieldOffset, &RawDatum, ACPI_READ); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* - * Merge with previous datum if necessary. - * - * Note: Before the shift, check if the shift value will be larger than - * the integer size. If so, there is no need to perform the operation. - * This avoids the differences in behavior between different compilers - * concerning shift values larger than the target data width. - */ - if (AccessBitWidth - ObjDesc->CommonField.StartFieldBitOffset < - ACPI_INTEGER_BIT_SIZE) - { - MergedDatum |= RawDatum << - (AccessBitWidth - ObjDesc->CommonField.StartFieldBitOffset); - } - - if (i == DatumCount) - { - break; - } - - /* Write merged datum to target buffer */ - - memcpy (((char *) Buffer) + BufferOffset, &MergedDatum, - ACPI_MIN(ObjDesc->CommonField.AccessByteWidth, - BufferLength - BufferOffset)); - - BufferOffset += ObjDesc->CommonField.AccessByteWidth; - MergedDatum = RawDatum >> ObjDesc->CommonField.StartFieldBitOffset; - } - - /* Mask off any extra bits in the last datum */ - - BufferTailBits = ObjDesc->CommonField.BitLength % AccessBitWidth; - if (BufferTailBits) - { - MergedDatum &= ACPI_MASK_BITS_ABOVE (BufferTailBits); - } - - /* Write the last datum to the buffer */ - - memcpy (((char *) Buffer) + BufferOffset, &MergedDatum, - ACPI_MIN(ObjDesc->CommonField.AccessByteWidth, - BufferLength - BufferOffset)); - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExInsertIntoField - * - * PARAMETERS: ObjDesc - Field to be written - * Buffer - Data to be written - * BufferLength - Length of Buffer - * - * RETURN: Status - * - * DESCRIPTION: Store the Buffer contents into the given field - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExInsertIntoField ( - ACPI_OPERAND_OBJECT *ObjDesc, - void *Buffer, - UINT32 BufferLength) -{ - void *NewBuffer; - ACPI_STATUS Status; - UINT64 Mask; - UINT64 WidthMask; - UINT64 MergedDatum; - UINT64 RawDatum = 0; - UINT32 FieldOffset = 0; - UINT32 BufferOffset = 0; - UINT32 BufferTailBits; - UINT32 DatumCount; - UINT32 FieldDatumCount; - UINT32 AccessBitWidth; - UINT32 RequiredLength; - UINT32 i; - - - ACPI_FUNCTION_TRACE (ExInsertIntoField); - - - /* Validate input buffer */ - - NewBuffer = NULL; - RequiredLength = ACPI_ROUND_BITS_UP_TO_BYTES ( - ObjDesc->CommonField.BitLength); - - /* - * We must have a buffer that is at least as long as the field - * we are writing to. This is because individual fields are - * indivisible and partial writes are not supported -- as per - * the ACPI specification. - */ - if (BufferLength < RequiredLength) - { - /* We need to create a new buffer */ - - NewBuffer = ACPI_ALLOCATE_ZEROED (RequiredLength); - if (!NewBuffer) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* - * Copy the original data to the new buffer, starting - * at Byte zero. All unused (upper) bytes of the - * buffer will be 0. - */ - memcpy ((char *) NewBuffer, (char *) Buffer, BufferLength); - Buffer = NewBuffer; - BufferLength = RequiredLength; - } - -/* TBD: Move to common setup code */ - - /* Algo is limited to sizeof(UINT64), so cut the AccessByteWidth */ - if (ObjDesc->CommonField.AccessByteWidth > sizeof (UINT64)) - { - ObjDesc->CommonField.AccessByteWidth = sizeof (UINT64); - } - - AccessBitWidth = ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth); - - /* Create the bitmasks used for bit insertion */ - - WidthMask = ACPI_MASK_BITS_ABOVE_64 (AccessBitWidth); - Mask = WidthMask & - ACPI_MASK_BITS_BELOW (ObjDesc->CommonField.StartFieldBitOffset); - - /* Compute the number of datums (access width data items) */ - - DatumCount = ACPI_ROUND_UP_TO (ObjDesc->CommonField.BitLength, - AccessBitWidth); - - FieldDatumCount = ACPI_ROUND_UP_TO (ObjDesc->CommonField.BitLength + - ObjDesc->CommonField.StartFieldBitOffset, - AccessBitWidth); - - /* Get initial Datum from the input buffer */ - - memcpy (&RawDatum, Buffer, - ACPI_MIN(ObjDesc->CommonField.AccessByteWidth, - BufferLength - BufferOffset)); - - MergedDatum = RawDatum << ObjDesc->CommonField.StartFieldBitOffset; - - /* Write the entire field */ - - for (i = 1; i < FieldDatumCount; i++) - { - /* Write merged datum to the target field */ - - MergedDatum &= Mask; - Status = AcpiExWriteWithUpdateRule ( - ObjDesc, Mask, MergedDatum, FieldOffset); - if (ACPI_FAILURE (Status)) - { - goto Exit; - } - - FieldOffset += ObjDesc->CommonField.AccessByteWidth; - - /* - * Start new output datum by merging with previous input datum - * if necessary. - * - * Note: Before the shift, check if the shift value will be larger than - * the integer size. If so, there is no need to perform the operation. - * This avoids the differences in behavior between different compilers - * concerning shift values larger than the target data width. - */ - if ((AccessBitWidth - ObjDesc->CommonField.StartFieldBitOffset) < - ACPI_INTEGER_BIT_SIZE) - { - MergedDatum = RawDatum >> - (AccessBitWidth - ObjDesc->CommonField.StartFieldBitOffset); - } - else - { - MergedDatum = 0; - } - - Mask = WidthMask; - - if (i == DatumCount) - { - break; - } - - /* Get the next input datum from the buffer */ - - BufferOffset += ObjDesc->CommonField.AccessByteWidth; - memcpy (&RawDatum, ((char *) Buffer) + BufferOffset, - ACPI_MIN(ObjDesc->CommonField.AccessByteWidth, - BufferLength - BufferOffset)); - - MergedDatum |= RawDatum << ObjDesc->CommonField.StartFieldBitOffset; - } - - /* Mask off any extra bits in the last datum */ - - BufferTailBits = (ObjDesc->CommonField.BitLength + - ObjDesc->CommonField.StartFieldBitOffset) % AccessBitWidth; - if (BufferTailBits) - { - Mask &= ACPI_MASK_BITS_ABOVE (BufferTailBits); - } - - /* Write the last datum to the field */ - - MergedDatum &= Mask; - Status = AcpiExWriteWithUpdateRule ( - ObjDesc, Mask, MergedDatum, FieldOffset); - -Exit: - /* Free temporary buffer if we used one */ - - if (NewBuffer) - { - ACPI_FREE (NewBuffer); - } - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/exmisc.c b/drivers/acpica/exmisc.c deleted file mode 100644 index b24720c..0000000 --- a/drivers/acpica/exmisc.c +++ /dev/null @@ -1,643 +0,0 @@ -/****************************************************************************** - * - * Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acinterp.h" -#include "amlcode.h" - - -#define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exmisc") - - -/******************************************************************************* - * - * FUNCTION: AcpiExGetObjectReference - * - * PARAMETERS: ObjDesc - Create a reference to this object - * ReturnDesc - Where to store the reference - * WalkState - Current state - * - * RETURN: Status - * - * DESCRIPTION: Obtain and return a "reference" to the target object - * Common code for the RefOfOp and the CondRefOfOp. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExGetObjectReference ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT **ReturnDesc, - ACPI_WALK_STATE *WalkState) -{ - ACPI_OPERAND_OBJECT *ReferenceObj; - ACPI_OPERAND_OBJECT *ReferencedObj; - - - ACPI_FUNCTION_TRACE_PTR (ExGetObjectReference, ObjDesc); - - - *ReturnDesc = NULL; - - switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc)) - { - case ACPI_DESC_TYPE_OPERAND: - - if (ObjDesc->Common.Type != ACPI_TYPE_LOCAL_REFERENCE) - { - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - - /* - * Must be a reference to a Local or Arg - */ - switch (ObjDesc->Reference.Class) - { - case ACPI_REFCLASS_LOCAL: - case ACPI_REFCLASS_ARG: - case ACPI_REFCLASS_DEBUG: - - /* The referenced object is the pseudo-node for the local/arg */ - - ReferencedObj = ObjDesc->Reference.Object; - break; - - default: - - ACPI_ERROR ((AE_INFO, "Invalid Reference Class 0x%2.2X", - ObjDesc->Reference.Class)); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - break; - - case ACPI_DESC_TYPE_NAMED: - /* - * A named reference that has already been resolved to a Node - */ - ReferencedObj = ObjDesc; - break; - - default: - - ACPI_ERROR ((AE_INFO, "Invalid descriptor type 0x%X", - ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))); - return_ACPI_STATUS (AE_TYPE); - } - - - /* Create a new reference object */ - - ReferenceObj = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_REFERENCE); - if (!ReferenceObj) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - ReferenceObj->Reference.Class = ACPI_REFCLASS_REFOF; - ReferenceObj->Reference.Object = ReferencedObj; - *ReturnDesc = ReferenceObj; - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Object %p Type [%s], returning Reference %p\n", - ObjDesc, AcpiUtGetObjectTypeName (ObjDesc), *ReturnDesc)); - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExDoMathOp - * - * PARAMETERS: Opcode - AML opcode - * Integer0 - Integer operand #0 - * Integer1 - Integer operand #1 - * - * RETURN: Integer result of the operation - * - * DESCRIPTION: Execute a math AML opcode. The purpose of having all of the - * math functions here is to prevent a lot of pointer dereferencing - * to obtain the operands. - * - ******************************************************************************/ - -UINT64 -AcpiExDoMathOp ( - UINT16 Opcode, - UINT64 Integer0, - UINT64 Integer1) -{ - - ACPI_FUNCTION_ENTRY (); - - - switch (Opcode) - { - case AML_ADD_OP: /* Add (Integer0, Integer1, Result) */ - - return (Integer0 + Integer1); - - case AML_BIT_AND_OP: /* And (Integer0, Integer1, Result) */ - - return (Integer0 & Integer1); - - case AML_BIT_NAND_OP: /* NAnd (Integer0, Integer1, Result) */ - - return (~(Integer0 & Integer1)); - - case AML_BIT_OR_OP: /* Or (Integer0, Integer1, Result) */ - - return (Integer0 | Integer1); - - case AML_BIT_NOR_OP: /* NOr (Integer0, Integer1, Result) */ - - return (~(Integer0 | Integer1)); - - case AML_BIT_XOR_OP: /* XOr (Integer0, Integer1, Result) */ - - return (Integer0 ^ Integer1); - - case AML_MULTIPLY_OP: /* Multiply (Integer0, Integer1, Result) */ - - return (Integer0 * Integer1); - - case AML_SHIFT_LEFT_OP: /* ShiftLeft (Operand, ShiftCount, Result)*/ - - /* - * We need to check if the shiftcount is larger than the integer bit - * width since the behavior of this is not well-defined in the C language. - */ - if (Integer1 >= AcpiGbl_IntegerBitWidth) - { - return (0); - } - return (Integer0 << Integer1); - - case AML_SHIFT_RIGHT_OP: /* ShiftRight (Operand, ShiftCount, Result) */ - - /* - * We need to check if the shiftcount is larger than the integer bit - * width since the behavior of this is not well-defined in the C language. - */ - if (Integer1 >= AcpiGbl_IntegerBitWidth) - { - return (0); - } - return (Integer0 >> Integer1); - - case AML_SUBTRACT_OP: /* Subtract (Integer0, Integer1, Result) */ - - return (Integer0 - Integer1); - - default: - - return (0); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExDoLogicalNumericOp - * - * PARAMETERS: Opcode - AML opcode - * Integer0 - Integer operand #0 - * Integer1 - Integer operand #1 - * LogicalResult - TRUE/FALSE result of the operation - * - * RETURN: Status - * - * DESCRIPTION: Execute a logical "Numeric" AML opcode. For these Numeric - * operators (LAnd and LOr), both operands must be integers. - * - * Note: cleanest machine code seems to be produced by the code - * below, rather than using statements of the form: - * Result = (Integer0 && Integer1); - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExDoLogicalNumericOp ( - UINT16 Opcode, - UINT64 Integer0, - UINT64 Integer1, - BOOLEAN *LogicalResult) -{ - ACPI_STATUS Status = AE_OK; - BOOLEAN LocalResult = FALSE; - - - ACPI_FUNCTION_TRACE (ExDoLogicalNumericOp); - - - switch (Opcode) - { - case AML_LOGICAL_AND_OP: /* LAnd (Integer0, Integer1) */ - - if (Integer0 && Integer1) - { - LocalResult = TRUE; - } - break; - - case AML_LOGICAL_OR_OP: /* LOr (Integer0, Integer1) */ - - if (Integer0 || Integer1) - { - LocalResult = TRUE; - } - break; - - default: - - ACPI_ERROR ((AE_INFO, - "Invalid numeric logical opcode: %X", Opcode)); - Status = AE_AML_INTERNAL; - break; - } - - /* Return the logical result and status */ - - *LogicalResult = LocalResult; - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExDoLogicalOp - * - * PARAMETERS: Opcode - AML opcode - * Operand0 - operand #0 - * Operand1 - operand #1 - * LogicalResult - TRUE/FALSE result of the operation - * - * RETURN: Status - * - * DESCRIPTION: Execute a logical AML opcode. The purpose of having all of the - * functions here is to prevent a lot of pointer dereferencing - * to obtain the operands and to simplify the generation of the - * logical value. For the Numeric operators (LAnd and LOr), both - * operands must be integers. For the other logical operators, - * operands can be any combination of Integer/String/Buffer. The - * first operand determines the type to which the second operand - * will be converted. - * - * Note: cleanest machine code seems to be produced by the code - * below, rather than using statements of the form: - * Result = (Operand0 == Operand1); - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExDoLogicalOp ( - UINT16 Opcode, - ACPI_OPERAND_OBJECT *Operand0, - ACPI_OPERAND_OBJECT *Operand1, - BOOLEAN *LogicalResult) -{ - ACPI_OPERAND_OBJECT *LocalOperand1 = Operand1; - UINT64 Integer0; - UINT64 Integer1; - UINT32 Length0; - UINT32 Length1; - ACPI_STATUS Status = AE_OK; - BOOLEAN LocalResult = FALSE; - int Compare; - - - ACPI_FUNCTION_TRACE (ExDoLogicalOp); - - - /* - * Convert the second operand if necessary. The first operand - * determines the type of the second operand, (See the Data Types - * section of the ACPI 3.0+ specification.) Both object types are - * guaranteed to be either Integer/String/Buffer by the operand - * resolution mechanism. - */ - switch (Operand0->Common.Type) - { - case ACPI_TYPE_INTEGER: - - Status = AcpiExConvertToInteger (Operand1, &LocalOperand1, - ACPI_IMPLICIT_CONVERSION); - break; - - case ACPI_TYPE_STRING: - - Status = AcpiExConvertToString ( - Operand1, &LocalOperand1, ACPI_IMPLICIT_CONVERT_HEX); - break; - - case ACPI_TYPE_BUFFER: - - Status = AcpiExConvertToBuffer (Operand1, &LocalOperand1); - break; - - default: - - ACPI_ERROR ((AE_INFO, - "Invalid object type for logical operator: %X", - Operand0->Common.Type)); - Status = AE_AML_INTERNAL; - break; - } - - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - /* - * Two cases: 1) Both Integers, 2) Both Strings or Buffers - */ - if (Operand0->Common.Type == ACPI_TYPE_INTEGER) - { - /* - * 1) Both operands are of type integer - * Note: LocalOperand1 may have changed above - */ - Integer0 = Operand0->Integer.Value; - Integer1 = LocalOperand1->Integer.Value; - - switch (Opcode) - { - case AML_LOGICAL_EQUAL_OP: /* LEqual (Operand0, Operand1) */ - - if (Integer0 == Integer1) - { - LocalResult = TRUE; - } - break; - - case AML_LOGICAL_GREATER_OP: /* LGreater (Operand0, Operand1) */ - - if (Integer0 > Integer1) - { - LocalResult = TRUE; - } - break; - - case AML_LOGICAL_LESS_OP: /* LLess (Operand0, Operand1) */ - - if (Integer0 < Integer1) - { - LocalResult = TRUE; - } - break; - - default: - - ACPI_ERROR ((AE_INFO, - "Invalid comparison opcode: %X", Opcode)); - Status = AE_AML_INTERNAL; - break; - } - } - else - { - /* - * 2) Both operands are Strings or both are Buffers - * Note: Code below takes advantage of common Buffer/String - * object fields. LocalOperand1 may have changed above. Use - * memcmp to handle nulls in buffers. - */ - Length0 = Operand0->Buffer.Length; - Length1 = LocalOperand1->Buffer.Length; - - /* Lexicographic compare: compare the data bytes */ - - Compare = memcmp (Operand0->Buffer.Pointer, - LocalOperand1->Buffer.Pointer, - (Length0 > Length1) ? Length1 : Length0); - - switch (Opcode) - { - case AML_LOGICAL_EQUAL_OP: /* LEqual (Operand0, Operand1) */ - - /* Length and all bytes must be equal */ - - if ((Length0 == Length1) && - (Compare == 0)) - { - /* Length and all bytes match ==> TRUE */ - - LocalResult = TRUE; - } - break; - - case AML_LOGICAL_GREATER_OP: /* LGreater (Operand0, Operand1) */ - - if (Compare > 0) - { - LocalResult = TRUE; - goto Cleanup; /* TRUE */ - } - if (Compare < 0) - { - goto Cleanup; /* FALSE */ - } - - /* Bytes match (to shortest length), compare lengths */ - - if (Length0 > Length1) - { - LocalResult = TRUE; - } - break; - - case AML_LOGICAL_LESS_OP: /* LLess (Operand0, Operand1) */ - - if (Compare > 0) - { - goto Cleanup; /* FALSE */ - } - if (Compare < 0) - { - LocalResult = TRUE; - goto Cleanup; /* TRUE */ - } - - /* Bytes match (to shortest length), compare lengths */ - - if (Length0 < Length1) - { - LocalResult = TRUE; - } - break; - - default: - - ACPI_ERROR ((AE_INFO, - "Invalid comparison opcode: %X", Opcode)); - Status = AE_AML_INTERNAL; - break; - } - } - -Cleanup: - - /* New object was created if implicit conversion performed - delete */ - - if (LocalOperand1 != Operand1) - { - AcpiUtRemoveReference (LocalOperand1); - } - - /* Return the logical result and status */ - - *LogicalResult = LocalResult; - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/exmutex.c b/drivers/acpica/exmutex.c deleted file mode 100644 index ba0ffe6..0000000 --- a/drivers/acpica/exmutex.c +++ /dev/null @@ -1,693 +0,0 @@ -/****************************************************************************** - * - * Module Name: exmutex - ASL Mutex Acquire/Release functions - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acinterp.h" -#include "acevents.h" - -#define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exmutex") - -/* Local prototypes */ - -static void -AcpiExLinkMutex ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_THREAD_STATE *Thread); - - -/******************************************************************************* - * - * FUNCTION: AcpiExUnlinkMutex - * - * PARAMETERS: ObjDesc - The mutex to be unlinked - * - * RETURN: None - * - * DESCRIPTION: Remove a mutex from the "AcquiredMutex" list - * - ******************************************************************************/ - -void -AcpiExUnlinkMutex ( - ACPI_OPERAND_OBJECT *ObjDesc) -{ - ACPI_THREAD_STATE *Thread = ObjDesc->Mutex.OwnerThread; - - - if (!Thread) - { - return; - } - - /* Doubly linked list */ - - if (ObjDesc->Mutex.Next) - { - (ObjDesc->Mutex.Next)->Mutex.Prev = ObjDesc->Mutex.Prev; - } - - if (ObjDesc->Mutex.Prev) - { - (ObjDesc->Mutex.Prev)->Mutex.Next = ObjDesc->Mutex.Next; - - /* - * Migrate the previous sync level associated with this mutex to - * the previous mutex on the list so that it may be preserved. - * This handles the case where several mutexes have been acquired - * at the same level, but are not released in opposite order. - */ - (ObjDesc->Mutex.Prev)->Mutex.OriginalSyncLevel = - ObjDesc->Mutex.OriginalSyncLevel; - } - else - { - Thread->AcquiredMutexList = ObjDesc->Mutex.Next; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExLinkMutex - * - * PARAMETERS: ObjDesc - The mutex to be linked - * Thread - Current executing thread object - * - * RETURN: None - * - * DESCRIPTION: Add a mutex to the "AcquiredMutex" list for this walk - * - ******************************************************************************/ - -static void -AcpiExLinkMutex ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_THREAD_STATE *Thread) -{ - ACPI_OPERAND_OBJECT *ListHead; - - - ListHead = Thread->AcquiredMutexList; - - /* This object will be the first object in the list */ - - ObjDesc->Mutex.Prev = NULL; - ObjDesc->Mutex.Next = ListHead; - - /* Update old first object to point back to this object */ - - if (ListHead) - { - ListHead->Mutex.Prev = ObjDesc; - } - - /* Update list head */ - - Thread->AcquiredMutexList = ObjDesc; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExAcquireMutexObject - * - * PARAMETERS: Timeout - Timeout in milliseconds - * ObjDesc - Mutex object - * ThreadId - Current thread state - * - * RETURN: Status - * - * DESCRIPTION: Acquire an AML mutex, low-level interface. Provides a common - * path that supports multiple acquires by the same thread. - * - * MUTEX: Interpreter must be locked - * - * NOTE: This interface is called from three places: - * 1) From AcpiExAcquireMutex, via an AML Acquire() operator - * 2) From AcpiExAcquireGlobalLock when an AML Field access requires the - * global lock - * 3) From the external interface, AcpiAcquireGlobalLock - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExAcquireMutexObject ( - UINT16 Timeout, - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_THREAD_ID ThreadId) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE_PTR (ExAcquireMutexObject, ObjDesc); - - - if (!ObjDesc) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* Support for multiple acquires by the owning thread */ - - if (ObjDesc->Mutex.ThreadId == ThreadId) - { - /* - * The mutex is already owned by this thread, just increment the - * acquisition depth - */ - ObjDesc->Mutex.AcquisitionDepth++; - return_ACPI_STATUS (AE_OK); - } - - /* Acquire the mutex, wait if necessary. Special case for Global Lock */ - - if (ObjDesc == AcpiGbl_GlobalLockMutex) - { - Status = AcpiEvAcquireGlobalLock (Timeout); - } - else - { - Status = AcpiExSystemWaitMutex (ObjDesc->Mutex.OsMutex, Timeout); - } - - if (ACPI_FAILURE (Status)) - { - /* Includes failure from a timeout on TimeDesc */ - - return_ACPI_STATUS (Status); - } - - /* Acquired the mutex: update mutex object */ - - ObjDesc->Mutex.ThreadId = ThreadId; - ObjDesc->Mutex.AcquisitionDepth = 1; - ObjDesc->Mutex.OriginalSyncLevel = 0; - ObjDesc->Mutex.OwnerThread = NULL; /* Used only for AML Acquire() */ - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExAcquireMutex - * - * PARAMETERS: TimeDesc - Timeout integer - * ObjDesc - Mutex object - * WalkState - Current method execution state - * - * RETURN: Status - * - * DESCRIPTION: Acquire an AML mutex - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExAcquireMutex ( - ACPI_OPERAND_OBJECT *TimeDesc, - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE_PTR (ExAcquireMutex, ObjDesc); - - - if (!ObjDesc) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* Must have a valid thread state struct */ - - if (!WalkState->Thread) - { - ACPI_ERROR ((AE_INFO, - "Cannot acquire Mutex [%4.4s], null thread info", - AcpiUtGetNodeName (ObjDesc->Mutex.Node))); - return_ACPI_STATUS (AE_AML_INTERNAL); - } - - /* - * Current sync level must be less than or equal to the sync level - * of the mutex. This mechanism provides some deadlock prevention. - */ - if (WalkState->Thread->CurrentSyncLevel > ObjDesc->Mutex.SyncLevel) - { - ACPI_ERROR ((AE_INFO, - "Cannot acquire Mutex [%4.4s], " - "current SyncLevel is too large (%u)", - AcpiUtGetNodeName (ObjDesc->Mutex.Node), - WalkState->Thread->CurrentSyncLevel)); - return_ACPI_STATUS (AE_AML_MUTEX_ORDER); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Acquiring: Mutex SyncLevel %u, Thread SyncLevel %u, " - "Depth %u TID %p\n", - ObjDesc->Mutex.SyncLevel, WalkState->Thread->CurrentSyncLevel, - ObjDesc->Mutex.AcquisitionDepth, WalkState->Thread)); - - Status = AcpiExAcquireMutexObject ((UINT16) TimeDesc->Integer.Value, - ObjDesc, WalkState->Thread->ThreadId); - - if (ACPI_SUCCESS (Status) && ObjDesc->Mutex.AcquisitionDepth == 1) - { - /* Save Thread object, original/current sync levels */ - - ObjDesc->Mutex.OwnerThread = WalkState->Thread; - ObjDesc->Mutex.OriginalSyncLevel = - WalkState->Thread->CurrentSyncLevel; - WalkState->Thread->CurrentSyncLevel = - ObjDesc->Mutex.SyncLevel; - - /* Link the mutex to the current thread for force-unlock at method exit */ - - AcpiExLinkMutex (ObjDesc, WalkState->Thread); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Acquired: Mutex SyncLevel %u, Thread SyncLevel %u, Depth %u\n", - ObjDesc->Mutex.SyncLevel, WalkState->Thread->CurrentSyncLevel, - ObjDesc->Mutex.AcquisitionDepth)); - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExReleaseMutexObject - * - * PARAMETERS: ObjDesc - The object descriptor for this op - * - * RETURN: Status - * - * DESCRIPTION: Release a previously acquired Mutex, low level interface. - * Provides a common path that supports multiple releases (after - * previous multiple acquires) by the same thread. - * - * MUTEX: Interpreter must be locked - * - * NOTE: This interface is called from three places: - * 1) From AcpiExReleaseMutex, via an AML Acquire() operator - * 2) From AcpiExReleaseGlobalLock when an AML Field access requires the - * global lock - * 3) From the external interface, AcpiReleaseGlobalLock - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExReleaseMutexObject ( - ACPI_OPERAND_OBJECT *ObjDesc) -{ - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE (ExReleaseMutexObject); - - - if (ObjDesc->Mutex.AcquisitionDepth == 0) - { - return_ACPI_STATUS (AE_NOT_ACQUIRED); - } - - /* Match multiple Acquires with multiple Releases */ - - ObjDesc->Mutex.AcquisitionDepth--; - if (ObjDesc->Mutex.AcquisitionDepth != 0) - { - /* Just decrement the depth and return */ - - return_ACPI_STATUS (AE_OK); - } - - if (ObjDesc->Mutex.OwnerThread) - { - /* Unlink the mutex from the owner's list */ - - AcpiExUnlinkMutex (ObjDesc); - ObjDesc->Mutex.OwnerThread = NULL; - } - - /* Release the mutex, special case for Global Lock */ - - if (ObjDesc == AcpiGbl_GlobalLockMutex) - { - Status = AcpiEvReleaseGlobalLock (); - } - else - { - AcpiOsReleaseMutex (ObjDesc->Mutex.OsMutex); - } - - /* Clear mutex info */ - - ObjDesc->Mutex.ThreadId = 0; - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExReleaseMutex - * - * PARAMETERS: ObjDesc - The object descriptor for this op - * WalkState - Current method execution state - * - * RETURN: Status - * - * DESCRIPTION: Release a previously acquired Mutex. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExReleaseMutex ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_WALK_STATE *WalkState) -{ - UINT8 PreviousSyncLevel; - ACPI_THREAD_STATE *OwnerThread; - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE (ExReleaseMutex); - - - if (!ObjDesc) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - OwnerThread = ObjDesc->Mutex.OwnerThread; - - /* The mutex must have been previously acquired in order to release it */ - - if (!OwnerThread) - { - ACPI_ERROR ((AE_INFO, - "Cannot release Mutex [%4.4s], not acquired", - AcpiUtGetNodeName (ObjDesc->Mutex.Node))); - return_ACPI_STATUS (AE_AML_MUTEX_NOT_ACQUIRED); - } - - /* Must have a valid thread ID */ - - if (!WalkState->Thread) - { - ACPI_ERROR ((AE_INFO, - "Cannot release Mutex [%4.4s], null thread info", - AcpiUtGetNodeName (ObjDesc->Mutex.Node))); - return_ACPI_STATUS (AE_AML_INTERNAL); - } - - /* - * The Mutex is owned, but this thread must be the owner. - * Special case for Global Lock, any thread can release - */ - if ((OwnerThread->ThreadId != WalkState->Thread->ThreadId) && - (ObjDesc != AcpiGbl_GlobalLockMutex)) - { - ACPI_ERROR ((AE_INFO, - "Thread %u cannot release Mutex [%4.4s] acquired by thread %u", - (UINT32) WalkState->Thread->ThreadId, - AcpiUtGetNodeName (ObjDesc->Mutex.Node), - (UINT32) OwnerThread->ThreadId)); - return_ACPI_STATUS (AE_AML_NOT_OWNER); - } - - /* - * The sync level of the mutex must be equal to the current sync level. In - * other words, the current level means that at least one mutex at that - * level is currently being held. Attempting to release a mutex of a - * different level can only mean that the mutex ordering rule is being - * violated. This behavior is clarified in ACPI 4.0 specification. - */ - if (ObjDesc->Mutex.SyncLevel != OwnerThread->CurrentSyncLevel) - { - ACPI_ERROR ((AE_INFO, - "Cannot release Mutex [%4.4s], SyncLevel mismatch: " - "mutex %u current %u", - AcpiUtGetNodeName (ObjDesc->Mutex.Node), - ObjDesc->Mutex.SyncLevel, WalkState->Thread->CurrentSyncLevel)); - return_ACPI_STATUS (AE_AML_MUTEX_ORDER); - } - - /* - * Get the previous SyncLevel from the head of the acquired mutex list. - * This handles the case where several mutexes at the same level have been - * acquired, but are not released in reverse order. - */ - PreviousSyncLevel = - OwnerThread->AcquiredMutexList->Mutex.OriginalSyncLevel; - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Releasing: Object SyncLevel %u, Thread SyncLevel %u, " - "Prev SyncLevel %u, Depth %u TID %p\n", - ObjDesc->Mutex.SyncLevel, WalkState->Thread->CurrentSyncLevel, - PreviousSyncLevel, ObjDesc->Mutex.AcquisitionDepth, - WalkState->Thread)); - - Status = AcpiExReleaseMutexObject (ObjDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - if (ObjDesc->Mutex.AcquisitionDepth == 0) - { - /* Restore the previous SyncLevel */ - - OwnerThread->CurrentSyncLevel = PreviousSyncLevel; - } - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Released: Object SyncLevel %u, Thread SyncLevel, %u, " - "Prev SyncLevel %u, Depth %u\n", - ObjDesc->Mutex.SyncLevel, WalkState->Thread->CurrentSyncLevel, - PreviousSyncLevel, ObjDesc->Mutex.AcquisitionDepth)); - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExReleaseAllMutexes - * - * PARAMETERS: Thread - Current executing thread object - * - * RETURN: Status - * - * DESCRIPTION: Release all mutexes held by this thread - * - * NOTE: This function is called as the thread is exiting the interpreter. - * Mutexes are not released when an individual control method is exited, but - * only when the parent thread actually exits the interpreter. This allows one - * method to acquire a mutex, and a different method to release it, as long as - * this is performed underneath a single parent control method. - * - ******************************************************************************/ - -void -AcpiExReleaseAllMutexes ( - ACPI_THREAD_STATE *Thread) -{ - ACPI_OPERAND_OBJECT *Next = Thread->AcquiredMutexList; - ACPI_OPERAND_OBJECT *ObjDesc; - - - ACPI_FUNCTION_TRACE (ExReleaseAllMutexes); - - - /* Traverse the list of owned mutexes, releasing each one */ - - while (Next) - { - ObjDesc = Next; - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Mutex [%4.4s] force-release, SyncLevel %u Depth %u\n", - ObjDesc->Mutex.Node->Name.Ascii, ObjDesc->Mutex.SyncLevel, - ObjDesc->Mutex.AcquisitionDepth)); - - /* Release the mutex, special case for Global Lock */ - - if (ObjDesc == AcpiGbl_GlobalLockMutex) - { - /* Ignore errors */ - - (void) AcpiEvReleaseGlobalLock (); - } - else - { - AcpiOsReleaseMutex (ObjDesc->Mutex.OsMutex); - } - - /* Update Thread SyncLevel (Last mutex is the important one) */ - - Thread->CurrentSyncLevel = ObjDesc->Mutex.OriginalSyncLevel; - - /* Mark mutex unowned */ - - Next = ObjDesc->Mutex.Next; - - ObjDesc->Mutex.Prev = NULL; - ObjDesc->Mutex.Next = NULL; - ObjDesc->Mutex.AcquisitionDepth = 0; - ObjDesc->Mutex.OwnerThread = NULL; - ObjDesc->Mutex.ThreadId = 0; - } - - return_VOID; -} diff --git a/drivers/acpica/exnames.c b/drivers/acpica/exnames.c deleted file mode 100644 index 46996ba..0000000 --- a/drivers/acpica/exnames.c +++ /dev/null @@ -1,585 +0,0 @@ -/****************************************************************************** - * - * Module Name: exnames - interpreter/scanner name load/execute - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acinterp.h" -#include "amlcode.h" - -#define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exnames") - -/* Local prototypes */ - -static char * -AcpiExAllocateNameString ( - UINT32 PrefixCount, - UINT32 NumNameSegs); - -static ACPI_STATUS -AcpiExNameSegment ( - UINT8 **InAmlAddress, - char *NameString); - - -/******************************************************************************* - * - * FUNCTION: AcpiExAllocateNameString - * - * PARAMETERS: PrefixCount - Count of parent levels. Special cases: - * (-1)==root, 0==none - * NumNameSegs - count of 4-character name segments - * - * RETURN: A pointer to the allocated string segment. This segment must - * be deleted by the caller. - * - * DESCRIPTION: Allocate a buffer for a name string. Ensure allocated name - * string is long enough, and set up prefix if any. - * - ******************************************************************************/ - -static char * -AcpiExAllocateNameString ( - UINT32 PrefixCount, - UINT32 NumNameSegs) -{ - char *TempPtr; - char *NameString; - UINT32 SizeNeeded; - - ACPI_FUNCTION_TRACE (ExAllocateNameString); - - - /* - * Allow room for all \ and ^ prefixes, all segments and a MultiNamePrefix. - * Also, one byte for the null terminator. - * This may actually be somewhat longer than needed. - */ - if (PrefixCount == ACPI_UINT32_MAX) - { - /* Special case for root */ - - SizeNeeded = 1 + (ACPI_NAMESEG_SIZE * NumNameSegs) + 2 + 1; - } - else - { - SizeNeeded = PrefixCount + (ACPI_NAMESEG_SIZE * NumNameSegs) + 2 + 1; - } - - /* - * Allocate a buffer for the name. - * This buffer must be deleted by the caller! - */ - NameString = ACPI_ALLOCATE (SizeNeeded); - if (!NameString) - { - ACPI_ERROR ((AE_INFO, - "Could not allocate size %u", SizeNeeded)); - return_PTR (NULL); - } - - TempPtr = NameString; - - /* Set up Root or Parent prefixes if needed */ - - if (PrefixCount == ACPI_UINT32_MAX) - { - *TempPtr++ = AML_ROOT_PREFIX; - } - else - { - while (PrefixCount--) - { - *TempPtr++ = AML_PARENT_PREFIX; - } - } - - - /* Set up Dual or Multi prefixes if needed */ - - if (NumNameSegs > 2) - { - /* Set up multi prefixes */ - - *TempPtr++ = AML_MULTI_NAME_PREFIX; - *TempPtr++ = (char) NumNameSegs; - } - else if (2 == NumNameSegs) - { - /* Set up dual prefixes */ - - *TempPtr++ = AML_DUAL_NAME_PREFIX; - } - - /* - * Terminate string following prefixes. AcpiExNameSegment() will - * append the segment(s) - */ - *TempPtr = 0; - - return_PTR (NameString); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExNameSegment - * - * PARAMETERS: InAmlAddress - Pointer to the name in the AML code - * NameString - Where to return the name. The name is appended - * to any existing string to form a namepath - * - * RETURN: Status - * - * DESCRIPTION: Extract an ACPI name (4 bytes) from the AML byte stream - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiExNameSegment ( - UINT8 **InAmlAddress, - char *NameString) -{ - char *AmlAddress = (void *) *InAmlAddress; - ACPI_STATUS Status = AE_OK; - UINT32 Index; - char CharBuf[5]; - - - ACPI_FUNCTION_TRACE (ExNameSegment); - - - /* - * If first character is a digit, then we know that we aren't looking - * at a valid name segment - */ - CharBuf[0] = *AmlAddress; - - if ('0' <= CharBuf[0] && CharBuf[0] <= '9') - { - ACPI_ERROR ((AE_INFO, "Invalid leading digit: %c", CharBuf[0])); - return_ACPI_STATUS (AE_CTRL_PENDING); - } - - for (Index = 0; - (Index < ACPI_NAMESEG_SIZE) && (AcpiUtValidNameChar (*AmlAddress, 0)); - Index++) - { - CharBuf[Index] = *AmlAddress++; - } - - - /* Valid name segment */ - - if (Index == 4) - { - /* Found 4 valid characters */ - - CharBuf[4] = '\0'; - - if (NameString) - { - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Appending NameSeg %s\n", CharBuf)); - strcat (NameString, CharBuf); - } - else - { - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "No Name string - %s\n", CharBuf)); - } - } - else if (Index == 0) - { - /* - * First character was not a valid name character, - * so we are looking at something other than a name. - */ - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Leading character is not alpha: %02Xh (not a name)\n", - CharBuf[0])); - Status = AE_CTRL_PENDING; - } - else - { - /* - * Segment started with one or more valid characters, but fewer than - * the required 4 - */ - Status = AE_AML_BAD_NAME; - ACPI_ERROR ((AE_INFO, - "Bad character 0x%02x in name, at %p", - *AmlAddress, AmlAddress)); - } - - *InAmlAddress = ACPI_CAST_PTR (UINT8, AmlAddress); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExGetNameString - * - * PARAMETERS: DataType - Object type to be associated with this - * name - * InAmlAddress - Pointer to the namestring in the AML code - * OutNameString - Where the namestring is returned - * OutNameLength - Length of the returned string - * - * RETURN: Status, namestring and length - * - * DESCRIPTION: Extract a full namepath from the AML byte stream, - * including any prefixes. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExGetNameString ( - ACPI_OBJECT_TYPE DataType, - UINT8 *InAmlAddress, - char **OutNameString, - UINT32 *OutNameLength) -{ - ACPI_STATUS Status = AE_OK; - UINT8 *AmlAddress = InAmlAddress; - char *NameString = NULL; - UINT32 NumSegments; - UINT32 PrefixCount = 0; - BOOLEAN HasPrefix = FALSE; - - - ACPI_FUNCTION_TRACE_PTR (ExGetNameString, AmlAddress); - - - if (ACPI_TYPE_LOCAL_REGION_FIELD == DataType || - ACPI_TYPE_LOCAL_BANK_FIELD == DataType || - ACPI_TYPE_LOCAL_INDEX_FIELD == DataType) - { - /* Disallow prefixes for types associated with FieldUnit names */ - - NameString = AcpiExAllocateNameString (0, 1); - if (!NameString) - { - Status = AE_NO_MEMORY; - } - else - { - Status = AcpiExNameSegment (&AmlAddress, NameString); - } - } - else - { - /* - * DataType is not a field name. - * Examine first character of name for root or parent prefix operators - */ - switch (*AmlAddress) - { - case AML_ROOT_PREFIX: - - ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "RootPrefix(\\) at %p\n", - AmlAddress)); - - /* - * Remember that we have a RootPrefix -- - * see comment in AcpiExAllocateNameString() - */ - AmlAddress++; - PrefixCount = ACPI_UINT32_MAX; - HasPrefix = TRUE; - break; - - case AML_PARENT_PREFIX: - - /* Increment past possibly multiple parent prefixes */ - - do - { - ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "ParentPrefix (^) at %p\n", - AmlAddress)); - - AmlAddress++; - PrefixCount++; - - } while (*AmlAddress == AML_PARENT_PREFIX); - - HasPrefix = TRUE; - break; - - default: - - /* Not a prefix character */ - - break; - } - - /* Examine first character of name for name segment prefix operator */ - - switch (*AmlAddress) - { - case AML_DUAL_NAME_PREFIX: - - ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "DualNamePrefix at %p\n", - AmlAddress)); - - AmlAddress++; - NameString = AcpiExAllocateNameString (PrefixCount, 2); - if (!NameString) - { - Status = AE_NO_MEMORY; - break; - } - - /* Indicate that we processed a prefix */ - - HasPrefix = TRUE; - - Status = AcpiExNameSegment (&AmlAddress, NameString); - if (ACPI_SUCCESS (Status)) - { - Status = AcpiExNameSegment (&AmlAddress, NameString); - } - break; - - case AML_MULTI_NAME_PREFIX: - - ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "MultiNamePrefix at %p\n", - AmlAddress)); - - /* Fetch count of segments remaining in name path */ - - AmlAddress++; - NumSegments = *AmlAddress; - - NameString = AcpiExAllocateNameString ( - PrefixCount, NumSegments); - if (!NameString) - { - Status = AE_NO_MEMORY; - break; - } - - /* Indicate that we processed a prefix */ - - AmlAddress++; - HasPrefix = TRUE; - - while (NumSegments && - (Status = AcpiExNameSegment (&AmlAddress, NameString)) == - AE_OK) - { - NumSegments--; - } - - break; - - case 0: - - /* NullName valid as of 8-12-98 ASL/AML Grammar Update */ - - if (PrefixCount == ACPI_UINT32_MAX) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "NameSeg is \"\\\" followed by NULL\n")); - } - - /* Consume the NULL byte */ - - AmlAddress++; - NameString = AcpiExAllocateNameString (PrefixCount, 0); - if (!NameString) - { - Status = AE_NO_MEMORY; - break; - } - - break; - - default: - - /* Name segment string */ - - NameString = AcpiExAllocateNameString (PrefixCount, 1); - if (!NameString) - { - Status = AE_NO_MEMORY; - break; - } - - Status = AcpiExNameSegment (&AmlAddress, NameString); - break; - } - } - - if (AE_CTRL_PENDING == Status && HasPrefix) - { - /* Ran out of segments after processing a prefix */ - - ACPI_ERROR ((AE_INFO, - "Malformed Name at %p", NameString)); - Status = AE_AML_BAD_NAME; - } - - if (ACPI_FAILURE (Status)) - { - if (NameString) - { - ACPI_FREE (NameString); - } - return_ACPI_STATUS (Status); - } - - *OutNameString = NameString; - *OutNameLength = (UINT32) (AmlAddress - InAmlAddress); - - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/exoparg1.c b/drivers/acpica/exoparg1.c deleted file mode 100644 index 339c4d3..0000000 --- a/drivers/acpica/exoparg1.c +++ /dev/null @@ -1,1269 +0,0 @@ -/****************************************************************************** - * - * Module Name: exoparg1 - AML execution - opcodes with 1 argument - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acparser.h" -#include "acdispat.h" -#include "acinterp.h" -#include "amlcode.h" -#include "acnamesp.h" - - -#define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exoparg1") - - -/*! - * Naming convention for AML interpreter execution routines. - * - * The routines that begin execution of AML opcodes are named with a common - * convention based upon the number of arguments, the number of target operands, - * and whether or not a value is returned: - * - * AcpiExOpcode_xA_yT_zR - * - * Where: - * - * xA - ARGUMENTS: The number of arguments (input operands) that are - * required for this opcode type (0 through 6 args). - * yT - TARGETS: The number of targets (output operands) that are required - * for this opcode type (0, 1, or 2 targets). - * zR - RETURN VALUE: Indicates whether this opcode type returns a value - * as the function return (0 or 1). - * - * The AcpiExOpcode* functions are called via the Dispatcher component with - * fully resolved operands. -!*/ - -/******************************************************************************* - * - * FUNCTION: AcpiExOpcode_0A_0T_1R - * - * PARAMETERS: WalkState - Current state (contains AML opcode) - * - * RETURN: Status - * - * DESCRIPTION: Execute operator with no operands, one return value - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExOpcode_0A_0T_1R ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status = AE_OK; - ACPI_OPERAND_OBJECT *ReturnDesc = NULL; - - - ACPI_FUNCTION_TRACE_STR (ExOpcode_0A_0T_1R, - AcpiPsGetOpcodeName (WalkState->Opcode)); - - - /* Examine the AML opcode */ - - switch (WalkState->Opcode) - { - case AML_TIMER_OP: /* Timer () */ - - /* Create a return object of type Integer */ - - ReturnDesc = AcpiUtCreateIntegerObject (AcpiOsGetTimer ()); - if (!ReturnDesc) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - break; - - default: /* Unknown opcode */ - - ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X", - WalkState->Opcode)); - Status = AE_AML_BAD_OPCODE; - break; - } - -Cleanup: - - /* Delete return object on error */ - - if ((ACPI_FAILURE (Status)) || WalkState->ResultObj) - { - AcpiUtRemoveReference (ReturnDesc); - WalkState->ResultObj = NULL; - } - else - { - /* Save the return value */ - - WalkState->ResultObj = ReturnDesc; - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExOpcode_1A_0T_0R - * - * PARAMETERS: WalkState - Current state (contains AML opcode) - * - * RETURN: Status - * - * DESCRIPTION: Execute Type 1 monadic operator with numeric operand on - * object stack - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExOpcode_1A_0T_0R ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE_STR (ExOpcode_1A_0T_0R, - AcpiPsGetOpcodeName (WalkState->Opcode)); - - - /* Examine the AML opcode */ - - switch (WalkState->Opcode) - { - case AML_RELEASE_OP: /* Release (MutexObject) */ - - Status = AcpiExReleaseMutex (Operand[0], WalkState); - break; - - case AML_RESET_OP: /* Reset (EventObject) */ - - Status = AcpiExSystemResetEvent (Operand[0]); - break; - - case AML_SIGNAL_OP: /* Signal (EventObject) */ - - Status = AcpiExSystemSignalEvent (Operand[0]); - break; - - case AML_SLEEP_OP: /* Sleep (MsecTime) */ - - Status = AcpiExSystemDoSleep (Operand[0]->Integer.Value); - break; - - case AML_STALL_OP: /* Stall (UsecTime) */ - - Status = AcpiExSystemDoStall ((UINT32) Operand[0]->Integer.Value); - break; - - case AML_UNLOAD_OP: /* Unload (Handle) */ - - Status = AcpiExUnloadTable (Operand[0]); - break; - - default: /* Unknown opcode */ - - ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X", - WalkState->Opcode)); - Status = AE_AML_BAD_OPCODE; - break; - } - - return_ACPI_STATUS (Status); -} - - -#ifdef _OBSOLETE_CODE /* Was originally used for Load() operator */ -/******************************************************************************* - * - * FUNCTION: AcpiExOpcode_1A_1T_0R - * - * PARAMETERS: WalkState - Current state (contains AML opcode) - * - * RETURN: Status - * - * DESCRIPTION: Execute opcode with one argument, one target, and no - * return value. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExOpcode_1A_1T_0R ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status = AE_OK; - ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; - - - ACPI_FUNCTION_TRACE_STR (ExOpcode_1A_1T_0R, - AcpiPsGetOpcodeName (WalkState->Opcode)); - - - /* Examine the AML opcode */ - - switch (WalkState->Opcode) - { -#ifdef _OBSOLETE_CODE - case AML_LOAD_OP: - - Status = AcpiExLoadOp (Operand[0], Operand[1], WalkState); - break; -#endif - - default: /* Unknown opcode */ - - ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X", - WalkState->Opcode)); - Status = AE_AML_BAD_OPCODE; - goto Cleanup; - } - - -Cleanup: - - return_ACPI_STATUS (Status); -} -#endif - -/******************************************************************************* - * - * FUNCTION: AcpiExOpcode_1A_1T_1R - * - * PARAMETERS: WalkState - Current state (contains AML opcode) - * - * RETURN: Status - * - * DESCRIPTION: Execute opcode with one argument, one target, and a - * return value. - * January 2022: Added Load operator, with new ACPI 6.4 - * semantics. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExOpcode_1A_1T_1R ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status = AE_OK; - ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; - ACPI_OPERAND_OBJECT *ReturnDesc = NULL; - ACPI_OPERAND_OBJECT *ReturnDesc2 = NULL; - UINT32 Temp32; - UINT32 i; - UINT64 PowerOfTen; - UINT64 Digit; - - - ACPI_FUNCTION_TRACE_STR (ExOpcode_1A_1T_1R, - AcpiPsGetOpcodeName (WalkState->Opcode)); - - - /* Examine the AML opcode */ - - switch (WalkState->Opcode) - { - case AML_BIT_NOT_OP: - case AML_FIND_SET_LEFT_BIT_OP: - case AML_FIND_SET_RIGHT_BIT_OP: - case AML_FROM_BCD_OP: - case AML_LOAD_OP: - case AML_TO_BCD_OP: - case AML_CONDITIONAL_REF_OF_OP: - - /* Create a return object of type Integer for these opcodes */ - - ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); - if (!ReturnDesc) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - switch (WalkState->Opcode) - { - case AML_BIT_NOT_OP: /* Not (Operand, Result) */ - - ReturnDesc->Integer.Value = ~Operand[0]->Integer.Value; - break; - - case AML_FIND_SET_LEFT_BIT_OP: /* FindSetLeftBit (Operand, Result) */ - - ReturnDesc->Integer.Value = Operand[0]->Integer.Value; - - /* - * Acpi specification describes Integer type as a little - * endian unsigned value, so this boundary condition is valid. - */ - for (Temp32 = 0; ReturnDesc->Integer.Value && - Temp32 < ACPI_INTEGER_BIT_SIZE; ++Temp32) - { - ReturnDesc->Integer.Value >>= 1; - } - - ReturnDesc->Integer.Value = Temp32; - break; - - case AML_FIND_SET_RIGHT_BIT_OP: /* FindSetRightBit (Operand, Result) */ - - ReturnDesc->Integer.Value = Operand[0]->Integer.Value; - - /* - * The Acpi specification describes Integer type as a little - * endian unsigned value, so this boundary condition is valid. - */ - for (Temp32 = 0; ReturnDesc->Integer.Value && - Temp32 < ACPI_INTEGER_BIT_SIZE; ++Temp32) - { - ReturnDesc->Integer.Value <<= 1; - } - - /* Since the bit position is one-based, subtract from 33 (65) */ - - ReturnDesc->Integer.Value = - Temp32 == 0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - Temp32; - break; - - case AML_FROM_BCD_OP: /* FromBcd (BCDValue, Result) */ - /* - * The 64-bit ACPI integer can hold 16 4-bit BCD characters - * (if table is 32-bit, integer can hold 8 BCD characters) - * Convert each 4-bit BCD value - */ - PowerOfTen = 1; - ReturnDesc->Integer.Value = 0; - Digit = Operand[0]->Integer.Value; - - /* Convert each BCD digit (each is one nybble wide) */ - - for (i = 0; (i < AcpiGbl_IntegerNybbleWidth) && (Digit > 0); i++) - { - /* Get the least significant 4-bit BCD digit */ - - Temp32 = ((UINT32) Digit) & 0xF; - - /* Check the range of the digit */ - - if (Temp32 > 9) - { - ACPI_ERROR ((AE_INFO, - "BCD digit too large (not decimal): 0x%X", - Temp32)); - - Status = AE_AML_NUMERIC_OVERFLOW; - goto Cleanup; - } - - /* Sum the digit into the result with the current power of 10 */ - - ReturnDesc->Integer.Value += - (((UINT64) Temp32) * PowerOfTen); - - /* Shift to next BCD digit */ - - Digit >>= 4; - - /* Next power of 10 */ - - PowerOfTen *= 10; - } - break; - - case AML_LOAD_OP: /* Result1 = Load (Operand[0], Result1) */ - - ReturnDesc->Integer.Value = 0; - Status = AcpiExLoadOp (Operand[0], ReturnDesc, WalkState); - if (ACPI_SUCCESS (Status)) - { - /* Return -1 (non-zero) indicates success */ - - ReturnDesc->Integer.Value = 0xFFFFFFFFFFFFFFFF; - } - break; - - case AML_TO_BCD_OP: /* ToBcd (Operand, Result) */ - - ReturnDesc->Integer.Value = 0; - Digit = Operand[0]->Integer.Value; - - /* Each BCD digit is one nybble wide */ - - for (i = 0; (i < AcpiGbl_IntegerNybbleWidth) && (Digit > 0); i++) - { - (void) AcpiUtShortDivide (Digit, 10, &Digit, &Temp32); - - /* - * Insert the BCD digit that resides in the - * remainder from above - */ - ReturnDesc->Integer.Value |= - (((UINT64) Temp32) << ACPI_MUL_4 (i)); - } - - /* Overflow if there is any data left in Digit */ - - if (Digit > 0) - { - ACPI_ERROR ((AE_INFO, - "Integer too large to convert to BCD: 0x%8.8X%8.8X", - ACPI_FORMAT_UINT64 (Operand[0]->Integer.Value))); - Status = AE_AML_NUMERIC_OVERFLOW; - goto Cleanup; - } - break; - - case AML_CONDITIONAL_REF_OF_OP: /* CondRefOf (SourceObject, Result) */ - /* - * This op is a little strange because the internal return value is - * different than the return value stored in the result descriptor - * (There are really two return values) - */ - if ((ACPI_NAMESPACE_NODE *) Operand[0] == AcpiGbl_RootNode) - { - /* - * This means that the object does not exist in the namespace, - * return FALSE - */ - ReturnDesc->Integer.Value = 0; - goto Cleanup; - } - - /* Get the object reference, store it, and remove our reference */ - - Status = AcpiExGetObjectReference (Operand[0], - &ReturnDesc2, WalkState); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - Status = AcpiExStore (ReturnDesc2, Operand[1], WalkState); - AcpiUtRemoveReference (ReturnDesc2); - - /* The object exists in the namespace, return TRUE */ - - ReturnDesc->Integer.Value = ACPI_UINT64_MAX; - goto Cleanup; - - - default: - - /* No other opcodes get here */ - - break; - } - break; - - case AML_STORE_OP: /* Store (Source, Target) */ - /* - * A store operand is typically a number, string, buffer or lvalue - * Be careful about deleting the source object, - * since the object itself may have been stored. - */ - Status = AcpiExStore (Operand[0], Operand[1], WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* It is possible that the Store already produced a return object */ - - if (!WalkState->ResultObj) - { - /* - * Normally, we would remove a reference on the Operand[0] - * parameter; But since it is being used as the internal return - * object (meaning we would normally increment it), the two - * cancel out, and we simply don't do anything. - */ - WalkState->ResultObj = Operand[0]; - WalkState->Operands[0] = NULL; /* Prevent deletion */ - } - return_ACPI_STATUS (Status); - - /* - * ACPI 2.0 Opcodes - */ - case AML_COPY_OBJECT_OP: /* CopyObject (Source, Target) */ - - Status = AcpiUtCopyIobjectToIobject ( - Operand[0], &ReturnDesc, WalkState); - break; - - case AML_TO_DECIMAL_STRING_OP: /* ToDecimalString (Data, Result) */ - - Status = AcpiExConvertToString ( - Operand[0], &ReturnDesc, ACPI_EXPLICIT_CONVERT_DECIMAL); - if (ReturnDesc == Operand[0]) - { - /* No conversion performed, add ref to handle return value */ - - AcpiUtAddReference (ReturnDesc); - } - break; - - case AML_TO_HEX_STRING_OP: /* ToHexString (Data, Result) */ - - Status = AcpiExConvertToString ( - Operand[0], &ReturnDesc, ACPI_EXPLICIT_CONVERT_HEX); - if (ReturnDesc == Operand[0]) - { - /* No conversion performed, add ref to handle return value */ - - AcpiUtAddReference (ReturnDesc); - } - break; - - case AML_TO_BUFFER_OP: /* ToBuffer (Data, Result) */ - - Status = AcpiExConvertToBuffer (Operand[0], &ReturnDesc); - if (ReturnDesc == Operand[0]) - { - /* No conversion performed, add ref to handle return value */ - - AcpiUtAddReference (ReturnDesc); - } - break; - - case AML_TO_INTEGER_OP: /* ToInteger (Data, Result) */ - - /* Perform "explicit" conversion */ - - Status = AcpiExConvertToInteger (Operand[0], &ReturnDesc, 0); - if (ReturnDesc == Operand[0]) - { - /* No conversion performed, add ref to handle return value */ - - AcpiUtAddReference (ReturnDesc); - } - break; - - case AML_SHIFT_LEFT_BIT_OP: /* ShiftLeftBit (Source, BitNum) */ - case AML_SHIFT_RIGHT_BIT_OP: /* ShiftRightBit (Source, BitNum) */ - - /* These are two obsolete opcodes */ - - ACPI_ERROR ((AE_INFO, - "%s is obsolete and not implemented", - AcpiPsGetOpcodeName (WalkState->Opcode))); - Status = AE_SUPPORT; - goto Cleanup; - - default: /* Unknown opcode */ - - ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X", - WalkState->Opcode)); - Status = AE_AML_BAD_OPCODE; - goto Cleanup; - } - - if (ACPI_SUCCESS (Status)) - { - /* Store the return value computed above into the target object */ - - Status = AcpiExStore (ReturnDesc, Operand[1], WalkState); - } - - -Cleanup: - - /* Delete return object on error */ - - if (ACPI_FAILURE (Status)) - { - AcpiUtRemoveReference (ReturnDesc); - } - - /* Save return object on success */ - - else if (!WalkState->ResultObj) - { - WalkState->ResultObj = ReturnDesc; - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExOpcode_1A_0T_1R - * - * PARAMETERS: WalkState - Current state (contains AML opcode) - * - * RETURN: Status - * - * DESCRIPTION: Execute opcode with one argument, no target, and a return value - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExOpcode_1A_0T_1R ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; - ACPI_OPERAND_OBJECT *TempDesc; - ACPI_OPERAND_OBJECT *ReturnDesc = NULL; - ACPI_STATUS Status = AE_OK; - UINT32 Type; - UINT64 Value; - - - ACPI_FUNCTION_TRACE_STR (ExOpcode_1A_0T_1R, - AcpiPsGetOpcodeName (WalkState->Opcode)); - - - /* Examine the AML opcode */ - - switch (WalkState->Opcode) - { - case AML_LOGICAL_NOT_OP: /* LNot (Operand) */ - - ReturnDesc = AcpiUtCreateIntegerObject ((UINT64) 0); - if (!ReturnDesc) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - /* - * Set result to ONES (TRUE) if Value == 0. Note: - * ReturnDesc->Integer.Value is initially == 0 (FALSE) from above. - */ - if (!Operand[0]->Integer.Value) - { - ReturnDesc->Integer.Value = ACPI_UINT64_MAX; - } - break; - - case AML_DECREMENT_OP: /* Decrement (Operand) */ - case AML_INCREMENT_OP: /* Increment (Operand) */ - /* - * Create a new integer. Can't just get the base integer and - * increment it because it may be an Arg or Field. - */ - ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); - if (!ReturnDesc) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - /* - * Since we are expecting a Reference operand, it can be either a - * NS Node or an internal object. - */ - TempDesc = Operand[0]; - if (ACPI_GET_DESCRIPTOR_TYPE (TempDesc) == ACPI_DESC_TYPE_OPERAND) - { - /* Internal reference object - prevent deletion */ - - AcpiUtAddReference (TempDesc); - } - - /* - * Convert the Reference operand to an Integer (This removes a - * reference on the Operand[0] object) - * - * NOTE: We use LNOT_OP here in order to force resolution of the - * reference operand to an actual integer. - */ - Status = AcpiExResolveOperands (AML_LOGICAL_NOT_OP, - &TempDesc, WalkState); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "While resolving operands for [%s]", - AcpiPsGetOpcodeName (WalkState->Opcode))); - - goto Cleanup; - } - - /* - * TempDesc is now guaranteed to be an Integer object -- - * Perform the actual increment or decrement - */ - if (WalkState->Opcode == AML_INCREMENT_OP) - { - ReturnDesc->Integer.Value = TempDesc->Integer.Value + 1; - } - else - { - ReturnDesc->Integer.Value = TempDesc->Integer.Value - 1; - } - - /* Finished with this Integer object */ - - AcpiUtRemoveReference (TempDesc); - - /* - * Store the result back (indirectly) through the original - * Reference object - */ - Status = AcpiExStore (ReturnDesc, Operand[0], WalkState); - break; - - case AML_OBJECT_TYPE_OP: /* ObjectType (SourceObject) */ - /* - * Note: The operand is not resolved at this point because we want to - * get the associated object, not its value. For example, we don't - * want to resolve a FieldUnit to its value, we want the actual - * FieldUnit object. - */ - - /* Get the type of the base object */ - - Status = AcpiExResolveMultiple (WalkState, Operand[0], &Type, NULL); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - /* Allocate a descriptor to hold the type. */ - - ReturnDesc = AcpiUtCreateIntegerObject ((UINT64) Type); - if (!ReturnDesc) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - break; - - case AML_SIZE_OF_OP: /* SizeOf (SourceObject) */ - /* - * Note: The operand is not resolved at this point because we want to - * get the associated object, not its value. - */ - - /* Get the base object */ - - Status = AcpiExResolveMultiple ( - WalkState, Operand[0], &Type, &TempDesc); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - /* - * The type of the base object must be integer, buffer, string, or - * package. All others are not supported. - * - * NOTE: Integer is not specifically supported by the ACPI spec, - * but is supported implicitly via implicit operand conversion. - * rather than bother with conversion, we just use the byte width - * global (4 or 8 bytes). - */ - switch (Type) - { - case ACPI_TYPE_INTEGER: - - Value = AcpiGbl_IntegerByteWidth; - break; - - case ACPI_TYPE_STRING: - - Value = TempDesc->String.Length; - break; - - case ACPI_TYPE_BUFFER: - - /* Buffer arguments may not be evaluated at this point */ - - Status = AcpiDsGetBufferArguments (TempDesc); - Value = TempDesc->Buffer.Length; - break; - - case ACPI_TYPE_PACKAGE: - - /* Package arguments may not be evaluated at this point */ - - Status = AcpiDsGetPackageArguments (TempDesc); - Value = TempDesc->Package.Count; - break; - - default: - - ACPI_ERROR ((AE_INFO, - "Operand must be Buffer/Integer/String/Package" - " - found type %s", - AcpiUtGetTypeName (Type))); - - Status = AE_AML_OPERAND_TYPE; - goto Cleanup; - } - - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - /* - * Now that we have the size of the object, create a result - * object to hold the value - */ - ReturnDesc = AcpiUtCreateIntegerObject (Value); - if (!ReturnDesc) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - break; - - - case AML_REF_OF_OP: /* RefOf (SourceObject) */ - - Status = AcpiExGetObjectReference ( - Operand[0], &ReturnDesc, WalkState); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - break; - - - case AML_DEREF_OF_OP: /* DerefOf (ObjReference | String) */ - - /* Check for a method local or argument, or standalone String */ - - if (ACPI_GET_DESCRIPTOR_TYPE (Operand[0]) == ACPI_DESC_TYPE_NAMED) - { - TempDesc = AcpiNsGetAttachedObject ( - (ACPI_NAMESPACE_NODE *) Operand[0]); - if (TempDesc && - ((TempDesc->Common.Type == ACPI_TYPE_STRING) || - (TempDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE))) - { - Operand[0] = TempDesc; - AcpiUtAddReference (TempDesc); - } - else - { - Status = AE_AML_OPERAND_TYPE; - goto Cleanup; - } - } - else - { - switch ((Operand[0])->Common.Type) - { - case ACPI_TYPE_LOCAL_REFERENCE: - /* - * This is a DerefOf (LocalX | ArgX) - * - * Must resolve/dereference the local/arg reference first - */ - switch (Operand[0]->Reference.Class) - { - case ACPI_REFCLASS_LOCAL: - case ACPI_REFCLASS_ARG: - - /* Set Operand[0] to the value of the local/arg */ - - Status = AcpiDsMethodDataGetValue ( - Operand[0]->Reference.Class, - Operand[0]->Reference.Value, - WalkState, &TempDesc); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - /* - * Delete our reference to the input object and - * point to the object just retrieved - */ - AcpiUtRemoveReference (Operand[0]); - Operand[0] = TempDesc; - break; - - case ACPI_REFCLASS_REFOF: - - /* Get the object to which the reference refers */ - - TempDesc = Operand[0]->Reference.Object; - AcpiUtRemoveReference (Operand[0]); - Operand[0] = TempDesc; - break; - - default: - - /* Must be an Index op - handled below */ - break; - } - break; - - case ACPI_TYPE_STRING: - - break; - - default: - - Status = AE_AML_OPERAND_TYPE; - goto Cleanup; - } - } - - if (ACPI_GET_DESCRIPTOR_TYPE (Operand[0]) != ACPI_DESC_TYPE_NAMED) - { - if ((Operand[0])->Common.Type == ACPI_TYPE_STRING) - { - /* - * This is a DerefOf (String). The string is a reference - * to a named ACPI object. - * - * 1) Find the owning Node - * 2) Dereference the node to an actual object. Could be a - * Field, so we need to resolve the node to a value. - */ - Status = AcpiNsGetNodeUnlocked (WalkState->ScopeInfo->Scope.Node, - Operand[0]->String.Pointer, - ACPI_NS_SEARCH_PARENT, - ACPI_CAST_INDIRECT_PTR ( - ACPI_NAMESPACE_NODE, &ReturnDesc)); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - Status = AcpiExResolveNodeToValue ( - ACPI_CAST_INDIRECT_PTR ( - ACPI_NAMESPACE_NODE, &ReturnDesc), - WalkState); - goto Cleanup; - } - } - - /* Operand[0] may have changed from the code above */ - - if (ACPI_GET_DESCRIPTOR_TYPE (Operand[0]) == ACPI_DESC_TYPE_NAMED) - { - /* - * This is a DerefOf (ObjectReference) - * Get the actual object from the Node (This is the dereference). - * This case may only happen when a LocalX or ArgX is - * dereferenced above, or for references to device and - * thermal objects. - */ - switch (((ACPI_NAMESPACE_NODE *) Operand[0])->Type) - { - case ACPI_TYPE_DEVICE: - case ACPI_TYPE_THERMAL: - - /* These types have no node subobject, return the NS node */ - - ReturnDesc = Operand[0]; - break; - - default: - /* For most types, get the object attached to the node */ - - ReturnDesc = AcpiNsGetAttachedObject ( - (ACPI_NAMESPACE_NODE *) Operand[0]); - AcpiUtAddReference (ReturnDesc); - break; - } - } - else - { - /* - * This must be a reference object produced by either the - * Index() or RefOf() operator - */ - switch (Operand[0]->Reference.Class) - { - case ACPI_REFCLASS_INDEX: - /* - * The target type for the Index operator must be - * either a Buffer or a Package - */ - switch (Operand[0]->Reference.TargetType) - { - case ACPI_TYPE_BUFFER_FIELD: - - TempDesc = Operand[0]->Reference.Object; - - /* - * Create a new object that contains one element of the - * buffer -- the element pointed to by the index. - * - * NOTE: index into a buffer is NOT a pointer to a - * sub-buffer of the main buffer, it is only a pointer to a - * single element (byte) of the buffer! - * - * Since we are returning the value of the buffer at the - * indexed location, we don't need to add an additional - * reference to the buffer itself. - */ - ReturnDesc = AcpiUtCreateIntegerObject ((UINT64) - TempDesc->Buffer.Pointer[Operand[0]->Reference.Value]); - if (!ReturnDesc) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - break; - - case ACPI_TYPE_PACKAGE: - /* - * Return the referenced element of the package. We must - * add another reference to the referenced object, however. - */ - ReturnDesc = *(Operand[0]->Reference.Where); - if (!ReturnDesc) - { - /* - * Element is NULL, do not allow the dereference. - * This provides compatibility with other ACPI - * implementations. - */ - return_ACPI_STATUS (AE_AML_UNINITIALIZED_ELEMENT); - } - - AcpiUtAddReference (ReturnDesc); - break; - - default: - - ACPI_ERROR ((AE_INFO, - "Unknown Index TargetType 0x%X in reference object %p", - Operand[0]->Reference.TargetType, Operand[0])); - - Status = AE_AML_OPERAND_TYPE; - goto Cleanup; - } - break; - - case ACPI_REFCLASS_REFOF: - - ReturnDesc = Operand[0]->Reference.Object; - - if (ACPI_GET_DESCRIPTOR_TYPE (ReturnDesc) == - ACPI_DESC_TYPE_NAMED) - { - ReturnDesc = AcpiNsGetAttachedObject ( - (ACPI_NAMESPACE_NODE *) ReturnDesc); - if (!ReturnDesc) - { - break; - } - - /* - * June 2013: - * BufferFields/FieldUnits require additional resolution - */ - switch (ReturnDesc->Common.Type) - { - case ACPI_TYPE_BUFFER_FIELD: - case ACPI_TYPE_LOCAL_REGION_FIELD: - case ACPI_TYPE_LOCAL_BANK_FIELD: - case ACPI_TYPE_LOCAL_INDEX_FIELD: - - Status = AcpiExReadDataFromField ( - WalkState, ReturnDesc, &TempDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - ReturnDesc = TempDesc; - break; - - default: - - /* Add another reference to the object */ - - AcpiUtAddReference (ReturnDesc); - break; - } - } - break; - - default: - - ACPI_ERROR ((AE_INFO, - "Unknown class in reference(%p) - 0x%2.2X", - Operand[0], Operand[0]->Reference.Class)); - - Status = AE_TYPE; - goto Cleanup; - } - } - break; - - default: - - ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X", - WalkState->Opcode)); - - Status = AE_AML_BAD_OPCODE; - goto Cleanup; - } - - -Cleanup: - - /* Delete return object on error */ - - if (ACPI_FAILURE (Status)) - { - AcpiUtRemoveReference (ReturnDesc); - } - - /* Save return object on success */ - - else - { - WalkState->ResultObj = ReturnDesc; - } - - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/exoparg2.c b/drivers/acpica/exoparg2.c deleted file mode 100644 index 83b2d48..0000000 --- a/drivers/acpica/exoparg2.c +++ /dev/null @@ -1,750 +0,0 @@ -/****************************************************************************** - * - * Module Name: exoparg2 - AML execution - opcodes with 2 arguments - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acparser.h" -#include "acinterp.h" -#include "acevents.h" -#include "amlcode.h" - - -#define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exoparg2") - - -/*! - * Naming convention for AML interpreter execution routines. - * - * The routines that begin execution of AML opcodes are named with a common - * convention based upon the number of arguments, the number of target operands, - * and whether or not a value is returned: - * - * AcpiExOpcode_xA_yT_zR - * - * Where: - * - * xA - ARGUMENTS: The number of arguments (input operands) that are - * required for this opcode type (1 through 6 args). - * yT - TARGETS: The number of targets (output operands) that are required - * for this opcode type (0, 1, or 2 targets). - * zR - RETURN VALUE: Indicates whether this opcode type returns a value - * as the function return (0 or 1). - * - * The AcpiExOpcode* functions are called via the Dispatcher component with - * fully resolved operands. -!*/ - - -/******************************************************************************* - * - * FUNCTION: AcpiExOpcode_2A_0T_0R - * - * PARAMETERS: WalkState - Current walk state - * - * RETURN: Status - * - * DESCRIPTION: Execute opcode with two arguments, no target, and no return - * value. - * - * ALLOCATION: Deletes both operands - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExOpcode_2A_0T_0R ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; - ACPI_NAMESPACE_NODE *Node; - UINT32 Value; - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE_STR (ExOpcode_2A_0T_0R, - AcpiPsGetOpcodeName (WalkState->Opcode)); - - - /* Examine the opcode */ - - switch (WalkState->Opcode) - { - case AML_NOTIFY_OP: /* Notify (NotifyObject, NotifyValue) */ - - /* The first operand is a namespace node */ - - Node = (ACPI_NAMESPACE_NODE *) Operand[0]; - - /* Second value is the notify value */ - - Value = (UINT32) Operand[1]->Integer.Value; - - /* Are notifies allowed on this object? */ - - if (!AcpiEvIsNotifyObject (Node)) - { - ACPI_ERROR ((AE_INFO, - "Unexpected notify object type [%s]", - AcpiUtGetTypeName (Node->Type))); - - Status = AE_AML_OPERAND_TYPE; - break; - } - - /* - * Dispatch the notify to the appropriate handler - * NOTE: the request is queued for execution after this method - * completes. The notify handlers are NOT invoked synchronously - * from this thread -- because handlers may in turn run other - * control methods. - */ - Status = AcpiEvQueueNotifyRequest (Node, Value); - break; - - default: - - ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X", - WalkState->Opcode)); - Status = AE_AML_BAD_OPCODE; - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExOpcode_2A_2T_1R - * - * PARAMETERS: WalkState - Current walk state - * - * RETURN: Status - * - * DESCRIPTION: Execute a dyadic operator (2 operands) with 2 output targets - * and one implicit return value. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExOpcode_2A_2T_1R ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; - ACPI_OPERAND_OBJECT *ReturnDesc1 = NULL; - ACPI_OPERAND_OBJECT *ReturnDesc2 = NULL; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE_STR (ExOpcode_2A_2T_1R, - AcpiPsGetOpcodeName (WalkState->Opcode)); - - - /* Execute the opcode */ - - switch (WalkState->Opcode) - { - case AML_DIVIDE_OP: - - /* Divide (Dividend, Divisor, RemainderResult QuotientResult) */ - - ReturnDesc1 = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); - if (!ReturnDesc1) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - ReturnDesc2 = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); - if (!ReturnDesc2) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - /* Quotient to ReturnDesc1, remainder to ReturnDesc2 */ - - Status = AcpiUtDivide ( - Operand[0]->Integer.Value, - Operand[1]->Integer.Value, - &ReturnDesc1->Integer.Value, - &ReturnDesc2->Integer.Value); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - break; - - default: - - ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X", - WalkState->Opcode)); - - Status = AE_AML_BAD_OPCODE; - goto Cleanup; - } - - /* Store the results to the target reference operands */ - - Status = AcpiExStore (ReturnDesc2, Operand[2], WalkState); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - Status = AcpiExStore (ReturnDesc1, Operand[3], WalkState); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - -Cleanup: - /* - * Since the remainder is not returned indirectly, remove a reference to - * it. Only the quotient is returned indirectly. - */ - AcpiUtRemoveReference (ReturnDesc2); - - if (ACPI_FAILURE (Status)) - { - /* Delete the return object */ - - AcpiUtRemoveReference (ReturnDesc1); - } - - /* Save return object (the remainder) on success */ - - else - { - WalkState->ResultObj = ReturnDesc1; - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExOpcode_2A_1T_1R - * - * PARAMETERS: WalkState - Current walk state - * - * RETURN: Status - * - * DESCRIPTION: Execute opcode with two arguments, one target, and a return - * value. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExOpcode_2A_1T_1R ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; - ACPI_OPERAND_OBJECT *ReturnDesc = NULL; - UINT64 Index; - ACPI_STATUS Status = AE_OK; - ACPI_SIZE Length = 0; - - - ACPI_FUNCTION_TRACE_STR (ExOpcode_2A_1T_1R, - AcpiPsGetOpcodeName (WalkState->Opcode)); - - - /* Execute the opcode */ - - if (WalkState->OpInfo->Flags & AML_MATH) - { - /* All simple math opcodes (add, etc.) */ - - ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); - if (!ReturnDesc) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - ReturnDesc->Integer.Value = AcpiExDoMathOp ( - WalkState->Opcode, - Operand[0]->Integer.Value, - Operand[1]->Integer.Value); - goto StoreResultToTarget; - } - - switch (WalkState->Opcode) - { - case AML_MOD_OP: /* Mod (Dividend, Divisor, RemainderResult (ACPI 2.0) */ - - ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); - if (!ReturnDesc) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - /* ReturnDesc will contain the remainder */ - - Status = AcpiUtDivide ( - Operand[0]->Integer.Value, - Operand[1]->Integer.Value, - NULL, - &ReturnDesc->Integer.Value); - break; - - case AML_CONCATENATE_OP: /* Concatenate (Data1, Data2, Result) */ - - Status = AcpiExDoConcatenate ( - Operand[0], Operand[1], &ReturnDesc, WalkState); - break; - - case AML_TO_STRING_OP: /* ToString (Buffer, Length, Result) (ACPI 2.0) */ - /* - * Input object is guaranteed to be a buffer at this point (it may have - * been converted.) Copy the raw buffer data to a new object of - * type String. - */ - - /* - * Get the length of the new string. It is the smallest of: - * 1) Length of the input buffer - * 2) Max length as specified in the ToString operator - * 3) Length of input buffer up to a zero byte (null terminator) - * - * NOTE: A length of zero is ok, and will create a zero-length, null - * terminated string. - */ - while ((Length < Operand[0]->Buffer.Length) && /* Length of input buffer */ - (Length < Operand[1]->Integer.Value) && /* Length operand */ - (Operand[0]->Buffer.Pointer[Length])) /* Null terminator */ - { - Length++; - } - - /* Allocate a new string object */ - - ReturnDesc = AcpiUtCreateStringObject (Length); - if (!ReturnDesc) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - /* - * Copy the raw buffer data with no transform. - * (NULL terminated already) - */ - memcpy (ReturnDesc->String.Pointer, - Operand[0]->Buffer.Pointer, Length); - break; - - case AML_CONCATENATE_TEMPLATE_OP: - - /* ConcatenateResTemplate (Buffer, Buffer, Result) (ACPI 2.0) */ - - Status = AcpiExConcatTemplate ( - Operand[0], Operand[1], &ReturnDesc, WalkState); - break; - - case AML_INDEX_OP: /* Index (Source Index Result) */ - - /* Create the internal return object */ - - ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_REFERENCE); - if (!ReturnDesc) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - /* Initialize the Index reference object */ - - Index = Operand[1]->Integer.Value; - ReturnDesc->Reference.Value = (UINT32) Index; - ReturnDesc->Reference.Class = ACPI_REFCLASS_INDEX; - - /* - * At this point, the Source operand is a String, Buffer, or Package. - * Verify that the index is within range. - */ - switch ((Operand[0])->Common.Type) - { - case ACPI_TYPE_STRING: - - if (Index >= Operand[0]->String.Length) - { - Length = Operand[0]->String.Length; - Status = AE_AML_STRING_LIMIT; - } - - ReturnDesc->Reference.TargetType = ACPI_TYPE_BUFFER_FIELD; - ReturnDesc->Reference.IndexPointer = - &(Operand[0]->Buffer.Pointer [Index]); - break; - - case ACPI_TYPE_BUFFER: - - if (Index >= Operand[0]->Buffer.Length) - { - Length = Operand[0]->Buffer.Length; - Status = AE_AML_BUFFER_LIMIT; - } - - ReturnDesc->Reference.TargetType = ACPI_TYPE_BUFFER_FIELD; - ReturnDesc->Reference.IndexPointer = - &(Operand[0]->Buffer.Pointer [Index]); - break; - - case ACPI_TYPE_PACKAGE: - - if (Index >= Operand[0]->Package.Count) - { - Length = Operand[0]->Package.Count; - Status = AE_AML_PACKAGE_LIMIT; - } - - ReturnDesc->Reference.TargetType = ACPI_TYPE_PACKAGE; - ReturnDesc->Reference.Where = - &Operand[0]->Package.Elements [Index]; - break; - - default: - - ACPI_ERROR ((AE_INFO, - "Invalid object type: %X", (Operand[0])->Common.Type)); - Status = AE_AML_INTERNAL; - goto Cleanup; - } - - /* Failure means that the Index was beyond the end of the object */ - - if (ACPI_FAILURE (Status)) - { - ACPI_BIOS_EXCEPTION ((AE_INFO, Status, - "Index (0x%X%8.8X) is beyond end of object (length 0x%X)", - ACPI_FORMAT_UINT64 (Index), (UINT32) Length)); - goto Cleanup; - } - - /* - * Save the target object and add a reference to it for the life - * of the index - */ - ReturnDesc->Reference.Object = Operand[0]; - AcpiUtAddReference (Operand[0]); - - /* Store the reference to the Target */ - - Status = AcpiExStore (ReturnDesc, Operand[2], WalkState); - - /* Return the reference */ - - WalkState->ResultObj = ReturnDesc; - goto Cleanup; - - default: - - ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X", - WalkState->Opcode)); - Status = AE_AML_BAD_OPCODE; - break; - } - - -StoreResultToTarget: - - if (ACPI_SUCCESS (Status)) - { - /* - * Store the result of the operation (which is now in ReturnDesc) into - * the Target descriptor. - */ - Status = AcpiExStore (ReturnDesc, Operand[2], WalkState); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - if (!WalkState->ResultObj) - { - WalkState->ResultObj = ReturnDesc; - } - } - - -Cleanup: - - /* Delete return object on error */ - - if (ACPI_FAILURE (Status)) - { - AcpiUtRemoveReference (ReturnDesc); - WalkState->ResultObj = NULL; - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExOpcode_2A_0T_1R - * - * PARAMETERS: WalkState - Current walk state - * - * RETURN: Status - * - * DESCRIPTION: Execute opcode with 2 arguments, no target, and a return value - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExOpcode_2A_0T_1R ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; - ACPI_OPERAND_OBJECT *ReturnDesc = NULL; - ACPI_STATUS Status = AE_OK; - BOOLEAN LogicalResult = FALSE; - - - ACPI_FUNCTION_TRACE_STR (ExOpcode_2A_0T_1R, - AcpiPsGetOpcodeName (WalkState->Opcode)); - - - /* Create the internal return object */ - - ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); - if (!ReturnDesc) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - /* Execute the Opcode */ - - if (WalkState->OpInfo->Flags & AML_LOGICAL_NUMERIC) - { - /* LogicalOp (Operand0, Operand1) */ - - Status = AcpiExDoLogicalNumericOp (WalkState->Opcode, - Operand[0]->Integer.Value, Operand[1]->Integer.Value, - &LogicalResult); - goto StoreLogicalResult; - } - else if (WalkState->OpInfo->Flags & AML_LOGICAL) - { - /* LogicalOp (Operand0, Operand1) */ - - Status = AcpiExDoLogicalOp (WalkState->Opcode, Operand[0], - Operand[1], &LogicalResult); - goto StoreLogicalResult; - } - - switch (WalkState->Opcode) - { - case AML_ACQUIRE_OP: /* Acquire (MutexObject, Timeout) */ - - Status = AcpiExAcquireMutex (Operand[1], Operand[0], WalkState); - if (Status == AE_TIME) - { - LogicalResult = TRUE; /* TRUE = Acquire timed out */ - Status = AE_OK; - } - break; - - - case AML_WAIT_OP: /* Wait (EventObject, Timeout) */ - - Status = AcpiExSystemWaitEvent (Operand[1], Operand[0]); - if (Status == AE_TIME) - { - LogicalResult = TRUE; /* TRUE, Wait timed out */ - Status = AE_OK; - } - break; - - default: - - ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X", - WalkState->Opcode)); - - Status = AE_AML_BAD_OPCODE; - goto Cleanup; - } - - -StoreLogicalResult: - /* - * Set return value to according to LogicalResult. logical TRUE (all ones) - * Default is FALSE (zero) - */ - if (LogicalResult) - { - ReturnDesc->Integer.Value = ACPI_UINT64_MAX; - } - -Cleanup: - - /* Delete return object on error */ - - if (ACPI_FAILURE (Status)) - { - AcpiUtRemoveReference (ReturnDesc); - } - - /* Save return object on success */ - - else - { - WalkState->ResultObj = ReturnDesc; - } - - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/exoparg3.c b/drivers/acpica/exoparg3.c deleted file mode 100644 index 722bbec..0000000 --- a/drivers/acpica/exoparg3.c +++ /dev/null @@ -1,409 +0,0 @@ -/****************************************************************************** - * - * Module Name: exoparg3 - AML execution - opcodes with 3 arguments - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acinterp.h" -#include "acoutput.h" -#include "acparser.h" -#include "amlcode.h" - - -#define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exoparg3") - - -/*! - * Naming convention for AML interpreter execution routines. - * - * The routines that begin execution of AML opcodes are named with a common - * convention based upon the number of arguments, the number of target operands, - * and whether or not a value is returned: - * - * AcpiExOpcode_xA_yT_zR - * - * Where: - * - * xA - ARGUMENTS: The number of arguments (input operands) that are - * required for this opcode type (1 through 6 args). - * yT - TARGETS: The number of targets (output operands) that are required - * for this opcode type (0, 1, or 2 targets). - * zR - RETURN VALUE: Indicates whether this opcode type returns a value - * as the function return (0 or 1). - * - * The AcpiExOpcode* functions are called via the Dispatcher component with - * fully resolved operands. -!*/ - - -/******************************************************************************* - * - * FUNCTION: AcpiExOpcode_3A_0T_0R - * - * PARAMETERS: WalkState - Current walk state - * - * RETURN: Status - * - * DESCRIPTION: Execute Triadic operator (3 operands) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExOpcode_3A_0T_0R ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; - ACPI_SIGNAL_FATAL_INFO Fatal; - - - ACPI_FUNCTION_TRACE_STR (ExOpcode_3A_0T_0R, - AcpiPsGetOpcodeName (WalkState->Opcode)); - - - switch (WalkState->Opcode) - { - case AML_FATAL_OP: /* Fatal (FatalType FatalCode FatalArg) */ - - Fatal.Type = (UINT32) Operand[0]->Integer.Value; - Fatal.Code = (UINT32) Operand[1]->Integer.Value; - Fatal.Argument = (UINT32) Operand[2]->Integer.Value; - - ACPI_BIOS_ERROR ((AE_INFO, - "Fatal ACPI BIOS error (Type 0x%X Code 0x%X Arg 0x%X)\n", - Fatal.Type, Fatal.Code, Fatal.Argument)); - - /* Always signal the OS! */ - - AcpiOsSignal (ACPI_SIGNAL_FATAL, &Fatal); - - /* - * Might return while OS is shutting down, so abort the AML execution - * by returning an error. - */ - return_ACPI_STATUS (AE_ERROR); - - case AML_EXTERNAL_OP: - /* - * If the interpreter sees this opcode, just ignore it. The External - * op is intended for use by disassemblers in order to properly - * disassemble control method invocations. The opcode or group of - * opcodes should be surrounded by an "if (0)" clause to ensure that - * AML interpreters never see the opcode. Thus, something is - * wrong if an external opcode ever gets here. - */ - ACPI_ERROR ((AE_INFO, "Executed External Op")); - - return_ACPI_STATUS (AE_OK); - - default: - - ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X", - WalkState->Opcode)); - - return_ACPI_STATUS (AE_AML_BAD_OPCODE); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExOpcode_3A_1T_1R - * - * PARAMETERS: WalkState - Current walk state - * - * RETURN: Status - * - * DESCRIPTION: Execute Triadic operator (3 operands) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExOpcode_3A_1T_1R ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; - ACPI_OPERAND_OBJECT *ReturnDesc = NULL; - char *Buffer = NULL; - ACPI_STATUS Status = AE_OK; - UINT64 Index; - ACPI_SIZE Length; - - - ACPI_FUNCTION_TRACE_STR (ExOpcode_3A_1T_1R, - AcpiPsGetOpcodeName (WalkState->Opcode)); - - - switch (WalkState->Opcode) - { - case AML_MID_OP: /* Mid (Source[0], Index[1], Length[2], Result[3]) */ - /* - * Create the return object. The Source operand is guaranteed to be - * either a String or a Buffer, so just use its type. - */ - ReturnDesc = AcpiUtCreateInternalObject ( - (Operand[0])->Common.Type); - if (!ReturnDesc) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - /* Get the Integer values from the objects */ - - Index = Operand[1]->Integer.Value; - Length = (ACPI_SIZE) Operand[2]->Integer.Value; - - /* - * If the index is beyond the length of the String/Buffer, or if the - * requested length is zero, return a zero-length String/Buffer - */ - if (Index >= Operand[0]->String.Length) - { - Length = 0; - } - - /* Truncate request if larger than the actual String/Buffer */ - - else if ((Index + Length) > Operand[0]->String.Length) - { - Length = - (ACPI_SIZE) Operand[0]->String.Length - (ACPI_SIZE) Index; - } - - /* Strings always have a sub-pointer, not so for buffers */ - - switch ((Operand[0])->Common.Type) - { - case ACPI_TYPE_STRING: - - /* Always allocate a new buffer for the String */ - - Buffer = ACPI_ALLOCATE_ZEROED ((ACPI_SIZE) Length + 1); - if (!Buffer) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - break; - - case ACPI_TYPE_BUFFER: - - /* If the requested length is zero, don't allocate a buffer */ - - if (Length > 0) - { - /* Allocate a new buffer for the Buffer */ - - Buffer = ACPI_ALLOCATE_ZEROED (Length); - if (!Buffer) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - } - break; - - default: /* Should not happen */ - - Status = AE_AML_OPERAND_TYPE; - goto Cleanup; - } - - if (Buffer) - { - /* We have a buffer, copy the portion requested */ - - memcpy (Buffer, - Operand[0]->String.Pointer + Index, Length); - } - - /* Set the length of the new String/Buffer */ - - ReturnDesc->String.Pointer = Buffer; - ReturnDesc->String.Length = (UINT32) Length; - - /* Mark buffer initialized */ - - ReturnDesc->Buffer.Flags |= AOPOBJ_DATA_VALID; - break; - - default: - - ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X", - WalkState->Opcode)); - - Status = AE_AML_BAD_OPCODE; - goto Cleanup; - } - - /* Store the result in the target */ - - Status = AcpiExStore (ReturnDesc, Operand[3], WalkState); - -Cleanup: - - /* Delete return object on error */ - - if (ACPI_FAILURE (Status) || WalkState->ResultObj) - { - AcpiUtRemoveReference (ReturnDesc); - WalkState->ResultObj = NULL; - } - else - { - /* Set the return object and exit */ - - WalkState->ResultObj = ReturnDesc; - } - - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/exoparg6.c b/drivers/acpica/exoparg6.c deleted file mode 100644 index 00ca4f7..0000000 --- a/drivers/acpica/exoparg6.c +++ /dev/null @@ -1,465 +0,0 @@ -/****************************************************************************** - * - * Module Name: exoparg6 - AML execution - opcodes with 6 arguments - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acinterp.h" -#include "acparser.h" -#include "amlcode.h" - - -#define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exoparg6") - - -/*! - * Naming convention for AML interpreter execution routines. - * - * The routines that begin execution of AML opcodes are named with a common - * convention based upon the number of arguments, the number of target operands, - * and whether or not a value is returned: - * - * AcpiExOpcode_xA_yT_zR - * - * Where: - * - * xA - ARGUMENTS: The number of arguments (input operands) that are - * required for this opcode type (1 through 6 args). - * yT - TARGETS: The number of targets (output operands) that are required - * for this opcode type (0, 1, or 2 targets). - * zR - RETURN VALUE: Indicates whether this opcode type returns a value - * as the function return (0 or 1). - * - * The AcpiExOpcode* functions are called via the Dispatcher component with - * fully resolved operands. -!*/ - -/* Local prototypes */ - -static BOOLEAN -AcpiExDoMatch ( - UINT32 MatchOp, - ACPI_OPERAND_OBJECT *PackageObj, - ACPI_OPERAND_OBJECT *MatchObj); - - -/******************************************************************************* - * - * FUNCTION: AcpiExDoMatch - * - * PARAMETERS: MatchOp - The AML match operand - * PackageObj - Object from the target package - * MatchObj - Object to be matched - * - * RETURN: TRUE if the match is successful, FALSE otherwise - * - * DESCRIPTION: Implements the low-level match for the ASL Match operator. - * Package elements will be implicitly converted to the type of - * the match object (Integer/Buffer/String). - * - ******************************************************************************/ - -static BOOLEAN -AcpiExDoMatch ( - UINT32 MatchOp, - ACPI_OPERAND_OBJECT *PackageObj, - ACPI_OPERAND_OBJECT *MatchObj) -{ - BOOLEAN LogicalResult = TRUE; - ACPI_STATUS Status; - - - /* - * Note: Since the PackageObj/MatchObj ordering is opposite to that of - * the standard logical operators, we have to reverse them when we call - * DoLogicalOp in order to make the implicit conversion rules work - * correctly. However, this means we have to flip the entire equation - * also. A bit ugly perhaps, but overall, better than fussing the - * parameters around at runtime, over and over again. - * - * Below, P[i] refers to the package element, M refers to the Match object. - */ - switch (MatchOp) - { - case MATCH_MTR: - - /* Always true */ - - break; - - case MATCH_MEQ: - /* - * True if equal: (P[i] == M) - * Change to: (M == P[i]) - */ - Status = AcpiExDoLogicalOp ( - AML_LOGICAL_EQUAL_OP, MatchObj, PackageObj, &LogicalResult); - if (ACPI_FAILURE (Status)) - { - return (FALSE); - } - break; - - case MATCH_MLE: - /* - * True if less than or equal: (P[i] <= M) (P[i] NotGreater than M) - * Change to: (M >= P[i]) (M NotLess than P[i]) - */ - Status = AcpiExDoLogicalOp ( - AML_LOGICAL_LESS_OP, MatchObj, PackageObj, &LogicalResult); - if (ACPI_FAILURE (Status)) - { - return (FALSE); - } - LogicalResult = (BOOLEAN) !LogicalResult; - break; - - case MATCH_MLT: - /* - * True if less than: (P[i] < M) - * Change to: (M > P[i]) - */ - Status = AcpiExDoLogicalOp ( - AML_LOGICAL_GREATER_OP, MatchObj, PackageObj, &LogicalResult); - if (ACPI_FAILURE (Status)) - { - return (FALSE); - } - break; - - case MATCH_MGE: - /* - * True if greater than or equal: (P[i] >= M) (P[i] NotLess than M) - * Change to: (M <= P[i]) (M NotGreater than P[i]) - */ - Status = AcpiExDoLogicalOp ( - AML_LOGICAL_GREATER_OP, MatchObj, PackageObj, &LogicalResult); - if (ACPI_FAILURE (Status)) - { - return (FALSE); - } - LogicalResult = (BOOLEAN)!LogicalResult; - break; - - case MATCH_MGT: - /* - * True if greater than: (P[i] > M) - * Change to: (M < P[i]) - */ - Status = AcpiExDoLogicalOp ( - AML_LOGICAL_LESS_OP, MatchObj, PackageObj, &LogicalResult); - if (ACPI_FAILURE (Status)) - { - return (FALSE); - } - break; - - default: - - /* Undefined */ - - return (FALSE); - } - - return (LogicalResult); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExOpcode_6A_0T_1R - * - * PARAMETERS: WalkState - Current walk state - * - * RETURN: Status - * - * DESCRIPTION: Execute opcode with 6 arguments, no target, and a return value - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExOpcode_6A_0T_1R ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; - ACPI_OPERAND_OBJECT *ReturnDesc = NULL; - ACPI_STATUS Status = AE_OK; - UINT64 Index; - ACPI_OPERAND_OBJECT *ThisElement; - - - ACPI_FUNCTION_TRACE_STR (ExOpcode_6A_0T_1R, - AcpiPsGetOpcodeName (WalkState->Opcode)); - - - switch (WalkState->Opcode) - { - case AML_MATCH_OP: - /* - * Match (SearchPkg[0], MatchOp1[1], MatchObj1[2], - * MatchOp2[3], MatchObj2[4], StartIndex[5]) - */ - - /* Validate both Match Term Operators (MTR, MEQ, etc.) */ - - if ((Operand[1]->Integer.Value > MAX_MATCH_OPERATOR) || - (Operand[3]->Integer.Value > MAX_MATCH_OPERATOR)) - { - ACPI_ERROR ((AE_INFO, "Match operator out of range")); - Status = AE_AML_OPERAND_VALUE; - goto Cleanup; - } - - /* Get the package StartIndex, validate against the package length */ - - Index = Operand[5]->Integer.Value; - if (Index >= Operand[0]->Package.Count) - { - ACPI_ERROR ((AE_INFO, - "Index (0x%8.8X%8.8X) beyond package end (0x%X)", - ACPI_FORMAT_UINT64 (Index), Operand[0]->Package.Count)); - Status = AE_AML_PACKAGE_LIMIT; - goto Cleanup; - } - - /* Create an integer for the return value */ - /* Default return value is ACPI_UINT64_MAX if no match found */ - - ReturnDesc = AcpiUtCreateIntegerObject (ACPI_UINT64_MAX); - if (!ReturnDesc) - { - Status = AE_NO_MEMORY; - goto Cleanup; - - } - - /* - * Examine each element until a match is found. Both match conditions - * must be satisfied for a match to occur. Within the loop, - * "continue" signifies that the current element does not match - * and the next should be examined. - * - * Upon finding a match, the loop will terminate via "break" at - * the bottom. If it terminates "normally", MatchValue will be - * ACPI_UINT64_MAX (Ones) (its initial value) indicating that no - * match was found. - */ - for ( ; Index < Operand[0]->Package.Count; Index++) - { - /* Get the current package element */ - - ThisElement = Operand[0]->Package.Elements[Index]; - - /* Treat any uninitialized (NULL) elements as non-matching */ - - if (!ThisElement) - { - continue; - } - - /* - * Both match conditions must be satisfied. Execution of a continue - * (proceed to next iteration of enclosing for loop) signifies a - * non-match. - */ - if (!AcpiExDoMatch ((UINT32) Operand[1]->Integer.Value, - ThisElement, Operand[2])) - { - continue; - } - - if (!AcpiExDoMatch ((UINT32) Operand[3]->Integer.Value, - ThisElement, Operand[4])) - { - continue; - } - - /* Match found: Index is the return value */ - - ReturnDesc->Integer.Value = Index; - break; - } - break; - - case AML_LOAD_TABLE_OP: - - Status = AcpiExLoadTableOp (WalkState, &ReturnDesc); - break; - - default: - - ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X", - WalkState->Opcode)); - - Status = AE_AML_BAD_OPCODE; - goto Cleanup; - } - - -Cleanup: - - /* Delete return object on error */ - - if (ACPI_FAILURE (Status)) - { - AcpiUtRemoveReference (ReturnDesc); - } - - /* Save return object on success */ - - else - { - WalkState->ResultObj = ReturnDesc; - } - - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/exprep.c b/drivers/acpica/exprep.c deleted file mode 100644 index c022231..0000000 --- a/drivers/acpica/exprep.c +++ /dev/null @@ -1,775 +0,0 @@ -/****************************************************************************** - * - * Module Name: exprep - ACPI AML field prep utilities - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acinterp.h" -#include "amlcode.h" -#include "acnamesp.h" -#include "acdispat.h" - - -#define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exprep") - -/* Local prototypes */ - -static UINT32 -AcpiExDecodeFieldAccess ( - ACPI_OPERAND_OBJECT *ObjDesc, - UINT8 FieldFlags, - UINT32 *ReturnByteAlignment); - - -#ifdef ACPI_UNDER_DEVELOPMENT - -static UINT32 -AcpiExGenerateAccess ( - UINT32 FieldBitOffset, - UINT32 FieldBitLength, - UINT32 RegionLength); - - -/******************************************************************************* - * - * FUNCTION: AcpiExGenerateAccess - * - * PARAMETERS: FieldBitOffset - Start of field within parent region/buffer - * FieldBitLength - Length of field in bits - * RegionLength - Length of parent in bytes - * - * RETURN: Field granularity (8, 16, 32 or 64) and - * ByteAlignment (1, 2, 3, or 4) - * - * DESCRIPTION: Generate an optimal access width for fields defined with the - * AnyAcc keyword. - * - * NOTE: Need to have the RegionLength in order to check for boundary - * conditions (end-of-region). However, the RegionLength is a deferred - * operation. Therefore, to complete this implementation, the generation - * of this access width must be deferred until the region length has - * been evaluated. - * - ******************************************************************************/ - -static UINT32 -AcpiExGenerateAccess ( - UINT32 FieldBitOffset, - UINT32 FieldBitLength, - UINT32 RegionLength) -{ - UINT32 FieldByteLength; - UINT32 FieldByteOffset; - UINT32 FieldByteEndOffset; - UINT32 AccessByteWidth; - UINT32 FieldStartOffset; - UINT32 FieldEndOffset; - UINT32 MinimumAccessWidth = 0xFFFFFFFF; - UINT32 MinimumAccesses = 0xFFFFFFFF; - UINT32 Accesses; - - - ACPI_FUNCTION_TRACE (ExGenerateAccess); - - - /* Round Field start offset and length to "minimal" byte boundaries */ - - FieldByteOffset = ACPI_DIV_8 ( - ACPI_ROUND_DOWN (FieldBitOffset, 8)); - - FieldByteEndOffset = ACPI_DIV_8 ( - ACPI_ROUND_UP (FieldBitLength + FieldBitOffset, 8)); - - FieldByteLength = FieldByteEndOffset - FieldByteOffset; - - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Bit length %u, Bit offset %u\n", - FieldBitLength, FieldBitOffset)); - - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Byte Length %u, Byte Offset %u, End Offset %u\n", - FieldByteLength, FieldByteOffset, FieldByteEndOffset)); - - /* - * Iterative search for the maximum access width that is both aligned - * and does not go beyond the end of the region - * - * Start at ByteAcc and work upwards to QwordAcc max. (1,2,4,8 bytes) - */ - for (AccessByteWidth = 1; AccessByteWidth <= 8; AccessByteWidth <<= 1) - { - /* - * 1) Round end offset up to next access boundary and make sure that - * this does not go beyond the end of the parent region. - * 2) When the Access width is greater than the FieldByteLength, we - * are done. (This does not optimize for the perfectly aligned - * case yet). - */ - if (ACPI_ROUND_UP (FieldByteEndOffset, AccessByteWidth) <= - RegionLength) - { - FieldStartOffset = - ACPI_ROUND_DOWN (FieldByteOffset, AccessByteWidth) / - AccessByteWidth; - - FieldEndOffset = - ACPI_ROUND_UP ((FieldByteLength + FieldByteOffset), - AccessByteWidth) / AccessByteWidth; - - Accesses = FieldEndOffset - FieldStartOffset; - - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "AccessWidth %u end is within region\n", AccessByteWidth)); - - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Field Start %u, Field End %u -- requires %u accesses\n", - FieldStartOffset, FieldEndOffset, Accesses)); - - /* Single access is optimal */ - - if (Accesses <= 1) - { - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Entire field can be accessed " - "with one operation of size %u\n", - AccessByteWidth)); - return_VALUE (AccessByteWidth); - } - - /* - * Fits in the region, but requires more than one read/write. - * try the next wider access on next iteration - */ - if (Accesses < MinimumAccesses) - { - MinimumAccesses = Accesses; - MinimumAccessWidth = AccessByteWidth; - } - } - else - { - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "AccessWidth %u end is NOT within region\n", - AccessByteWidth)); - if (AccessByteWidth == 1) - { - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Field goes beyond end-of-region!\n")); - - /* Field does not fit in the region at all */ - - return_VALUE (0); - } - - /* - * This width goes beyond the end-of-region, back off to - * previous access - */ - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Backing off to previous optimal access width of %u\n", - MinimumAccessWidth)); - return_VALUE (MinimumAccessWidth); - } - } - - /* - * Could not read/write field with one operation, - * just use max access width - */ - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Cannot access field in one operation, using width 8\n")); - - return_VALUE (8); -} -#endif /* ACPI_UNDER_DEVELOPMENT */ - - -/******************************************************************************* - * - * FUNCTION: AcpiExDecodeFieldAccess - * - * PARAMETERS: ObjDesc - Field object - * FieldFlags - Encoded fieldflags (contains access bits) - * ReturnByteAlignment - Where the byte alignment is returned - * - * RETURN: Field granularity (8, 16, 32 or 64) and - * ByteAlignment (1, 2, 3, or 4) - * - * DESCRIPTION: Decode the AccessType bits of a field definition. - * - ******************************************************************************/ - -static UINT32 -AcpiExDecodeFieldAccess ( - ACPI_OPERAND_OBJECT *ObjDesc, - UINT8 FieldFlags, - UINT32 *ReturnByteAlignment) -{ - UINT32 Access; - UINT32 ByteAlignment; - UINT32 BitLength; - - - ACPI_FUNCTION_TRACE (ExDecodeFieldAccess); - - - Access = (FieldFlags & AML_FIELD_ACCESS_TYPE_MASK); - - switch (Access) - { - case AML_FIELD_ACCESS_ANY: - -#ifdef ACPI_UNDER_DEVELOPMENT - ByteAlignment = - AcpiExGenerateAccess (ObjDesc->CommonField.StartFieldBitOffset, - ObjDesc->CommonField.BitLength, - 0xFFFFFFFF /* Temp until we pass RegionLength as parameter */); - BitLength = ByteAlignment * 8; -#endif - - ByteAlignment = 1; - BitLength = 8; - break; - - case AML_FIELD_ACCESS_BYTE: - case AML_FIELD_ACCESS_BUFFER: /* ACPI 2.0 (SMBus Buffer) */ - - ByteAlignment = 1; - BitLength = 8; - break; - - case AML_FIELD_ACCESS_WORD: - - ByteAlignment = 2; - BitLength = 16; - break; - - case AML_FIELD_ACCESS_DWORD: - - ByteAlignment = 4; - BitLength = 32; - break; - - case AML_FIELD_ACCESS_QWORD: /* ACPI 2.0 */ - - ByteAlignment = 8; - BitLength = 64; - break; - - default: - - /* Invalid field access type */ - - ACPI_ERROR ((AE_INFO, - "Unknown field access type 0x%X", - Access)); - - return_UINT32 (0); - } - - if (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD) - { - /* - * BufferField access can be on any byte boundary, so the - * ByteAlignment is always 1 byte -- regardless of any ByteAlignment - * implied by the field access type. - */ - ByteAlignment = 1; - } - - *ReturnByteAlignment = ByteAlignment; - return_UINT32 (BitLength); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExPrepCommonFieldObject - * - * PARAMETERS: ObjDesc - The field object - * FieldFlags - Access, LockRule, and UpdateRule. - * The format of a FieldFlag is described - * in the ACPI specification - * FieldAttribute - Special attributes (not used) - * FieldBitPosition - Field start position - * FieldBitLength - Field length in number of bits - * - * RETURN: Status - * - * DESCRIPTION: Initialize the areas of the field object that are common - * to the various types of fields. Note: This is very "sensitive" - * code because we are solving the general case for field - * alignment. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExPrepCommonFieldObject ( - ACPI_OPERAND_OBJECT *ObjDesc, - UINT8 FieldFlags, - UINT8 FieldAttribute, - UINT32 FieldBitPosition, - UINT32 FieldBitLength) -{ - UINT32 AccessBitWidth; - UINT32 ByteAlignment; - UINT32 NearestByteAddress; - - - ACPI_FUNCTION_TRACE (ExPrepCommonFieldObject); - - - /* - * Note: the structure being initialized is the - * ACPI_COMMON_FIELD_INFO; No structure fields outside of the common - * area are initialized by this procedure. - */ - ObjDesc->CommonField.FieldFlags = FieldFlags; - ObjDesc->CommonField.Attribute = FieldAttribute; - ObjDesc->CommonField.BitLength = FieldBitLength; - - /* - * Decode the access type so we can compute offsets. The access type gives - * two pieces of information - the width of each field access and the - * necessary ByteAlignment (address granularity) of the access. - * - * For AnyAcc, the AccessBitWidth is the largest width that is both - * necessary and possible in an attempt to access the whole field in one - * I/O operation. However, for AnyAcc, the ByteAlignment is always one - * byte. - * - * For all Buffer Fields, the ByteAlignment is always one byte. - * - * For all other access types (Byte, Word, Dword, Qword), the Bitwidth is - * the same (equivalent) as the ByteAlignment. - */ - AccessBitWidth = AcpiExDecodeFieldAccess ( - ObjDesc, FieldFlags, &ByteAlignment); - if (!AccessBitWidth) - { - return_ACPI_STATUS (AE_AML_OPERAND_VALUE); - } - - /* Setup width (access granularity) fields (values are: 1, 2, 4, 8) */ - - ObjDesc->CommonField.AccessByteWidth = (UINT8) - ACPI_DIV_8 (AccessBitWidth); - - /* - * BaseByteOffset is the address of the start of the field within the - * region. It is the byte address of the first *datum* (field-width data - * unit) of the field. (i.e., the first datum that contains at least the - * first *bit* of the field.) - * - * Note: ByteAlignment is always either equal to the AccessBitWidth or 8 - * (Byte access), and it defines the addressing granularity of the parent - * region or buffer. - */ - NearestByteAddress = - ACPI_ROUND_BITS_DOWN_TO_BYTES (FieldBitPosition); - ObjDesc->CommonField.BaseByteOffset = (UINT32) - ACPI_ROUND_DOWN (NearestByteAddress, ByteAlignment); - - /* - * StartFieldBitOffset is the offset of the first bit of the field within - * a field datum. - */ - ObjDesc->CommonField.StartFieldBitOffset = (UINT8) - (FieldBitPosition - ACPI_MUL_8 (ObjDesc->CommonField.BaseByteOffset)); - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExPrepFieldValue - * - * PARAMETERS: Info - Contains all field creation info - * - * RETURN: Status - * - * DESCRIPTION: Construct an object of type ACPI_OPERAND_OBJECT with a - * subtype of DefField and connect it to the parent Node. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExPrepFieldValue ( - ACPI_CREATE_FIELD_INFO *Info) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_OPERAND_OBJECT *SecondDesc = NULL; - ACPI_STATUS Status; - UINT32 AccessByteWidth; - UINT32 Type; - - - ACPI_FUNCTION_TRACE (ExPrepFieldValue); - - - /* Parameter validation */ - - if (Info->FieldType != ACPI_TYPE_LOCAL_INDEX_FIELD) - { - if (!Info->RegionNode) - { - ACPI_ERROR ((AE_INFO, "Null RegionNode")); - return_ACPI_STATUS (AE_AML_NO_OPERAND); - } - - Type = AcpiNsGetType (Info->RegionNode); - if (Type != ACPI_TYPE_REGION) - { - ACPI_ERROR ((AE_INFO, "Needed Region, found type 0x%X (%s)", - Type, AcpiUtGetTypeName (Type))); - - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - } - - /* Allocate a new field object */ - - ObjDesc = AcpiUtCreateInternalObject (Info->FieldType); - if (!ObjDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Initialize areas of the object that are common to all fields */ - - ObjDesc->CommonField.Node = Info->FieldNode; - Status = AcpiExPrepCommonFieldObject (ObjDesc, - Info->FieldFlags, Info->Attribute, - Info->FieldBitPosition, Info->FieldBitLength); - if (ACPI_FAILURE (Status)) - { - AcpiUtDeleteObjectDesc (ObjDesc); - return_ACPI_STATUS (Status); - } - - /* Initialize areas of the object that are specific to the field type */ - - switch (Info->FieldType) - { - case ACPI_TYPE_LOCAL_REGION_FIELD: - - ObjDesc->Field.RegionObj = AcpiNsGetAttachedObject (Info->RegionNode); - - /* Fields specific to GenericSerialBus fields */ - - ObjDesc->Field.AccessLength = Info->AccessLength; - - if (Info->ConnectionNode) - { - SecondDesc = Info->ConnectionNode->Object; - if (SecondDesc == NULL) - { - break; - } - if (!(SecondDesc->Common.Flags & AOPOBJ_DATA_VALID)) - { - Status = AcpiDsGetBufferArguments (SecondDesc); - if (ACPI_FAILURE (Status)) - { - AcpiUtDeleteObjectDesc (ObjDesc); - return_ACPI_STATUS (Status); - } - } - - ObjDesc->Field.ResourceBuffer = - SecondDesc->Buffer.Pointer; - ObjDesc->Field.ResourceLength = - (UINT16) SecondDesc->Buffer.Length; - } - else if (Info->ResourceBuffer) - { - ObjDesc->Field.ResourceBuffer = Info->ResourceBuffer; - ObjDesc->Field.ResourceLength = Info->ResourceLength; - } - - ObjDesc->Field.PinNumberIndex = Info->PinNumberIndex; - - /* Allow full data read from EC address space */ - - if ((ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_EC) && - (ObjDesc->CommonField.BitLength > 8)) - { - AccessByteWidth = ACPI_ROUND_BITS_UP_TO_BYTES ( - ObjDesc->CommonField.BitLength); - - /* Maximum byte width supported is 255 */ - - if (AccessByteWidth < 256) - { - ObjDesc->CommonField.AccessByteWidth = - (UINT8) AccessByteWidth; - } - } - - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "RegionField: BitOff %X, Off %X, Gran %X, Region %p\n", - ObjDesc->Field.StartFieldBitOffset, - ObjDesc->Field.BaseByteOffset, - ObjDesc->Field.AccessByteWidth, - ObjDesc->Field.RegionObj)); - break; - - case ACPI_TYPE_LOCAL_BANK_FIELD: - - ObjDesc->BankField.Value = Info->BankValue; - ObjDesc->BankField.RegionObj = - AcpiNsGetAttachedObject (Info->RegionNode); - ObjDesc->BankField.BankObj = - AcpiNsGetAttachedObject (Info->RegisterNode); - - /* An additional reference for the attached objects */ - - AcpiUtAddReference (ObjDesc->BankField.RegionObj); - AcpiUtAddReference (ObjDesc->BankField.BankObj); - - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Bank Field: BitOff %X, Off %X, Gran %X, Region %p, BankReg %p\n", - ObjDesc->BankField.StartFieldBitOffset, - ObjDesc->BankField.BaseByteOffset, - ObjDesc->Field.AccessByteWidth, - ObjDesc->BankField.RegionObj, - ObjDesc->BankField.BankObj)); - - /* - * Remember location in AML stream of the field unit - * opcode and operands -- since the BankValue - * operands must be evaluated. - */ - SecondDesc = ObjDesc->Common.NextObject; - SecondDesc->Extra.AmlStart = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, - Info->DataRegisterNode)->Named.Data; - SecondDesc->Extra.AmlLength = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, - Info->DataRegisterNode)->Named.Length; - - break; - - case ACPI_TYPE_LOCAL_INDEX_FIELD: - - /* Get the Index and Data registers */ - - ObjDesc->IndexField.IndexObj = - AcpiNsGetAttachedObject (Info->RegisterNode); - ObjDesc->IndexField.DataObj = - AcpiNsGetAttachedObject (Info->DataRegisterNode); - - if (!ObjDesc->IndexField.DataObj || !ObjDesc->IndexField.IndexObj) - { - ACPI_ERROR ((AE_INFO, "Null Index Object during field prep")); - AcpiUtDeleteObjectDesc (ObjDesc); - return_ACPI_STATUS (AE_AML_INTERNAL); - } - - /* An additional reference for the attached objects */ - - AcpiUtAddReference (ObjDesc->IndexField.DataObj); - AcpiUtAddReference (ObjDesc->IndexField.IndexObj); - - /* - * April 2006: Changed to match MS behavior - * - * The value written to the Index register is the byte offset of the - * target field in units of the granularity of the IndexField - * - * Previously, the value was calculated as an index in terms of the - * width of the Data register, as below: - * - * ObjDesc->IndexField.Value = (UINT32) - * (Info->FieldBitPosition / ACPI_MUL_8 ( - * ObjDesc->Field.AccessByteWidth)); - * - * February 2006: Tried value as a byte offset: - * ObjDesc->IndexField.Value = (UINT32) - * ACPI_DIV_8 (Info->FieldBitPosition); - */ - ObjDesc->IndexField.Value = (UINT32) ACPI_ROUND_DOWN ( - ACPI_DIV_8 (Info->FieldBitPosition), - ObjDesc->IndexField.AccessByteWidth); - - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "IndexField: BitOff %X, Off %X, Value %X, " - "Gran %X, Index %p, Data %p\n", - ObjDesc->IndexField.StartFieldBitOffset, - ObjDesc->IndexField.BaseByteOffset, - ObjDesc->IndexField.Value, - ObjDesc->Field.AccessByteWidth, - ObjDesc->IndexField.IndexObj, - ObjDesc->IndexField.DataObj)); - break; - - default: - - /* No other types should get here */ - - break; - } - - /* - * Store the constructed descriptor (ObjDesc) into the parent Node, - * preserving the current type of that NamedObj. - */ - Status = AcpiNsAttachObject ( - Info->FieldNode, ObjDesc, AcpiNsGetType (Info->FieldNode)); - - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Set NamedObj %p [%4.4s], ObjDesc %p\n", - Info->FieldNode, AcpiUtGetNodeName (Info->FieldNode), ObjDesc)); - - /* Remove local reference to the object */ - - AcpiUtRemoveReference (ObjDesc); - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/exregion.c b/drivers/acpica/exregion.c deleted file mode 100644 index 32cec4d..0000000 --- a/drivers/acpica/exregion.c +++ /dev/null @@ -1,709 +0,0 @@ -/****************************************************************************** - * - * Module Name: exregion - ACPI default OpRegion (address space) handlers - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acinterp.h" - - -#define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exregion") - - -/******************************************************************************* - * - * FUNCTION: AcpiExSystemMemorySpaceHandler - * - * PARAMETERS: Function - Read or Write operation - * Address - Where in the space to read or write - * BitWidth - Field width in bits (8, 16, or 32) - * Value - Pointer to in or out value - * HandlerContext - Pointer to Handler's context - * RegionContext - Pointer to context specific to the - * accessed region - * - * RETURN: Status - * - * DESCRIPTION: Handler for the System Memory address space (Op Region) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExSystemMemorySpaceHandler ( - UINT32 Function, - ACPI_PHYSICAL_ADDRESS Address, - UINT32 BitWidth, - UINT64 *Value, - void *HandlerContext, - void *RegionContext) -{ - ACPI_STATUS Status = AE_OK; - void *LogicalAddrPtr = NULL; - ACPI_MEM_SPACE_CONTEXT *MemInfo = RegionContext; - ACPI_MEM_MAPPING *Mm = MemInfo->CurMm; - UINT32 Length; - ACPI_SIZE MapLength; -#ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED - UINT32 Remainder; -#endif - - - ACPI_FUNCTION_TRACE (ExSystemMemorySpaceHandler); - - - /* Validate and translate the bit width */ - - switch (BitWidth) - { - case 8: - - Length = 1; - break; - - case 16: - - Length = 2; - break; - - case 32: - - Length = 4; - break; - - case 64: - - Length = 8; - break; - - default: - - ACPI_ERROR ((AE_INFO, "Invalid SystemMemory width %u", - BitWidth)); - return_ACPI_STATUS (AE_AML_OPERAND_VALUE); - } - -#ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED - /* - * Hardware does not support non-aligned data transfers, we must verify - * the request. - */ - (void) AcpiUtShortDivide ((UINT64) Address, Length, NULL, &Remainder); - if (Remainder != 0) - { - return_ACPI_STATUS (AE_AML_ALIGNMENT); - } -#endif - - /* - * Does the request fit into the cached memory mapping? - * Is 1) Address below the current mapping? OR - * 2) Address beyond the current mapping? - */ - if (!Mm || (Address < Mm->PhysicalAddress) || - ((UINT64) Address + Length > (UINT64) Mm->PhysicalAddress + Mm->Length)) - { - /* - * The request cannot be resolved by the current memory mapping. - * - * Look for an existing saved mapping covering the address range - * at hand. If found, save it as the current one and carry out - * the access. - */ - for (Mm = MemInfo->FirstMm; Mm; Mm = Mm->NextMm) - { - if (Mm == MemInfo->CurMm) - { - continue; - } - - if (Address < Mm->PhysicalAddress) - { - continue; - } - - if ((UINT64) Address + Length > (UINT64) Mm->PhysicalAddress + Mm->Length) - { - continue; - } - - MemInfo->CurMm = Mm; - goto access; - } - - /* Create a new mappings list entry */ - - Mm = ACPI_ALLOCATE_ZEROED(sizeof(*Mm)); - if (!Mm) - { - ACPI_ERROR((AE_INFO, - "Unable to save memory mapping at 0x%8.8X%8.8X, size %u", - ACPI_FORMAT_UINT64(Address), Length)); - return_ACPI_STATUS(AE_NO_MEMORY); - } - - /* - * October 2009: Attempt to map from the requested address to the - * end of the region. However, we will never map more than one - * page, nor will we cross a page boundary. - */ - MapLength = (ACPI_SIZE) - ((MemInfo->Address + MemInfo->Length) - Address); - - if (MapLength > ACPI_DEFAULT_PAGE_SIZE) - { - MapLength = ACPI_DEFAULT_PAGE_SIZE; - } - - /* Create a new mapping starting at the address given */ - - LogicalAddrPtr = AcpiOsMapMemory(Address, MapLength); - if (!LogicalAddrPtr) - { - ACPI_ERROR ((AE_INFO, - "Could not map memory at 0x%8.8X%8.8X, size %u", - ACPI_FORMAT_UINT64 (Address), (UINT32) MapLength)); - ACPI_FREE(Mm); - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Save the physical address and mapping size */ - - Mm->LogicalAddress = LogicalAddrPtr; - Mm->PhysicalAddress = Address; - Mm->Length = MapLength; - - /* - * Add the new entry to the mappigs list and save it as the - * current mapping. - */ - Mm->NextMm = MemInfo->FirstMm; - MemInfo->FirstMm = Mm; - MemInfo->CurMm = Mm; - } - -access: - /* - * Generate a logical pointer corresponding to the address we want to - * access - */ - LogicalAddrPtr = Mm->LogicalAddress + - ((UINT64) Address - (UINT64) Mm->PhysicalAddress); - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "System-Memory (width %u) R/W %u Address=%8.8X%8.8X\n", - BitWidth, Function, ACPI_FORMAT_UINT64 (Address))); - - /* - * Perform the memory read or write - * - * Note: For machines that do not support non-aligned transfers, the target - * address was checked for alignment above. We do not attempt to break the - * transfer up into smaller (byte-size) chunks because the AML specifically - * asked for a transfer width that the hardware may require. - */ - switch (Function) - { - case ACPI_READ: - - *Value = 0; - switch (BitWidth) - { - case 8: - - *Value = (UINT64) ACPI_GET8 (LogicalAddrPtr); - break; - - case 16: - - *Value = (UINT64) ACPI_GET16 (LogicalAddrPtr); - break; - - case 32: - - *Value = (UINT64) ACPI_GET32 (LogicalAddrPtr); - break; - - case 64: - - *Value = (UINT64) ACPI_GET64 (LogicalAddrPtr); - break; - - default: - - /* BitWidth was already validated */ - - break; - } - break; - - case ACPI_WRITE: - - switch (BitWidth) - { - case 8: - - ACPI_SET8 (LogicalAddrPtr, *Value); - break; - - case 16: - - ACPI_SET16 (LogicalAddrPtr, *Value); - break; - - case 32: - - ACPI_SET32 (LogicalAddrPtr, *Value); - break; - - case 64: - - ACPI_SET64 (LogicalAddrPtr, *Value); - break; - - default: - - /* BitWidth was already validated */ - - break; - } - break; - - default: - - Status = AE_BAD_PARAMETER; - break; - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExSystemIoSpaceHandler - * - * PARAMETERS: Function - Read or Write operation - * Address - Where in the space to read or write - * BitWidth - Field width in bits (8, 16, or 32) - * Value - Pointer to in or out value - * HandlerContext - Pointer to Handler's context - * RegionContext - Pointer to context specific to the - * accessed region - * - * RETURN: Status - * - * DESCRIPTION: Handler for the System IO address space (Op Region) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExSystemIoSpaceHandler ( - UINT32 Function, - ACPI_PHYSICAL_ADDRESS Address, - UINT32 BitWidth, - UINT64 *Value, - void *HandlerContext, - void *RegionContext) -{ - ACPI_STATUS Status = AE_OK; - UINT32 Value32; - - - ACPI_FUNCTION_TRACE (ExSystemIoSpaceHandler); - - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "System-IO (width %u) R/W %u Address=%8.8X%8.8X\n", - BitWidth, Function, ACPI_FORMAT_UINT64 (Address))); - - /* Decode the function parameter */ - - switch (Function) - { - case ACPI_READ: - - Status = AcpiHwReadPort ((ACPI_IO_ADDRESS) Address, - &Value32, BitWidth); - *Value = Value32; - break; - - case ACPI_WRITE: - - Status = AcpiHwWritePort ((ACPI_IO_ADDRESS) Address, - (UINT32) *Value, BitWidth); - break; - - default: - - Status = AE_BAD_PARAMETER; - break; - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExPciConfigSpaceHandler - * - * PARAMETERS: Function - Read or Write operation - * Address - Where in the space to read or write - * BitWidth - Field width in bits (8, 16, or 32) - * Value - Pointer to in or out value - * HandlerContext - Pointer to Handler's context - * RegionContext - Pointer to context specific to the - * accessed region - * - * RETURN: Status - * - * DESCRIPTION: Handler for the PCI Config address space (Op Region) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExPciConfigSpaceHandler ( - UINT32 Function, - ACPI_PHYSICAL_ADDRESS Address, - UINT32 BitWidth, - UINT64 *Value, - void *HandlerContext, - void *RegionContext) -{ - ACPI_STATUS Status = AE_OK; - ACPI_PCI_ID *PciId; - UINT16 PciRegister; - - - ACPI_FUNCTION_TRACE (ExPciConfigSpaceHandler); - - - /* - * The arguments to AcpiOs(Read|Write)PciConfiguration are: - * - * PciSegment is the PCI bus segment range 0-31 - * PciBus is the PCI bus number range 0-255 - * PciDevice is the PCI device number range 0-31 - * PciFunction is the PCI device function number - * PciRegister is the Config space register range 0-255 bytes - * - * Value - input value for write, output address for read - * - */ - PciId = (ACPI_PCI_ID *) RegionContext; - PciRegister = (UINT16) (UINT32) Address; - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Pci-Config %u (%u) Seg(%04x) Bus(%04x) " - "Dev(%04x) Func(%04x) Reg(%04x)\n", - Function, BitWidth, PciId->Segment, PciId->Bus, PciId->Device, - PciId->Function, PciRegister)); - - switch (Function) - { - case ACPI_READ: - - *Value = 0; - Status = AcpiOsReadPciConfiguration ( - PciId, PciRegister, Value, BitWidth); - break; - - case ACPI_WRITE: - - Status = AcpiOsWritePciConfiguration ( - PciId, PciRegister, *Value, BitWidth); - break; - - default: - - Status = AE_BAD_PARAMETER; - break; - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExCmosSpaceHandler - * - * PARAMETERS: Function - Read or Write operation - * Address - Where in the space to read or write - * BitWidth - Field width in bits (8, 16, or 32) - * Value - Pointer to in or out value - * HandlerContext - Pointer to Handler's context - * RegionContext - Pointer to context specific to the - * accessed region - * - * RETURN: Status - * - * DESCRIPTION: Handler for the CMOS address space (Op Region) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExCmosSpaceHandler ( - UINT32 Function, - ACPI_PHYSICAL_ADDRESS Address, - UINT32 BitWidth, - UINT64 *Value, - void *HandlerContext, - void *RegionContext) -{ - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE (ExCmosSpaceHandler); - - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExPciBarSpaceHandler - * - * PARAMETERS: Function - Read or Write operation - * Address - Where in the space to read or write - * BitWidth - Field width in bits (8, 16, or 32) - * Value - Pointer to in or out value - * HandlerContext - Pointer to Handler's context - * RegionContext - Pointer to context specific to the - * accessed region - * - * RETURN: Status - * - * DESCRIPTION: Handler for the PCI BarTarget address space (Op Region) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExPciBarSpaceHandler ( - UINT32 Function, - ACPI_PHYSICAL_ADDRESS Address, - UINT32 BitWidth, - UINT64 *Value, - void *HandlerContext, - void *RegionContext) -{ - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE (ExPciBarSpaceHandler); - - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExDataTableSpaceHandler - * - * PARAMETERS: Function - Read or Write operation - * Address - Where in the space to read or write - * BitWidth - Field width in bits (8, 16, or 32) - * Value - Pointer to in or out value - * HandlerContext - Pointer to Handler's context - * RegionContext - Pointer to context specific to the - * accessed region - * - * RETURN: Status - * - * DESCRIPTION: Handler for the Data Table address space (Op Region) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExDataTableSpaceHandler ( - UINT32 Function, - ACPI_PHYSICAL_ADDRESS Address, - UINT32 BitWidth, - UINT64 *Value, - void *HandlerContext, - void *RegionContext) -{ - ACPI_DATA_TABLE_MAPPING *Mapping; - char *Pointer; - - - ACPI_FUNCTION_TRACE (ExDataTableSpaceHandler); - - - Mapping = (ACPI_DATA_TABLE_MAPPING *) RegionContext; - Pointer = ACPI_CAST_PTR (char, Mapping->Pointer) + - (Address - ACPI_PTR_TO_PHYSADDR (Mapping->Pointer)); - - /* - * Perform the memory read or write. The BitWidth was already - * validated. - */ - switch (Function) - { - case ACPI_READ: - - memcpy (ACPI_CAST_PTR (char, Value), Pointer, ACPI_DIV_8 (BitWidth)); - break; - - case ACPI_WRITE: - - memcpy (Pointer, ACPI_CAST_PTR (char, Value), ACPI_DIV_8 (BitWidth)); - break; - - default: - - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - return_ACPI_STATUS (AE_OK); -} diff --git a/drivers/acpica/exresnte.c b/drivers/acpica/exresnte.c deleted file mode 100644 index 319d81e..0000000 --- a/drivers/acpica/exresnte.c +++ /dev/null @@ -1,400 +0,0 @@ -/****************************************************************************** - * - * Module Name: exresnte - AML Interpreter object resolution - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acdispat.h" -#include "acinterp.h" -#include "acnamesp.h" - - -#define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exresnte") - - -/******************************************************************************* - * - * FUNCTION: AcpiExResolveNodeToValue - * - * PARAMETERS: ObjectPtr - Pointer to a location that contains - * a pointer to a NS node, and will receive a - * pointer to the resolved object. - * WalkState - Current state. Valid only if executing AML - * code. NULL if simply resolving an object - * - * RETURN: Status - * - * DESCRIPTION: Resolve a Namespace node to a valued object - * - * Note: for some of the data types, the pointer attached to the Node - * can be either a pointer to an actual internal object or a pointer into the - * AML stream itself. These types are currently: - * - * ACPI_TYPE_INTEGER - * ACPI_TYPE_STRING - * ACPI_TYPE_BUFFER - * ACPI_TYPE_MUTEX - * ACPI_TYPE_PACKAGE - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExResolveNodeToValue ( - ACPI_NAMESPACE_NODE **ObjectPtr, - ACPI_WALK_STATE *WalkState) - -{ - ACPI_STATUS Status = AE_OK; - ACPI_OPERAND_OBJECT *SourceDesc; - ACPI_OPERAND_OBJECT *ObjDesc = NULL; - ACPI_NAMESPACE_NODE *Node; - ACPI_OBJECT_TYPE EntryType; - - - ACPI_FUNCTION_TRACE (ExResolveNodeToValue); - - - /* - * The stack pointer points to a ACPI_NAMESPACE_NODE (Node). Get the - * object that is attached to the Node. - */ - Node = *ObjectPtr; - SourceDesc = AcpiNsGetAttachedObject (Node); - EntryType = AcpiNsGetType ((ACPI_HANDLE) Node); - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Entry=%p SourceDesc=%p [%s]\n", - Node, SourceDesc, AcpiUtGetTypeName (EntryType))); - - if ((EntryType == ACPI_TYPE_LOCAL_ALIAS) || - (EntryType == ACPI_TYPE_LOCAL_METHOD_ALIAS)) - { - /* There is always exactly one level of indirection */ - - Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Node->Object); - SourceDesc = AcpiNsGetAttachedObject (Node); - EntryType = AcpiNsGetType ((ACPI_HANDLE) Node); - *ObjectPtr = Node; - } - - /* - * Several object types require no further processing: - * 1) Device/Thermal objects don't have a "real" subobject, return Node - * 2) Method locals and arguments have a pseudo-Node - * 3) 10/2007: Added method type to assist with Package construction. - */ - if ((EntryType == ACPI_TYPE_DEVICE) || - (EntryType == ACPI_TYPE_THERMAL) || - (EntryType == ACPI_TYPE_METHOD) || - (Node->Flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL))) - { - return_ACPI_STATUS (AE_OK); - } - - if (!SourceDesc) - { - ACPI_ERROR ((AE_INFO, "No object attached to node [%4.4s] %p", - Node->Name.Ascii, Node)); - return_ACPI_STATUS (AE_AML_UNINITIALIZED_NODE); - } - - /* - * Action is based on the type of the Node, which indicates the type - * of the attached object or pointer - */ - switch (EntryType) - { - case ACPI_TYPE_PACKAGE: - - if (SourceDesc->Common.Type != ACPI_TYPE_PACKAGE) - { - ACPI_ERROR ((AE_INFO, "Object not a Package, type %s", - AcpiUtGetObjectTypeName (SourceDesc))); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - - Status = AcpiDsGetPackageArguments (SourceDesc); - if (ACPI_SUCCESS (Status)) - { - /* Return an additional reference to the object */ - - ObjDesc = SourceDesc; - AcpiUtAddReference (ObjDesc); - } - break; - - case ACPI_TYPE_BUFFER: - - if (SourceDesc->Common.Type != ACPI_TYPE_BUFFER) - { - ACPI_ERROR ((AE_INFO, "Object not a Buffer, type %s", - AcpiUtGetObjectTypeName (SourceDesc))); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - - Status = AcpiDsGetBufferArguments (SourceDesc); - if (ACPI_SUCCESS (Status)) - { - /* Return an additional reference to the object */ - - ObjDesc = SourceDesc; - AcpiUtAddReference (ObjDesc); - } - break; - - case ACPI_TYPE_STRING: - - if (SourceDesc->Common.Type != ACPI_TYPE_STRING) - { - ACPI_ERROR ((AE_INFO, "Object not a String, type %s", - AcpiUtGetObjectTypeName (SourceDesc))); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - - /* Return an additional reference to the object */ - - ObjDesc = SourceDesc; - AcpiUtAddReference (ObjDesc); - break; - - case ACPI_TYPE_INTEGER: - - if (SourceDesc->Common.Type != ACPI_TYPE_INTEGER) - { - ACPI_ERROR ((AE_INFO, "Object not a Integer, type %s", - AcpiUtGetObjectTypeName (SourceDesc))); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - - /* Return an additional reference to the object */ - - ObjDesc = SourceDesc; - AcpiUtAddReference (ObjDesc); - break; - - case ACPI_TYPE_BUFFER_FIELD: - case ACPI_TYPE_LOCAL_REGION_FIELD: - case ACPI_TYPE_LOCAL_BANK_FIELD: - case ACPI_TYPE_LOCAL_INDEX_FIELD: - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "FieldRead Node=%p SourceDesc=%p Type=%X\n", - Node, SourceDesc, EntryType)); - - Status = AcpiExReadDataFromField (WalkState, SourceDesc, &ObjDesc); - break; - - /* For these objects, just return the object attached to the Node */ - - case ACPI_TYPE_MUTEX: - case ACPI_TYPE_POWER: - case ACPI_TYPE_PROCESSOR: - case ACPI_TYPE_EVENT: - case ACPI_TYPE_REGION: - - /* Return an additional reference to the object */ - - ObjDesc = SourceDesc; - AcpiUtAddReference (ObjDesc); - break; - - /* TYPE_ANY is untyped, and thus there is no object associated with it */ - - case ACPI_TYPE_ANY: - - ACPI_ERROR ((AE_INFO, - "Untyped entry %p, no attached object!", Node)); - - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */ - - case ACPI_TYPE_LOCAL_REFERENCE: - - switch (SourceDesc->Reference.Class) - { - case ACPI_REFCLASS_TABLE: /* This is a DdbHandle */ - case ACPI_REFCLASS_REFOF: - case ACPI_REFCLASS_INDEX: - - /* Return an additional reference to the object */ - - ObjDesc = SourceDesc; - AcpiUtAddReference (ObjDesc); - break; - - default: - - /* No named references are allowed here */ - - ACPI_ERROR ((AE_INFO, - "Unsupported Reference type 0x%X", - SourceDesc->Reference.Class)); - - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - break; - - default: - - /* Default case is for unknown types */ - - ACPI_ERROR ((AE_INFO, - "Node %p - Unknown object type 0x%X", - Node, EntryType)); - - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - - } /* switch (EntryType) */ - - - /* Return the object descriptor */ - - *ObjectPtr = (void *) ObjDesc; - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/exresolv.c b/drivers/acpica/exresolv.c deleted file mode 100644 index 6dc658c..0000000 --- a/drivers/acpica/exresolv.c +++ /dev/null @@ -1,701 +0,0 @@ -/****************************************************************************** - * - * Module Name: exresolv - AML Interpreter object resolution - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "amlcode.h" -#include "acdispat.h" -#include "acinterp.h" -#include "acnamesp.h" - - -#define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exresolv") - -/* Local prototypes */ - -static ACPI_STATUS -AcpiExResolveObjectToValue ( - ACPI_OPERAND_OBJECT **StackPtr, - ACPI_WALK_STATE *WalkState); - - -/******************************************************************************* - * - * FUNCTION: AcpiExResolveToValue - * - * PARAMETERS: **StackPtr - Points to entry on ObjStack, which can - * be either an (ACPI_OPERAND_OBJECT *) - * or an ACPI_HANDLE. - * WalkState - Current method state - * - * RETURN: Status - * - * DESCRIPTION: Convert Reference objects to values - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExResolveToValue ( - ACPI_OPERAND_OBJECT **StackPtr, - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE_PTR (ExResolveToValue, StackPtr); - - - if (!StackPtr || !*StackPtr) - { - ACPI_ERROR ((AE_INFO, "Internal - null pointer")); - return_ACPI_STATUS (AE_AML_NO_OPERAND); - } - - /* - * The entity pointed to by the StackPtr can be either - * 1) A valid ACPI_OPERAND_OBJECT, or - * 2) A ACPI_NAMESPACE_NODE (NamedObj) - */ - if (ACPI_GET_DESCRIPTOR_TYPE (*StackPtr) == ACPI_DESC_TYPE_OPERAND) - { - Status = AcpiExResolveObjectToValue (StackPtr, WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - if (!*StackPtr) - { - ACPI_ERROR ((AE_INFO, "Internal - null pointer")); - return_ACPI_STATUS (AE_AML_NO_OPERAND); - } - } - - /* - * Object on the stack may have changed if AcpiExResolveObjectToValue() - * was called (i.e., we can't use an _else_ here.) - */ - if (ACPI_GET_DESCRIPTOR_TYPE (*StackPtr) == ACPI_DESC_TYPE_NAMED) - { - Status = AcpiExResolveNodeToValue ( - ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, StackPtr), - WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Resolved object %p\n", *StackPtr)); - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExResolveObjectToValue - * - * PARAMETERS: StackPtr - Pointer to an internal object - * WalkState - Current method state - * - * RETURN: Status - * - * DESCRIPTION: Retrieve the value from an internal object. The Reference type - * uses the associated AML opcode to determine the value. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiExResolveObjectToValue ( - ACPI_OPERAND_OBJECT **StackPtr, - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status = AE_OK; - ACPI_OPERAND_OBJECT *StackDesc; - ACPI_OPERAND_OBJECT *ObjDesc = NULL; - UINT8 RefType; - - - ACPI_FUNCTION_TRACE (ExResolveObjectToValue); - - - StackDesc = *StackPtr; - - /* This is an object of type ACPI_OPERAND_OBJECT */ - - switch (StackDesc->Common.Type) - { - case ACPI_TYPE_LOCAL_REFERENCE: - - RefType = StackDesc->Reference.Class; - - switch (RefType) - { - case ACPI_REFCLASS_LOCAL: - case ACPI_REFCLASS_ARG: - /* - * Get the local from the method's state info - * Note: this increments the local's object reference count - */ - Status = AcpiDsMethodDataGetValue (RefType, - StackDesc->Reference.Value, WalkState, &ObjDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Arg/Local %X] ValueObj is %p\n", - StackDesc->Reference.Value, ObjDesc)); - - /* - * Now we can delete the original Reference Object and - * replace it with the resolved value - */ - AcpiUtRemoveReference (StackDesc); - *StackPtr = ObjDesc; - break; - - case ACPI_REFCLASS_INDEX: - - switch (StackDesc->Reference.TargetType) - { - case ACPI_TYPE_BUFFER_FIELD: - - /* Just return - do not dereference */ - break; - - case ACPI_TYPE_PACKAGE: - - /* If method call or CopyObject - do not dereference */ - - if ((WalkState->Opcode == AML_INT_METHODCALL_OP) || - (WalkState->Opcode == AML_COPY_OBJECT_OP)) - { - break; - } - - /* Otherwise, dereference the PackageIndex to a package element */ - - ObjDesc = *StackDesc->Reference.Where; - if (ObjDesc) - { - /* - * Valid object descriptor, copy pointer to return value - * (i.e., dereference the package index) - * Delete the ref object, increment the returned object - */ - AcpiUtAddReference (ObjDesc); - *StackPtr = ObjDesc; - } - else - { - /* - * A NULL object descriptor means an uninitialized element of - * the package, can't dereference it - */ - ACPI_ERROR ((AE_INFO, - "Attempt to dereference an Index to " - "NULL package element Idx=%p", - StackDesc)); - Status = AE_AML_UNINITIALIZED_ELEMENT; - } - break; - - default: - - /* Invalid reference object */ - - ACPI_ERROR ((AE_INFO, - "Unknown TargetType 0x%X in Index/Reference object %p", - StackDesc->Reference.TargetType, StackDesc)); - Status = AE_AML_INTERNAL; - break; - } - break; - - case ACPI_REFCLASS_REFOF: - case ACPI_REFCLASS_DEBUG: - case ACPI_REFCLASS_TABLE: - - /* Just leave the object as-is, do not dereference */ - - break; - - case ACPI_REFCLASS_NAME: /* Reference to a named object */ - - /* Dereference the name */ - - if ((StackDesc->Reference.Node->Type == ACPI_TYPE_DEVICE) || - (StackDesc->Reference.Node->Type == ACPI_TYPE_THERMAL)) - { - /* These node types do not have 'real' subobjects */ - - *StackPtr = (void *) StackDesc->Reference.Node; - } - else - { - /* Get the object pointed to by the namespace node */ - - *StackPtr = (StackDesc->Reference.Node)->Object; - AcpiUtAddReference (*StackPtr); - } - - AcpiUtRemoveReference (StackDesc); - break; - - default: - - ACPI_ERROR ((AE_INFO, - "Unknown Reference type 0x%X in %p", - RefType, StackDesc)); - Status = AE_AML_INTERNAL; - break; - } - break; - - case ACPI_TYPE_BUFFER: - - Status = AcpiDsGetBufferArguments (StackDesc); - break; - - case ACPI_TYPE_PACKAGE: - - Status = AcpiDsGetPackageArguments (StackDesc); - break; - - case ACPI_TYPE_BUFFER_FIELD: - case ACPI_TYPE_LOCAL_REGION_FIELD: - case ACPI_TYPE_LOCAL_BANK_FIELD: - case ACPI_TYPE_LOCAL_INDEX_FIELD: - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "FieldRead SourceDesc=%p Type=%X\n", - StackDesc, StackDesc->Common.Type)); - - Status = AcpiExReadDataFromField (WalkState, StackDesc, &ObjDesc); - - /* Remove a reference to the original operand, then override */ - - AcpiUtRemoveReference (*StackPtr); - *StackPtr = (void *) ObjDesc; - break; - - default: - - break; - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExResolveMultiple - * - * PARAMETERS: WalkState - Current state (contains AML opcode) - * Operand - Starting point for resolution - * ReturnType - Where the object type is returned - * ReturnDesc - Where the resolved object is returned - * - * RETURN: Status - * - * DESCRIPTION: Return the base object and type. Traverse a reference list if - * necessary to get to the base object. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExResolveMultiple ( - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT *Operand, - ACPI_OBJECT_TYPE *ReturnType, - ACPI_OPERAND_OBJECT **ReturnDesc) -{ - ACPI_OPERAND_OBJECT *ObjDesc = ACPI_CAST_PTR (void, Operand); - ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Operand); - ACPI_OBJECT_TYPE Type; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiExResolveMultiple); - - - /* Operand can be either a namespace node or an operand descriptor */ - - switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc)) - { - case ACPI_DESC_TYPE_OPERAND: - - Type = ObjDesc->Common.Type; - break; - - case ACPI_DESC_TYPE_NAMED: - - Type = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type; - ObjDesc = AcpiNsGetAttachedObject (Node); - - /* If we had an Alias node, use the attached object for type info */ - - if (Type == ACPI_TYPE_LOCAL_ALIAS) - { - Type = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type; - ObjDesc = AcpiNsGetAttachedObject ( - (ACPI_NAMESPACE_NODE *) ObjDesc); - } - - switch (Type) - { - case ACPI_TYPE_DEVICE: - case ACPI_TYPE_THERMAL: - - /* These types have no attached subobject */ - break; - - default: - - /* All other types require a subobject */ - - if (!ObjDesc) - { - ACPI_ERROR ((AE_INFO, - "[%4.4s] Node is unresolved or uninitialized", - AcpiUtGetNodeName (Node))); - return_ACPI_STATUS (AE_AML_UNINITIALIZED_NODE); - } - break; - } - break; - - default: - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - - /* If type is anything other than a reference, we are done */ - - if (Type != ACPI_TYPE_LOCAL_REFERENCE) - { - goto Exit; - } - - /* - * For reference objects created via the RefOf, Index, or Load/LoadTable - * operators, we need to get to the base object (as per the ACPI - * specification of the ObjectType and SizeOf operators). This means - * traversing the list of possibly many nested references. - */ - while (ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) - { - switch (ObjDesc->Reference.Class) - { - case ACPI_REFCLASS_REFOF: - case ACPI_REFCLASS_NAME: - - /* Dereference the reference pointer */ - - if (ObjDesc->Reference.Class == ACPI_REFCLASS_REFOF) - { - Node = ObjDesc->Reference.Object; - } - else /* AML_INT_NAMEPATH_OP */ - { - Node = ObjDesc->Reference.Node; - } - - /* All "References" point to a NS node */ - - if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) - { - ACPI_ERROR ((AE_INFO, - "Not a namespace node %p [%s]", - Node, AcpiUtGetDescriptorName (Node))); - return_ACPI_STATUS (AE_AML_INTERNAL); - } - - /* Get the attached object */ - - ObjDesc = AcpiNsGetAttachedObject (Node); - if (!ObjDesc) - { - /* No object, use the NS node type */ - - Type = AcpiNsGetType (Node); - goto Exit; - } - - /* Check for circular references */ - - if (ObjDesc == Operand) - { - return_ACPI_STATUS (AE_AML_CIRCULAR_REFERENCE); - } - break; - - case ACPI_REFCLASS_INDEX: - - /* Get the type of this reference (index into another object) */ - - Type = ObjDesc->Reference.TargetType; - if (Type != ACPI_TYPE_PACKAGE) - { - goto Exit; - } - - /* - * The main object is a package, we want to get the type - * of the individual package element that is referenced by - * the index. - * - * This could of course in turn be another reference object. - */ - ObjDesc = *(ObjDesc->Reference.Where); - if (!ObjDesc) - { - /* NULL package elements are allowed */ - - Type = 0; /* Uninitialized */ - goto Exit; - } - break; - - case ACPI_REFCLASS_TABLE: - - Type = ACPI_TYPE_DDB_HANDLE; - goto Exit; - - case ACPI_REFCLASS_LOCAL: - case ACPI_REFCLASS_ARG: - - if (ReturnDesc) - { - Status = AcpiDsMethodDataGetValue (ObjDesc->Reference.Class, - ObjDesc->Reference.Value, WalkState, &ObjDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - AcpiUtRemoveReference (ObjDesc); - } - else - { - Status = AcpiDsMethodDataGetNode (ObjDesc->Reference.Class, - ObjDesc->Reference.Value, WalkState, &Node); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - ObjDesc = AcpiNsGetAttachedObject (Node); - if (!ObjDesc) - { - Type = ACPI_TYPE_ANY; - goto Exit; - } - } - break; - - case ACPI_REFCLASS_DEBUG: - - /* The Debug Object is of type "DebugObject" */ - - Type = ACPI_TYPE_DEBUG_OBJECT; - goto Exit; - - default: - - ACPI_ERROR ((AE_INFO, - "Unknown Reference Class 0x%2.2X", - ObjDesc->Reference.Class)); - return_ACPI_STATUS (AE_AML_INTERNAL); - } - } - - /* - * Now we are guaranteed to have an object that has not been created - * via the RefOf or Index operators. - */ - Type = ObjDesc->Common.Type; - - -Exit: - /* Convert internal types to external types */ - - switch (Type) - { - case ACPI_TYPE_LOCAL_REGION_FIELD: - case ACPI_TYPE_LOCAL_BANK_FIELD: - case ACPI_TYPE_LOCAL_INDEX_FIELD: - - Type = ACPI_TYPE_FIELD_UNIT; - break; - - case ACPI_TYPE_LOCAL_SCOPE: - - /* Per ACPI Specification, Scope is untyped */ - - Type = ACPI_TYPE_ANY; - break; - - default: - - /* No change to Type required */ - - break; - } - - *ReturnType = Type; - if (ReturnDesc) - { - *ReturnDesc = ObjDesc; - } - return_ACPI_STATUS (AE_OK); -} diff --git a/drivers/acpica/exresop.c b/drivers/acpica/exresop.c deleted file mode 100644 index 2bc79be..0000000 --- a/drivers/acpica/exresop.c +++ /dev/null @@ -1,840 +0,0 @@ -/****************************************************************************** - * - * Module Name: exresop - AML Interpreter operand/object resolution - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "amlcode.h" -#include "acparser.h" -#include "acinterp.h" -#include "acnamesp.h" - - -#define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exresop") - -/* Local prototypes */ - -static ACPI_STATUS -AcpiExCheckObjectType ( - ACPI_OBJECT_TYPE TypeNeeded, - ACPI_OBJECT_TYPE ThisType, - void *Object); - - -/******************************************************************************* - * - * FUNCTION: AcpiExCheckObjectType - * - * PARAMETERS: TypeNeeded Object type needed - * ThisType Actual object type - * Object Object pointer - * - * RETURN: Status - * - * DESCRIPTION: Check required type against actual type - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiExCheckObjectType ( - ACPI_OBJECT_TYPE TypeNeeded, - ACPI_OBJECT_TYPE ThisType, - void *Object) -{ - ACPI_FUNCTION_ENTRY (); - - - if (TypeNeeded == ACPI_TYPE_ANY) - { - /* All types OK, so we don't perform any typechecks */ - - return (AE_OK); - } - - if (TypeNeeded == ACPI_TYPE_LOCAL_REFERENCE) - { - /* - * Allow the AML "Constant" opcodes (Zero, One, etc.) to be reference - * objects and thus allow them to be targets. (As per the ACPI - * specification, a store to a constant is a noop.) - */ - if ((ThisType == ACPI_TYPE_INTEGER) && - (((ACPI_OPERAND_OBJECT *) Object)->Common.Flags & - AOPOBJ_AML_CONSTANT)) - { - return (AE_OK); - } - } - - if (TypeNeeded != ThisType) - { - ACPI_ERROR ((AE_INFO, - "Needed type [%s], found [%s] %p", - AcpiUtGetTypeName (TypeNeeded), - AcpiUtGetTypeName (ThisType), Object)); - - return (AE_AML_OPERAND_TYPE); - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExResolveOperands - * - * PARAMETERS: Opcode - Opcode being interpreted - * StackPtr - Pointer to the operand stack to be - * resolved - * WalkState - Current state - * - * RETURN: Status - * - * DESCRIPTION: Convert multiple input operands to the types required by the - * target operator. - * - * Each 5-bit group in ArgTypes represents one required - * operand and indicates the required Type. The corresponding operand - * will be converted to the required type if possible, otherwise we - * abort with an exception. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExResolveOperands ( - UINT16 Opcode, - ACPI_OPERAND_OBJECT **StackPtr, - ACPI_WALK_STATE *WalkState) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_STATUS Status = AE_OK; - UINT8 ObjectType; - UINT32 ArgTypes; - const ACPI_OPCODE_INFO *OpInfo; - UINT32 ThisArgType; - ACPI_OBJECT_TYPE TypeNeeded; - UINT16 TargetOp = 0; - - - ACPI_FUNCTION_TRACE_U32 (ExResolveOperands, Opcode); - - - OpInfo = AcpiPsGetOpcodeInfo (Opcode); - if (OpInfo->Class == AML_CLASS_UNKNOWN) - { - return_ACPI_STATUS (AE_AML_BAD_OPCODE); - } - - ArgTypes = OpInfo->RuntimeArgs; - if (ArgTypes == ARGI_INVALID_OPCODE) - { - ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X", - Opcode)); - - return_ACPI_STATUS (AE_AML_INTERNAL); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Opcode %X [%s] RequiredOperandTypes=%8.8X\n", - Opcode, OpInfo->Name, ArgTypes)); - - /* - * Normal exit is with (ArgTypes == 0) at end of argument list. - * Function will return an exception from within the loop upon - * finding an entry which is not (or cannot be converted - * to) the required type; if stack underflows; or upon - * finding a NULL stack entry (which should not happen). - */ - while (GET_CURRENT_ARG_TYPE (ArgTypes)) - { - if (!StackPtr || !*StackPtr) - { - ACPI_ERROR ((AE_INFO, "Null stack entry at %p", - StackPtr)); - - return_ACPI_STATUS (AE_AML_INTERNAL); - } - - /* Extract useful items */ - - ObjDesc = *StackPtr; - - /* Decode the descriptor type */ - - switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc)) - { - case ACPI_DESC_TYPE_NAMED: - - /* Namespace Node */ - - ObjectType = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type; - - /* - * Resolve an alias object. The construction of these objects - * guarantees that there is only one level of alias indirection; - * thus, the attached object is always the aliased namespace node - */ - if (ObjectType == ACPI_TYPE_LOCAL_ALIAS) - { - ObjDesc = AcpiNsGetAttachedObject ( - (ACPI_NAMESPACE_NODE *) ObjDesc); - *StackPtr = ObjDesc; - ObjectType = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type; - } - break; - - case ACPI_DESC_TYPE_OPERAND: - - /* ACPI internal object */ - - ObjectType = ObjDesc->Common.Type; - - /* Check for bad ACPI_OBJECT_TYPE */ - - if (!AcpiUtValidObjectType (ObjectType)) - { - ACPI_ERROR ((AE_INFO, - "Bad operand object type [0x%X]", ObjectType)); - - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - - if (ObjectType == (UINT8) ACPI_TYPE_LOCAL_REFERENCE) - { - /* Validate the Reference */ - - switch (ObjDesc->Reference.Class) - { - case ACPI_REFCLASS_DEBUG: - - TargetOp = AML_DEBUG_OP; - - ACPI_FALLTHROUGH; - - case ACPI_REFCLASS_ARG: - case ACPI_REFCLASS_LOCAL: - case ACPI_REFCLASS_INDEX: - case ACPI_REFCLASS_REFOF: - case ACPI_REFCLASS_TABLE: /* DdbHandle from LOAD_OP or LOAD_TABLE_OP */ - case ACPI_REFCLASS_NAME: /* Reference to a named object */ - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Operand is a Reference, Class [%s] %2.2X\n", - AcpiUtGetReferenceName (ObjDesc), - ObjDesc->Reference.Class)); - break; - - default: - - ACPI_ERROR ((AE_INFO, - "Unknown Reference Class 0x%2.2X in %p", - ObjDesc->Reference.Class, ObjDesc)); - - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - } - break; - - default: - - /* Invalid descriptor */ - - ACPI_ERROR ((AE_INFO, "Invalid descriptor %p [%s]", - ObjDesc, AcpiUtGetDescriptorName (ObjDesc))); - - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - - /* Get one argument type, point to the next */ - - ThisArgType = GET_CURRENT_ARG_TYPE (ArgTypes); - INCREMENT_ARG_LIST (ArgTypes); - - /* - * Handle cases where the object does not need to be - * resolved to a value - */ - switch (ThisArgType) - { - case ARGI_REF_OR_STRING: /* Can be a String or Reference */ - - if ((ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == - ACPI_DESC_TYPE_OPERAND) && - (ObjDesc->Common.Type == ACPI_TYPE_STRING)) - { - /* - * String found - the string references a named object and - * must be resolved to a node - */ - goto NextOperand; - } - - /* - * Else not a string - fall through to the normal Reference - * case below - */ - ACPI_FALLTHROUGH; - - case ARGI_REFERENCE: /* References: */ - case ARGI_INTEGER_REF: - case ARGI_OBJECT_REF: - case ARGI_DEVICE_REF: - case ARGI_TARGETREF: /* Allows implicit conversion rules before store */ - case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */ - case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */ - case ARGI_STORE_TARGET: - - /* - * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE - * A Namespace Node is OK as-is - */ - if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED) - { - goto NextOperand; - } - - Status = AcpiExCheckObjectType ( - ACPI_TYPE_LOCAL_REFERENCE, ObjectType, ObjDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - goto NextOperand; - - case ARGI_DATAREFOBJ: /* Store operator only */ - /* - * We don't want to resolve IndexOp reference objects during - * a store because this would be an implicit DeRefOf operation. - * Instead, we just want to store the reference object. - * -- All others must be resolved below. - */ - if ((Opcode == AML_STORE_OP) && - ((*StackPtr)->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) && - ((*StackPtr)->Reference.Class == ACPI_REFCLASS_INDEX)) - { - goto NextOperand; - } - break; - - default: - - /* All cases covered above */ - - break; - } - - /* - * Resolve this object to a value - */ - Status = AcpiExResolveToValue (StackPtr, WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Get the resolved object */ - - ObjDesc = *StackPtr; - - /* - * Check the resulting object (value) type - */ - switch (ThisArgType) - { - /* - * For the simple cases, only one type of resolved object - * is allowed - */ - case ARGI_MUTEX: - - /* Need an operand of type ACPI_TYPE_MUTEX */ - - TypeNeeded = ACPI_TYPE_MUTEX; - break; - - case ARGI_EVENT: - - /* Need an operand of type ACPI_TYPE_EVENT */ - - TypeNeeded = ACPI_TYPE_EVENT; - break; - - case ARGI_PACKAGE: /* Package */ - - /* Need an operand of type ACPI_TYPE_PACKAGE */ - - TypeNeeded = ACPI_TYPE_PACKAGE; - break; - - case ARGI_ANYTYPE: - - /* Any operand type will do */ - - TypeNeeded = ACPI_TYPE_ANY; - break; - - case ARGI_DDBHANDLE: - - /* Need an operand of type ACPI_TYPE_DDB_HANDLE */ - - TypeNeeded = ACPI_TYPE_LOCAL_REFERENCE; - break; - - - /* - * The more complex cases allow multiple resolved object types - */ - case ARGI_INTEGER: - - /* - * Need an operand of type ACPI_TYPE_INTEGER, but we can - * implicitly convert from a STRING or BUFFER. - * - * Known as "Implicit Source Operand Conversion" - */ - Status = AcpiExConvertToInteger (ObjDesc, StackPtr, - ACPI_IMPLICIT_CONVERSION); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_TYPE) - { - ACPI_ERROR ((AE_INFO, - "Needed [Integer/String/Buffer], found [%s] %p", - AcpiUtGetObjectTypeName (ObjDesc), ObjDesc)); - - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - - return_ACPI_STATUS (Status); - } - - if (ObjDesc != *StackPtr) - { - AcpiUtRemoveReference (ObjDesc); - } - goto NextOperand; - - case ARGI_BUFFER: - /* - * Need an operand of type ACPI_TYPE_BUFFER, - * But we can implicitly convert from a STRING or INTEGER - * Aka - "Implicit Source Operand Conversion" - */ - Status = AcpiExConvertToBuffer (ObjDesc, StackPtr); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_TYPE) - { - ACPI_ERROR ((AE_INFO, - "Needed [Integer/String/Buffer], found [%s] %p", - AcpiUtGetObjectTypeName (ObjDesc), ObjDesc)); - - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - - return_ACPI_STATUS (Status); - } - - if (ObjDesc != *StackPtr) - { - AcpiUtRemoveReference (ObjDesc); - } - goto NextOperand; - - case ARGI_STRING: - /* - * Need an operand of type ACPI_TYPE_STRING, - * But we can implicitly convert from a BUFFER or INTEGER - * Aka - "Implicit Source Operand Conversion" - */ - Status = AcpiExConvertToString ( - ObjDesc, StackPtr, ACPI_IMPLICIT_CONVERT_HEX); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_TYPE) - { - ACPI_ERROR ((AE_INFO, - "Needed [Integer/String/Buffer], found [%s] %p", - AcpiUtGetObjectTypeName (ObjDesc), ObjDesc)); - - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - - return_ACPI_STATUS (Status); - } - - if (ObjDesc != *StackPtr) - { - AcpiUtRemoveReference (ObjDesc); - } - goto NextOperand; - - case ARGI_COMPUTEDATA: - - /* Need an operand of type INTEGER, STRING or BUFFER */ - - switch (ObjDesc->Common.Type) - { - case ACPI_TYPE_INTEGER: - case ACPI_TYPE_STRING: - case ACPI_TYPE_BUFFER: - - /* Valid operand */ - break; - - default: - ACPI_ERROR ((AE_INFO, - "Needed [Integer/String/Buffer], found [%s] %p", - AcpiUtGetObjectTypeName (ObjDesc), ObjDesc)); - - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - goto NextOperand; - - case ARGI_BUFFER_OR_STRING: - - /* Need an operand of type STRING or BUFFER */ - - switch (ObjDesc->Common.Type) - { - case ACPI_TYPE_STRING: - case ACPI_TYPE_BUFFER: - - /* Valid operand */ - break; - - case ACPI_TYPE_INTEGER: - - /* Highest priority conversion is to type Buffer */ - - Status = AcpiExConvertToBuffer (ObjDesc, StackPtr); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - if (ObjDesc != *StackPtr) - { - AcpiUtRemoveReference (ObjDesc); - } - break; - - default: - ACPI_ERROR ((AE_INFO, - "Needed [Integer/String/Buffer], found [%s] %p", - AcpiUtGetObjectTypeName (ObjDesc), ObjDesc)); - - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - goto NextOperand; - - case ARGI_DATAOBJECT: - /* - * ARGI_DATAOBJECT is only used by the SizeOf operator. - * Need a buffer, string, package, or RefOf reference. - * - * The only reference allowed here is a direct reference to - * a namespace node. - */ - switch (ObjDesc->Common.Type) - { - case ACPI_TYPE_PACKAGE: - case ACPI_TYPE_STRING: - case ACPI_TYPE_BUFFER: - case ACPI_TYPE_LOCAL_REFERENCE: - - /* Valid operand */ - break; - - default: - - ACPI_ERROR ((AE_INFO, - "Needed [Buffer/String/Package/Reference], found [%s] %p", - AcpiUtGetObjectTypeName (ObjDesc), ObjDesc)); - - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - goto NextOperand; - - case ARGI_COMPLEXOBJ: - - /* Need a buffer or package or (ACPI 2.0) String */ - - switch (ObjDesc->Common.Type) - { - case ACPI_TYPE_PACKAGE: - case ACPI_TYPE_STRING: - case ACPI_TYPE_BUFFER: - - /* Valid operand */ - break; - - default: - - ACPI_ERROR ((AE_INFO, - "Needed [Buffer/String/Package], found [%s] %p", - AcpiUtGetObjectTypeName (ObjDesc), ObjDesc)); - - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - goto NextOperand; - - case ARGI_REGION_OR_BUFFER: /* Used by Load() only */ - - /* - * Need an operand of type REGION or a BUFFER - * (which could be a resolved region field) - */ - switch (ObjDesc->Common.Type) - { - case ACPI_TYPE_BUFFER: - case ACPI_TYPE_REGION: - - /* Valid operand */ - break; - - default: - - ACPI_ERROR ((AE_INFO, - "Needed [Region/Buffer], found [%s] %p", - AcpiUtGetObjectTypeName (ObjDesc), ObjDesc)); - - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - goto NextOperand; - - case ARGI_DATAREFOBJ: - - /* Used by the Store() operator only */ - - switch (ObjDesc->Common.Type) - { - case ACPI_TYPE_INTEGER: - case ACPI_TYPE_PACKAGE: - case ACPI_TYPE_STRING: - case ACPI_TYPE_BUFFER: - case ACPI_TYPE_BUFFER_FIELD: - case ACPI_TYPE_LOCAL_REFERENCE: - case ACPI_TYPE_LOCAL_REGION_FIELD: - case ACPI_TYPE_LOCAL_BANK_FIELD: - case ACPI_TYPE_LOCAL_INDEX_FIELD: - case ACPI_TYPE_DDB_HANDLE: - - /* Valid operand */ - break; - - default: - - if (AcpiGbl_EnableInterpreterSlack) - { - /* - * Enable original behavior of Store(), allowing any - * and all objects as the source operand. The ACPI - * spec does not allow this, however. - */ - break; - } - - if (TargetOp == AML_DEBUG_OP) - { - /* Allow store of any object to the Debug object */ - - break; - } - - ACPI_ERROR ((AE_INFO, - "Needed Integer/Buffer/String/Package/Ref/Ddb]" - ", found [%s] %p", - AcpiUtGetObjectTypeName (ObjDesc), ObjDesc)); - - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - goto NextOperand; - - default: - - /* Unknown type */ - - ACPI_ERROR ((AE_INFO, - "Internal - Unknown ARGI (required operand) type 0x%X", - ThisArgType)); - - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* - * Make sure that the original object was resolved to the - * required object type (Simple cases only). - */ - Status = AcpiExCheckObjectType ( - TypeNeeded, (*StackPtr)->Common.Type, *StackPtr); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - -NextOperand: - /* - * If more operands needed, decrement StackPtr to point - * to next operand on stack - */ - if (GET_CURRENT_ARG_TYPE (ArgTypes)) - { - StackPtr--; - } - } - - ACPI_DUMP_OPERANDS (WalkState->Operands, - AcpiPsGetOpcodeName (Opcode), WalkState->NumOperands); - - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/exserial.c b/drivers/acpica/exserial.c deleted file mode 100644 index f574027..0000000 --- a/drivers/acpica/exserial.c +++ /dev/null @@ -1,531 +0,0 @@ -/****************************************************************************** - * - * Module Name: exserial - FieldUnit support for serial address spaces - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acdispat.h" -#include "acinterp.h" -#include "amlcode.h" - - -#define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exserial") - - -/******************************************************************************* - * - * FUNCTION: AcpiExReadGpio - * - * PARAMETERS: ObjDesc - The named field to read - * Buffer - Where the return data is returned - * - * RETURN: Status - * - * DESCRIPTION: Read from a named field that references a Generic Serial Bus - * field - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExReadGpio ( - ACPI_OPERAND_OBJECT *ObjDesc, - void *Buffer) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE_PTR (ExReadGpio, ObjDesc); - - - /* - * For GPIO (GeneralPurposeIo), the Address will be the bit offset - * from the previous Connection() operator, making it effectively a - * pin number index. The BitLength is the length of the field, which - * is thus the number of pins. - */ - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "GPIO FieldRead [FROM]: Pin %u Bits %u\n", - ObjDesc->Field.PinNumberIndex, ObjDesc->Field.BitLength)); - - /* Lock entire transaction if requested */ - - AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); - - /* Perform the read */ - - Status = AcpiExAccessRegion ( - ObjDesc, 0, (UINT64 *) Buffer, ACPI_READ); - - AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExWriteGpio - * - * PARAMETERS: SourceDesc - Contains data to write. Expect to be - * an Integer object. - * ObjDesc - The named field - * ResultDesc - Where the return value is returned, if any - * - * RETURN: Status - * - * DESCRIPTION: Write to a named field that references a General Purpose I/O - * field. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExWriteGpio ( - ACPI_OPERAND_OBJECT *SourceDesc, - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT **ReturnBuffer) -{ - ACPI_STATUS Status; - void *Buffer; - - - ACPI_FUNCTION_TRACE_PTR (ExWriteGpio, ObjDesc); - - - /* - * For GPIO (GeneralPurposeIo), we will bypass the entire field - * mechanism and handoff the bit address and bit width directly to - * the handler. The Address will be the bit offset - * from the previous Connection() operator, making it effectively a - * pin number index. The BitLength is the length of the field, which - * is thus the number of pins. - */ - if (SourceDesc->Common.Type != ACPI_TYPE_INTEGER) - { - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "GPIO FieldWrite [FROM]: (%s:%X), Value %.8X [TO]: Pin %u Bits %u\n", - AcpiUtGetTypeName (SourceDesc->Common.Type), - SourceDesc->Common.Type, (UINT32) SourceDesc->Integer.Value, - ObjDesc->Field.PinNumberIndex, ObjDesc->Field.BitLength)); - - Buffer = &SourceDesc->Integer.Value; - - /* Lock entire transaction if requested */ - - AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); - - /* Perform the write */ - - Status = AcpiExAccessRegion ( - ObjDesc, 0, (UINT64 *) Buffer, ACPI_WRITE); - AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExReadSerialBus - * - * PARAMETERS: ObjDesc - The named field to read - * ReturnBuffer - Where the return value is returned, if any - * - * RETURN: Status - * - * DESCRIPTION: Read from a named field that references a serial bus - * (SMBus, IPMI, or GSBus). - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExReadSerialBus ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT **ReturnBuffer) -{ - ACPI_STATUS Status; - UINT32 BufferLength; - ACPI_OPERAND_OBJECT *BufferDesc; - UINT32 Function; - UINT16 AccessorType; - - - ACPI_FUNCTION_TRACE_PTR (ExReadSerialBus, ObjDesc); - - - /* - * This is an SMBus, GSBus or IPMI read. We must create a buffer to - * hold the data and then directly access the region handler. - * - * Note: SMBus and GSBus protocol value is passed in upper 16-bits - * of Function - * - * Common buffer format: - * Status; (Byte 0 of the data buffer) - * Length; (Byte 1 of the data buffer) - * Data[x-1]: (Bytes 2-x of the arbitrary length data buffer) - */ - switch (ObjDesc->Field.RegionObj->Region.SpaceId) - { - case ACPI_ADR_SPACE_SMBUS: - - BufferLength = ACPI_SMBUS_BUFFER_SIZE; - Function = ACPI_READ | (ObjDesc->Field.Attribute << 16); - break; - - case ACPI_ADR_SPACE_IPMI: - - BufferLength = ACPI_IPMI_BUFFER_SIZE; - Function = ACPI_READ; - break; - - case ACPI_ADR_SPACE_GSBUS: - - AccessorType = ObjDesc->Field.Attribute; - if (AccessorType == AML_FIELD_ATTRIB_RAW_PROCESS_BYTES) - { - ACPI_ERROR ((AE_INFO, - "Invalid direct read using bidirectional write-then-read protocol")); - - return_ACPI_STATUS (AE_AML_PROTOCOL); - } - - Status = AcpiExGetProtocolBufferLength (AccessorType, &BufferLength); - if (ACPI_FAILURE (Status)) - { - ACPI_ERROR ((AE_INFO, - "Invalid protocol ID for GSBus: 0x%4.4X", AccessorType)); - - return_ACPI_STATUS (Status); - } - - /* Add header length to get the full size of the buffer */ - - BufferLength += ACPI_SERIAL_HEADER_SIZE; - Function = ACPI_READ | (AccessorType << 16); - break; - - case ACPI_ADR_SPACE_PLATFORM_RT: - - BufferLength = ACPI_PRM_INPUT_BUFFER_SIZE; - Function = ACPI_READ; - break; - - case ACPI_ADR_SPACE_FIXED_HARDWARE: - - BufferLength = ACPI_FFH_INPUT_BUFFER_SIZE; - Function = ACPI_READ; - break; - - default: - return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID); - } - - /* Create the local transfer buffer that is returned to the caller */ - - BufferDesc = AcpiUtCreateBufferObject (BufferLength); - if (!BufferDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Lock entire transaction if requested */ - - AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); - - /* Call the region handler for the write-then-read */ - - Status = AcpiExAccessRegion (ObjDesc, 0, - ACPI_CAST_PTR (UINT64, BufferDesc->Buffer.Pointer), Function); - AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); - - *ReturnBuffer = BufferDesc; - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExWriteSerialBus - * - * PARAMETERS: SourceDesc - Contains data to write - * ObjDesc - The named field - * ReturnBuffer - Where the return value is returned, if any - * - * RETURN: Status - * - * DESCRIPTION: Write to a named field that references a serial bus - * (SMBus, IPMI, GSBus). - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExWriteSerialBus ( - ACPI_OPERAND_OBJECT *SourceDesc, - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT **ReturnBuffer) -{ - ACPI_STATUS Status; - UINT32 BufferLength; - UINT32 DataLength; - void *Buffer; - ACPI_OPERAND_OBJECT *BufferDesc; - UINT32 Function; - UINT16 AccessorType; - - - ACPI_FUNCTION_TRACE_PTR (ExWriteSerialBus, ObjDesc); - - - /* - * This is an SMBus, GSBus or IPMI write. We will bypass the entire - * field mechanism and handoff the buffer directly to the handler. - * For these address spaces, the buffer is bidirectional; on a - * write, return data is returned in the same buffer. - * - * Source must be a buffer of sufficient size, these are fixed size: - * ACPI_SMBUS_BUFFER_SIZE, or ACPI_IPMI_BUFFER_SIZE. - * - * Note: SMBus and GSBus protocol type is passed in upper 16-bits - * of Function - * - * Common buffer format: - * Status; (Byte 0 of the data buffer) - * Length; (Byte 1 of the data buffer) - * Data[x-1]: (Bytes 2-x of the arbitrary length data buffer) - */ - if (SourceDesc->Common.Type != ACPI_TYPE_BUFFER) - { - ACPI_ERROR ((AE_INFO, - "SMBus/IPMI/GenericSerialBus write requires " - "Buffer, found type %s", - AcpiUtGetObjectTypeName (SourceDesc))); - - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - - switch (ObjDesc->Field.RegionObj->Region.SpaceId) - { - case ACPI_ADR_SPACE_SMBUS: - - BufferLength = ACPI_SMBUS_BUFFER_SIZE; - Function = ACPI_WRITE | (ObjDesc->Field.Attribute << 16); - break; - - case ACPI_ADR_SPACE_IPMI: - - BufferLength = ACPI_IPMI_BUFFER_SIZE; - Function = ACPI_WRITE; - break; - - case ACPI_ADR_SPACE_GSBUS: - - AccessorType = ObjDesc->Field.Attribute; - Status = AcpiExGetProtocolBufferLength (AccessorType, &BufferLength); - if (ACPI_FAILURE (Status)) - { - ACPI_ERROR ((AE_INFO, - "Invalid protocol ID for GSBus: 0x%4.4X", AccessorType)); - - return_ACPI_STATUS (Status); - } - - /* Add header length to get the full size of the buffer */ - - BufferLength += ACPI_SERIAL_HEADER_SIZE; - Function = ACPI_WRITE | (AccessorType << 16); - break; - - case ACPI_ADR_SPACE_PLATFORM_RT: - - BufferLength = ACPI_PRM_INPUT_BUFFER_SIZE; - Function = ACPI_WRITE; - break; - - case ACPI_ADR_SPACE_FIXED_HARDWARE: - - BufferLength = ACPI_FFH_INPUT_BUFFER_SIZE; - Function = ACPI_WRITE; - break; - - default: - return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID); - } - - /* Create the transfer/bidirectional/return buffer */ - - BufferDesc = AcpiUtCreateBufferObject (BufferLength); - if (!BufferDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Copy the input buffer data to the transfer buffer */ - - Buffer = BufferDesc->Buffer.Pointer; - DataLength = ACPI_MIN (BufferLength, SourceDesc->Buffer.Length); - memcpy (Buffer, SourceDesc->Buffer.Pointer, DataLength); - - /* Lock entire transaction if requested */ - - AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); - - /* - * Perform the write (returns status and perhaps data in the - * same buffer) - */ - Status = AcpiExAccessRegion ( - ObjDesc, 0, (UINT64 *) Buffer, Function); - AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); - - *ReturnBuffer = BufferDesc; - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/exstore.c b/drivers/acpica/exstore.c deleted file mode 100644 index f397691..0000000 --- a/drivers/acpica/exstore.c +++ /dev/null @@ -1,752 +0,0 @@ -/****************************************************************************** - * - * Module Name: exstore - AML Interpreter object store support - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acdispat.h" -#include "acinterp.h" -#include "amlcode.h" -#include "acnamesp.h" - - -#define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exstore") - -/* Local prototypes */ - -static ACPI_STATUS -AcpiExStoreObjectToIndex ( - ACPI_OPERAND_OBJECT *ValDesc, - ACPI_OPERAND_OBJECT *DestDesc, - ACPI_WALK_STATE *WalkState); - -static ACPI_STATUS -AcpiExStoreDirectToNode ( - ACPI_OPERAND_OBJECT *SourceDesc, - ACPI_NAMESPACE_NODE *Node, - ACPI_WALK_STATE *WalkState); - - -/******************************************************************************* - * - * FUNCTION: AcpiExStore - * - * PARAMETERS: *SourceDesc - Value to be stored - * *DestDesc - Where to store it. Must be an NS node - * or ACPI_OPERAND_OBJECT of type - * Reference; - * WalkState - Current walk state - * - * RETURN: Status - * - * DESCRIPTION: Store the value described by SourceDesc into the location - * described by DestDesc. Called by various interpreter - * functions to store the result of an operation into - * the destination operand -- not just simply the actual "Store" - * ASL operator. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExStore ( - ACPI_OPERAND_OBJECT *SourceDesc, - ACPI_OPERAND_OBJECT *DestDesc, - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status = AE_OK; - ACPI_OPERAND_OBJECT *RefDesc = DestDesc; - - - ACPI_FUNCTION_TRACE_PTR (ExStore, DestDesc); - - - /* Validate parameters */ - - if (!SourceDesc || !DestDesc) - { - ACPI_ERROR ((AE_INFO, "Null parameter")); - return_ACPI_STATUS (AE_AML_NO_OPERAND); - } - - /* DestDesc can be either a namespace node or an ACPI object */ - - if (ACPI_GET_DESCRIPTOR_TYPE (DestDesc) == ACPI_DESC_TYPE_NAMED) - { - /* - * Dest is a namespace node, - * Storing an object into a Named node. - */ - Status = AcpiExStoreObjectToNode (SourceDesc, - (ACPI_NAMESPACE_NODE *) DestDesc, WalkState, - ACPI_IMPLICIT_CONVERSION); - - return_ACPI_STATUS (Status); - } - - /* Destination object must be a Reference or a Constant object */ - - switch (DestDesc->Common.Type) - { - case ACPI_TYPE_LOCAL_REFERENCE: - - break; - - case ACPI_TYPE_INTEGER: - - /* Allow stores to Constants -- a Noop as per ACPI spec */ - - if (DestDesc->Common.Flags & AOPOBJ_AML_CONSTANT) - { - return_ACPI_STATUS (AE_OK); - } - - ACPI_FALLTHROUGH; - - default: - - /* Destination is not a Reference object */ - - ACPI_ERROR ((AE_INFO, - "Target is not a Reference or Constant object - [%s] %p", - AcpiUtGetObjectTypeName (DestDesc), DestDesc)); - - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - - /* - * Examine the Reference class. These cases are handled: - * - * 1) Store to Name (Change the object associated with a name) - * 2) Store to an indexed area of a Buffer or Package - * 3) Store to a Method Local or Arg - * 4) Store to the debug object - */ - switch (RefDesc->Reference.Class) - { - case ACPI_REFCLASS_REFOF: - - /* Storing an object into a Name "container" */ - - Status = AcpiExStoreObjectToNode (SourceDesc, - RefDesc->Reference.Object, - WalkState, ACPI_IMPLICIT_CONVERSION); - break; - - case ACPI_REFCLASS_INDEX: - - /* Storing to an Index (pointer into a packager or buffer) */ - - Status = AcpiExStoreObjectToIndex (SourceDesc, RefDesc, WalkState); - break; - - case ACPI_REFCLASS_LOCAL: - case ACPI_REFCLASS_ARG: - - /* Store to a method local/arg */ - - Status = AcpiDsStoreObjectToLocal (RefDesc->Reference.Class, - RefDesc->Reference.Value, SourceDesc, WalkState); - break; - - case ACPI_REFCLASS_DEBUG: - /* - * Storing to the Debug object causes the value stored to be - * displayed and otherwise has no effect -- see ACPI Specification - */ - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "**** Write to Debug Object: Object %p [%s] ****:\n\n", - SourceDesc, AcpiUtGetObjectTypeName (SourceDesc))); - - ACPI_DEBUG_OBJECT (SourceDesc, 0, 0); - break; - - default: - - ACPI_ERROR ((AE_INFO, "Unknown Reference Class 0x%2.2X", - RefDesc->Reference.Class)); - ACPI_DUMP_ENTRY (RefDesc, ACPI_LV_INFO); - - Status = AE_AML_INTERNAL; - break; - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExStoreObjectToIndex - * - * PARAMETERS: *SourceDesc - Value to be stored - * *DestDesc - Named object to receive the value - * WalkState - Current walk state - * - * RETURN: Status - * - * DESCRIPTION: Store the object to indexed Buffer or Package element - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiExStoreObjectToIndex ( - ACPI_OPERAND_OBJECT *SourceDesc, - ACPI_OPERAND_OBJECT *IndexDesc, - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status = AE_OK; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_OPERAND_OBJECT *NewDesc; - UINT8 Value = 0; - UINT32 i; - - - ACPI_FUNCTION_TRACE (ExStoreObjectToIndex); - - - /* - * Destination must be a reference pointer, and - * must point to either a buffer or a package - */ - switch (IndexDesc->Reference.TargetType) - { - case ACPI_TYPE_PACKAGE: - /* - * Storing to a package element. Copy the object and replace - * any existing object with the new object. No implicit - * conversion is performed. - * - * The object at *(IndexDesc->Reference.Where) is the - * element within the package that is to be modified. - * The parent package object is at IndexDesc->Reference.Object - */ - ObjDesc = *(IndexDesc->Reference.Where); - - if (SourceDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE && - SourceDesc->Reference.Class == ACPI_REFCLASS_TABLE) - { - /* This is a DDBHandle, just add a reference to it */ - - AcpiUtAddReference (SourceDesc); - NewDesc = SourceDesc; - } - else - { - /* Normal object, copy it */ - - Status = AcpiUtCopyIobjectToIobject ( - SourceDesc, &NewDesc, WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - if (ObjDesc) - { - /* Decrement reference count by the ref count of the parent package */ - - for (i = 0; - i < ((ACPI_OPERAND_OBJECT *) - IndexDesc->Reference.Object)->Common.ReferenceCount; - i++) - { - AcpiUtRemoveReference (ObjDesc); - } - } - - *(IndexDesc->Reference.Where) = NewDesc; - - /* Increment ref count by the ref count of the parent package-1 */ - - for (i = 1; - i < ((ACPI_OPERAND_OBJECT *) - IndexDesc->Reference.Object)->Common.ReferenceCount; - i++) - { - AcpiUtAddReference (NewDesc); - } - - break; - - case ACPI_TYPE_BUFFER_FIELD: - /* - * Store into a Buffer or String (not actually a real BufferField) - * at a location defined by an Index. - * - * The first 8-bit element of the source object is written to the - * 8-bit Buffer location defined by the Index destination object, - * according to the ACPI 2.0 specification. - */ - - /* - * Make sure the target is a Buffer or String. An error should - * not happen here, since the ReferenceObject was constructed - * by the INDEX_OP code. - */ - ObjDesc = IndexDesc->Reference.Object; - if ((ObjDesc->Common.Type != ACPI_TYPE_BUFFER) && - (ObjDesc->Common.Type != ACPI_TYPE_STRING)) - { - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - - /* - * The assignment of the individual elements will be slightly - * different for each source type. - */ - switch (SourceDesc->Common.Type) - { - case ACPI_TYPE_INTEGER: - - /* Use the least-significant byte of the integer */ - - Value = (UINT8) (SourceDesc->Integer.Value); - break; - - case ACPI_TYPE_BUFFER: - case ACPI_TYPE_STRING: - - /* Note: Takes advantage of common string/buffer fields */ - - Value = SourceDesc->Buffer.Pointer[0]; - break; - - default: - - /* All other types are invalid */ - - ACPI_ERROR ((AE_INFO, - "Source must be type [Integer/Buffer/String], found [%s]", - AcpiUtGetObjectTypeName (SourceDesc))); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - - /* Store the source value into the target buffer byte */ - - ObjDesc->Buffer.Pointer[IndexDesc->Reference.Value] = Value; - break; - - default: - ACPI_ERROR ((AE_INFO, - "Target is not of type [Package/BufferField]")); - Status = AE_AML_TARGET_TYPE; - break; - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExStoreObjectToNode - * - * PARAMETERS: SourceDesc - Value to be stored - * Node - Named object to receive the value - * WalkState - Current walk state - * ImplicitConversion - Perform implicit conversion (yes/no) - * - * RETURN: Status - * - * DESCRIPTION: Store the object to the named object. - * - * The assignment of an object to a named object is handled here. - * The value passed in will replace the current value (if any) - * with the input value. - * - * When storing into an object the data is converted to the - * target object type then stored in the object. This means - * that the target object type (for an initialized target) will - * not be changed by a store operation. A CopyObject can change - * the target type, however. - * - * The ImplicitConversion flag is set to NO/FALSE only when - * storing to an ArgX -- as per the rules of the ACPI spec. - * - * Assumes parameters are already validated. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExStoreObjectToNode ( - ACPI_OPERAND_OBJECT *SourceDesc, - ACPI_NAMESPACE_NODE *Node, - ACPI_WALK_STATE *WalkState, - UINT8 ImplicitConversion) -{ - ACPI_STATUS Status = AE_OK; - ACPI_OPERAND_OBJECT *TargetDesc; - ACPI_OPERAND_OBJECT *NewDesc; - ACPI_OBJECT_TYPE TargetType; - - - ACPI_FUNCTION_TRACE_PTR (ExStoreObjectToNode, SourceDesc); - - - /* Get current type of the node, and object attached to Node */ - - TargetType = AcpiNsGetType (Node); - TargetDesc = AcpiNsGetAttachedObject (Node); - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Storing %p [%s] to node %p [%s]\n", - SourceDesc, AcpiUtGetObjectTypeName (SourceDesc), - Node, AcpiUtGetTypeName (TargetType))); - - /* Only limited target types possible for everything except CopyObject */ - - if (WalkState->Opcode != AML_COPY_OBJECT_OP) - { - /* - * Only CopyObject allows all object types to be overwritten. For - * TargetRef(s), there are restrictions on the object types that - * are allowed. - * - * Allowable operations/typing for Store: - * - * 1) Simple Store - * Integer --> Integer (Named/Local/Arg) - * String --> String (Named/Local/Arg) - * Buffer --> Buffer (Named/Local/Arg) - * Package --> Package (Named/Local/Arg) - * - * 2) Store with implicit conversion - * Integer --> String or Buffer (Named) - * String --> Integer or Buffer (Named) - * Buffer --> Integer or String (Named) - */ - switch (TargetType) - { - case ACPI_TYPE_PACKAGE: - /* - * Here, can only store a package to an existing package. - * Storing a package to a Local/Arg is OK, and handled - * elsewhere. - */ - if (WalkState->Opcode == AML_STORE_OP) - { - if (SourceDesc->Common.Type != ACPI_TYPE_PACKAGE) - { - ACPI_ERROR ((AE_INFO, - "Cannot assign type [%s] to [Package] " - "(source must be type Pkg)", - AcpiUtGetObjectTypeName (SourceDesc))); - - return_ACPI_STATUS (AE_AML_TARGET_TYPE); - } - break; - } - - ACPI_FALLTHROUGH; - - case ACPI_TYPE_DEVICE: - case ACPI_TYPE_EVENT: - case ACPI_TYPE_MUTEX: - case ACPI_TYPE_REGION: - case ACPI_TYPE_POWER: - case ACPI_TYPE_PROCESSOR: - case ACPI_TYPE_THERMAL: - - ACPI_ERROR ((AE_INFO, - "Target must be [Buffer/Integer/String/Reference]" - ", found [%s] (%4.4s)", - AcpiUtGetTypeName (Node->Type), Node->Name.Ascii)); - - return_ACPI_STATUS (AE_AML_TARGET_TYPE); - - default: - break; - } - } - - /* - * Resolve the source object to an actual value - * (If it is a reference object) - */ - Status = AcpiExResolveObject (&SourceDesc, TargetType, WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Do the actual store operation */ - - switch (TargetType) - { - /* - * The simple data types all support implicit source operand - * conversion before the store. - */ - case ACPI_TYPE_INTEGER: - case ACPI_TYPE_STRING: - case ACPI_TYPE_BUFFER: - - if ((WalkState->Opcode == AML_COPY_OBJECT_OP) || - !ImplicitConversion) - { - /* - * However, CopyObject and Stores to ArgX do not perform - * an implicit conversion, as per the ACPI specification. - * A direct store is performed instead. - */ - Status = AcpiExStoreDirectToNode (SourceDesc, Node, WalkState); - break; - } - - /* Store with implicit source operand conversion support */ - - Status = AcpiExStoreObjectToObject (SourceDesc, TargetDesc, - &NewDesc, WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - if (NewDesc != TargetDesc) - { - /* - * Store the new NewDesc as the new value of the Name, and set - * the Name's type to that of the value being stored in it. - * SourceDesc reference count is incremented by AttachObject. - * - * Note: This may change the type of the node if an explicit - * store has been performed such that the node/object type - * has been changed. - */ - Status = AcpiNsAttachObject ( - Node, NewDesc, NewDesc->Common.Type); - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Store type [%s] into [%s] via Convert/Attach\n", - AcpiUtGetObjectTypeName (SourceDesc), - AcpiUtGetObjectTypeName (NewDesc))); - } - break; - - case ACPI_TYPE_BUFFER_FIELD: - case ACPI_TYPE_LOCAL_REGION_FIELD: - case ACPI_TYPE_LOCAL_BANK_FIELD: - case ACPI_TYPE_LOCAL_INDEX_FIELD: - /* - * For all fields, always write the source data to the target - * field. Any required implicit source operand conversion is - * performed in the function below as necessary. Note, field - * objects must retain their original type permanently. - */ - Status = AcpiExWriteDataToField (SourceDesc, TargetDesc, - &WalkState->ResultObj); - break; - - default: - /* - * CopyObject operator: No conversions for all other types. - * Instead, directly store a copy of the source object. - * - * This is the ACPI spec-defined behavior for the CopyObject - * operator. (Note, for this default case, all normal - * Store/Target operations exited above with an error). - */ - Status = AcpiExStoreDirectToNode (SourceDesc, Node, WalkState); - break; - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExStoreDirectToNode - * - * PARAMETERS: SourceDesc - Value to be stored - * Node - Named object to receive the value - * WalkState - Current walk state - * - * RETURN: Status - * - * DESCRIPTION: "Store" an object directly to a node. This involves a copy - * and an attach. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiExStoreDirectToNode ( - ACPI_OPERAND_OBJECT *SourceDesc, - ACPI_NAMESPACE_NODE *Node, - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status; - ACPI_OPERAND_OBJECT *NewDesc; - - - ACPI_FUNCTION_TRACE (ExStoreDirectToNode); - - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Storing [%s] (%p) directly into node [%s] (%p)" - " with no implicit conversion\n", - AcpiUtGetObjectTypeName (SourceDesc), SourceDesc, - AcpiUtGetTypeName (Node->Type), Node)); - - /* Copy the source object to a new object */ - - Status = AcpiUtCopyIobjectToIobject (SourceDesc, &NewDesc, WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Attach the new object to the node */ - - Status = AcpiNsAttachObject (Node, NewDesc, NewDesc->Common.Type); - AcpiUtRemoveReference (NewDesc); - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/exstoren.c b/drivers/acpica/exstoren.c deleted file mode 100644 index 71d0ad1..0000000 --- a/drivers/acpica/exstoren.c +++ /dev/null @@ -1,412 +0,0 @@ -/****************************************************************************** - * - * Module Name: exstoren - AML Interpreter object store support, - * Store to Node (namespace object) - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acinterp.h" -#include "amlcode.h" - - -#define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exstoren") - - -/******************************************************************************* - * - * FUNCTION: AcpiExResolveObject - * - * PARAMETERS: SourceDescPtr - Pointer to the source object - * TargetType - Current type of the target - * WalkState - Current walk state - * - * RETURN: Status, resolved object in SourceDescPtr. - * - * DESCRIPTION: Resolve an object. If the object is a reference, dereference - * it and return the actual object in the SourceDescPtr. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExResolveObject ( - ACPI_OPERAND_OBJECT **SourceDescPtr, - ACPI_OBJECT_TYPE TargetType, - ACPI_WALK_STATE *WalkState) -{ - ACPI_OPERAND_OBJECT *SourceDesc = *SourceDescPtr; - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE (ExResolveObject); - - - /* Ensure we have a Target that can be stored to */ - - switch (TargetType) - { - case ACPI_TYPE_BUFFER_FIELD: - case ACPI_TYPE_LOCAL_REGION_FIELD: - case ACPI_TYPE_LOCAL_BANK_FIELD: - case ACPI_TYPE_LOCAL_INDEX_FIELD: - /* - * These cases all require only Integers or values that - * can be converted to Integers (Strings or Buffers) - */ - case ACPI_TYPE_INTEGER: - case ACPI_TYPE_STRING: - case ACPI_TYPE_BUFFER: - /* - * Stores into a Field/Region or into a Integer/Buffer/String - * are all essentially the same. This case handles the - * "interchangeable" types Integer, String, and Buffer. - */ - if (SourceDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) - { - /* Resolve a reference object first */ - - Status = AcpiExResolveToValue (SourceDescPtr, WalkState); - if (ACPI_FAILURE (Status)) - { - break; - } - } - - /* For CopyObject, no further validation necessary */ - - if (WalkState->Opcode == AML_COPY_OBJECT_OP) - { - break; - } - - /* Must have a Integer, Buffer, or String */ - - if ((SourceDesc->Common.Type != ACPI_TYPE_INTEGER) && - (SourceDesc->Common.Type != ACPI_TYPE_BUFFER) && - (SourceDesc->Common.Type != ACPI_TYPE_STRING) && - !((SourceDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) && - (SourceDesc->Reference.Class== ACPI_REFCLASS_TABLE))) - { - /* Conversion successful but still not a valid type */ - - ACPI_ERROR ((AE_INFO, - "Cannot assign type [%s] to [%s] (must be type Int/Str/Buf)", - AcpiUtGetObjectTypeName (SourceDesc), - AcpiUtGetTypeName (TargetType))); - - Status = AE_AML_OPERAND_TYPE; - } - break; - - case ACPI_TYPE_LOCAL_ALIAS: - case ACPI_TYPE_LOCAL_METHOD_ALIAS: - /* - * All aliases should have been resolved earlier, during the - * operand resolution phase. - */ - ACPI_ERROR ((AE_INFO, "Store into an unresolved Alias object")); - Status = AE_AML_INTERNAL; - break; - - case ACPI_TYPE_PACKAGE: - default: - /* - * All other types than Alias and the various Fields come here, - * including the untyped case - ACPI_TYPE_ANY. - */ - break; - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExStoreObjectToObject - * - * PARAMETERS: SourceDesc - Object to store - * DestDesc - Object to receive a copy of the source - * NewDesc - New object if DestDesc is obsoleted - * WalkState - Current walk state - * - * RETURN: Status - * - * DESCRIPTION: "Store" an object to another object. This may include - * converting the source type to the target type (implicit - * conversion), and a copy of the value of the source to - * the target. - * - * The Assignment of an object to another (not named) object - * is handled here. - * The Source passed in will replace the current value (if any) - * with the input value. - * - * When storing into an object the data is converted to the - * target object type then stored in the object. This means - * that the target object type (for an initialized target) will - * not be changed by a store operation. - * - * This module allows destination types of Number, String, - * Buffer, and Package. - * - * Assumes parameters are already validated. NOTE: SourceDesc - * resolution (from a reference object) must be performed by - * the caller if necessary. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExStoreObjectToObject ( - ACPI_OPERAND_OBJECT *SourceDesc, - ACPI_OPERAND_OBJECT *DestDesc, - ACPI_OPERAND_OBJECT **NewDesc, - ACPI_WALK_STATE *WalkState) -{ - ACPI_OPERAND_OBJECT *ActualSrcDesc; - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE_PTR (ExStoreObjectToObject, SourceDesc); - - - ActualSrcDesc = SourceDesc; - if (!DestDesc) - { - /* - * There is no destination object (An uninitialized node or - * package element), so we can simply copy the source object - * creating a new destination object - */ - Status = AcpiUtCopyIobjectToIobject (ActualSrcDesc, NewDesc, WalkState); - return_ACPI_STATUS (Status); - } - - if (SourceDesc->Common.Type != DestDesc->Common.Type) - { - /* - * The source type does not match the type of the destination. - * Perform the "implicit conversion" of the source to the current type - * of the target as per the ACPI specification. - * - * If no conversion performed, ActualSrcDesc = SourceDesc. - * Otherwise, ActualSrcDesc is a temporary object to hold the - * converted object. - */ - Status = AcpiExConvertToTargetType (DestDesc->Common.Type, - SourceDesc, &ActualSrcDesc, WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - if (SourceDesc == ActualSrcDesc) - { - /* - * No conversion was performed. Return the SourceDesc as the - * new object. - */ - *NewDesc = SourceDesc; - return_ACPI_STATUS (AE_OK); - } - } - - /* - * We now have two objects of identical types, and we can perform a - * copy of the *value* of the source object. - */ - switch (DestDesc->Common.Type) - { - case ACPI_TYPE_INTEGER: - - DestDesc->Integer.Value = ActualSrcDesc->Integer.Value; - - /* Truncate value if we are executing from a 32-bit ACPI table */ - - (void) AcpiExTruncateFor32bitTable (DestDesc); - break; - - case ACPI_TYPE_STRING: - - Status = AcpiExStoreStringToString (ActualSrcDesc, DestDesc); - break; - - case ACPI_TYPE_BUFFER: - - Status = AcpiExStoreBufferToBuffer (ActualSrcDesc, DestDesc); - break; - - case ACPI_TYPE_PACKAGE: - - Status = AcpiUtCopyIobjectToIobject (ActualSrcDesc, &DestDesc, - WalkState); - break; - - default: - /* - * All other types come here. - */ - ACPI_WARNING ((AE_INFO, "Store into type [%s] not implemented", - AcpiUtGetObjectTypeName (DestDesc))); - - Status = AE_NOT_IMPLEMENTED; - break; - } - - if (ActualSrcDesc != SourceDesc) - { - /* Delete the intermediate (temporary) source object */ - - AcpiUtRemoveReference (ActualSrcDesc); - } - - *NewDesc = DestDesc; - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/exstorob.c b/drivers/acpica/exstorob.c deleted file mode 100644 index 026ab5b..0000000 --- a/drivers/acpica/exstorob.c +++ /dev/null @@ -1,348 +0,0 @@ -/****************************************************************************** - * - * Module Name: exstorob - AML object store support, store to object - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acinterp.h" - - -#define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exstorob") - - -/******************************************************************************* - * - * FUNCTION: AcpiExStoreBufferToBuffer - * - * PARAMETERS: SourceDesc - Source object to copy - * TargetDesc - Destination object of the copy - * - * RETURN: Status - * - * DESCRIPTION: Copy a buffer object to another buffer object. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExStoreBufferToBuffer ( - ACPI_OPERAND_OBJECT *SourceDesc, - ACPI_OPERAND_OBJECT *TargetDesc) -{ - UINT32 Length; - UINT8 *Buffer; - - - ACPI_FUNCTION_TRACE_PTR (ExStoreBufferToBuffer, SourceDesc); - - - /* If Source and Target are the same, just return */ - - if (SourceDesc == TargetDesc) - { - return_ACPI_STATUS (AE_OK); - } - - /* We know that SourceDesc is a buffer by now */ - - Buffer = ACPI_CAST_PTR (UINT8, SourceDesc->Buffer.Pointer); - Length = SourceDesc->Buffer.Length; - - /* - * If target is a buffer of length zero or is a static buffer, - * allocate a new buffer of the proper length - */ - if ((TargetDesc->Buffer.Length == 0) || - (TargetDesc->Common.Flags & AOPOBJ_STATIC_POINTER)) - { - TargetDesc->Buffer.Pointer = ACPI_ALLOCATE (Length); - if (!TargetDesc->Buffer.Pointer) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - TargetDesc->Buffer.Length = Length; - } - - /* Copy source buffer to target buffer */ - - if (Length <= TargetDesc->Buffer.Length) - { - /* Clear existing buffer and copy in the new one */ - - memset (TargetDesc->Buffer.Pointer, 0, TargetDesc->Buffer.Length); - memcpy (TargetDesc->Buffer.Pointer, Buffer, Length); - -#ifdef ACPI_OBSOLETE_BEHAVIOR - /* - * NOTE: ACPI versions up to 3.0 specified that the buffer must be - * truncated if the string is smaller than the buffer. However, "other" - * implementations of ACPI never did this and thus became the defacto - * standard. ACPI 3.0A changes this behavior such that the buffer - * is no longer truncated. - */ - - /* - * OBSOLETE BEHAVIOR: - * If the original source was a string, we must truncate the buffer, - * according to the ACPI spec. Integer-to-Buffer and Buffer-to-Buffer - * copy must not truncate the original buffer. - */ - if (OriginalSrcType == ACPI_TYPE_STRING) - { - /* Set the new length of the target */ - - TargetDesc->Buffer.Length = Length; - } -#endif - } - else - { - /* Truncate the source, copy only what will fit */ - - memcpy (TargetDesc->Buffer.Pointer, Buffer, - TargetDesc->Buffer.Length); - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Truncating source buffer from %X to %X\n", - Length, TargetDesc->Buffer.Length)); - } - - /* Copy flags */ - - TargetDesc->Buffer.Flags = SourceDesc->Buffer.Flags; - TargetDesc->Common.Flags &= ~AOPOBJ_STATIC_POINTER; - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExStoreStringToString - * - * PARAMETERS: SourceDesc - Source object to copy - * TargetDesc - Destination object of the copy - * - * RETURN: Status - * - * DESCRIPTION: Copy a String object to another String object - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExStoreStringToString ( - ACPI_OPERAND_OBJECT *SourceDesc, - ACPI_OPERAND_OBJECT *TargetDesc) -{ - UINT32 Length; - UINT8 *Buffer; - - - ACPI_FUNCTION_TRACE_PTR (ExStoreStringToString, SourceDesc); - - - /* If Source and Target are the same, just return */ - - if (SourceDesc == TargetDesc) - { - return_ACPI_STATUS (AE_OK); - } - - /* We know that SourceDesc is a string by now */ - - Buffer = ACPI_CAST_PTR (UINT8, SourceDesc->String.Pointer); - Length = SourceDesc->String.Length; - - /* - * Replace existing string value if it will fit and the string - * pointer is not a static pointer (part of an ACPI table) - */ - if ((Length < TargetDesc->String.Length) && - (!(TargetDesc->Common.Flags & AOPOBJ_STATIC_POINTER))) - { - /* - * String will fit in existing non-static buffer. - * Clear old string and copy in the new one - */ - memset (TargetDesc->String.Pointer, 0, - (ACPI_SIZE) TargetDesc->String.Length + 1); - memcpy (TargetDesc->String.Pointer, Buffer, Length); - } - else - { - /* - * Free the current buffer, then allocate a new buffer - * large enough to hold the value - */ - if (TargetDesc->String.Pointer && - (!(TargetDesc->Common.Flags & AOPOBJ_STATIC_POINTER))) - { - /* Only free if not a pointer into the DSDT */ - - ACPI_FREE (TargetDesc->String.Pointer); - } - - TargetDesc->String.Pointer = - ACPI_ALLOCATE_ZEROED ((ACPI_SIZE) Length + 1); - - if (!TargetDesc->String.Pointer) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - TargetDesc->Common.Flags &= ~AOPOBJ_STATIC_POINTER; - memcpy (TargetDesc->String.Pointer, Buffer, Length); - } - - /* Set the new target length */ - - TargetDesc->String.Length = Length; - return_ACPI_STATUS (AE_OK); -} diff --git a/drivers/acpica/exsystem.c b/drivers/acpica/exsystem.c deleted file mode 100644 index 1f42625..0000000 --- a/drivers/acpica/exsystem.c +++ /dev/null @@ -1,462 +0,0 @@ -/****************************************************************************** - * - * Module Name: exsystem - Interface to OS services - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acinterp.h" - -#define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exsystem") - - -/******************************************************************************* - * - * FUNCTION: AcpiExSystemWaitSemaphore - * - * PARAMETERS: Semaphore - Semaphore to wait on - * Timeout - Max time to wait - * - * RETURN: Status - * - * DESCRIPTION: Implements a semaphore wait with a check to see if the - * semaphore is available immediately. If it is not, the - * interpreter is released before waiting. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExSystemWaitSemaphore ( - ACPI_SEMAPHORE Semaphore, - UINT16 Timeout) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (ExSystemWaitSemaphore); - - - Status = AcpiOsWaitSemaphore (Semaphore, 1, ACPI_DO_NOT_WAIT); - if (ACPI_SUCCESS (Status)) - { - return_ACPI_STATUS (Status); - } - - if (Status == AE_TIME) - { - /* We must wait, so unlock the interpreter */ - - AcpiExExitInterpreter (); - Status = AcpiOsWaitSemaphore (Semaphore, 1, Timeout); - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "*** Thread awake after blocking, %s\n", - AcpiFormatException (Status))); - - /* Reacquire the interpreter */ - - AcpiExEnterInterpreter (); - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExSystemWaitMutex - * - * PARAMETERS: Mutex - Mutex to wait on - * Timeout - Max time to wait - * - * RETURN: Status - * - * DESCRIPTION: Implements a mutex wait with a check to see if the - * mutex is available immediately. If it is not, the - * interpreter is released before waiting. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExSystemWaitMutex ( - ACPI_MUTEX Mutex, - UINT16 Timeout) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (ExSystemWaitMutex); - - - Status = AcpiOsAcquireMutex (Mutex, ACPI_DO_NOT_WAIT); - if (ACPI_SUCCESS (Status)) - { - return_ACPI_STATUS (Status); - } - - if (Status == AE_TIME) - { - /* We must wait, so unlock the interpreter */ - - AcpiExExitInterpreter (); - Status = AcpiOsAcquireMutex (Mutex, Timeout); - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "*** Thread awake after blocking, %s\n", - AcpiFormatException (Status))); - - /* Reacquire the interpreter */ - - AcpiExEnterInterpreter (); - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExSystemDoStall - * - * PARAMETERS: HowLongUs - The amount of time to stall, - * in microseconds - * - * RETURN: Status - * - * DESCRIPTION: Suspend running thread for specified amount of time. - * Note: ACPI specification requires that Stall() does not - * relinquish the processor, and delays longer than 100 usec - * should use Sleep() instead. We allow stalls up to 255 usec - * for compatibility with other interpreters and existing BIOSs. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExSystemDoStall ( - UINT32 HowLongUs) -{ - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_ENTRY (); - - - if (HowLongUs > 255) - { - /* - * Longer than 255 microseconds, this is an error - * - * (ACPI specifies 100 usec as max, but this gives some slack in - * order to support existing BIOSs) - */ - ACPI_ERROR_ONCE ((AE_INFO, - "Time parameter is too large (%u)", HowLongUs)); - Status = AE_AML_OPERAND_VALUE; - } - else - { - if (HowLongUs > 100) - { - ACPI_WARNING_ONCE ((AE_INFO, - "Time parameter %u us > 100 us violating ACPI spec, please fix the firmware.", HowLongUs)); - } - AcpiOsStall (HowLongUs); - } - - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExSystemDoSleep - * - * PARAMETERS: HowLongMs - The amount of time to sleep, - * in milliseconds - * - * RETURN: None - * - * DESCRIPTION: Sleep the running thread for specified amount of time. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExSystemDoSleep ( - UINT64 HowLongMs) -{ - ACPI_FUNCTION_ENTRY (); - - - /* Since this thread will sleep, we must release the interpreter */ - - AcpiExExitInterpreter (); - - /* - * For compatibility with other ACPI implementations and to prevent - * accidental deep sleeps, limit the sleep time to something reasonable. - */ - if (HowLongMs > ACPI_MAX_SLEEP) - { - HowLongMs = ACPI_MAX_SLEEP; - } - - AcpiOsSleep (HowLongMs); - - /* And now we must get the interpreter again */ - - AcpiExEnterInterpreter (); - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExSystemSignalEvent - * - * PARAMETERS: ObjDesc - The object descriptor for this op - * - * RETURN: Status - * - * DESCRIPTION: Provides an access point to perform synchronization operations - * within the AML. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExSystemSignalEvent ( - ACPI_OPERAND_OBJECT *ObjDesc) -{ - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE (ExSystemSignalEvent); - - - if (ObjDesc) - { - Status = AcpiOsSignalSemaphore (ObjDesc->Event.OsSemaphore, 1); - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExSystemWaitEvent - * - * PARAMETERS: TimeDesc - The 'time to delay' object descriptor - * ObjDesc - The object descriptor for this op - * - * RETURN: Status - * - * DESCRIPTION: Provides an access point to perform synchronization operations - * within the AML. This operation is a request to wait for an - * event. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExSystemWaitEvent ( - ACPI_OPERAND_OBJECT *TimeDesc, - ACPI_OPERAND_OBJECT *ObjDesc) -{ - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE (ExSystemWaitEvent); - - - if (ObjDesc) - { - Status = AcpiExSystemWaitSemaphore (ObjDesc->Event.OsSemaphore, - (UINT16) TimeDesc->Integer.Value); - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExSystemResetEvent - * - * PARAMETERS: ObjDesc - The object descriptor for this op - * - * RETURN: Status - * - * DESCRIPTION: Reset an event to a known state. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExSystemResetEvent ( - ACPI_OPERAND_OBJECT *ObjDesc) -{ - ACPI_STATUS Status = AE_OK; - ACPI_SEMAPHORE TempSemaphore; - - - ACPI_FUNCTION_ENTRY (); - - - /* - * We are going to simply delete the existing semaphore and - * create a new one! - */ - Status = AcpiOsCreateSemaphore (ACPI_NO_UNIT_LIMIT, 0, &TempSemaphore); - if (ACPI_SUCCESS (Status)) - { - (void) AcpiOsDeleteSemaphore (ObjDesc->Event.OsSemaphore); - ObjDesc->Event.OsSemaphore = TempSemaphore; - } - - return (Status); -} diff --git a/drivers/acpica/extrace.c b/drivers/acpica/extrace.c deleted file mode 100644 index 2d596f2..0000000 --- a/drivers/acpica/extrace.c +++ /dev/null @@ -1,569 +0,0 @@ -/****************************************************************************** - * - * Module Name: extrace - Support for interpreter execution tracing - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" -#include "acinterp.h" - - -#define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("extrace") - - -static ACPI_OPERAND_OBJECT *AcpiGbl_TraceMethodObject = NULL; - -/* Local prototypes */ - -#ifdef ACPI_DEBUG_OUTPUT -static const char * -AcpiExGetTraceEventName ( - ACPI_TRACE_EVENT_TYPE Type); -#endif - - -/******************************************************************************* - * - * FUNCTION: AcpiExInterpreterTraceEnabled - * - * PARAMETERS: Name - Whether method name should be matched, - * this should be checked before starting - * the tracer - * - * RETURN: TRUE if interpreter trace is enabled. - * - * DESCRIPTION: Check whether interpreter trace is enabled - * - ******************************************************************************/ - -static BOOLEAN -AcpiExInterpreterTraceEnabled ( - char *Name) -{ - - /* Check if tracing is enabled */ - - if (!(AcpiGbl_TraceFlags & ACPI_TRACE_ENABLED)) - { - return (FALSE); - } - - /* - * Check if tracing is filtered: - * - * 1. If the tracer is started, AcpiGbl_TraceMethodObject should have - * been filled by the trace starter - * 2. If the tracer is not started, AcpiGbl_TraceMethodName should be - * matched if it is specified - * 3. If the tracer is oneshot style, AcpiGbl_TraceMethodName should - * not be cleared by the trace stopper during the first match - */ - if (AcpiGbl_TraceMethodObject) - { - return (TRUE); - } - - if (Name && - (AcpiGbl_TraceMethodName && - strcmp (AcpiGbl_TraceMethodName, Name))) - { - return (FALSE); - } - - if ((AcpiGbl_TraceFlags & ACPI_TRACE_ONESHOT) && - !AcpiGbl_TraceMethodName) - { - return (FALSE); - } - - return (TRUE); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExGetTraceEventName - * - * PARAMETERS: Type - Trace event type - * - * RETURN: Trace event name. - * - * DESCRIPTION: Used to obtain the full trace event name. - * - ******************************************************************************/ - -#ifdef ACPI_DEBUG_OUTPUT - -static const char * -AcpiExGetTraceEventName ( - ACPI_TRACE_EVENT_TYPE Type) -{ - - switch (Type) - { - case ACPI_TRACE_AML_METHOD: - - return "Method"; - - case ACPI_TRACE_AML_OPCODE: - - return "Opcode"; - - case ACPI_TRACE_AML_REGION: - - return "Region"; - - default: - - return ""; - } -} - -#endif - -/******************************************************************************* - * - * FUNCTION: AcpiExTraceArgs - * - * PARAMETERS: Params - AML method arguments - * Count - numer of method arguments - * - * RETURN: None - * - * DESCRIPTION: Trace any arguments - * - ******************************************************************************/ - -void -AcpiExTraceArgs(ACPI_OPERAND_OBJECT **Params, UINT32 Count) -{ - UINT32 i; - - ACPI_FUNCTION_NAME(ExTraceArgs); - - for (i = 0; i < Count; i++) - { - ACPI_OPERAND_OBJECT *obj_desc = Params[i]; - - if (!i) - { - ACPI_DEBUG_PRINT((ACPI_DB_TRACE_POINT, " ")); - } - - switch (obj_desc->Common.Type) - { - case ACPI_TYPE_INTEGER: - ACPI_DEBUG_PRINT_RAW((ACPI_DB_TRACE_POINT, "%lx", obj_desc->Integer.Value)); - break; - - case ACPI_TYPE_STRING: - if (!obj_desc->String.Length) - { - ACPI_DEBUG_PRINT_RAW((ACPI_DB_TRACE_POINT, "NULL")); - break; - } - if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_TRACE_POINT, _COMPONENT)) - { - AcpiUtPrintString(obj_desc->String.Pointer, ACPI_UINT8_MAX); - } - break; - - default: - ACPI_DEBUG_PRINT_RAW((ACPI_DB_TRACE_POINT, "Unknown")); - break; - } - - if ((i + 1) == Count) - { - ACPI_DEBUG_PRINT_RAW((ACPI_DB_TRACE_POINT, "\n")); - } - else - { - ACPI_DEBUG_PRINT_RAW((ACPI_DB_TRACE_POINT, ", ")); - } - } -} - -/******************************************************************************* - * - * FUNCTION: AcpiExTracePoint - * - * PARAMETERS: Type - Trace event type - * Begin - TRUE if before execution - * Aml - Executed AML address - * Pathname - Object path - * - * RETURN: None - * - * DESCRIPTION: Internal interpreter execution trace. - * - ******************************************************************************/ - -void -AcpiExTracePoint ( - ACPI_TRACE_EVENT_TYPE Type, - BOOLEAN Begin, - UINT8 *Aml, - char *Pathname) -{ - - ACPI_FUNCTION_NAME (ExTracePoint); - - - if (Pathname) - { - ACPI_DEBUG_PRINT ((ACPI_DB_TRACE_POINT, - "%s %s [%s] execution.\n", - AcpiExGetTraceEventName (Type), Begin ? "Begin" : "End", - Pathname)); - } - else - { - ACPI_DEBUG_PRINT ((ACPI_DB_TRACE_POINT, - "%s %s [0x%p] execution.\n", - AcpiExGetTraceEventName (Type), Begin ? "Begin" : "End", - Aml)); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExStartTraceMethod - * - * PARAMETERS: MethodNode - Node of the method - * ObjDesc - The method object - * WalkState - current state, NULL if not yet executing - * a method. - * - * RETURN: None - * - * DESCRIPTION: Start control method execution trace - * - ******************************************************************************/ - -void -AcpiExStartTraceMethod ( - ACPI_NAMESPACE_NODE *MethodNode, - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_WALK_STATE *WalkState) -{ - char *Pathname = NULL; - BOOLEAN Enabled = FALSE; - - - ACPI_FUNCTION_NAME (ExStartTraceMethod); - - - if (MethodNode) - { - Pathname = AcpiNsGetNormalizedPathname (MethodNode, TRUE); - } - - Enabled = AcpiExInterpreterTraceEnabled (Pathname); - if (Enabled && !AcpiGbl_TraceMethodObject) - { - AcpiGbl_TraceMethodObject = ObjDesc; - AcpiGbl_OriginalDbgLevel = AcpiDbgLevel; - AcpiGbl_OriginalDbgLayer = AcpiDbgLayer; - AcpiDbgLevel = ACPI_TRACE_LEVEL_ALL; - AcpiDbgLayer = ACPI_TRACE_LAYER_ALL; - - if (AcpiGbl_TraceDbgLevel) - { - AcpiDbgLevel = AcpiGbl_TraceDbgLevel; - } - - if (AcpiGbl_TraceDbgLayer) - { - AcpiDbgLayer = AcpiGbl_TraceDbgLayer; - } - } - - if (Enabled) - { - ACPI_TRACE_POINT (ACPI_TRACE_AML_METHOD, TRUE, - ObjDesc ? ObjDesc->Method.AmlStart : NULL, Pathname); - } - - if (Pathname) - { - ACPI_FREE (Pathname); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExStopTraceMethod - * - * PARAMETERS: MethodNode - Node of the method - * ObjDesc - The method object - * WalkState - current state, NULL if not yet executing - * a method. - * - * RETURN: None - * - * DESCRIPTION: Stop control method execution trace - * - ******************************************************************************/ - -void -AcpiExStopTraceMethod ( - ACPI_NAMESPACE_NODE *MethodNode, - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_WALK_STATE *WalkState) -{ - char *Pathname = NULL; - BOOLEAN Enabled; - - - ACPI_FUNCTION_NAME (ExStopTraceMethod); - - - if (MethodNode) - { - Pathname = AcpiNsGetNormalizedPathname (MethodNode, TRUE); - } - - Enabled = AcpiExInterpreterTraceEnabled (NULL); - - if (Enabled) - { - ACPI_TRACE_POINT (ACPI_TRACE_AML_METHOD, FALSE, - ObjDesc ? ObjDesc->Method.AmlStart : NULL, Pathname); - } - - /* Check whether the tracer should be stopped */ - - if (AcpiGbl_TraceMethodObject == ObjDesc) - { - /* Disable further tracing if type is one-shot */ - - if (AcpiGbl_TraceFlags & ACPI_TRACE_ONESHOT) - { - AcpiGbl_TraceMethodName = NULL; - } - - AcpiDbgLevel = AcpiGbl_OriginalDbgLevel; - AcpiDbgLayer = AcpiGbl_OriginalDbgLayer; - AcpiGbl_TraceMethodObject = NULL; - } - - if (Pathname) - { - ACPI_FREE (Pathname); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExStartTraceOpcode - * - * PARAMETERS: Op - The parser opcode object - * WalkState - current state, NULL if not yet executing - * a method. - * - * RETURN: None - * - * DESCRIPTION: Start opcode execution trace - * - ******************************************************************************/ - -void -AcpiExStartTraceOpcode ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState) -{ - - ACPI_FUNCTION_NAME (ExStartTraceOpcode); - - - if (AcpiExInterpreterTraceEnabled (NULL) && - (AcpiGbl_TraceFlags & ACPI_TRACE_OPCODE)) - { - ACPI_TRACE_POINT (ACPI_TRACE_AML_OPCODE, TRUE, - Op->Common.Aml, Op->Common.AmlOpName); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExStopTraceOpcode - * - * PARAMETERS: Op - The parser opcode object - * WalkState - current state, NULL if not yet executing - * a method. - * - * RETURN: None - * - * DESCRIPTION: Stop opcode execution trace - * - ******************************************************************************/ - -void -AcpiExStopTraceOpcode ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState) -{ - - ACPI_FUNCTION_NAME (ExStopTraceOpcode); - - - if (AcpiExInterpreterTraceEnabled (NULL) && - (AcpiGbl_TraceFlags & ACPI_TRACE_OPCODE)) - { - ACPI_TRACE_POINT (ACPI_TRACE_AML_OPCODE, FALSE, - Op->Common.Aml, Op->Common.AmlOpName); - } -} diff --git a/drivers/acpica/exutils.c b/drivers/acpica/exutils.c deleted file mode 100644 index f7472a2..0000000 --- a/drivers/acpica/exutils.c +++ /dev/null @@ -1,615 +0,0 @@ -/****************************************************************************** - * - * Module Name: exutils - interpreter/scanner utilities - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -/* - * DEFINE_AML_GLOBALS is tested in amlcode.h - * to determine whether certain global names should be "defined" or only - * "declared" in the current compilation. This enhances maintainability - * by enabling a single header file to embody all knowledge of the names - * in question. - * - * Exactly one module of any executable should #define DEFINE_GLOBALS - * before #including the header files which use this convention. The - * names in question will be defined and initialized in that module, - * and declared as extern in all other modules which #include those - * header files. - */ - -#define DEFINE_AML_GLOBALS - -#include "acpi.h" -#include "accommon.h" -#include "acinterp.h" -#include "amlcode.h" - -#define _COMPONENT ACPI_EXECUTER - ACPI_MODULE_NAME ("exutils") - -/* Local prototypes */ - -static UINT32 -AcpiExDigitsNeeded ( - UINT64 Value, - UINT32 Base); - - -/******************************************************************************* - * - * FUNCTION: AcpiExEnterInterpreter - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Enter the interpreter execution region. Failure to enter - * the interpreter region is a fatal system error. Used in - * conjunction with ExitInterpreter. - * - ******************************************************************************/ - -void -AcpiExEnterInterpreter ( - void) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (ExEnterInterpreter); - - - Status = AcpiUtAcquireMutex (ACPI_MTX_INTERPRETER); - if (ACPI_FAILURE (Status)) - { - ACPI_ERROR ((AE_INFO, "Could not acquire AML Interpreter mutex")); - } - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - ACPI_ERROR ((AE_INFO, "Could not acquire AML Namespace mutex")); - } - - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExExitInterpreter - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Exit the interpreter execution region. This is the top level - * routine used to exit the interpreter when all processing has - * been completed, or when the method blocks. - * - * Cases where the interpreter is unlocked internally: - * 1) Method will be blocked on a Sleep() AML opcode - * 2) Method will be blocked on an Acquire() AML opcode - * 3) Method will be blocked on a Wait() AML opcode - * 4) Method will be blocked to acquire the global lock - * 5) Method will be blocked waiting to execute a serialized control - * method that is currently executing - * 6) About to invoke a user-installed opregion handler - * - ******************************************************************************/ - -void -AcpiExExitInterpreter ( - void) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (ExExitInterpreter); - - - Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - ACPI_ERROR ((AE_INFO, "Could not release AML Namespace mutex")); - } - Status = AcpiUtReleaseMutex (ACPI_MTX_INTERPRETER); - if (ACPI_FAILURE (Status)) - { - ACPI_ERROR ((AE_INFO, "Could not release AML Interpreter mutex")); - } - - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExTruncateFor32bitTable - * - * PARAMETERS: ObjDesc - Object to be truncated - * - * RETURN: TRUE if a truncation was performed, FALSE otherwise. - * - * DESCRIPTION: Truncate an ACPI Integer to 32 bits if the execution mode is - * 32-bit, as determined by the revision of the DSDT. - * - ******************************************************************************/ - -BOOLEAN -AcpiExTruncateFor32bitTable ( - ACPI_OPERAND_OBJECT *ObjDesc) -{ - - ACPI_FUNCTION_ENTRY (); - - - /* - * Object must be a valid number and we must be executing - * a control method. Object could be NS node for AML_INT_NAMEPATH_OP. - */ - if ((!ObjDesc) || - (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) || - (ObjDesc->Common.Type != ACPI_TYPE_INTEGER)) - { - return (FALSE); - } - - if ((AcpiGbl_IntegerByteWidth == 4) && - (ObjDesc->Integer.Value > (UINT64) ACPI_UINT32_MAX)) - { - /* - * We are executing in a 32-bit ACPI table. Truncate - * the value to 32 bits by zeroing out the upper 32-bit field - */ - ObjDesc->Integer.Value &= (UINT64) ACPI_UINT32_MAX; - return (TRUE); - } - - return (FALSE); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExAcquireGlobalLock - * - * PARAMETERS: FieldFlags - Flags with Lock rule: - * AlwaysLock or NeverLock - * - * RETURN: None - * - * DESCRIPTION: Obtain the ACPI hardware Global Lock, only if the field - * flags specify that it is to be obtained before field access. - * - ******************************************************************************/ - -void -AcpiExAcquireGlobalLock ( - UINT32 FieldFlags) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (ExAcquireGlobalLock); - - - /* Only use the lock if the AlwaysLock bit is set */ - - if (!(FieldFlags & AML_FIELD_LOCK_RULE_MASK)) - { - return_VOID; - } - - /* Attempt to get the global lock, wait forever */ - - Status = AcpiExAcquireMutexObject (ACPI_WAIT_FOREVER, - AcpiGbl_GlobalLockMutex, AcpiOsGetThreadId ()); - - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Could not acquire Global Lock")); - } - - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExReleaseGlobalLock - * - * PARAMETERS: FieldFlags - Flags with Lock rule: - * AlwaysLock or NeverLock - * - * RETURN: None - * - * DESCRIPTION: Release the ACPI hardware Global Lock - * - ******************************************************************************/ - -void -AcpiExReleaseGlobalLock ( - UINT32 FieldFlags) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (ExReleaseGlobalLock); - - - /* Only use the lock if the AlwaysLock bit is set */ - - if (!(FieldFlags & AML_FIELD_LOCK_RULE_MASK)) - { - return_VOID; - } - - /* Release the global lock */ - - Status = AcpiExReleaseMutexObject (AcpiGbl_GlobalLockMutex); - if (ACPI_FAILURE (Status)) - { - /* Report the error, but there isn't much else we can do */ - - ACPI_EXCEPTION ((AE_INFO, Status, - "Could not release Global Lock")); - } - - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExDigitsNeeded - * - * PARAMETERS: Value - Value to be represented - * Base - Base of representation - * - * RETURN: The number of digits. - * - * DESCRIPTION: Calculate the number of digits needed to represent the Value - * in the given Base (Radix) - * - ******************************************************************************/ - -static UINT32 -AcpiExDigitsNeeded ( - UINT64 Value, - UINT32 Base) -{ - UINT32 NumDigits; - UINT64 CurrentValue; - - - ACPI_FUNCTION_TRACE (ExDigitsNeeded); - - - /* UINT64 is unsigned, so we don't worry about a '-' prefix */ - - if (Value == 0) - { - return_UINT32 (1); - } - - CurrentValue = Value; - NumDigits = 0; - - /* Count the digits in the requested base */ - - while (CurrentValue) - { - (void) AcpiUtShortDivide (CurrentValue, Base, &CurrentValue, NULL); - NumDigits++; - } - - return_UINT32 (NumDigits); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExEisaIdToString - * - * PARAMETERS: OutString - Where to put the converted string (8 bytes) - * CompressedId - EISAID to be converted - * - * RETURN: None - * - * DESCRIPTION: Convert a numeric EISAID to string representation. Return - * buffer must be large enough to hold the string. The string - * returned is always exactly of length ACPI_EISAID_STRING_SIZE - * (includes null terminator). The EISAID is always 32 bits. - * - ******************************************************************************/ - -void -AcpiExEisaIdToString ( - char *OutString, - UINT64 CompressedId) -{ - UINT32 SwappedId; - - - ACPI_FUNCTION_ENTRY (); - - - /* The EISAID should be a 32-bit integer */ - - if (CompressedId > ACPI_UINT32_MAX) - { - ACPI_WARNING ((AE_INFO, - "Expected EISAID is larger than 32 bits: " - "0x%8.8X%8.8X, truncating", - ACPI_FORMAT_UINT64 (CompressedId))); - } - - /* Swap ID to big-endian to get contiguous bits */ - - SwappedId = AcpiUtDwordByteSwap ((UINT32) CompressedId); - - /* First 3 bytes are uppercase letters. Next 4 bytes are hexadecimal */ - - OutString[0] = (char) (0x40 + (((unsigned long) SwappedId >> 26) & 0x1F)); - OutString[1] = (char) (0x40 + ((SwappedId >> 21) & 0x1F)); - OutString[2] = (char) (0x40 + ((SwappedId >> 16) & 0x1F)); - OutString[3] = AcpiUtHexToAsciiChar ((UINT64) SwappedId, 12); - OutString[4] = AcpiUtHexToAsciiChar ((UINT64) SwappedId, 8); - OutString[5] = AcpiUtHexToAsciiChar ((UINT64) SwappedId, 4); - OutString[6] = AcpiUtHexToAsciiChar ((UINT64) SwappedId, 0); - OutString[7] = 0; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExIntegerToString - * - * PARAMETERS: OutString - Where to put the converted string. At least - * 21 bytes are needed to hold the largest - * possible 64-bit integer. - * Value - Value to be converted - * - * RETURN: Converted string in OutString - * - * DESCRIPTION: Convert a 64-bit integer to decimal string representation. - * Assumes string buffer is large enough to hold the string. The - * largest string is (ACPI_MAX64_DECIMAL_DIGITS + 1). - * - ******************************************************************************/ - -void -AcpiExIntegerToString ( - char *OutString, - UINT64 Value) -{ - UINT32 Count; - UINT32 DigitsNeeded; - UINT32 Remainder; - - - ACPI_FUNCTION_ENTRY (); - - - DigitsNeeded = AcpiExDigitsNeeded (Value, 10); - OutString[DigitsNeeded] = 0; - - for (Count = DigitsNeeded; Count > 0; Count--) - { - (void) AcpiUtShortDivide (Value, 10, &Value, &Remainder); - OutString[Count-1] = (char) ('0' + Remainder);\ - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExPciClsToString - * - * PARAMETERS: OutString - Where to put the converted string (7 bytes) - * ClassCode - PCI class code to be converted (3 bytes) - * - * RETURN: Converted string in OutString - * - * DESCRIPTION: Convert 3-bytes PCI class code to string representation. - * Return buffer must be large enough to hold the string. The - * string returned is always exactly of length - * ACPI_PCICLS_STRING_SIZE (includes null terminator). - * - ******************************************************************************/ - -void -AcpiExPciClsToString ( - char *OutString, - UINT8 ClassCode[3]) -{ - - ACPI_FUNCTION_ENTRY (); - - - /* All 3 bytes are hexadecimal */ - - OutString[0] = AcpiUtHexToAsciiChar ((UINT64) ClassCode[0], 4); - OutString[1] = AcpiUtHexToAsciiChar ((UINT64) ClassCode[0], 0); - OutString[2] = AcpiUtHexToAsciiChar ((UINT64) ClassCode[1], 4); - OutString[3] = AcpiUtHexToAsciiChar ((UINT64) ClassCode[1], 0); - OutString[4] = AcpiUtHexToAsciiChar ((UINT64) ClassCode[2], 4); - OutString[5] = AcpiUtHexToAsciiChar ((UINT64) ClassCode[2], 0); - OutString[6] = 0; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiIsValidSpaceId - * - * PARAMETERS: SpaceId - ID to be validated - * - * RETURN: TRUE if SpaceId is a valid/supported ID. - * - * DESCRIPTION: Validate an operation region SpaceID. - * - ******************************************************************************/ - -BOOLEAN -AcpiIsValidSpaceId ( - UINT8 SpaceId) -{ - - if ((SpaceId >= ACPI_NUM_PREDEFINED_REGIONS) && - (SpaceId < ACPI_USER_REGION_BEGIN) && - (SpaceId != ACPI_ADR_SPACE_DATA_TABLE) && - (SpaceId != ACPI_ADR_SPACE_FIXED_HARDWARE)) - { - return (FALSE); - } - - return (TRUE); -} diff --git a/drivers/acpica/hwacpi.c b/drivers/acpica/hwacpi.c deleted file mode 100644 index 21081dc..0000000 --- a/drivers/acpica/hwacpi.c +++ /dev/null @@ -1,329 +0,0 @@ -/****************************************************************************** - * - * Module Name: hwacpi - ACPI Hardware Initialization/Mode Interface - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" - - -#define _COMPONENT ACPI_HARDWARE - ACPI_MODULE_NAME ("hwacpi") - - -#if (!ACPI_REDUCED_HARDWARE) /* Entire module */ -/****************************************************************************** - * - * FUNCTION: AcpiHwSetMode - * - * PARAMETERS: Mode - SYS_MODE_ACPI or SYS_MODE_LEGACY - * - * RETURN: Status - * - * DESCRIPTION: Transitions the system into the requested mode. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiHwSetMode ( - UINT32 Mode) -{ - - ACPI_STATUS Status; - UINT32 Retry; - - - ACPI_FUNCTION_TRACE (HwSetMode); - - - /* If the Hardware Reduced flag is set, machine is always in acpi mode */ - - if (AcpiGbl_ReducedHardware) - { - return_ACPI_STATUS (AE_OK); - } - - /* - * ACPI 2.0 clarified that if SMI_CMD in FADT is zero, - * system does not support mode transition. - */ - if (!AcpiGbl_FADT.SmiCommand) - { - ACPI_ERROR ((AE_INFO, "No SMI_CMD in FADT, mode transition failed")); - return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE); - } - - /* - * ACPI 2.0 clarified the meaning of ACPI_ENABLE and ACPI_DISABLE - * in FADT: If it is zero, enabling or disabling is not supported. - * As old systems may have used zero for mode transition, - * we make sure both the numbers are zero to determine these - * transitions are not supported. - */ - if (!AcpiGbl_FADT.AcpiEnable && !AcpiGbl_FADT.AcpiDisable) - { - ACPI_ERROR ((AE_INFO, - "No ACPI mode transition supported in this system " - "(enable/disable both zero)")); - return_ACPI_STATUS (AE_OK); - } - - switch (Mode) - { - case ACPI_SYS_MODE_ACPI: - - /* BIOS should have disabled ALL fixed and GP events */ - - Status = AcpiHwWritePort (AcpiGbl_FADT.SmiCommand, - (UINT32) AcpiGbl_FADT.AcpiEnable, 8); - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Attempting to enable ACPI mode\n")); - break; - - case ACPI_SYS_MODE_LEGACY: - /* - * BIOS should clear all fixed status bits and restore fixed event - * enable bits to default - */ - Status = AcpiHwWritePort (AcpiGbl_FADT.SmiCommand, - (UINT32) AcpiGbl_FADT.AcpiDisable, 8); - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Attempting to enable Legacy (non-ACPI) mode\n")); - break; - - default: - - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Could not write ACPI mode change")); - return_ACPI_STATUS (Status); - } - - /* - * Some hardware takes a LONG time to switch modes. Give them 3 sec to - * do so, but allow faster systems to proceed more quickly. - */ - Retry = 3000; - while (Retry) - { - if (AcpiHwGetMode () == Mode) - { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Mode %X successfully enabled\n", Mode)); - return_ACPI_STATUS (AE_OK); - } - AcpiOsStall (ACPI_USEC_PER_MSEC); - Retry--; - } - - ACPI_ERROR ((AE_INFO, "Hardware did not change modes")); - return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiHwGetMode - * - * PARAMETERS: none - * - * RETURN: SYS_MODE_ACPI or SYS_MODE_LEGACY - * - * DESCRIPTION: Return current operating state of system. Determined by - * querying the SCI_EN bit. - * - ******************************************************************************/ - -UINT32 -AcpiHwGetMode ( - void) -{ - ACPI_STATUS Status; - UINT32 Value; - - - ACPI_FUNCTION_TRACE (HwGetMode); - - - /* If the Hardware Reduced flag is set, machine is always in acpi mode */ - - if (AcpiGbl_ReducedHardware) - { - return_UINT32 (ACPI_SYS_MODE_ACPI); - } - - /* - * ACPI 2.0 clarified that if SMI_CMD in FADT is zero, - * system does not support mode transition. - */ - if (!AcpiGbl_FADT.SmiCommand) - { - return_UINT32 (ACPI_SYS_MODE_ACPI); - } - - Status = AcpiReadBitRegister (ACPI_BITREG_SCI_ENABLE, &Value); - if (ACPI_FAILURE (Status)) - { - return_UINT32 (ACPI_SYS_MODE_LEGACY); - } - - if (Value) - { - return_UINT32 (ACPI_SYS_MODE_ACPI); - } - else - { - return_UINT32 (ACPI_SYS_MODE_LEGACY); - } -} - -#endif /* !ACPI_REDUCED_HARDWARE */ diff --git a/drivers/acpica/hwesleep.c b/drivers/acpica/hwesleep.c deleted file mode 100644 index c6ed424..0000000 --- a/drivers/acpica/hwesleep.c +++ /dev/null @@ -1,376 +0,0 @@ -/****************************************************************************** - * - * Name: hwesleep.c - ACPI Hardware Sleep/Wake Support functions for the - * extended FADT-V5 sleep registers. - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" - -#define _COMPONENT ACPI_HARDWARE - ACPI_MODULE_NAME ("hwesleep") - - -/******************************************************************************* - * - * FUNCTION: AcpiHwExecuteSleepMethod - * - * PARAMETERS: MethodPathname - Pathname of method to execute - * IntegerArgument - Argument to pass to the method - * - * RETURN: None - * - * DESCRIPTION: Execute a sleep/wake related method with one integer argument - * and no return value. - * - ******************************************************************************/ - -void -AcpiHwExecuteSleepMethod ( - char *MethodPathname, - UINT32 IntegerArgument) -{ - ACPI_OBJECT_LIST ArgList; - ACPI_OBJECT Arg; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (HwExecuteSleepMethod); - - - /* One argument, IntegerArgument; No return value expected */ - - ArgList.Count = 1; - ArgList.Pointer = &Arg; - Arg.Type = ACPI_TYPE_INTEGER; - Arg.Integer.Value = (UINT64) IntegerArgument; - - Status = AcpiEvaluateObject (NULL, MethodPathname, &ArgList, NULL); - if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND) - { - ACPI_EXCEPTION ((AE_INFO, Status, "While executing method %s", - MethodPathname)); - } - - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiHwExtendedSleep - * - * PARAMETERS: SleepState - Which sleep state to enter - * - * RETURN: Status - * - * DESCRIPTION: Enter a system sleep state via the extended FADT sleep - * registers (V5 FADT). - * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED - * - ******************************************************************************/ - -ACPI_STATUS -AcpiHwExtendedSleep ( - UINT8 SleepState) -{ - ACPI_STATUS Status; - UINT8 SleepControl; - UINT64 SleepStatus; - - - ACPI_FUNCTION_TRACE (HwExtendedSleep); - - - /* Extended sleep registers must be valid */ - - if (!AcpiGbl_FADT.SleepControl.Address || - !AcpiGbl_FADT.SleepStatus.Address) - { - return_ACPI_STATUS (AE_NOT_EXIST); - } - - /* Clear wake status (WAK_STS) */ - - Status = AcpiWrite ((UINT64) ACPI_X_WAKE_STATUS, - &AcpiGbl_FADT.SleepStatus); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - AcpiGbl_SystemAwakeAndRunning = FALSE; - - /* - * Set the SLP_TYP and SLP_EN bits. - * - * Note: We only use the first value returned by the \_Sx method - * (AcpiGbl_SleepTypeA) - As per ACPI specification. - */ - ACPI_DEBUG_PRINT ((ACPI_DB_INIT, - "Entering sleep state [S%u]\n", SleepState)); - - SleepControl = ((AcpiGbl_SleepTypeA << ACPI_X_SLEEP_TYPE_POSITION) & - ACPI_X_SLEEP_TYPE_MASK) | ACPI_X_SLEEP_ENABLE; - - /* Flush caches, as per ACPI specification */ - - if (SleepState < ACPI_STATE_S4) - { - ACPI_FLUSH_CPU_CACHE (); - } - - Status = AcpiOsEnterSleep (SleepState, SleepControl, 0); - if (Status == AE_CTRL_TERMINATE) - { - return_ACPI_STATUS (AE_OK); - } - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Status = AcpiWrite ((UINT64) SleepControl, &AcpiGbl_FADT.SleepControl); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Wait for transition back to Working State */ - - do - { - Status = AcpiRead (&SleepStatus, &AcpiGbl_FADT.SleepStatus); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - } while (!(((UINT8) SleepStatus) & ACPI_X_WAKE_STATUS)); - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiHwExtendedWakePrep - * - * PARAMETERS: SleepState - Which sleep state we just exited - * - * RETURN: Status - * - * DESCRIPTION: Perform first part of OS-independent ACPI cleanup after - * a sleep. Called with interrupts ENABLED. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiHwExtendedWakePrep ( - UINT8 SleepState) -{ - UINT8 SleepTypeValue; - - - ACPI_FUNCTION_TRACE (HwExtendedWakePrep); - - - if (AcpiGbl_SleepTypeAS0 != ACPI_SLEEP_TYPE_INVALID) - { - SleepTypeValue = ((AcpiGbl_SleepTypeAS0 << ACPI_X_SLEEP_TYPE_POSITION) & - ACPI_X_SLEEP_TYPE_MASK); - - (void) AcpiWrite ((UINT64) (SleepTypeValue | ACPI_X_SLEEP_ENABLE), - &AcpiGbl_FADT.SleepControl); - } - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiHwExtendedWake - * - * PARAMETERS: SleepState - Which sleep state we just exited - * - * RETURN: Status - * - * DESCRIPTION: Perform OS-independent ACPI cleanup after a sleep - * Called with interrupts ENABLED. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiHwExtendedWake ( - UINT8 SleepState) -{ - ACPI_FUNCTION_TRACE (HwExtendedWake); - - - /* Ensure EnterSleepStatePrep -> EnterSleepState ordering */ - - AcpiGbl_SleepTypeA = ACPI_SLEEP_TYPE_INVALID; - - /* Execute the wake methods */ - - AcpiHwExecuteSleepMethod (METHOD_PATHNAME__SST, ACPI_SST_WAKING); - AcpiHwExecuteSleepMethod (METHOD_PATHNAME__WAK, SleepState); - - /* - * Some BIOS code assumes that WAK_STS will be cleared on resume - * and use it to determine whether the system is rebooting or - * resuming. Clear WAK_STS for compatibility. - */ - (void) AcpiWrite ((UINT64) ACPI_X_WAKE_STATUS, &AcpiGbl_FADT.SleepStatus); - AcpiGbl_SystemAwakeAndRunning = TRUE; - - AcpiHwExecuteSleepMethod (METHOD_PATHNAME__SST, ACPI_SST_WORKING); - return_ACPI_STATUS (AE_OK); -} diff --git a/drivers/acpica/hwgpe.c b/drivers/acpica/hwgpe.c deleted file mode 100644 index bb4ebc0..0000000 --- a/drivers/acpica/hwgpe.c +++ /dev/null @@ -1,797 +0,0 @@ -/****************************************************************************** - * - * Module Name: hwgpe - Low level GPE enable/disable/clear functions - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acevents.h" - -#define _COMPONENT ACPI_HARDWARE - ACPI_MODULE_NAME ("hwgpe") - -#if (!ACPI_REDUCED_HARDWARE) /* Entire module */ - -/* Local prototypes */ - -static ACPI_STATUS -AcpiHwEnableWakeupGpeBlock ( - ACPI_GPE_XRUPT_INFO *GpeXruptInfo, - ACPI_GPE_BLOCK_INFO *GpeBlock, - void *Context); - -static ACPI_STATUS -AcpiHwGpeEnableWrite ( - UINT8 EnableMask, - ACPI_GPE_REGISTER_INFO *GpeRegisterInfo); - - -/****************************************************************************** - * - * FUNCTION: AcpiHwGetGpeRegisterBit - * - * PARAMETERS: GpeEventInfo - Info block for the GPE - * - * RETURN: Register mask with a one in the GPE bit position - * - * DESCRIPTION: Compute the register mask for this GPE. One bit is set in the - * correct position for the input GPE. - * - ******************************************************************************/ - -UINT32 -AcpiHwGetGpeRegisterBit ( - ACPI_GPE_EVENT_INFO *GpeEventInfo) -{ - - return ((UINT32) 1 << - (GpeEventInfo->GpeNumber - GpeEventInfo->RegisterInfo->BaseGpeNumber)); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiHwLowSetGpe - * - * PARAMETERS: GpeEventInfo - Info block for the GPE to be disabled - * Action - Enable or disable - * - * RETURN: Status - * - * DESCRIPTION: Enable or disable a single GPE in the parent enable register. - * The EnableMask field of the involved GPE register must be - * updated by the caller if necessary. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiHwLowSetGpe ( - ACPI_GPE_EVENT_INFO *GpeEventInfo, - UINT32 Action) -{ - ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; - ACPI_STATUS Status = AE_OK; - UINT64 EnableMask; - UINT32 RegisterBit; - - - ACPI_FUNCTION_ENTRY (); - - - /* Get the info block for the entire GPE register */ - - GpeRegisterInfo = GpeEventInfo->RegisterInfo; - if (!GpeRegisterInfo) - { - return (AE_NOT_EXIST); - } - - /* Get current value of the enable register that contains this GPE */ - - Status = AcpiHwRead (&EnableMask, &GpeRegisterInfo->EnableAddress); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Set or clear just the bit that corresponds to this GPE */ - - RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo); - switch (Action) - { - case ACPI_GPE_CONDITIONAL_ENABLE: - - /* Only enable if the corresponding EnableMask bit is set */ - - if (!(RegisterBit & GpeRegisterInfo->EnableMask)) - { - return (AE_BAD_PARAMETER); - } - - ACPI_FALLTHROUGH; - - case ACPI_GPE_ENABLE: - - ACPI_SET_BIT (EnableMask, RegisterBit); - break; - - case ACPI_GPE_DISABLE: - - ACPI_CLEAR_BIT (EnableMask, RegisterBit); - break; - - default: - - ACPI_ERROR ((AE_INFO, "Invalid GPE Action, %u", Action)); - return (AE_BAD_PARAMETER); - } - - if (!(RegisterBit & GpeRegisterInfo->MaskForRun)) - { - /* Write the updated enable mask */ - - Status = AcpiHwWrite (EnableMask, &GpeRegisterInfo->EnableAddress); - } - return (Status); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiHwClearGpe - * - * PARAMETERS: GpeEventInfo - Info block for the GPE to be cleared - * - * RETURN: Status - * - * DESCRIPTION: Clear the status bit for a single GPE. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiHwClearGpe ( - ACPI_GPE_EVENT_INFO *GpeEventInfo) -{ - ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; - ACPI_STATUS Status; - UINT32 RegisterBit; - - - ACPI_FUNCTION_ENTRY (); - - /* Get the info block for the entire GPE register */ - - GpeRegisterInfo = GpeEventInfo->RegisterInfo; - if (!GpeRegisterInfo) - { - return (AE_NOT_EXIST); - } - - /* - * Write a one to the appropriate bit in the status register to - * clear this GPE. - */ - RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo); - - Status = AcpiHwWrite (RegisterBit, &GpeRegisterInfo->StatusAddress); - return (Status); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiHwGetGpeStatus - * - * PARAMETERS: GpeEventInfo - Info block for the GPE to queried - * EventStatus - Where the GPE status is returned - * - * RETURN: Status - * - * DESCRIPTION: Return the status of a single GPE. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiHwGetGpeStatus ( - ACPI_GPE_EVENT_INFO *GpeEventInfo, - ACPI_EVENT_STATUS *EventStatus) -{ - UINT64 InByte; - UINT32 RegisterBit; - ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; - ACPI_EVENT_STATUS LocalEventStatus = 0; - ACPI_STATUS Status; - - - ACPI_FUNCTION_ENTRY (); - - - if (!EventStatus) - { - return (AE_BAD_PARAMETER); - } - - /* GPE currently handled? */ - - if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) != - ACPI_GPE_DISPATCH_NONE) - { - LocalEventStatus |= ACPI_EVENT_FLAG_HAS_HANDLER; - } - - /* Get the info block for the entire GPE register */ - - GpeRegisterInfo = GpeEventInfo->RegisterInfo; - - /* Get the register bitmask for this GPE */ - - RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo); - - /* GPE currently enabled? (enabled for runtime?) */ - - if (RegisterBit & GpeRegisterInfo->EnableForRun) - { - LocalEventStatus |= ACPI_EVENT_FLAG_ENABLED; - } - - /* GPE currently masked? (masked for runtime?) */ - - if (RegisterBit & GpeRegisterInfo->MaskForRun) - { - LocalEventStatus |= ACPI_EVENT_FLAG_MASKED; - } - - /* GPE enabled for wake? */ - - if (RegisterBit & GpeRegisterInfo->EnableForWake) - { - LocalEventStatus |= ACPI_EVENT_FLAG_WAKE_ENABLED; - } - - /* GPE currently enabled (enable bit == 1)? */ - - Status = AcpiHwRead (&InByte, &GpeRegisterInfo->EnableAddress); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - if (RegisterBit & InByte) - { - LocalEventStatus |= ACPI_EVENT_FLAG_ENABLE_SET; - } - - /* GPE currently active (status bit == 1)? */ - - Status = AcpiHwRead (&InByte, &GpeRegisterInfo->StatusAddress); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - if (RegisterBit & InByte) - { - LocalEventStatus |= ACPI_EVENT_FLAG_STATUS_SET; - } - - /* Set return value */ - - (*EventStatus) = LocalEventStatus; - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiHwGpeEnableWrite - * - * PARAMETERS: EnableMask - Bit mask to write to the GPE register - * GpeRegisterInfo - Gpe Register info - * - * RETURN: Status - * - * DESCRIPTION: Write the enable mask byte to the given GPE register. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiHwGpeEnableWrite ( - UINT8 EnableMask, - ACPI_GPE_REGISTER_INFO *GpeRegisterInfo) -{ - ACPI_STATUS Status; - - - GpeRegisterInfo->EnableMask = EnableMask; - - Status = AcpiHwWrite (EnableMask, &GpeRegisterInfo->EnableAddress); - return (Status); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiHwDisableGpeBlock - * - * PARAMETERS: GpeXruptInfo - GPE Interrupt info - * GpeBlock - Gpe Block info - * - * RETURN: Status - * - * DESCRIPTION: Disable all GPEs within a single GPE block - * - ******************************************************************************/ - -ACPI_STATUS -AcpiHwDisableGpeBlock ( - ACPI_GPE_XRUPT_INFO *GpeXruptInfo, - ACPI_GPE_BLOCK_INFO *GpeBlock, - void *Context) -{ - UINT32 i; - ACPI_STATUS Status; - - - /* Examine each GPE Register within the block */ - - for (i = 0; i < GpeBlock->RegisterCount; i++) - { - /* Disable all GPEs in this register */ - - Status = AcpiHwGpeEnableWrite (0x00, &GpeBlock->RegisterInfo[i]); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiHwClearGpeBlock - * - * PARAMETERS: GpeXruptInfo - GPE Interrupt info - * GpeBlock - Gpe Block info - * - * RETURN: Status - * - * DESCRIPTION: Clear status bits for all GPEs within a single GPE block - * - ******************************************************************************/ - -ACPI_STATUS -AcpiHwClearGpeBlock ( - ACPI_GPE_XRUPT_INFO *GpeXruptInfo, - ACPI_GPE_BLOCK_INFO *GpeBlock, - void *Context) -{ - UINT32 i; - ACPI_STATUS Status; - - - /* Examine each GPE Register within the block */ - - for (i = 0; i < GpeBlock->RegisterCount; i++) - { - /* Clear status on all GPEs in this register */ - - Status = AcpiHwWrite (0xFF, &GpeBlock->RegisterInfo[i].StatusAddress); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiHwEnableRuntimeGpeBlock - * - * PARAMETERS: GpeXruptInfo - GPE Interrupt info - * GpeBlock - Gpe Block info - * - * RETURN: Status - * - * DESCRIPTION: Enable all "runtime" GPEs within a single GPE block. Includes - * combination wake/run GPEs. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiHwEnableRuntimeGpeBlock ( - ACPI_GPE_XRUPT_INFO *GpeXruptInfo, - ACPI_GPE_BLOCK_INFO *GpeBlock, - void *Context) -{ - UINT32 i; - ACPI_STATUS Status; - ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; - UINT8 EnableMask; - - - /* NOTE: assumes that all GPEs are currently disabled */ - - /* Examine each GPE Register within the block */ - - for (i = 0; i < GpeBlock->RegisterCount; i++) - { - GpeRegisterInfo = &GpeBlock->RegisterInfo[i]; - if (!GpeRegisterInfo->EnableForRun) - { - continue; - } - - /* Enable all "runtime" GPEs in this register */ - - EnableMask = GpeRegisterInfo->EnableForRun & - ~GpeRegisterInfo->MaskForRun; - Status = AcpiHwGpeEnableWrite (EnableMask, GpeRegisterInfo); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiHwEnableWakeupGpeBlock - * - * PARAMETERS: GpeXruptInfo - GPE Interrupt info - * GpeBlock - Gpe Block info - * - * RETURN: Status - * - * DESCRIPTION: Enable all "wake" GPEs within a single GPE block. Includes - * combination wake/run GPEs. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiHwEnableWakeupGpeBlock ( - ACPI_GPE_XRUPT_INFO *GpeXruptInfo, - ACPI_GPE_BLOCK_INFO *GpeBlock, - void *Context) -{ - UINT32 i; - ACPI_STATUS Status; - ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; - - - /* Examine each GPE Register within the block */ - - for (i = 0; i < GpeBlock->RegisterCount; i++) - { - GpeRegisterInfo = &GpeBlock->RegisterInfo[i]; - - /* - * Enable all "wake" GPEs in this register and disable the - * remaining ones. - */ - Status = AcpiHwGpeEnableWrite (GpeRegisterInfo->EnableForWake, - GpeRegisterInfo); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiHwGetGpeBlockStatus - * - * PARAMETERS: GpeXruptInfo - GPE Interrupt info - * GpeBlock - Gpe Block info - * - * RETURN: Success - * - * DESCRIPTION: Produce a combined GPE status bits mask for the given block. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiHwGetGpeBlockStatus( - ACPI_GPE_XRUPT_INFO *GpeXruptInfo, - ACPI_GPE_BLOCK_INFO *GpeBlock, - void *RetPtr) -{ - ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; - UINT64 InEnable; - UINT64 InStatus; - ACPI_STATUS Status; - UINT8 *Ret = RetPtr; - UINT32 i; - - - /* Examine each GPE Register within the block */ - - for (i = 0; i < GpeBlock->RegisterCount; i++) - { - GpeRegisterInfo = &GpeBlock->RegisterInfo[i]; - - Status = AcpiHwRead (&InEnable, &GpeRegisterInfo->EnableAddress); - if (ACPI_FAILURE (Status)) - { - continue; - } - - Status = AcpiHwRead (&InStatus, &GpeRegisterInfo->StatusAddress); - if (ACPI_FAILURE (Status)) - { - continue; - } - - *Ret |= InEnable & InStatus; - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiHwDisableAllGpes - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Disable and clear all GPEs in all GPE blocks - * - ******************************************************************************/ - -ACPI_STATUS -AcpiHwDisableAllGpes ( - void) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (HwDisableAllGpes); - - - Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock, NULL); - return_ACPI_STATUS (Status); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiHwEnableAllRuntimeGpes - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Enable all "runtime" GPEs, in all GPE blocks - * - ******************************************************************************/ - -ACPI_STATUS -AcpiHwEnableAllRuntimeGpes ( - void) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (HwEnableAllRuntimeGpes); - - - Status = AcpiEvWalkGpeList (AcpiHwEnableRuntimeGpeBlock, NULL); - return_ACPI_STATUS (Status); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiHwEnableAllWakeupGpes - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Enable all "wakeup" GPEs, in all GPE blocks - * - ******************************************************************************/ - -ACPI_STATUS -AcpiHwEnableAllWakeupGpes ( - void) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (HwEnableAllWakeupGpes); - - - Status = AcpiEvWalkGpeList (AcpiHwEnableWakeupGpeBlock, NULL); - return_ACPI_STATUS (Status); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiHwCheckAllGpes - * - * PARAMETERS: None - * - * RETURN: Combined status of all GPEs - * - * DESCRIPTION: Check all enabled GPEs in all GPE blocks and return TRUE if the - * status bit is set for at least one of them of FALSE otherwise. - * - ******************************************************************************/ - -UINT8 -AcpiHwCheckAllGpes ( - void) -{ - UINT8 Ret = 0; - - - ACPI_FUNCTION_TRACE (AcpiHwCheckAllGpes); - - (void) AcpiEvWalkGpeList (AcpiHwGetGpeBlockStatus, &Ret); - return (Ret != 0); -} - -#endif /* !ACPI_REDUCED_HARDWARE */ diff --git a/drivers/acpica/hwpci.c b/drivers/acpica/hwpci.c deleted file mode 100644 index 32fb6af..0000000 --- a/drivers/acpica/hwpci.c +++ /dev/null @@ -1,571 +0,0 @@ -/******************************************************************************* - * - * Module Name: hwpci - Obtain PCI bus, device, and function numbers - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" - - -#define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("hwpci") - - -/* PCI configuration space values */ - -#define PCI_CFG_HEADER_TYPE_REG 0x0E -#define PCI_CFG_PRIMARY_BUS_NUMBER_REG 0x18 -#define PCI_CFG_SECONDARY_BUS_NUMBER_REG 0x19 - -/* PCI header values */ - -#define PCI_HEADER_TYPE_MASK 0x7F -#define PCI_TYPE_BRIDGE 0x01 -#define PCI_TYPE_CARDBUS_BRIDGE 0x02 - -typedef struct acpi_pci_device -{ - ACPI_HANDLE Device; - struct acpi_pci_device *Next; - -} ACPI_PCI_DEVICE; - - -/* Local prototypes */ - -static ACPI_STATUS -AcpiHwBuildPciList ( - ACPI_HANDLE RootPciDevice, - ACPI_HANDLE PciRegion, - ACPI_PCI_DEVICE **ReturnListHead); - -static ACPI_STATUS -AcpiHwProcessPciList ( - ACPI_PCI_ID *PciId, - ACPI_PCI_DEVICE *ListHead); - -static void -AcpiHwDeletePciList ( - ACPI_PCI_DEVICE *ListHead); - -static ACPI_STATUS -AcpiHwGetPciDeviceInfo ( - ACPI_PCI_ID *PciId, - ACPI_HANDLE PciDevice, - UINT16 *BusNumber, - BOOLEAN *IsBridge); - - -/******************************************************************************* - * - * FUNCTION: AcpiHwDerivePciId - * - * PARAMETERS: PciId - Initial values for the PCI ID. May be - * modified by this function. - * RootPciDevice - A handle to a PCI device object. This - * object must be a PCI Root Bridge having a - * _HID value of either PNP0A03 or PNP0A08 - * PciRegion - A handle to a PCI configuration space - * Operation Region being initialized - * - * RETURN: Status - * - * DESCRIPTION: This function derives a full PCI ID for a PCI device, - * consisting of a Segment number, Bus number, Device number, - * and function code. - * - * The PCI hardware dynamically configures PCI bus numbers - * depending on the bus topology discovered during system - * initialization. This function is invoked during configuration - * of a PCI_Config Operation Region in order to (possibly) update - * the Bus/Device/Function numbers in the PciId with the actual - * values as determined by the hardware and operating system - * configuration. - * - * The PciId parameter is initially populated during the Operation - * Region initialization. This function is then called, and is - * will make any necessary modifications to the Bus, Device, or - * Function number PCI ID subfields as appropriate for the - * current hardware and OS configuration. - * - * NOTE: Created 08/2010. Replaces the previous OSL AcpiOsDerivePciId - * interface since this feature is OS-independent. This module - * specifically avoids any use of recursion by building a local - * temporary device list. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiHwDerivePciId ( - ACPI_PCI_ID *PciId, - ACPI_HANDLE RootPciDevice, - ACPI_HANDLE PciRegion) -{ - ACPI_STATUS Status; - ACPI_PCI_DEVICE *ListHead; - - - ACPI_FUNCTION_TRACE (HwDerivePciId); - - - if (!PciId) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* Build a list of PCI devices, from PciRegion up to RootPciDevice */ - - Status = AcpiHwBuildPciList (RootPciDevice, PciRegion, &ListHead); - if (ACPI_SUCCESS (Status)) - { - /* Walk the list, updating the PCI device/function/bus numbers */ - - Status = AcpiHwProcessPciList (PciId, ListHead); - - /* Delete the list */ - - AcpiHwDeletePciList (ListHead); - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiHwBuildPciList - * - * PARAMETERS: RootPciDevice - A handle to a PCI device object. This - * object is guaranteed to be a PCI Root - * Bridge having a _HID value of either - * PNP0A03 or PNP0A08 - * PciRegion - A handle to the PCI configuration space - * Operation Region - * ReturnListHead - Where the PCI device list is returned - * - * RETURN: Status - * - * DESCRIPTION: Builds a list of devices from the input PCI region up to the - * Root PCI device for this namespace subtree. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiHwBuildPciList ( - ACPI_HANDLE RootPciDevice, - ACPI_HANDLE PciRegion, - ACPI_PCI_DEVICE **ReturnListHead) -{ - ACPI_HANDLE CurrentDevice; - ACPI_HANDLE ParentDevice; - ACPI_STATUS Status; - ACPI_PCI_DEVICE *ListElement; - - - /* - * Ascend namespace branch until the RootPciDevice is reached, building - * a list of device nodes. Loop will exit when either the PCI device is - * found, or the root of the namespace is reached. - */ - *ReturnListHead = NULL; - CurrentDevice = PciRegion; - while (1) - { - Status = AcpiGetParent (CurrentDevice, &ParentDevice); - if (ACPI_FAILURE (Status)) - { - /* Must delete the list before exit */ - - AcpiHwDeletePciList (*ReturnListHead); - return (Status); - } - - /* Finished when we reach the PCI root device (PNP0A03 or PNP0A08) */ - - if (ParentDevice == RootPciDevice) - { - return (AE_OK); - } - - ListElement = ACPI_ALLOCATE (sizeof (ACPI_PCI_DEVICE)); - if (!ListElement) - { - /* Must delete the list before exit */ - - AcpiHwDeletePciList (*ReturnListHead); - return (AE_NO_MEMORY); - } - - /* Put new element at the head of the list */ - - ListElement->Next = *ReturnListHead; - ListElement->Device = ParentDevice; - *ReturnListHead = ListElement; - - CurrentDevice = ParentDevice; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiHwProcessPciList - * - * PARAMETERS: PciId - Initial values for the PCI ID. May be - * modified by this function. - * ListHead - Device list created by - * AcpiHwBuildPciList - * - * RETURN: Status - * - * DESCRIPTION: Walk downward through the PCI device list, getting the device - * info for each, via the PCI configuration space and updating - * the PCI ID as necessary. Deletes the list during traversal. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiHwProcessPciList ( - ACPI_PCI_ID *PciId, - ACPI_PCI_DEVICE *ListHead) -{ - ACPI_STATUS Status = AE_OK; - ACPI_PCI_DEVICE *Info; - UINT16 BusNumber; - BOOLEAN IsBridge = TRUE; - - - ACPI_FUNCTION_NAME (HwProcessPciList); - - - ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, - "Input PciId: Seg %4.4X Bus %4.4X Dev %4.4X Func %4.4X\n", - PciId->Segment, PciId->Bus, PciId->Device, PciId->Function)); - - BusNumber = PciId->Bus; - - /* - * Descend down the namespace tree, collecting PCI device, function, - * and bus numbers. BusNumber is only important for PCI bridges. - * Algorithm: As we descend the tree, use the last valid PCI device, - * function, and bus numbers that are discovered, and assign them - * to the PCI ID for the target device. - */ - Info = ListHead; - while (Info) - { - Status = AcpiHwGetPciDeviceInfo (PciId, Info->Device, - &BusNumber, &IsBridge); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - Info = Info->Next; - } - - ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, - "Output PciId: Seg %4.4X Bus %4.4X Dev %4.4X Func %4.4X " - "Status %X BusNumber %X IsBridge %X\n", - PciId->Segment, PciId->Bus, PciId->Device, PciId->Function, - Status, BusNumber, IsBridge)); - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiHwDeletePciList - * - * PARAMETERS: ListHead - Device list created by - * AcpiHwBuildPciList - * - * RETURN: None - * - * DESCRIPTION: Free the entire PCI list. - * - ******************************************************************************/ - -static void -AcpiHwDeletePciList ( - ACPI_PCI_DEVICE *ListHead) -{ - ACPI_PCI_DEVICE *Next; - ACPI_PCI_DEVICE *Previous; - - - Next = ListHead; - while (Next) - { - Previous = Next; - Next = Previous->Next; - ACPI_FREE (Previous); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiHwGetPciDeviceInfo - * - * PARAMETERS: PciId - Initial values for the PCI ID. May be - * modified by this function. - * PciDevice - Handle for the PCI device object - * BusNumber - Where a PCI bridge bus number is returned - * IsBridge - Return value, indicates if this PCI - * device is a PCI bridge - * - * RETURN: Status - * - * DESCRIPTION: Get the device info for a single PCI device object. Get the - * _ADR (contains PCI device and function numbers), and for PCI - * bridge devices, get the bus number from PCI configuration - * space. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiHwGetPciDeviceInfo ( - ACPI_PCI_ID *PciId, - ACPI_HANDLE PciDevice, - UINT16 *BusNumber, - BOOLEAN *IsBridge) -{ - ACPI_STATUS Status; - ACPI_OBJECT_TYPE ObjectType; - UINT64 ReturnValue; - UINT64 PciValue; - - - /* We only care about objects of type Device */ - - Status = AcpiGetType (PciDevice, &ObjectType); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - if (ObjectType != ACPI_TYPE_DEVICE) - { - return (AE_OK); - } - - /* We need an _ADR. Ignore device if not present */ - - Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, - PciDevice, &ReturnValue); - if (ACPI_FAILURE (Status)) - { - return (AE_OK); - } - - /* - * From _ADR, get the PCI Device and Function and - * update the PCI ID. - */ - PciId->Device = ACPI_HIWORD (ACPI_LODWORD (ReturnValue)); - PciId->Function = ACPI_LOWORD (ACPI_LODWORD (ReturnValue)); - - /* - * If the previous device was a bridge, use the previous - * device bus number - */ - if (*IsBridge) - { - PciId->Bus = *BusNumber; - } - - /* - * Get the bus numbers from PCI Config space: - * - * First, get the PCI HeaderType - */ - *IsBridge = FALSE; - Status = AcpiOsReadPciConfiguration (PciId, - PCI_CFG_HEADER_TYPE_REG, &PciValue, 8); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* We only care about bridges (1=PciBridge, 2=CardBusBridge) */ - - PciValue &= PCI_HEADER_TYPE_MASK; - - if ((PciValue != PCI_TYPE_BRIDGE) && - (PciValue != PCI_TYPE_CARDBUS_BRIDGE)) - { - return (AE_OK); - } - - /* Bridge: Get the Primary BusNumber */ - - Status = AcpiOsReadPciConfiguration (PciId, - PCI_CFG_PRIMARY_BUS_NUMBER_REG, &PciValue, 8); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - *IsBridge = TRUE; - PciId->Bus = (UINT16) PciValue; - - /* Bridge: Get the Secondary BusNumber */ - - Status = AcpiOsReadPciConfiguration (PciId, - PCI_CFG_SECONDARY_BUS_NUMBER_REG, &PciValue, 8); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - *BusNumber = (UINT16) PciValue; - return (AE_OK); -} diff --git a/drivers/acpica/hwregs.c b/drivers/acpica/hwregs.c deleted file mode 100644 index de375d9..0000000 --- a/drivers/acpica/hwregs.c +++ /dev/null @@ -1,1012 +0,0 @@ -/******************************************************************************* - * - * Module Name: hwregs - Read/write access functions for the various ACPI - * control and status registers. - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acevents.h" - -#define _COMPONENT ACPI_HARDWARE - ACPI_MODULE_NAME ("hwregs") - - -#if (!ACPI_REDUCED_HARDWARE) - -/* Local Prototypes */ - -static UINT8 -AcpiHwGetAccessBitWidth ( - UINT64 Address, - ACPI_GENERIC_ADDRESS *Reg, - UINT8 MaxBitWidth); - -static ACPI_STATUS -AcpiHwReadMultiple ( - UINT32 *Value, - ACPI_GENERIC_ADDRESS *RegisterA, - ACPI_GENERIC_ADDRESS *RegisterB); - -static ACPI_STATUS -AcpiHwWriteMultiple ( - UINT32 Value, - ACPI_GENERIC_ADDRESS *RegisterA, - ACPI_GENERIC_ADDRESS *RegisterB); - -#endif /* !ACPI_REDUCED_HARDWARE */ - - -/****************************************************************************** - * - * FUNCTION: AcpiHwGetAccessBitWidth - * - * PARAMETERS: Address - GAS register address - * Reg - GAS register structure - * MaxBitWidth - Max BitWidth supported (32 or 64) - * - * RETURN: Status - * - * DESCRIPTION: Obtain optimal access bit width - * - ******************************************************************************/ - -static UINT8 -AcpiHwGetAccessBitWidth ( - UINT64 Address, - ACPI_GENERIC_ADDRESS *Reg, - UINT8 MaxBitWidth) -{ - UINT8 AccessBitWidth; - - - /* - * GAS format "register", used by FADT: - * 1. Detected if BitOffset is 0 and BitWidth is 8/16/32/64; - * 2. AccessSize field is ignored and BitWidth field is used for - * determining the boundary of the IO accesses. - * GAS format "region", used by APEI registers: - * 1. Detected if BitOffset is not 0 or BitWidth is not 8/16/32/64; - * 2. AccessSize field is used for determining the boundary of the - * IO accesses; - * 3. BitOffset/BitWidth fields are used to describe the "region". - * - * Note: This algorithm assumes that the "Address" fields should always - * contain aligned values. - */ - if (!Reg->BitOffset && Reg->BitWidth && - ACPI_IS_POWER_OF_TWO (Reg->BitWidth) && - ACPI_IS_ALIGNED (Reg->BitWidth, 8)) - { - AccessBitWidth = Reg->BitWidth; - } - else if (Reg->AccessWidth) - { - AccessBitWidth = ACPI_ACCESS_BIT_WIDTH (Reg->AccessWidth); - } - else - { - AccessBitWidth = ACPI_ROUND_UP_POWER_OF_TWO_8 ( - Reg->BitOffset + Reg->BitWidth); - if (AccessBitWidth <= 8) - { - AccessBitWidth = 8; - } - else - { - while (!ACPI_IS_ALIGNED (Address, AccessBitWidth >> 3)) - { - AccessBitWidth >>= 1; - } - } - } - - /* Maximum IO port access bit width is 32 */ - - if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_IO) - { - MaxBitWidth = 32; - } - - /* - * Return access width according to the requested maximum access bit width, - * as the caller should know the format of the register and may enforce - * a 32-bit accesses. - */ - if (AccessBitWidth < MaxBitWidth) - { - return (AccessBitWidth); - } - return (MaxBitWidth); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiHwValidateRegister - * - * PARAMETERS: Reg - GAS register structure - * MaxBitWidth - Max BitWidth supported (32 or 64) - * Address - Pointer to where the gas->address - * is returned - * - * RETURN: Status - * - * DESCRIPTION: Validate the contents of a GAS register. Checks the GAS - * pointer, Address, SpaceId, BitWidth, and BitOffset. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiHwValidateRegister ( - ACPI_GENERIC_ADDRESS *Reg, - UINT8 MaxBitWidth, - UINT64 *Address) -{ - UINT8 BitWidth; - UINT8 AccessWidth; - - - /* Must have a valid pointer to a GAS structure */ - - if (!Reg) - { - return (AE_BAD_PARAMETER); - } - - /* - * Copy the target address. This handles possible alignment issues. - * Address must not be null. A null address also indicates an optional - * ACPI register that is not supported, so no error message. - */ - ACPI_MOVE_64_TO_64 (Address, &Reg->Address); - if (!(*Address)) - { - return (AE_BAD_ADDRESS); - } - - /* Validate the SpaceID */ - - if ((Reg->SpaceId != ACPI_ADR_SPACE_SYSTEM_MEMORY) && - (Reg->SpaceId != ACPI_ADR_SPACE_SYSTEM_IO)) - { - ACPI_ERROR ((AE_INFO, - "Unsupported address space: 0x%X", Reg->SpaceId)); - return (AE_SUPPORT); - } - - /* Validate the AccessWidth */ - - if (Reg->AccessWidth > 4) - { - ACPI_ERROR ((AE_INFO, - "Unsupported register access width: 0x%X", Reg->AccessWidth)); - return (AE_SUPPORT); - } - - /* Validate the BitWidth, convert AccessWidth into number of bits */ - - AccessWidth = AcpiHwGetAccessBitWidth (*Address, Reg, MaxBitWidth); - BitWidth = ACPI_ROUND_UP (Reg->BitOffset + Reg->BitWidth, AccessWidth); - if (MaxBitWidth < BitWidth) - { - ACPI_WARNING ((AE_INFO, - "Requested bit width 0x%X is smaller than register bit width 0x%X", - MaxBitWidth, BitWidth)); - return (AE_SUPPORT); - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiHwRead - * - * PARAMETERS: Value - Where the value is returned - * Reg - GAS register structure - * - * RETURN: Status - * - * DESCRIPTION: Read from either memory or IO space. This is a 64-bit max - * version of AcpiRead. - * - * LIMITATIONS: - * SpaceID must be SystemMemory or SystemIO. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiHwRead ( - UINT64 *Value, - ACPI_GENERIC_ADDRESS *Reg) -{ - UINT64 Address; - UINT8 AccessWidth; - UINT32 BitWidth; - UINT8 BitOffset; - UINT64 Value64; - UINT32 Value32; - UINT8 Index; - ACPI_STATUS Status; - - - ACPI_FUNCTION_NAME (HwRead); - - - /* Validate contents of the GAS register */ - - Status = AcpiHwValidateRegister (Reg, 64, &Address); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* - * Initialize entire 64-bit return value to zero, convert AccessWidth - * into number of bits based - */ - *Value = 0; - AccessWidth = AcpiHwGetAccessBitWidth (Address, Reg, 64); - BitWidth = Reg->BitOffset + Reg->BitWidth; - BitOffset = Reg->BitOffset; - - /* - * Two address spaces supported: Memory or IO. PCI_Config is - * not supported here because the GAS structure is insufficient - */ - Index = 0; - while (BitWidth) - { - if (BitOffset >= AccessWidth) - { - Value64 = 0; - BitOffset -= AccessWidth; - } - else - { - if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY) - { - Status = AcpiOsReadMemory ((ACPI_PHYSICAL_ADDRESS) - Address + Index * ACPI_DIV_8 (AccessWidth), - &Value64, AccessWidth); - } - else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */ - { - Status = AcpiHwReadPort ((ACPI_IO_ADDRESS) - Address + Index * ACPI_DIV_8 (AccessWidth), - &Value32, AccessWidth); - Value64 = (UINT64) Value32; - } - } - - /* - * Use offset style bit writes because "Index * AccessWidth" is - * ensured to be less than 64-bits by AcpiHwValidateRegister(). - */ - ACPI_SET_BITS (Value, Index * AccessWidth, - ACPI_MASK_BITS_ABOVE_64 (AccessWidth), Value64); - - BitWidth -= BitWidth > AccessWidth ? AccessWidth : BitWidth; - Index++; - } - - ACPI_DEBUG_PRINT ((ACPI_DB_IO, - "Read: %8.8X%8.8X width %2d from %8.8X%8.8X (%s)\n", - ACPI_FORMAT_UINT64 (*Value), AccessWidth, - ACPI_FORMAT_UINT64 (Address), AcpiUtGetRegionName (Reg->SpaceId))); - - return (Status); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiHwWrite - * - * PARAMETERS: Value - Value to be written - * Reg - GAS register structure - * - * RETURN: Status - * - * DESCRIPTION: Write to either memory or IO space. This is a 64-bit max - * version of AcpiWrite. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiHwWrite ( - UINT64 Value, - ACPI_GENERIC_ADDRESS *Reg) -{ - UINT64 Address; - UINT8 AccessWidth; - UINT32 BitWidth; - UINT8 BitOffset; - UINT64 Value64; - UINT8 Index; - ACPI_STATUS Status; - - - ACPI_FUNCTION_NAME (HwWrite); - - - /* Validate contents of the GAS register */ - - Status = AcpiHwValidateRegister (Reg, 64, &Address); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Convert AccessWidth into number of bits based */ - - AccessWidth = AcpiHwGetAccessBitWidth (Address, Reg, 64); - BitWidth = Reg->BitOffset + Reg->BitWidth; - BitOffset = Reg->BitOffset; - - /* - * Two address spaces supported: Memory or IO. PCI_Config is - * not supported here because the GAS structure is insufficient - */ - Index = 0; - while (BitWidth) - { - /* - * Use offset style bit reads because "Index * AccessWidth" is - * ensured to be less than 64-bits by AcpiHwValidateRegister(). - */ - Value64 = ACPI_GET_BITS (&Value, Index * AccessWidth, - ACPI_MASK_BITS_ABOVE_64 (AccessWidth)); - - if (BitOffset >= AccessWidth) - { - BitOffset -= AccessWidth; - } - else - { - if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY) - { - Status = AcpiOsWriteMemory ((ACPI_PHYSICAL_ADDRESS) - Address + Index * ACPI_DIV_8 (AccessWidth), - Value64, AccessWidth); - } - else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */ - { - Status = AcpiHwWritePort ((ACPI_IO_ADDRESS) - Address + Index * ACPI_DIV_8 (AccessWidth), - (UINT32) Value64, AccessWidth); - } - } - - /* - * Index * AccessWidth is ensured to be less than 32-bits by - * AcpiHwValidateRegister(). - */ - BitWidth -= BitWidth > AccessWidth ? AccessWidth : BitWidth; - Index++; - } - - ACPI_DEBUG_PRINT ((ACPI_DB_IO, - "Wrote: %8.8X%8.8X width %2d to %8.8X%8.8X (%s)\n", - ACPI_FORMAT_UINT64 (Value), AccessWidth, - ACPI_FORMAT_UINT64 (Address), AcpiUtGetRegionName (Reg->SpaceId))); - - return (Status); -} - - -#if (!ACPI_REDUCED_HARDWARE) -/******************************************************************************* - * - * FUNCTION: AcpiHwClearAcpiStatus - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Clears all fixed and general purpose status bits - * - ******************************************************************************/ - -ACPI_STATUS -AcpiHwClearAcpiStatus ( - void) -{ - ACPI_STATUS Status; - ACPI_CPU_FLAGS LockFlags = 0; - - - ACPI_FUNCTION_TRACE (HwClearAcpiStatus); - - - ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %04X to %8.8X%8.8X\n", - ACPI_BITMASK_ALL_FIXED_STATUS, - ACPI_FORMAT_UINT64 (AcpiGbl_XPm1aStatus.Address))); - - LockFlags = AcpiOsAcquireLock (AcpiGbl_HardwareLock); - - /* Clear the fixed events in PM1 A/B */ - - Status = AcpiHwRegisterWrite (ACPI_REGISTER_PM1_STATUS, - ACPI_BITMASK_ALL_FIXED_STATUS); - - AcpiOsReleaseLock (AcpiGbl_HardwareLock, LockFlags); - - if (ACPI_FAILURE (Status)) - { - goto Exit; - } - - /* Clear the GPE Bits in all GPE registers in all GPE blocks */ - - Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock, NULL); - -Exit: - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiHwGetBitRegisterInfo - * - * PARAMETERS: RegisterId - Index of ACPI Register to access - * - * RETURN: The bitmask to be used when accessing the register - * - * DESCRIPTION: Map RegisterId into a register bitmask. - * - ******************************************************************************/ - -ACPI_BIT_REGISTER_INFO * -AcpiHwGetBitRegisterInfo ( - UINT32 RegisterId) -{ - ACPI_FUNCTION_ENTRY (); - - - if (RegisterId > ACPI_BITREG_MAX) - { - ACPI_ERROR ((AE_INFO, "Invalid BitRegister ID: 0x%X", RegisterId)); - return (NULL); - } - - return (&AcpiGbl_BitRegisterInfo[RegisterId]); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiHwWritePm1Control - * - * PARAMETERS: Pm1aControl - Value to be written to PM1A control - * Pm1bControl - Value to be written to PM1B control - * - * RETURN: Status - * - * DESCRIPTION: Write the PM1 A/B control registers. These registers are - * different than the PM1 A/B status and enable registers - * in that different values can be written to the A/B registers. - * Most notably, the SLP_TYP bits can be different, as per the - * values returned from the _Sx predefined methods. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiHwWritePm1Control ( - UINT32 Pm1aControl, - UINT32 Pm1bControl) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (HwWritePm1Control); - - - Status = AcpiHwWrite (Pm1aControl, &AcpiGbl_FADT.XPm1aControlBlock); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - if (AcpiGbl_FADT.XPm1bControlBlock.Address) - { - Status = AcpiHwWrite (Pm1bControl, &AcpiGbl_FADT.XPm1bControlBlock); - } - return_ACPI_STATUS (Status); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiHwRegisterRead - * - * PARAMETERS: RegisterId - ACPI Register ID - * ReturnValue - Where the register value is returned - * - * RETURN: Status and the value read. - * - * DESCRIPTION: Read from the specified ACPI register - * - ******************************************************************************/ - -ACPI_STATUS -AcpiHwRegisterRead ( - UINT32 RegisterId, - UINT32 *ReturnValue) -{ - UINT32 Value = 0; - UINT64 Value64; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (HwRegisterRead); - - - switch (RegisterId) - { - case ACPI_REGISTER_PM1_STATUS: /* PM1 A/B: 16-bit access each */ - - Status = AcpiHwReadMultiple (&Value, - &AcpiGbl_XPm1aStatus, - &AcpiGbl_XPm1bStatus); - break; - - case ACPI_REGISTER_PM1_ENABLE: /* PM1 A/B: 16-bit access each */ - - Status = AcpiHwReadMultiple (&Value, - &AcpiGbl_XPm1aEnable, - &AcpiGbl_XPm1bEnable); - break; - - case ACPI_REGISTER_PM1_CONTROL: /* PM1 A/B: 16-bit access each */ - - Status = AcpiHwReadMultiple (&Value, - &AcpiGbl_FADT.XPm1aControlBlock, - &AcpiGbl_FADT.XPm1bControlBlock); - - /* - * Zero the write-only bits. From the ACPI specification, "Hardware - * Write-Only Bits": "Upon reads to registers with write-only bits, - * software masks out all write-only bits." - */ - Value &= ~ACPI_PM1_CONTROL_WRITEONLY_BITS; - break; - - case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ - - Status = AcpiHwRead (&Value64, &AcpiGbl_FADT.XPm2ControlBlock); - if (ACPI_SUCCESS (Status)) - { - Value = (UINT32) Value64; - } - break; - - case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ - - Status = AcpiHwRead (&Value64, &AcpiGbl_FADT.XPmTimerBlock); - if (ACPI_SUCCESS (Status)) - { - Value = (UINT32) Value64; - } - - break; - - case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */ - - Status = AcpiHwReadPort (AcpiGbl_FADT.SmiCommand, &Value, 8); - break; - - default: - - ACPI_ERROR ((AE_INFO, "Unknown Register ID: 0x%X", - RegisterId)); - Status = AE_BAD_PARAMETER; - break; - } - - if (ACPI_SUCCESS (Status)) - { - *ReturnValue = (UINT32) Value; - } - - return_ACPI_STATUS (Status); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiHwRegisterWrite - * - * PARAMETERS: RegisterId - ACPI Register ID - * Value - The value to write - * - * RETURN: Status - * - * DESCRIPTION: Write to the specified ACPI register - * - * NOTE: In accordance with the ACPI specification, this function automatically - * preserves the value of the following bits, meaning that these bits cannot be - * changed via this interface: - * - * PM1_CONTROL[0] = SCI_EN - * PM1_CONTROL[9] - * PM1_STATUS[11] - * - * ACPI References: - * 1) Hardware Ignored Bits: When software writes to a register with ignored - * bit fields, it preserves the ignored bit fields - * 2) SCI_EN: OSPM always preserves this bit position - * - ******************************************************************************/ - -ACPI_STATUS -AcpiHwRegisterWrite ( - UINT32 RegisterId, - UINT32 Value) -{ - ACPI_STATUS Status; - UINT32 ReadValue; - UINT64 ReadValue64; - - - ACPI_FUNCTION_TRACE (HwRegisterWrite); - - - switch (RegisterId) - { - case ACPI_REGISTER_PM1_STATUS: /* PM1 A/B: 16-bit access each */ - /* - * Handle the "ignored" bit in PM1 Status. According to the ACPI - * specification, ignored bits are to be preserved when writing. - * Normally, this would mean a read/modify/write sequence. However, - * preserving a bit in the status register is different. Writing a - * one clears the status, and writing a zero preserves the status. - * Therefore, we must always write zero to the ignored bit. - * - * This behavior is clarified in the ACPI 4.0 specification. - */ - Value &= ~ACPI_PM1_STATUS_PRESERVED_BITS; - - Status = AcpiHwWriteMultiple (Value, - &AcpiGbl_XPm1aStatus, - &AcpiGbl_XPm1bStatus); - break; - - case ACPI_REGISTER_PM1_ENABLE: /* PM1 A/B: 16-bit access each */ - - Status = AcpiHwWriteMultiple (Value, - &AcpiGbl_XPm1aEnable, - &AcpiGbl_XPm1bEnable); - break; - - case ACPI_REGISTER_PM1_CONTROL: /* PM1 A/B: 16-bit access each */ - /* - * Perform a read first to preserve certain bits (per ACPI spec) - * Note: This includes SCI_EN, we never want to change this bit - */ - Status = AcpiHwReadMultiple (&ReadValue, - &AcpiGbl_FADT.XPm1aControlBlock, - &AcpiGbl_FADT.XPm1bControlBlock); - if (ACPI_FAILURE (Status)) - { - goto Exit; - } - - /* Insert the bits to be preserved */ - - ACPI_INSERT_BITS (Value, ACPI_PM1_CONTROL_PRESERVED_BITS, ReadValue); - - /* Now we can write the data */ - - Status = AcpiHwWriteMultiple (Value, - &AcpiGbl_FADT.XPm1aControlBlock, - &AcpiGbl_FADT.XPm1bControlBlock); - break; - - case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ - /* - * For control registers, all reserved bits must be preserved, - * as per the ACPI spec. - */ - Status = AcpiHwRead (&ReadValue64, &AcpiGbl_FADT.XPm2ControlBlock); - if (ACPI_FAILURE (Status)) - { - goto Exit; - } - ReadValue = (UINT32) ReadValue64; - - /* Insert the bits to be preserved */ - - ACPI_INSERT_BITS (Value, ACPI_PM2_CONTROL_PRESERVED_BITS, ReadValue); - - Status = AcpiHwWrite (Value, &AcpiGbl_FADT.XPm2ControlBlock); - break; - - case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ - - Status = AcpiHwWrite (Value, &AcpiGbl_FADT.XPmTimerBlock); - break; - - case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */ - - /* SMI_CMD is currently always in IO space */ - - Status = AcpiHwWritePort (AcpiGbl_FADT.SmiCommand, Value, 8); - break; - - default: - - ACPI_ERROR ((AE_INFO, "Unknown Register ID: 0x%X", - RegisterId)); - Status = AE_BAD_PARAMETER; - break; - } - -Exit: - return_ACPI_STATUS (Status); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiHwReadMultiple - * - * PARAMETERS: Value - Where the register value is returned - * RegisterA - First ACPI register (required) - * RegisterB - Second ACPI register (optional) - * - * RETURN: Status - * - * DESCRIPTION: Read from the specified two-part ACPI register (such as PM1 A/B) - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiHwReadMultiple ( - UINT32 *Value, - ACPI_GENERIC_ADDRESS *RegisterA, - ACPI_GENERIC_ADDRESS *RegisterB) -{ - UINT32 ValueA = 0; - UINT32 ValueB = 0; - UINT64 Value64; - ACPI_STATUS Status; - - - /* The first register is always required */ - - Status = AcpiHwRead (&Value64, RegisterA); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - ValueA = (UINT32) Value64; - - /* Second register is optional */ - - if (RegisterB->Address) - { - Status = AcpiHwRead (&Value64, RegisterB); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - ValueB = (UINT32) Value64; - } - - /* - * OR the two return values together. No shifting or masking is necessary, - * because of how the PM1 registers are defined in the ACPI specification: - * - * "Although the bits can be split between the two register blocks (each - * register block has a unique pointer within the FADT), the bit positions - * are maintained. The register block with unimplemented bits (that is, - * those implemented in the other register block) always returns zeros, - * and writes have no side effects" - */ - *Value = (ValueA | ValueB); - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiHwWriteMultiple - * - * PARAMETERS: Value - The value to write - * RegisterA - First ACPI register (required) - * RegisterB - Second ACPI register (optional) - * - * RETURN: Status - * - * DESCRIPTION: Write to the specified two-part ACPI register (such as PM1 A/B) - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiHwWriteMultiple ( - UINT32 Value, - ACPI_GENERIC_ADDRESS *RegisterA, - ACPI_GENERIC_ADDRESS *RegisterB) -{ - ACPI_STATUS Status; - - - /* The first register is always required */ - - Status = AcpiHwWrite (Value, RegisterA); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* - * Second register is optional - * - * No bit shifting or clearing is necessary, because of how the PM1 - * registers are defined in the ACPI specification: - * - * "Although the bits can be split between the two register blocks (each - * register block has a unique pointer within the FADT), the bit positions - * are maintained. The register block with unimplemented bits (that is, - * those implemented in the other register block) always returns zeros, - * and writes have no side effects" - */ - if (RegisterB->Address) - { - Status = AcpiHwWrite (Value, RegisterB); - } - - return (Status); -} - -#endif /* !ACPI_REDUCED_HARDWARE */ diff --git a/drivers/acpica/hwsleep.c b/drivers/acpica/hwsleep.c deleted file mode 100644 index bb38234..0000000 --- a/drivers/acpica/hwsleep.c +++ /dev/null @@ -1,482 +0,0 @@ -/****************************************************************************** - * - * Name: hwsleep.c - ACPI Hardware Sleep/Wake Support functions for the - * original/legacy sleep/PM registers. - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" - -#define _COMPONENT ACPI_HARDWARE - ACPI_MODULE_NAME ("hwsleep") - - -#if (!ACPI_REDUCED_HARDWARE) /* Entire module */ -/******************************************************************************* - * - * FUNCTION: AcpiHwLegacySleep - * - * PARAMETERS: SleepState - Which sleep state to enter - * - * RETURN: Status - * - * DESCRIPTION: Enter a system sleep state via the legacy FADT PM registers - * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED - * - ******************************************************************************/ - -ACPI_STATUS -AcpiHwLegacySleep ( - UINT8 SleepState) -{ - ACPI_BIT_REGISTER_INFO *SleepTypeRegInfo; - ACPI_BIT_REGISTER_INFO *SleepEnableRegInfo; - UINT32 Pm1aControl; - UINT32 Pm1bControl; - UINT32 InValue; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (HwLegacySleep); - - - SleepTypeRegInfo = AcpiHwGetBitRegisterInfo (ACPI_BITREG_SLEEP_TYPE); - SleepEnableRegInfo = AcpiHwGetBitRegisterInfo (ACPI_BITREG_SLEEP_ENABLE); - - /* Clear wake status */ - - Status = AcpiWriteBitRegister (ACPI_BITREG_WAKE_STATUS, - ACPI_CLEAR_STATUS); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Disable all GPEs */ - - Status = AcpiHwDisableAllGpes (); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - Status = AcpiHwClearAcpiStatus(); - if (ACPI_FAILURE(Status)) - { - return_ACPI_STATUS(Status); - } - AcpiGbl_SystemAwakeAndRunning = FALSE; - - /* Enable all wakeup GPEs */ - - Status = AcpiHwEnableAllWakeupGpes (); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Get current value of PM1A control */ - - Status = AcpiHwRegisterRead (ACPI_REGISTER_PM1_CONTROL, - &Pm1aControl); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - ACPI_DEBUG_PRINT ((ACPI_DB_INIT, - "Entering sleep state [S%u]\n", SleepState)); - - /* Clear the SLP_EN and SLP_TYP fields */ - - Pm1aControl &= ~(SleepTypeRegInfo->AccessBitMask | - SleepEnableRegInfo->AccessBitMask); - Pm1bControl = Pm1aControl; - - /* Insert the SLP_TYP bits */ - - Pm1aControl |= (AcpiGbl_SleepTypeA << SleepTypeRegInfo->BitPosition); - Pm1bControl |= (AcpiGbl_SleepTypeB << SleepTypeRegInfo->BitPosition); - - /* - * We split the writes of SLP_TYP and SLP_EN to workaround - * poorly implemented hardware. - */ - - /* Write #1: write the SLP_TYP data to the PM1 Control registers */ - - Status = AcpiHwWritePm1Control (Pm1aControl, Pm1bControl); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Insert the sleep enable (SLP_EN) bit */ - - Pm1aControl |= SleepEnableRegInfo->AccessBitMask; - Pm1bControl |= SleepEnableRegInfo->AccessBitMask; - - /* Flush caches, as per ACPI specification */ - - if (SleepState < ACPI_STATE_S4) - { - ACPI_FLUSH_CPU_CACHE (); - } - - Status = AcpiOsEnterSleep (SleepState, Pm1aControl, Pm1bControl); - if (Status == AE_CTRL_TERMINATE) - { - return_ACPI_STATUS (AE_OK); - } - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Write #2: Write both SLP_TYP + SLP_EN */ - - Status = AcpiHwWritePm1Control (Pm1aControl, Pm1bControl); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - if (SleepState > ACPI_STATE_S3) - { - /* - * We wanted to sleep > S3, but it didn't happen (by virtue of the - * fact that we are still executing!) - * - * Wait ten seconds, then try again. This is to get S4/S5 to work on - * all machines. - * - * We wait so long to allow chipsets that poll this reg very slowly - * to still read the right value. Ideally, this block would go - * away entirely. - */ - AcpiOsStall (10 * ACPI_USEC_PER_SEC); - - Status = AcpiHwRegisterWrite (ACPI_REGISTER_PM1_CONTROL, - SleepEnableRegInfo->AccessBitMask); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - /* Wait for transition back to Working State */ - - do - { - Status = AcpiReadBitRegister (ACPI_BITREG_WAKE_STATUS, &InValue); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - } while (!InValue); - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiHwLegacyWakePrep - * - * PARAMETERS: SleepState - Which sleep state we just exited - * - * RETURN: Status - * - * DESCRIPTION: Perform the first state of OS-independent ACPI cleanup after a - * sleep. - * Called with interrupts ENABLED. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiHwLegacyWakePrep ( - UINT8 SleepState) -{ - ACPI_STATUS Status = AE_OK; - ACPI_BIT_REGISTER_INFO *SleepTypeRegInfo; - ACPI_BIT_REGISTER_INFO *SleepEnableRegInfo; - UINT32 Pm1aControl; - UINT32 Pm1bControl; - - - ACPI_FUNCTION_TRACE (HwLegacyWakePrep); - - /* - * Set SLP_TYPE and SLP_EN to state S0. - * This is unclear from the ACPI Spec, but it is required - * by some machines. - */ - if (AcpiGbl_SleepTypeAS0 != ACPI_SLEEP_TYPE_INVALID) - { - SleepTypeRegInfo = - AcpiHwGetBitRegisterInfo (ACPI_BITREG_SLEEP_TYPE); - SleepEnableRegInfo = - AcpiHwGetBitRegisterInfo (ACPI_BITREG_SLEEP_ENABLE); - - /* Get current value of PM1A control */ - - Status = AcpiHwRegisterRead (ACPI_REGISTER_PM1_CONTROL, - &Pm1aControl); - if (ACPI_SUCCESS (Status)) - { - /* Clear the SLP_EN and SLP_TYP fields */ - - Pm1aControl &= ~(SleepTypeRegInfo->AccessBitMask | - SleepEnableRegInfo->AccessBitMask); - Pm1bControl = Pm1aControl; - - /* Insert the SLP_TYP bits */ - - Pm1aControl |= (AcpiGbl_SleepTypeAS0 << - SleepTypeRegInfo->BitPosition); - Pm1bControl |= (AcpiGbl_SleepTypeBS0 << - SleepTypeRegInfo->BitPosition); - - /* Write the control registers and ignore any errors */ - - (void) AcpiHwWritePm1Control (Pm1aControl, Pm1bControl); - } - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiHwLegacyWake - * - * PARAMETERS: SleepState - Which sleep state we just exited - * - * RETURN: Status - * - * DESCRIPTION: Perform OS-independent ACPI cleanup after a sleep - * Called with interrupts ENABLED. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiHwLegacyWake ( - UINT8 SleepState) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (HwLegacyWake); - - - /* Ensure EnterSleepStatePrep -> EnterSleepState ordering */ - - AcpiGbl_SleepTypeA = ACPI_SLEEP_TYPE_INVALID; - AcpiHwExecuteSleepMethod (METHOD_PATHNAME__SST, ACPI_SST_WAKING); - - /* - * GPEs must be enabled before _WAK is called as GPEs - * might get fired there - * - * Restore the GPEs: - * 1) Disable all GPEs - * 2) Enable all runtime GPEs - */ - Status = AcpiHwDisableAllGpes (); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Status = AcpiHwEnableAllRuntimeGpes (); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* - * Now we can execute _WAK, etc. Some machines require that the GPEs - * are enabled before the wake methods are executed. - */ - AcpiHwExecuteSleepMethod (METHOD_PATHNAME__WAK, SleepState); - - /* - * Some BIOS code assumes that WAK_STS will be cleared on resume - * and use it to determine whether the system is rebooting or - * resuming. Clear WAK_STS for compatibility. - */ - (void) AcpiWriteBitRegister (ACPI_BITREG_WAKE_STATUS, - ACPI_CLEAR_STATUS); - AcpiGbl_SystemAwakeAndRunning = TRUE; - - /* Enable power button */ - - (void) AcpiWriteBitRegister( - AcpiGbl_FixedEventInfo[ACPI_EVENT_POWER_BUTTON].EnableRegisterId, - ACPI_ENABLE_EVENT); - - (void) AcpiWriteBitRegister( - AcpiGbl_FixedEventInfo[ACPI_EVENT_POWER_BUTTON].StatusRegisterId, - ACPI_CLEAR_STATUS); - - /* Enable sleep button */ - - (void) AcpiWriteBitRegister ( - AcpiGbl_FixedEventInfo[ACPI_EVENT_SLEEP_BUTTON].EnableRegisterId, - ACPI_ENABLE_EVENT); - - (void) AcpiWriteBitRegister ( - AcpiGbl_FixedEventInfo[ACPI_EVENT_SLEEP_BUTTON].StatusRegisterId, - ACPI_CLEAR_STATUS); - - AcpiHwExecuteSleepMethod (METHOD_PATHNAME__SST, ACPI_SST_WORKING); - return_ACPI_STATUS (Status); -} - -#endif /* !ACPI_REDUCED_HARDWARE */ diff --git a/drivers/acpica/hwtimer.c b/drivers/acpica/hwtimer.c deleted file mode 100644 index 68cf627..0000000 --- a/drivers/acpica/hwtimer.c +++ /dev/null @@ -1,348 +0,0 @@ -/****************************************************************************** - * - * Name: hwtimer.c - ACPI Power Management Timer Interface - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#define EXPORT_ACPI_INTERFACES - -#include "acpi.h" -#include "accommon.h" - -#define _COMPONENT ACPI_HARDWARE - ACPI_MODULE_NAME ("hwtimer") - - -#if (!ACPI_REDUCED_HARDWARE) /* Entire module */ -/****************************************************************************** - * - * FUNCTION: AcpiGetTimerResolution - * - * PARAMETERS: Resolution - Where the resolution is returned - * - * RETURN: Status and timer resolution - * - * DESCRIPTION: Obtains resolution of the ACPI PM Timer (24 or 32 bits). - * - ******************************************************************************/ - -ACPI_STATUS -AcpiGetTimerResolution ( - UINT32 *Resolution) -{ - ACPI_FUNCTION_TRACE (AcpiGetTimerResolution); - - - if (!Resolution) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - if ((AcpiGbl_FADT.Flags & ACPI_FADT_32BIT_TIMER) == 0) - { - *Resolution = 24; - } - else - { - *Resolution = 32; - } - - return_ACPI_STATUS (AE_OK); -} - -ACPI_EXPORT_SYMBOL (AcpiGetTimerResolution) - - -/****************************************************************************** - * - * FUNCTION: AcpiGetTimer - * - * PARAMETERS: Ticks - Where the timer value is returned - * - * RETURN: Status and current timer value (ticks) - * - * DESCRIPTION: Obtains current value of ACPI PM Timer (in ticks). - * - ******************************************************************************/ - -ACPI_STATUS -AcpiGetTimer ( - UINT32 *Ticks) -{ - ACPI_STATUS Status; - UINT64 TimerValue; - - - ACPI_FUNCTION_TRACE (AcpiGetTimer); - - - if (!Ticks) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* ACPI 5.0A: PM Timer is optional */ - - if (!AcpiGbl_FADT.XPmTimerBlock.Address) - { - return_ACPI_STATUS (AE_SUPPORT); - } - - Status = AcpiHwRead (&TimerValue, &AcpiGbl_FADT.XPmTimerBlock); - if (ACPI_SUCCESS (Status)) - { - /* ACPI PM Timer is defined to be 32 bits (PM_TMR_LEN) */ - - *Ticks = (UINT32) TimerValue; - } - - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiGetTimer) - - -/****************************************************************************** - * - * FUNCTION: AcpiGetTimerDuration - * - * PARAMETERS: StartTicks - Starting timestamp - * EndTicks - End timestamp - * TimeElapsed - Where the elapsed time is returned - * - * RETURN: Status and TimeElapsed - * - * DESCRIPTION: Computes the time elapsed (in microseconds) between two - * PM Timer time stamps, taking into account the possibility of - * rollovers, the timer resolution, and timer frequency. - * - * The PM Timer's clock ticks at roughly 3.6 times per - * _microsecond_, and its clock continues through Cx state - * transitions (unlike many CPU timestamp counters) -- making it - * a versatile and accurate timer. - * - * Note that this function accommodates only a single timer - * rollover. Thus for 24-bit timers, this function should only - * be used for calculating durations less than ~4.6 seconds - * (~20 minutes for 32-bit timers) -- calculations below: - * - * 2**24 Ticks / 3,600,000 Ticks/Sec = 4.66 sec - * 2**32 Ticks / 3,600,000 Ticks/Sec = 1193 sec or 19.88 minutes - * - ******************************************************************************/ - -ACPI_STATUS -AcpiGetTimerDuration ( - UINT32 StartTicks, - UINT32 EndTicks, - UINT32 *TimeElapsed) -{ - ACPI_STATUS Status; - UINT64 DeltaTicks; - UINT64 Quotient; - - - ACPI_FUNCTION_TRACE (AcpiGetTimerDuration); - - - if (!TimeElapsed) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* ACPI 5.0A: PM Timer is optional */ - - if (!AcpiGbl_FADT.XPmTimerBlock.Address) - { - return_ACPI_STATUS (AE_SUPPORT); - } - - if (StartTicks == EndTicks) - { - *TimeElapsed = 0; - return_ACPI_STATUS (AE_OK); - } - - /* - * Compute Tick Delta: - * Handle (max one) timer rollovers on 24-bit versus 32-bit timers. - */ - DeltaTicks = EndTicks; - if (StartTicks > EndTicks) - { - if ((AcpiGbl_FADT.Flags & ACPI_FADT_32BIT_TIMER) == 0) - { - /* 24-bit Timer */ - - DeltaTicks |= (UINT64) 1 << 24; - } - else - { - /* 32-bit Timer */ - - DeltaTicks |= (UINT64) 1 << 32; - } - } - DeltaTicks -= StartTicks; - - /* - * Compute Duration (Requires a 64-bit multiply and divide): - * - * TimeElapsed (microseconds) = - * (DeltaTicks * ACPI_USEC_PER_SEC) / ACPI_PM_TIMER_FREQUENCY; - */ - Status = AcpiUtShortDivide (DeltaTicks * ACPI_USEC_PER_SEC, - ACPI_PM_TIMER_FREQUENCY, &Quotient, NULL); - - *TimeElapsed = (UINT32) Quotient; - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiGetTimerDuration) - -#endif /* !ACPI_REDUCED_HARDWARE */ diff --git a/drivers/acpica/hwvalid.c b/drivers/acpica/hwvalid.c deleted file mode 100644 index 0dfe4d2..0000000 --- a/drivers/acpica/hwvalid.c +++ /dev/null @@ -1,472 +0,0 @@ -/****************************************************************************** - * - * Module Name: hwvalid - I/O request validation - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" - -#define _COMPONENT ACPI_HARDWARE - ACPI_MODULE_NAME ("hwvalid") - -/* Local prototypes */ - -static ACPI_STATUS -AcpiHwValidateIoRequest ( - ACPI_IO_ADDRESS Address, - UINT32 BitWidth); - - -/* - * Protected I/O ports. Some ports are always illegal, and some are - * conditionally illegal. This table must remain ordered by port address. - * - * The table is used to implement the Microsoft port access rules that - * first appeared in Windows XP. Some ports are always illegal, and some - * ports are only illegal if the BIOS calls _OSI with nothing newer than - * the specific _OSI strings. - * - * This provides ACPICA with the desired port protections and - * Microsoft compatibility. - * - * Description of port entries: - * DMA: DMA controller - * PIC0: Programmable Interrupt Controller (8259A) - * PIT1: System Timer 1 - * PIT2: System Timer 2 failsafe - * RTC: Real-time clock - * CMOS: Extended CMOS - * DMA1: DMA 1 page registers - * DMA1L: DMA 1 Ch 0 low page - * DMA2: DMA 2 page registers - * DMA2L: DMA 2 low page refresh - * ARBC: Arbitration control - * SETUP: Reserved system board setup - * POS: POS channel select - * PIC1: Cascaded PIC - * IDMA: ISA DMA - * ELCR: PIC edge/level registers - * PCI: PCI configuration space - */ -static const ACPI_PORT_INFO AcpiProtectedPorts[] = -{ - {"DMA", 0x0000, 0x000F, ACPI_OSI_WIN_XP}, - {"PIC0", 0x0020, 0x0021, ACPI_ALWAYS_ILLEGAL}, - {"PIT1", 0x0040, 0x0043, ACPI_OSI_WIN_XP}, - {"PIT2", 0x0048, 0x004B, ACPI_OSI_WIN_XP}, - {"RTC", 0x0070, 0x0071, ACPI_OSI_WIN_XP}, - {"CMOS", 0x0074, 0x0076, ACPI_OSI_WIN_XP}, - {"DMA1", 0x0081, 0x0083, ACPI_OSI_WIN_XP}, - {"DMA1L", 0x0087, 0x0087, ACPI_OSI_WIN_XP}, - {"DMA2", 0x0089, 0x008B, ACPI_OSI_WIN_XP}, - {"DMA2L", 0x008F, 0x008F, ACPI_OSI_WIN_XP}, - {"ARBC", 0x0090, 0x0091, ACPI_OSI_WIN_XP}, - {"SETUP", 0x0093, 0x0094, ACPI_OSI_WIN_XP}, - {"POS", 0x0096, 0x0097, ACPI_OSI_WIN_XP}, - {"PIC1", 0x00A0, 0x00A1, ACPI_ALWAYS_ILLEGAL}, - {"IDMA", 0x00C0, 0x00DF, ACPI_OSI_WIN_XP}, - {"ELCR", 0x04D0, 0x04D1, ACPI_ALWAYS_ILLEGAL}, - {"PCI", 0x0CF8, 0x0CFF, ACPI_OSI_WIN_XP} -}; - -#define ACPI_PORT_INFO_ENTRIES ACPI_ARRAY_LENGTH (AcpiProtectedPorts) - - -/****************************************************************************** - * - * FUNCTION: AcpiHwValidateIoRequest - * - * PARAMETERS: Address Address of I/O port/register - * BitWidth Number of bits (8,16,32) - * - * RETURN: Status - * - * DESCRIPTION: Validates an I/O request (address/length). Certain ports are - * always illegal and some ports are only illegal depending on - * the requests the BIOS AML code makes to the predefined - * _OSI method. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiHwValidateIoRequest ( - ACPI_IO_ADDRESS Address, - UINT32 BitWidth) -{ - UINT32 i; - UINT32 ByteWidth; - ACPI_IO_ADDRESS LastAddress; - const ACPI_PORT_INFO *PortInfo; - - - ACPI_FUNCTION_TRACE (HwValidateIoRequest); - - - /* Supported widths are 8/16/32 */ - - if ((BitWidth != 8) && - (BitWidth != 16) && - (BitWidth != 32)) - { - ACPI_ERROR ((AE_INFO, - "Bad BitWidth parameter: %8.8X", BitWidth)); - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - PortInfo = AcpiProtectedPorts; - ByteWidth = ACPI_DIV_8 (BitWidth); - LastAddress = Address + ByteWidth - 1; - - ACPI_DEBUG_PRINT ((ACPI_DB_IO, - "Address %8.8X%8.8X LastAddress %8.8X%8.8X Length %X", - ACPI_FORMAT_UINT64 (Address), ACPI_FORMAT_UINT64 (LastAddress), - ByteWidth)); - - /* Maximum 16-bit address in I/O space */ - - if (LastAddress > ACPI_UINT16_MAX) - { - ACPI_ERROR ((AE_INFO, - "Illegal I/O port address/length above 64K: %8.8X%8.8X/0x%X", - ACPI_FORMAT_UINT64 (Address), ByteWidth)); - return_ACPI_STATUS (AE_LIMIT); - } - - /* Exit if requested address is not within the protected port table */ - - if (Address > AcpiProtectedPorts[ACPI_PORT_INFO_ENTRIES - 1].End) - { - return_ACPI_STATUS (AE_OK); - } - - /* Check request against the list of protected I/O ports */ - - for (i = 0; i < ACPI_PORT_INFO_ENTRIES; i++, PortInfo++) - { - /* - * Check if the requested address range will write to a reserved - * port. There are four cases to consider: - * - * 1) Address range is contained completely in the port address range - * 2) Address range overlaps port range at the port range start - * 3) Address range overlaps port range at the port range end - * 4) Address range completely encompasses the port range - */ - if ((Address <= PortInfo->End) && (LastAddress >= PortInfo->Start)) - { - /* Port illegality may depend on the _OSI calls made by the BIOS */ - if (PortInfo->OsiDependency == ACPI_ALWAYS_ILLEGAL || - AcpiGbl_OsiData == PortInfo->OsiDependency) - { - ACPI_DEBUG_PRINT ((ACPI_DB_VALUES, - "Denied AML access to port 0x%8.8X%8.8X/%X (%s 0x%.4X-0x%.4X)\n", - ACPI_FORMAT_UINT64 (Address), ByteWidth, PortInfo->Name, - PortInfo->Start, PortInfo->End)); - - return_ACPI_STATUS (AE_AML_ILLEGAL_ADDRESS); - } - } - - /* Finished if address range ends before the end of this port */ - - if (LastAddress <= PortInfo->End) - { - break; - } - } - - return_ACPI_STATUS (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiHwReadPort - * - * PARAMETERS: Address Address of I/O port/register to read - * Value Where value (data) is returned - * Width Number of bits - * - * RETURN: Status and value read from port - * - * DESCRIPTION: Read data from an I/O port or register. This is a front-end - * to AcpiOsReadPort that performs validation on both the port - * address and the length. - * - *****************************************************************************/ - -ACPI_STATUS -AcpiHwReadPort ( - ACPI_IO_ADDRESS Address, - UINT32 *Value, - UINT32 Width) -{ - ACPI_STATUS Status; - UINT32 OneByte; - UINT32 i; - - - /* Truncate address to 16 bits if requested */ - - if (AcpiGbl_TruncateIoAddresses) - { - Address &= ACPI_UINT16_MAX; - } - - /* Validate the entire request and perform the I/O */ - - Status = AcpiHwValidateIoRequest (Address, Width); - if (ACPI_SUCCESS (Status)) - { - Status = AcpiOsReadPort (Address, Value, Width); - return (Status); - } - - if (Status != AE_AML_ILLEGAL_ADDRESS) - { - return (Status); - } - - /* - * There has been a protection violation within the request. Fall - * back to byte granularity port I/O and ignore the failing bytes. - * This provides compatibility with other ACPI implementations. - */ - for (i = 0, *Value = 0; i < Width; i += 8) - { - /* Validate and read one byte */ - - if (AcpiHwValidateIoRequest (Address, 8) == AE_OK) - { - Status = AcpiOsReadPort (Address, &OneByte, 8); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - *Value |= (OneByte << i); - } - - Address++; - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiHwWritePort - * - * PARAMETERS: Address Address of I/O port/register to write - * Value Value to write - * Width Number of bits - * - * RETURN: Status - * - * DESCRIPTION: Write data to an I/O port or register. This is a front-end - * to AcpiOsWritePort that performs validation on both the port - * address and the length. - * - *****************************************************************************/ - -ACPI_STATUS -AcpiHwWritePort ( - ACPI_IO_ADDRESS Address, - UINT32 Value, - UINT32 Width) -{ - ACPI_STATUS Status; - UINT32 i; - - - /* Truncate address to 16 bits if requested */ - - if (AcpiGbl_TruncateIoAddresses) - { - Address &= ACPI_UINT16_MAX; - } - - /* Validate the entire request and perform the I/O */ - - Status = AcpiHwValidateIoRequest (Address, Width); - if (ACPI_SUCCESS (Status)) - { - Status = AcpiOsWritePort (Address, Value, Width); - return (Status); - } - - if (Status != AE_AML_ILLEGAL_ADDRESS) - { - return (Status); - } - - /* - * There has been a protection violation within the request. Fall - * back to byte granularity port I/O and ignore the failing bytes. - * This provides compatibility with other ACPI implementations. - */ - for (i = 0; i < Width; i += 8) - { - /* Validate and write one byte */ - - if (AcpiHwValidateIoRequest (Address, 8) == AE_OK) - { - Status = AcpiOsWritePort (Address, (Value >> i) & 0xFF, 8); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - - Address++; - } - - return (AE_OK); -} diff --git a/drivers/acpica/hwxface.c b/drivers/acpica/hwxface.c deleted file mode 100644 index 5075fdc..0000000 --- a/drivers/acpica/hwxface.c +++ /dev/null @@ -1,646 +0,0 @@ -/****************************************************************************** - * - * Module Name: hwxface - Public ACPICA hardware interfaces - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#define EXPORT_ACPI_INTERFACES - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" - -#define _COMPONENT ACPI_HARDWARE - ACPI_MODULE_NAME ("hwxface") - - -/****************************************************************************** - * - * FUNCTION: AcpiReset - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Set reset register in memory or IO space. Note: Does not - * support reset register in PCI config space, this must be - * handled separately. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiReset ( - void) -{ - ACPI_GENERIC_ADDRESS *ResetReg; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiReset); - - - ResetReg = &AcpiGbl_FADT.ResetRegister; - - /* Check if the reset register is supported */ - - if (!(AcpiGbl_FADT.Flags & ACPI_FADT_RESET_REGISTER) || - !ResetReg->Address) - { - return_ACPI_STATUS (AE_NOT_EXIST); - } - - if (ResetReg->SpaceId == ACPI_ADR_SPACE_SYSTEM_IO) - { - /* - * For I/O space, write directly to the OSL. This bypasses the port - * validation mechanism, which may block a valid write to the reset - * register. - * - * NOTE: - * The ACPI spec requires the reset register width to be 8, so we - * hardcode it here and ignore the FADT value. This maintains - * compatibility with other ACPI implementations that have allowed - * BIOS code with bad register width values to go unnoticed. - */ - Status = AcpiOsWritePort ((ACPI_IO_ADDRESS) ResetReg->Address, - AcpiGbl_FADT.ResetValue, ACPI_RESET_REGISTER_WIDTH); - } - else - { - /* Write the reset value to the reset register */ - - Status = AcpiHwWrite (AcpiGbl_FADT.ResetValue, ResetReg); - } - - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiReset) - - -/****************************************************************************** - * - * FUNCTION: AcpiRead - * - * PARAMETERS: Value - Where the value is returned - * Reg - GAS register structure - * - * RETURN: Status - * - * DESCRIPTION: Read from either memory or IO space. - * - * LIMITATIONS: - * BitWidth must be exactly 8, 16, 32, or 64. - * SpaceID must be SystemMemory or SystemIO. - * BitOffset and AccessWidth are currently ignored, as there has - * not been a need to implement these. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiRead ( - UINT64 *ReturnValue, - ACPI_GENERIC_ADDRESS *Reg) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_NAME (AcpiRead); - - - Status = AcpiHwRead (ReturnValue, Reg); - return (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiRead) - - -/****************************************************************************** - * - * FUNCTION: AcpiWrite - * - * PARAMETERS: Value - Value to be written - * Reg - GAS register structure - * - * RETURN: Status - * - * DESCRIPTION: Write to either memory or IO space. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiWrite ( - UINT64 Value, - ACPI_GENERIC_ADDRESS *Reg) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_NAME (AcpiWrite); - - - Status = AcpiHwWrite (Value, Reg); - return (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiWrite) - - -#if (!ACPI_REDUCED_HARDWARE) -/******************************************************************************* - * - * FUNCTION: AcpiReadBitRegister - * - * PARAMETERS: RegisterId - ID of ACPI Bit Register to access - * ReturnValue - Value that was read from the register, - * normalized to bit position zero. - * - * RETURN: Status and the value read from the specified Register. Value - * returned is normalized to bit0 (is shifted all the way right) - * - * DESCRIPTION: ACPI BitRegister read function. Does not acquire the HW lock. - * - * SUPPORTS: Bit fields in PM1 Status, PM1 Enable, PM1 Control, and - * PM2 Control. - * - * Note: The hardware lock is not required when reading the ACPI bit registers - * since almost all of them are single bit and it does not matter that - * the parent hardware register can be split across two physical - * registers. The only multi-bit field is SLP_TYP in the PM1 control - * register, but this field does not cross an 8-bit boundary (nor does - * it make much sense to actually read this field.) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiReadBitRegister ( - UINT32 RegisterId, - UINT32 *ReturnValue) -{ - ACPI_BIT_REGISTER_INFO *BitRegInfo; - UINT32 RegisterValue; - UINT32 Value; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE_U32 (AcpiReadBitRegister, RegisterId); - - - /* Get the info structure corresponding to the requested ACPI Register */ - - BitRegInfo = AcpiHwGetBitRegisterInfo (RegisterId); - if (!BitRegInfo) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* Read the entire parent register */ - - Status = AcpiHwRegisterRead (BitRegInfo->ParentRegister, - &RegisterValue); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Normalize the value that was read, mask off other bits */ - - Value = ((RegisterValue & BitRegInfo->AccessBitMask) - >> BitRegInfo->BitPosition); - - ACPI_DEBUG_PRINT ((ACPI_DB_IO, - "BitReg %X, ParentReg %X, Actual %8.8X, ReturnValue %8.8X\n", - RegisterId, BitRegInfo->ParentRegister, RegisterValue, Value)); - - *ReturnValue = Value; - return_ACPI_STATUS (AE_OK); -} - -ACPI_EXPORT_SYMBOL (AcpiReadBitRegister) - - -/******************************************************************************* - * - * FUNCTION: AcpiWriteBitRegister - * - * PARAMETERS: RegisterId - ID of ACPI Bit Register to access - * Value - Value to write to the register, in bit - * position zero. The bit is automatically - * shifted to the correct position. - * - * RETURN: Status - * - * DESCRIPTION: ACPI Bit Register write function. Acquires the hardware lock - * since most operations require a read/modify/write sequence. - * - * SUPPORTS: Bit fields in PM1 Status, PM1 Enable, PM1 Control, and - * PM2 Control. - * - * Note that at this level, the fact that there may be actually two - * hardware registers (A and B - and B may not exist) is abstracted. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiWriteBitRegister ( - UINT32 RegisterId, - UINT32 Value) -{ - ACPI_BIT_REGISTER_INFO *BitRegInfo; - ACPI_CPU_FLAGS LockFlags; - UINT32 RegisterValue; - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE_U32 (AcpiWriteBitRegister, RegisterId); - - - /* Get the info structure corresponding to the requested ACPI Register */ - - BitRegInfo = AcpiHwGetBitRegisterInfo (RegisterId); - if (!BitRegInfo) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - LockFlags = AcpiOsAcquireLock (AcpiGbl_HardwareLock); - - /* - * At this point, we know that the parent register is one of the - * following: PM1 Status, PM1 Enable, PM1 Control, or PM2 Control - */ - if (BitRegInfo->ParentRegister != ACPI_REGISTER_PM1_STATUS) - { - /* - * 1) Case for PM1 Enable, PM1 Control, and PM2 Control - * - * Perform a register read to preserve the bits that we are not - * interested in - */ - Status = AcpiHwRegisterRead (BitRegInfo->ParentRegister, - &RegisterValue); - if (ACPI_FAILURE (Status)) - { - goto UnlockAndExit; - } - - /* - * Insert the input bit into the value that was just read - * and write the register - */ - ACPI_REGISTER_INSERT_VALUE (RegisterValue, BitRegInfo->BitPosition, - BitRegInfo->AccessBitMask, Value); - - Status = AcpiHwRegisterWrite (BitRegInfo->ParentRegister, - RegisterValue); - } - else - { - /* - * 2) Case for PM1 Status - * - * The Status register is different from the rest. Clear an event - * by writing 1, writing 0 has no effect. So, the only relevant - * information is the single bit we're interested in, all others - * should be written as 0 so they will be left unchanged. - */ - RegisterValue = ACPI_REGISTER_PREPARE_BITS (Value, - BitRegInfo->BitPosition, BitRegInfo->AccessBitMask); - - /* No need to write the register if value is all zeros */ - - if (RegisterValue) - { - Status = AcpiHwRegisterWrite (ACPI_REGISTER_PM1_STATUS, - RegisterValue); - } - } - - ACPI_DEBUG_PRINT ((ACPI_DB_IO, - "BitReg %X, ParentReg %X, Value %8.8X, Actual %8.8X\n", - RegisterId, BitRegInfo->ParentRegister, Value, RegisterValue)); - - -UnlockAndExit: - - AcpiOsReleaseLock (AcpiGbl_HardwareLock, LockFlags); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiWriteBitRegister) - -#endif /* !ACPI_REDUCED_HARDWARE */ - - -/******************************************************************************* - * - * FUNCTION: AcpiGetSleepTypeData - * - * PARAMETERS: SleepState - Numeric sleep state - * *SleepTypeA - Where SLP_TYPa is returned - * *SleepTypeB - Where SLP_TYPb is returned - * - * RETURN: Status - * - * DESCRIPTION: Obtain the SLP_TYPa and SLP_TYPb values for the requested - * sleep state via the appropriate \_Sx object. - * - * The sleep state package returned from the corresponding \_Sx_ object - * must contain at least one integer. - * - * March 2005: - * Added support for a package that contains two integers. This - * goes against the ACPI specification which defines this object as a - * package with one encoded DWORD integer. However, existing practice - * by many BIOS vendors is to return a package with 2 or more integer - * elements, at least one per sleep type (A/B). - * - * January 2013: - * Therefore, we must be prepared to accept a package with either a - * single integer or multiple integers. - * - * The single integer DWORD format is as follows: - * BYTE 0 - Value for the PM1A SLP_TYP register - * BYTE 1 - Value for the PM1B SLP_TYP register - * BYTE 2-3 - Reserved - * - * The dual integer format is as follows: - * Integer 0 - Value for the PM1A SLP_TYP register - * Integer 1 - Value for the PM1A SLP_TYP register - * - ******************************************************************************/ - -ACPI_STATUS -AcpiGetSleepTypeData ( - UINT8 SleepState, - UINT8 *SleepTypeA, - UINT8 *SleepTypeB) -{ - ACPI_STATUS Status; - ACPI_EVALUATE_INFO *Info; - ACPI_OPERAND_OBJECT **Elements; - - - ACPI_FUNCTION_TRACE (AcpiGetSleepTypeData); - - - /* Validate parameters */ - - if ((SleepState > ACPI_S_STATES_MAX) || - !SleepTypeA || !SleepTypeB) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* Allocate the evaluation information block */ - - Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO)); - if (!Info) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* - * Evaluate the \_Sx namespace object containing the register values - * for this state - */ - Info->RelativePathname = AcpiGbl_SleepStateNames[SleepState]; - - Status = AcpiNsEvaluate (Info); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_NOT_FOUND) - { - /* The _Sx states are optional, ignore NOT_FOUND */ - - goto FinalCleanup; - } - - goto WarningCleanup; - } - - /* Must have a return object */ - - if (!Info->ReturnObject) - { - ACPI_ERROR ((AE_INFO, "No Sleep State object returned from [%s]", - Info->RelativePathname)); - Status = AE_AML_NO_RETURN_VALUE; - goto WarningCleanup; - } - - /* Return object must be of type Package */ - - if (Info->ReturnObject->Common.Type != ACPI_TYPE_PACKAGE) - { - ACPI_ERROR ((AE_INFO, "Sleep State return object is not a Package")); - Status = AE_AML_OPERAND_TYPE; - goto ReturnValueCleanup; - } - - /* - * Any warnings about the package length or the object types have - * already been issued by the predefined name module -- there is no - * need to repeat them here. - */ - Elements = Info->ReturnObject->Package.Elements; - switch (Info->ReturnObject->Package.Count) - { - case 0: - - Status = AE_AML_PACKAGE_LIMIT; - break; - - case 1: - - if (Elements[0]->Common.Type != ACPI_TYPE_INTEGER) - { - Status = AE_AML_OPERAND_TYPE; - break; - } - - /* A valid _Sx_ package with one integer */ - - *SleepTypeA = (UINT8) Elements[0]->Integer.Value; - *SleepTypeB = (UINT8) (Elements[0]->Integer.Value >> 8); - break; - - case 2: - default: - - if ((Elements[0]->Common.Type != ACPI_TYPE_INTEGER) || - (Elements[1]->Common.Type != ACPI_TYPE_INTEGER)) - { - Status = AE_AML_OPERAND_TYPE; - break; - } - - /* A valid _Sx_ package with two integers */ - - *SleepTypeA = (UINT8) Elements[0]->Integer.Value; - *SleepTypeB = (UINT8) Elements[1]->Integer.Value; - break; - } - -ReturnValueCleanup: - AcpiUtRemoveReference (Info->ReturnObject); - -WarningCleanup: - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "While evaluating Sleep State [%s]", - Info->RelativePathname)); - } - -FinalCleanup: - ACPI_FREE (Info); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiGetSleepTypeData) diff --git a/drivers/acpica/hwxfsleep.c b/drivers/acpica/hwxfsleep.c deleted file mode 100644 index eefc239..0000000 --- a/drivers/acpica/hwxfsleep.c +++ /dev/null @@ -1,623 +0,0 @@ -/****************************************************************************** - * - * Name: hwxfsleep.c - ACPI Hardware Sleep/Wake External Interfaces - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#define EXPORT_ACPI_INTERFACES - -#include "acpi.h" -#include "accommon.h" - -#define _COMPONENT ACPI_HARDWARE - ACPI_MODULE_NAME ("hwxfsleep") - -/* Local prototypes */ - -static ACPI_STATUS -AcpiHwSetFirmwareWakingVector ( - ACPI_TABLE_FACS *Facs, - ACPI_PHYSICAL_ADDRESS PhysicalAddress, - ACPI_PHYSICAL_ADDRESS PhysicalAddress64); - -static ACPI_STATUS -AcpiHwSleepDispatch ( - UINT8 SleepState, - UINT32 FunctionId); - -/* - * Dispatch table used to efficiently branch to the various sleep - * functions. - */ -#define ACPI_SLEEP_FUNCTION_ID 0 -#define ACPI_WAKE_PREP_FUNCTION_ID 1 -#define ACPI_WAKE_FUNCTION_ID 2 - -/* Legacy functions are optional, based upon ACPI_REDUCED_HARDWARE */ - -static ACPI_SLEEP_FUNCTIONS AcpiSleepDispatch[] = -{ - {ACPI_STRUCT_INIT (LegacyFunction, - ACPI_HW_OPTIONAL_FUNCTION (AcpiHwLegacySleep)), - ACPI_STRUCT_INIT (ExtendedFunction, - AcpiHwExtendedSleep) }, - {ACPI_STRUCT_INIT (LegacyFunction, - ACPI_HW_OPTIONAL_FUNCTION (AcpiHwLegacyWakePrep)), - ACPI_STRUCT_INIT (ExtendedFunction, - AcpiHwExtendedWakePrep) }, - {ACPI_STRUCT_INIT (LegacyFunction, - ACPI_HW_OPTIONAL_FUNCTION (AcpiHwLegacyWake)), - ACPI_STRUCT_INIT (ExtendedFunction, - AcpiHwExtendedWake) } -}; - - -/******************************************************************************* - * - * FUNCTION: AcpiHwSetFirmwareWakingVector - * - * PARAMETERS: Facs - Pointer to FACS table - * PhysicalAddress - 32-bit physical address of ACPI real mode - * entry point - * PhysicalAddress64 - 64-bit physical address of ACPI protected - * mode entry point - * - * RETURN: Status - * - * DESCRIPTION: Sets the FirmwareWakingVector fields of the FACS - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiHwSetFirmwareWakingVector ( - ACPI_TABLE_FACS *Facs, - ACPI_PHYSICAL_ADDRESS PhysicalAddress, - ACPI_PHYSICAL_ADDRESS PhysicalAddress64) -{ - ACPI_FUNCTION_TRACE (AcpiHwSetFirmwareWakingVector); - - - /* - * According to the ACPI specification 2.0c and later, the 64-bit - * waking vector should be cleared and the 32-bit waking vector should - * be used, unless we want the wake-up code to be called by the BIOS in - * Protected Mode. Some systems (for example HP dv5-1004nr) are known - * to fail to resume if the 64-bit vector is used. - */ - - /* Set the 32-bit vector */ - - Facs->FirmwareWakingVector = (UINT32) PhysicalAddress; - - if (Facs->Length > 32) - { - if (Facs->Version >= 1) - { - /* Set the 64-bit vector */ - - Facs->XFirmwareWakingVector = PhysicalAddress64; - } - else - { - /* Clear the 64-bit vector if it exists */ - - Facs->XFirmwareWakingVector = 0; - } - } - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiSetFirmwareWakingVector - * - * PARAMETERS: PhysicalAddress - 32-bit physical address of ACPI real mode - * entry point - * PhysicalAddress64 - 64-bit physical address of ACPI protected - * mode entry point - * - * RETURN: Status - * - * DESCRIPTION: Sets the FirmwareWakingVector fields of the FACS - * - ******************************************************************************/ - -ACPI_STATUS -AcpiSetFirmwareWakingVector ( - ACPI_PHYSICAL_ADDRESS PhysicalAddress, - ACPI_PHYSICAL_ADDRESS PhysicalAddress64) -{ - - ACPI_FUNCTION_TRACE (AcpiSetFirmwareWakingVector); - - if (AcpiGbl_FACS) - { - (void) AcpiHwSetFirmwareWakingVector (AcpiGbl_FACS, - PhysicalAddress, PhysicalAddress64); - } - - return_ACPI_STATUS (AE_OK); -} - -ACPI_EXPORT_SYMBOL (AcpiSetFirmwareWakingVector) - - -/* - * These functions are removed for the ACPI_REDUCED_HARDWARE case: - * AcpiEnterSleepStateS4bios - */ - -#if (!ACPI_REDUCED_HARDWARE) -/******************************************************************************* - * - * FUNCTION: AcpiEnterSleepStateS4bios - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Perform a S4 bios request. - * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEnterSleepStateS4bios ( - void) -{ - UINT32 InValue; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiEnterSleepStateS4bios); - - - /* Clear the wake status bit (PM1) */ - - Status = AcpiWriteBitRegister (ACPI_BITREG_WAKE_STATUS, ACPI_CLEAR_STATUS); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Status = AcpiHwClearAcpiStatus (); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* - * 1) Disable all GPEs - * 2) Enable all wakeup GPEs - */ - Status = AcpiHwDisableAllGpes (); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - AcpiGbl_SystemAwakeAndRunning = FALSE; - - Status = AcpiHwEnableAllWakeupGpes (); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Status = AcpiHwWritePort (AcpiGbl_FADT.SmiCommand, - (UINT32) AcpiGbl_FADT.S4BiosRequest, 8); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - do { - AcpiOsStall (ACPI_USEC_PER_MSEC); - Status = AcpiReadBitRegister (ACPI_BITREG_WAKE_STATUS, &InValue); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - } while (!InValue); - - return_ACPI_STATUS (AE_OK); -} - -ACPI_EXPORT_SYMBOL (AcpiEnterSleepStateS4bios) - -#endif /* !ACPI_REDUCED_HARDWARE */ - - -/******************************************************************************* - * - * FUNCTION: AcpiHwSleepDispatch - * - * PARAMETERS: SleepState - Which sleep state to enter/exit - * FunctionId - Sleep, WakePrep, or Wake - * - * RETURN: Status from the invoked sleep handling function. - * - * DESCRIPTION: Dispatch a sleep/wake request to the appropriate handling - * function. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiHwSleepDispatch ( - UINT8 SleepState, - UINT32 FunctionId) -{ - ACPI_STATUS Status; - ACPI_SLEEP_FUNCTIONS *SleepFunctions = &AcpiSleepDispatch[FunctionId]; - - -#if (!ACPI_REDUCED_HARDWARE) - /* - * If the Hardware Reduced flag is set (from the FADT), we must - * use the extended sleep registers (FADT). Note: As per the ACPI - * specification, these extended registers are to be used for HW-reduced - * platforms only. They are not general-purpose replacements for the - * legacy PM register sleep support. - */ - if (AcpiGbl_ReducedHardware) - { - Status = SleepFunctions->ExtendedFunction (SleepState); - } - else - { - /* Legacy sleep */ - - Status = SleepFunctions->LegacyFunction (SleepState); - } - - return (Status); - -#else - /* - * For the case where reduced-hardware-only code is being generated, - * we know that only the extended sleep registers are available - */ - Status = SleepFunctions->ExtendedFunction (SleepState); - return (Status); - -#endif /* !ACPI_REDUCED_HARDWARE */ -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEnterSleepStatePrep - * - * PARAMETERS: SleepState - Which sleep state to enter - * - * RETURN: Status - * - * DESCRIPTION: Prepare to enter a system sleep state. - * This function must execute with interrupts enabled. - * We break sleeping into 2 stages so that OSPM can handle - * various OS-specific tasks between the two steps. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEnterSleepStatePrep ( - UINT8 SleepState) -{ - ACPI_STATUS Status; - ACPI_OBJECT_LIST ArgList; - ACPI_OBJECT Arg; - UINT32 SstValue; - - - ACPI_FUNCTION_TRACE (AcpiEnterSleepStatePrep); - - - Status = AcpiGetSleepTypeData (SleepState, - &AcpiGbl_SleepTypeA, &AcpiGbl_SleepTypeB); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Status = AcpiGetSleepTypeData (ACPI_STATE_S0, - &AcpiGbl_SleepTypeAS0, &AcpiGbl_SleepTypeBS0); - if (ACPI_FAILURE (Status)) { - AcpiGbl_SleepTypeAS0 = ACPI_SLEEP_TYPE_INVALID; - } - - /* Execute the _PTS method (Prepare To Sleep) */ - - ArgList.Count = 1; - ArgList.Pointer = &Arg; - Arg.Type = ACPI_TYPE_INTEGER; - Arg.Integer.Value = SleepState; - - Status = AcpiEvaluateObject (NULL, METHOD_PATHNAME__PTS, &ArgList, NULL); - if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND) - { - return_ACPI_STATUS (Status); - } - - /* Setup the argument to the _SST method (System STatus) */ - - switch (SleepState) - { - case ACPI_STATE_S0: - - SstValue = ACPI_SST_WORKING; - break; - - case ACPI_STATE_S1: - case ACPI_STATE_S2: - case ACPI_STATE_S3: - - SstValue = ACPI_SST_SLEEPING; - break; - - case ACPI_STATE_S4: - - SstValue = ACPI_SST_SLEEP_CONTEXT; - break; - - default: - - SstValue = ACPI_SST_INDICATOR_OFF; /* Default is off */ - break; - } - - /* - * Set the system indicators to show the desired sleep state. - * _SST is an optional method (return no error if not found) - */ - AcpiHwExecuteSleepMethod (METHOD_PATHNAME__SST, SstValue); - return_ACPI_STATUS (AE_OK); -} - -ACPI_EXPORT_SYMBOL (AcpiEnterSleepStatePrep) - - -/******************************************************************************* - * - * FUNCTION: AcpiEnterSleepState - * - * PARAMETERS: SleepState - Which sleep state to enter - * - * RETURN: Status - * - * DESCRIPTION: Enter a system sleep state - * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEnterSleepState ( - UINT8 SleepState) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiEnterSleepState); - - - if ((AcpiGbl_SleepTypeA > ACPI_SLEEP_TYPE_MAX) || - (AcpiGbl_SleepTypeB > ACPI_SLEEP_TYPE_MAX)) - { - ACPI_ERROR ((AE_INFO, "Sleep values out of range: A=0x%X B=0x%X", - AcpiGbl_SleepTypeA, AcpiGbl_SleepTypeB)); - return_ACPI_STATUS (AE_AML_OPERAND_VALUE); - } - - Status = AcpiHwSleepDispatch (SleepState, ACPI_SLEEP_FUNCTION_ID); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiEnterSleepState) - - -/******************************************************************************* - * - * FUNCTION: AcpiLeaveSleepStatePrep - * - * PARAMETERS: SleepState - Which sleep state we are exiting - * - * RETURN: Status - * - * DESCRIPTION: Perform the first state of OS-independent ACPI cleanup after a - * sleep. Called with interrupts DISABLED. - * We break wake/resume into 2 stages so that OSPM can handle - * various OS-specific tasks between the two steps. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiLeaveSleepStatePrep ( - UINT8 SleepState) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiLeaveSleepStatePrep); - - - Status = AcpiHwSleepDispatch (SleepState, ACPI_WAKE_PREP_FUNCTION_ID); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiLeaveSleepStatePrep) - - -/******************************************************************************* - * - * FUNCTION: AcpiLeaveSleepState - * - * PARAMETERS: SleepState - Which sleep state we are exiting - * - * RETURN: Status - * - * DESCRIPTION: Perform OS-independent ACPI cleanup after a sleep - * Called with interrupts ENABLED. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiLeaveSleepState ( - UINT8 SleepState) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiLeaveSleepState); - - - Status = AcpiHwSleepDispatch (SleepState, ACPI_WAKE_FUNCTION_ID); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiLeaveSleepState) diff --git a/drivers/acpica/nsaccess.c b/drivers/acpica/nsaccess.c deleted file mode 100644 index 5f044e1..0000000 --- a/drivers/acpica/nsaccess.c +++ /dev/null @@ -1,919 +0,0 @@ -/******************************************************************************* - * - * Module Name: nsaccess - Top-level functions for accessing ACPI namespace - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "amlcode.h" -#include "acnamesp.h" -#include "acdispat.h" - -#ifdef ACPI_ASL_COMPILER - #include "acdisasm.h" -#endif - -#define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nsaccess") - - -/******************************************************************************* - * - * FUNCTION: AcpiNsRootInitialize - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Allocate and initialize the default root named objects - * - * MUTEX: Locks namespace for entire execution - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsRootInitialize ( - void) -{ - ACPI_STATUS Status; - const ACPI_PREDEFINED_NAMES *InitVal = NULL; - ACPI_NAMESPACE_NODE *NewNode; - ACPI_NAMESPACE_NODE *PrevNode = NULL; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_STRING Val = NULL; - - - ACPI_FUNCTION_TRACE (NsRootInitialize); - - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* - * The global root ptr is initially NULL, so a non-NULL value indicates - * that AcpiNsRootInitialize() has already been called; just return. - */ - if (AcpiGbl_RootNode) - { - Status = AE_OK; - goto UnlockAndExit; - } - - /* - * Tell the rest of the subsystem that the root is initialized - * (This is OK because the namespace is locked) - */ - AcpiGbl_RootNode = &AcpiGbl_RootNodeStruct; - - /* Enter the predefined names in the name table */ - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Entering predefined entries into namespace\n")); - - /* - * Create the initial (default) namespace. - * This namespace looks like something similar to this: - * - * ACPI Namespace (from Namespace Root): - * 0 _GPE Scope 00203160 00 - * 0 _PR_ Scope 002031D0 00 - * 0 _SB_ Device 00203240 00 Notify Object: 0020ADD8 - * 0 _SI_ Scope 002032B0 00 - * 0 _TZ_ Device 00203320 00 - * 0 _REV Integer 00203390 00 = 0000000000000002 - * 0 _OS_ String 00203488 00 Len 14 "Microsoft Windows NT" - * 0 _GL_ Mutex 00203580 00 Object 002035F0 - * 0 _OSI Method 00203678 00 Args 1 Len 0000 Aml 00000000 - */ - for (InitVal = AcpiGbl_PreDefinedNames; InitVal->Name; InitVal++) - { - Status = AE_OK; - - /* _OSI is optional for now, will be permanent later */ - - if (!strcmp (InitVal->Name, "_OSI") && !AcpiGbl_CreateOsiMethod) - { - continue; - } - - /* - * Create, init, and link the new predefined name - * Note: No need to use AcpiNsLookup here because all the - * predefined names are at the root level. It is much easier to - * just create and link the new node(s) here. - */ - NewNode = AcpiNsCreateNode (*ACPI_CAST_PTR (UINT32, InitVal->Name)); - if (!NewNode) - { - Status = AE_NO_MEMORY; - goto UnlockAndExit; - } - - NewNode->DescriptorType = ACPI_DESC_TYPE_NAMED; - NewNode->Type = InitVal->Type; - - if (!PrevNode) - { - AcpiGbl_RootNodeStruct.Child = NewNode; - } - else - { - PrevNode->Peer = NewNode; - } - - NewNode->Parent = &AcpiGbl_RootNodeStruct; - PrevNode = NewNode; - - /* - * Name entered successfully. If entry in PreDefinedNames[] specifies - * an initial value, create the initial value. - */ - if (InitVal->Val) - { - Status = AcpiOsPredefinedOverride (InitVal, &Val); - if (ACPI_FAILURE (Status)) - { - ACPI_ERROR ((AE_INFO, - "Could not override predefined %s", - InitVal->Name)); - } - - if (!Val) - { - Val = InitVal->Val; - } - - /* - * Entry requests an initial value, allocate a - * descriptor for it. - */ - ObjDesc = AcpiUtCreateInternalObject (InitVal->Type); - if (!ObjDesc) - { - Status = AE_NO_MEMORY; - goto UnlockAndExit; - } - - /* - * Convert value string from table entry to - * internal representation. Only types actually - * used for initial values are implemented here. - */ - switch (InitVal->Type) - { - case ACPI_TYPE_METHOD: - - ObjDesc->Method.ParamCount = (UINT8) ACPI_TO_INTEGER (Val); - ObjDesc->Common.Flags |= AOPOBJ_DATA_VALID; - -#if defined (ACPI_ASL_COMPILER) - - /* Save the parameter count for the iASL compiler */ - - NewNode->Value = ObjDesc->Method.ParamCount; -#else - /* Mark this as a very SPECIAL method (_OSI) */ - - ObjDesc->Method.InfoFlags = ACPI_METHOD_INTERNAL_ONLY; - ObjDesc->Method.Dispatch.Implementation = AcpiUtOsiImplementation; -#endif - break; - - case ACPI_TYPE_INTEGER: - - ObjDesc->Integer.Value = ACPI_TO_INTEGER (Val); - break; - - case ACPI_TYPE_STRING: - - /* Build an object around the static string */ - - ObjDesc->String.Length = (UINT32) strlen (Val); - ObjDesc->String.Pointer = Val; - ObjDesc->Common.Flags |= AOPOBJ_STATIC_POINTER; - break; - - case ACPI_TYPE_MUTEX: - - ObjDesc->Mutex.Node = NewNode; - ObjDesc->Mutex.SyncLevel = (UINT8) (ACPI_TO_INTEGER (Val) - 1); - - /* Create a mutex */ - - Status = AcpiOsCreateMutex (&ObjDesc->Mutex.OsMutex); - if (ACPI_FAILURE (Status)) - { - AcpiUtRemoveReference (ObjDesc); - goto UnlockAndExit; - } - - /* Special case for ACPI Global Lock */ - - if (strcmp (InitVal->Name, "_GL_") == 0) - { - AcpiGbl_GlobalLockMutex = ObjDesc; - - /* Create additional counting semaphore for global lock */ - - Status = AcpiOsCreateSemaphore ( - 1, 0, &AcpiGbl_GlobalLockSemaphore); - if (ACPI_FAILURE (Status)) - { - AcpiUtRemoveReference (ObjDesc); - goto UnlockAndExit; - } - } - break; - - default: - - ACPI_ERROR ((AE_INFO, "Unsupported initial type value 0x%X", - InitVal->Type)); - AcpiUtRemoveReference (ObjDesc); - ObjDesc = NULL; - continue; - } - - /* Store pointer to value descriptor in the Node */ - - Status = AcpiNsAttachObject (NewNode, ObjDesc, - ObjDesc->Common.Type); - - /* Remove local reference to the object */ - - AcpiUtRemoveReference (ObjDesc); - } - } - -UnlockAndExit: - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - - /* Save a handle to "_GPE", it is always present */ - - if (ACPI_SUCCESS (Status)) - { - Status = AcpiNsGetNode (NULL, "\\_GPE", ACPI_NS_NO_UPSEARCH, - &AcpiGbl_FadtGpeDevice); - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsLookup - * - * PARAMETERS: ScopeInfo - Current scope info block - * Pathname - Search pathname, in internal format - * (as represented in the AML stream) - * Type - Type associated with name - * InterpreterMode - IMODE_LOAD_PASS2 => add name if not found - * Flags - Flags describing the search restrictions - * WalkState - Current state of the walk - * ReturnNode - Where the Node is placed (if found - * or created successfully) - * - * RETURN: Status - * - * DESCRIPTION: Find or enter the passed name in the name space. - * Log an error if name not found in Exec mode. - * - * MUTEX: Assumes namespace is locked. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsLookup ( - ACPI_GENERIC_STATE *ScopeInfo, - char *Pathname, - ACPI_OBJECT_TYPE Type, - ACPI_INTERPRETER_MODE InterpreterMode, - UINT32 Flags, - ACPI_WALK_STATE *WalkState, - ACPI_NAMESPACE_NODE **ReturnNode) -{ - ACPI_STATUS Status; - char *Path = Pathname; - char *ExternalPath; - ACPI_NAMESPACE_NODE *PrefixNode; - ACPI_NAMESPACE_NODE *CurrentNode = NULL; - ACPI_NAMESPACE_NODE *ThisNode = NULL; - UINT32 NumSegments; - UINT32 NumCarats; - ACPI_NAME SimpleName; - ACPI_OBJECT_TYPE TypeToCheckFor; - ACPI_OBJECT_TYPE ThisSearchType; - UINT32 SearchParentFlag = ACPI_NS_SEARCH_PARENT; - UINT32 LocalFlags; - ACPI_INTERPRETER_MODE LocalInterpreterMode; - - - ACPI_FUNCTION_TRACE (NsLookup); - - - if (!ReturnNode) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - LocalFlags = Flags & - ~(ACPI_NS_ERROR_IF_FOUND | ACPI_NS_OVERRIDE_IF_FOUND | - ACPI_NS_SEARCH_PARENT); - *ReturnNode = ACPI_ENTRY_NOT_FOUND; - AcpiGbl_NsLookupCount++; - - if (!AcpiGbl_RootNode) - { - return_ACPI_STATUS (AE_NO_NAMESPACE); - } - - /* Get the prefix scope. A null scope means use the root scope */ - - if ((!ScopeInfo) || - (!ScopeInfo->Scope.Node)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Null scope prefix, using root node (%p)\n", - AcpiGbl_RootNode)); - - PrefixNode = AcpiGbl_RootNode; - } - else - { - PrefixNode = ScopeInfo->Scope.Node; - if (ACPI_GET_DESCRIPTOR_TYPE (PrefixNode) != ACPI_DESC_TYPE_NAMED) - { - ACPI_ERROR ((AE_INFO, "%p is not a namespace node [%s]", - PrefixNode, AcpiUtGetDescriptorName (PrefixNode))); - return_ACPI_STATUS (AE_AML_INTERNAL); - } - - if (!(Flags & ACPI_NS_PREFIX_IS_SCOPE)) - { - /* - * This node might not be a actual "scope" node (such as a - * Device/Method, etc.) It could be a Package or other object - * node. Backup up the tree to find the containing scope node. - */ - while (!AcpiNsOpensScope (PrefixNode->Type) && - PrefixNode->Type != ACPI_TYPE_ANY) - { - PrefixNode = PrefixNode->Parent; - } - } - } - - /* Save type. TBD: may be no longer necessary */ - - TypeToCheckFor = Type; - - /* - * Begin examination of the actual pathname - */ - if (!Pathname) - { - /* A Null NamePath is allowed and refers to the root */ - - NumSegments = 0; - ThisNode = AcpiGbl_RootNode; - Path = ""; - - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Null Pathname (Zero segments), Flags=%X\n", Flags)); - } - else - { - /* - * Name pointer is valid (and must be in internal name format) - * - * Check for scope prefixes: - * - * As represented in the AML stream, a namepath consists of an - * optional scope prefix followed by a name segment part. - * - * If present, the scope prefix is either a Root Prefix (in - * which case the name is fully qualified), or one or more - * Parent Prefixes (in which case the name's scope is relative - * to the current scope). - */ - if (*Path == (UINT8) AML_ROOT_PREFIX) - { - /* Pathname is fully qualified, start from the root */ - - ThisNode = AcpiGbl_RootNode; - SearchParentFlag = ACPI_NS_NO_UPSEARCH; - - /* Point to name segment part */ - - Path++; - - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Path is absolute from root [%p]\n", ThisNode)); - } - else - { - /* Pathname is relative to current scope, start there */ - - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Searching relative to prefix scope [%4.4s] (%p)\n", - AcpiUtGetNodeName (PrefixNode), PrefixNode)); - - /* - * Handle multiple Parent Prefixes (carat) by just getting - * the parent node for each prefix instance. - */ - ThisNode = PrefixNode; - NumCarats = 0; - while (*Path == (UINT8) AML_PARENT_PREFIX) - { - /* Name is fully qualified, no search rules apply */ - - SearchParentFlag = ACPI_NS_NO_UPSEARCH; - - /* - * Point past this prefix to the name segment - * part or the next Parent Prefix - */ - Path++; - - /* Backup to the parent node */ - - NumCarats++; - ThisNode = ThisNode->Parent; - if (!ThisNode) - { - /* - * Current scope has no parent scope. Externalize - * the internal path for error message. - */ - Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, Pathname, - NULL, &ExternalPath); - if (ACPI_SUCCESS (Status)) - { - ACPI_ERROR ((AE_INFO, - "%s: Path has too many parent prefixes (^)", - ExternalPath)); - - ACPI_FREE (ExternalPath); - } - - return_ACPI_STATUS (AE_NOT_FOUND); - } - } - - if (SearchParentFlag == ACPI_NS_NO_UPSEARCH) - { - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Search scope is [%4.4s], path has %u carat(s)\n", - AcpiUtGetNodeName (ThisNode), NumCarats)); - } - } - - /* - * Determine the number of ACPI name segments in this pathname. - * - * The segment part consists of either: - * - A Null name segment (0) - * - A DualNamePrefix followed by two 4-byte name segments - * - A MultiNamePrefix followed by a byte indicating the - * number of segments and the segments themselves. - * - A single 4-byte name segment - * - * Examine the name prefix opcode, if any, to determine the number of - * segments. - */ - switch (*Path) - { - case 0: - /* - * Null name after a root or parent prefixes. We already - * have the correct target node and there are no name segments. - */ - NumSegments = 0; - Type = ThisNode->Type; - - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Prefix-only Pathname (Zero name segments), Flags=%X\n", - Flags)); - break; - - case AML_DUAL_NAME_PREFIX: - - /* More than one NameSeg, search rules do not apply */ - - SearchParentFlag = ACPI_NS_NO_UPSEARCH; - - /* Two segments, point to first name segment */ - - NumSegments = 2; - Path++; - - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Dual Pathname (2 segments, Flags=%X)\n", Flags)); - break; - - case AML_MULTI_NAME_PREFIX: - - /* More than one NameSeg, search rules do not apply */ - - SearchParentFlag = ACPI_NS_NO_UPSEARCH; - - /* Extract segment count, point to first name segment */ - - Path++; - NumSegments = (UINT32) (UINT8) *Path; - Path++; - - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Multi Pathname (%u Segments, Flags=%X)\n", - NumSegments, Flags)); - break; - - default: - /* - * Not a Null name, no Dual or Multi prefix, hence there is - * only one name segment and Pathname is already pointing to it. - */ - NumSegments = 1; - - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Simple Pathname (1 segment, Flags=%X)\n", Flags)); - break; - } - - ACPI_DEBUG_EXEC (AcpiNsPrintPathname (NumSegments, Path)); - } - - - /* - * Search namespace for each segment of the name. Loop through and - * verify (or add to the namespace) each name segment. - * - * The object type is significant only at the last name - * segment. (We don't care about the types along the path, only - * the type of the final target object.) - */ - ThisSearchType = ACPI_TYPE_ANY; - CurrentNode = ThisNode; - - while (NumSegments && CurrentNode) - { - NumSegments--; - if (!NumSegments) - { - /* This is the last segment, enable typechecking */ - - ThisSearchType = Type; - - /* - * Only allow automatic parent search (search rules) if the caller - * requested it AND we have a single, non-fully-qualified NameSeg - */ - if ((SearchParentFlag != ACPI_NS_NO_UPSEARCH) && - (Flags & ACPI_NS_SEARCH_PARENT)) - { - LocalFlags |= ACPI_NS_SEARCH_PARENT; - } - - /* Set error flag according to caller */ - - if (Flags & ACPI_NS_ERROR_IF_FOUND) - { - LocalFlags |= ACPI_NS_ERROR_IF_FOUND; - } - - /* Set override flag according to caller */ - - if (Flags & ACPI_NS_OVERRIDE_IF_FOUND) - { - LocalFlags |= ACPI_NS_OVERRIDE_IF_FOUND; - } - } - - /* Handle opcodes that create a new NameSeg via a full NamePath */ - - LocalInterpreterMode = InterpreterMode; - if ((Flags & ACPI_NS_PREFIX_MUST_EXIST) && (NumSegments > 0)) - { - /* Every element of the path must exist (except for the final NameSeg) */ - - LocalInterpreterMode = ACPI_IMODE_EXECUTE; - } - - /* Extract one ACPI name from the front of the pathname */ - - ACPI_MOVE_32_TO_32 (&SimpleName, Path); - - /* Try to find the single (4 character) ACPI name */ - - Status = AcpiNsSearchAndEnter (SimpleName, WalkState, CurrentNode, - LocalInterpreterMode, ThisSearchType, LocalFlags, &ThisNode); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_NOT_FOUND) - { -#if !defined ACPI_ASL_COMPILER /* Note: iASL reports this error by itself, not needed here */ - if (Flags & ACPI_NS_PREFIX_MUST_EXIST) - { - AcpiOsPrintf (ACPI_MSG_BIOS_ERROR - "Object does not exist: %4.4s\n", (char *) &SimpleName); - } -#endif - /* Name not found in ACPI namespace */ - - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Name [%4.4s] not found in scope [%4.4s] %p\n", - (char *) &SimpleName, (char *) &CurrentNode->Name, - CurrentNode)); - } - -#ifdef ACPI_EXEC_APP - if ((Status == AE_ALREADY_EXISTS) && - (ThisNode->Flags & ANOBJ_NODE_EARLY_INIT)) - { - ThisNode->Flags &= ~ANOBJ_NODE_EARLY_INIT; - Status = AE_OK; - } -#endif - -#ifdef ACPI_ASL_COMPILER - /* - * If this ACPI name already exists within the namespace as an - * external declaration, then mark the external as a conflicting - * declaration and proceed to process the current node as if it did - * not exist in the namespace. If this node is not processed as - * normal, then it could cause improper namespace resolution - * by failing to open a new scope. - */ - if (AcpiGbl_DisasmFlag && - (Status == AE_ALREADY_EXISTS) && - ((ThisNode->Flags & ANOBJ_IS_EXTERNAL) || - (WalkState && WalkState->Opcode == AML_EXTERNAL_OP))) - { - ThisNode->Flags &= ~ANOBJ_IS_EXTERNAL; - ThisNode->Type = (UINT8)ThisSearchType; - if (WalkState->Opcode != AML_EXTERNAL_OP) - { - AcpiDmMarkExternalConflict (ThisNode); - } - break; - } -#endif - - *ReturnNode = ThisNode; - return_ACPI_STATUS (Status); - } - - /* More segments to follow? */ - - if (NumSegments > 0) - { - /* - * If we have an alias to an object that opens a scope (such as a - * device or processor), we need to dereference the alias here so - * that we can access any children of the original node (via the - * remaining segments). - */ - if (ThisNode->Type == ACPI_TYPE_LOCAL_ALIAS) - { - if (!ThisNode->Object) - { - return_ACPI_STATUS (AE_NOT_EXIST); - } - - if (AcpiNsOpensScope (((ACPI_NAMESPACE_NODE *) - ThisNode->Object)->Type)) - { - ThisNode = (ACPI_NAMESPACE_NODE *) ThisNode->Object; - } - } - } - - /* Special handling for the last segment (NumSegments == 0) */ - - else - { - /* - * Sanity typecheck of the target object: - * - * If 1) This is the last segment (NumSegments == 0) - * 2) And we are looking for a specific type - * (Not checking for TYPE_ANY) - * 3) Which is not an alias - * 4) Which is not a local type (TYPE_SCOPE) - * 5) And the type of target object is known (not TYPE_ANY) - * 6) And target object does not match what we are looking for - * - * Then we have a type mismatch. Just warn and ignore it. - */ - if ((TypeToCheckFor != ACPI_TYPE_ANY) && - (TypeToCheckFor != ACPI_TYPE_LOCAL_ALIAS) && - (TypeToCheckFor != ACPI_TYPE_LOCAL_METHOD_ALIAS) && - (TypeToCheckFor != ACPI_TYPE_LOCAL_SCOPE) && - (ThisNode->Type != ACPI_TYPE_ANY) && - (ThisNode->Type != TypeToCheckFor)) - { - /* Complain about a type mismatch */ - - ACPI_WARNING ((AE_INFO, - "NsLookup: Type mismatch on %4.4s (%s), searching for (%s)", - ACPI_CAST_PTR (char, &SimpleName), - AcpiUtGetTypeName (ThisNode->Type), - AcpiUtGetTypeName (TypeToCheckFor))); - } - - /* - * If this is the last name segment and we are not looking for a - * specific type, but the type of found object is known, use that - * type to (later) see if it opens a scope. - */ - if (Type == ACPI_TYPE_ANY) - { - Type = ThisNode->Type; - } - } - - /* Point to next name segment and make this node current */ - - Path += ACPI_NAMESEG_SIZE; - CurrentNode = ThisNode; - } - - /* Always check if we need to open a new scope */ - - if (!(Flags & ACPI_NS_DONT_OPEN_SCOPE) && (WalkState)) - { - /* - * If entry is a type which opens a scope, push the new scope on the - * scope stack. - */ - if (AcpiNsOpensScope (Type)) - { - Status = AcpiDsScopeStackPush (ThisNode, Type, WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - } - -#ifdef ACPI_EXEC_APP - if (Flags & ACPI_NS_EARLY_INIT) - { - ThisNode->Flags |= ANOBJ_NODE_EARLY_INIT; - } -#endif - - *ReturnNode = ThisNode; - return_ACPI_STATUS (AE_OK); -} diff --git a/drivers/acpica/nsalloc.c b/drivers/acpica/nsalloc.c deleted file mode 100644 index d4ff32d..0000000 --- a/drivers/acpica/nsalloc.c +++ /dev/null @@ -1,708 +0,0 @@ -/******************************************************************************* - * - * Module Name: nsalloc - Namespace allocation and deletion utilities - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" - - -#define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nsalloc") - - -/******************************************************************************* - * - * FUNCTION: AcpiNsCreateNode - * - * PARAMETERS: Name - Name of the new node (4 char ACPI name) - * - * RETURN: New namespace node (Null on failure) - * - * DESCRIPTION: Create a namespace node - * - ******************************************************************************/ - -ACPI_NAMESPACE_NODE * -AcpiNsCreateNode ( - UINT32 Name) -{ - ACPI_NAMESPACE_NODE *Node; -#ifdef ACPI_DBG_TRACK_ALLOCATIONS - UINT32 Temp; -#endif - - - ACPI_FUNCTION_TRACE (NsCreateNode); - - - Node = AcpiOsAcquireObject (AcpiGbl_NamespaceCache); - if (!Node) - { - return_PTR (NULL); - } - - ACPI_MEM_TRACKING (AcpiGbl_NsNodeList->TotalAllocated++); - -#ifdef ACPI_DBG_TRACK_ALLOCATIONS - Temp = AcpiGbl_NsNodeList->TotalAllocated - - AcpiGbl_NsNodeList->TotalFreed; - if (Temp > AcpiGbl_NsNodeList->MaxOccupied) - { - AcpiGbl_NsNodeList->MaxOccupied = Temp; - } -#endif - - Node->Name.Integer = Name; - ACPI_SET_DESCRIPTOR_TYPE (Node, ACPI_DESC_TYPE_NAMED); - return_PTR (Node); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsDeleteNode - * - * PARAMETERS: Node - Node to be deleted - * - * RETURN: None - * - * DESCRIPTION: Delete a namespace node. All node deletions must come through - * here. Detaches any attached objects, including any attached - * data. If a handler is associated with attached data, it is - * invoked before the node is deleted. - * - ******************************************************************************/ - -void -AcpiNsDeleteNode ( - ACPI_NAMESPACE_NODE *Node) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_OPERAND_OBJECT *NextDesc; - - - ACPI_FUNCTION_NAME (NsDeleteNode); - - - if (!Node) - { - return_VOID; - } - - /* Detach an object if there is one */ - - AcpiNsDetachObject (Node); - - /* - * Delete an attached data object list if present (objects that were - * attached via AcpiAttachData). Note: After any normal object is - * detached above, the only possible remaining object(s) are data - * objects, in a linked list. - */ - ObjDesc = Node->Object; - while (ObjDesc && - (ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA)) - { - /* Invoke the attached data deletion handler if present */ - - if (ObjDesc->Data.Handler) - { - ObjDesc->Data.Handler (Node, ObjDesc->Data.Pointer); - } - - NextDesc = ObjDesc->Common.NextObject; - AcpiUtRemoveReference (ObjDesc); - ObjDesc = NextDesc; - } - - /* Special case for the statically allocated root node */ - - if (Node == AcpiGbl_RootNode) - { - return; - } - - /* Now we can delete the node */ - - (void) AcpiOsReleaseObject (AcpiGbl_NamespaceCache, Node); - - ACPI_MEM_TRACKING (AcpiGbl_NsNodeList->TotalFreed++); - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Node %p, Remaining %X\n", - Node, AcpiGbl_CurrentNodeCount)); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsRemoveNode - * - * PARAMETERS: Node - Node to be removed/deleted - * - * RETURN: None - * - * DESCRIPTION: Remove (unlink) and delete a namespace node - * - ******************************************************************************/ - -void -AcpiNsRemoveNode ( - ACPI_NAMESPACE_NODE *Node) -{ - ACPI_NAMESPACE_NODE *ParentNode; - ACPI_NAMESPACE_NODE *PrevNode; - ACPI_NAMESPACE_NODE *NextNode; - - - ACPI_FUNCTION_TRACE_PTR (NsRemoveNode, Node); - - - ParentNode = Node->Parent; - - PrevNode = NULL; - NextNode = ParentNode->Child; - - /* Find the node that is the previous peer in the parent's child list */ - - while (NextNode != Node) - { - PrevNode = NextNode; - NextNode = NextNode->Peer; - } - - if (PrevNode) - { - /* Node is not first child, unlink it */ - - PrevNode->Peer = Node->Peer; - } - else - { - /* - * Node is first child (has no previous peer). - * Link peer list to parent - */ - ParentNode->Child = Node->Peer; - } - - /* Delete the node and any attached objects */ - - AcpiNsDeleteNode (Node); - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsInstallNode - * - * PARAMETERS: WalkState - Current state of the walk - * ParentNode - The parent of the new Node - * Node - The new Node to install - * Type - ACPI object type of the new Node - * - * RETURN: None - * - * DESCRIPTION: Initialize a new namespace node and install it amongst - * its peers. - * - * Note: Current namespace lookup is linear search. This appears - * to be sufficient as namespace searches consume only a small - * fraction of the execution time of the ACPI subsystem. - * - ******************************************************************************/ - -void -AcpiNsInstallNode ( - ACPI_WALK_STATE *WalkState, - ACPI_NAMESPACE_NODE *ParentNode, /* Parent */ - ACPI_NAMESPACE_NODE *Node, /* New Child*/ - ACPI_OBJECT_TYPE Type) -{ - ACPI_OWNER_ID OwnerId = 0; - ACPI_NAMESPACE_NODE *ChildNode; - - - ACPI_FUNCTION_TRACE (NsInstallNode); - - - if (WalkState) - { - /* - * Get the owner ID from the Walk state. The owner ID is used to - * track table deletion and deletion of objects created by methods. - */ - OwnerId = WalkState->OwnerId; - - if ((WalkState->MethodDesc) && - (ParentNode != WalkState->MethodNode)) - { - /* - * A method is creating a new node that is not a child of the - * method (it is non-local). Mark the executing method as having - * modified the namespace. This is used for cleanup when the - * method exits. - */ - WalkState->MethodDesc->Method.InfoFlags |= - ACPI_METHOD_MODIFIED_NAMESPACE; - } - } - - /* Link the new entry into the parent and existing children */ - - Node->Peer = NULL; - Node->Parent = ParentNode; - ChildNode = ParentNode->Child; - - if (!ChildNode) - { - ParentNode->Child = Node; - } - else - { - /* Add node to the end of the peer list */ - - while (ChildNode->Peer) - { - ChildNode = ChildNode->Peer; - } - - ChildNode->Peer = Node; - } - - /* Init the new entry */ - - Node->OwnerId = OwnerId; - Node->Type = (UINT8) Type; - - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "%4.4s (%s) [Node %p Owner %3.3X] added to %4.4s (%s) [Node %p]\n", - AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type), Node, OwnerId, - AcpiUtGetNodeName (ParentNode), AcpiUtGetTypeName (ParentNode->Type), - ParentNode)); - - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsDeleteChildren - * - * PARAMETERS: ParentNode - Delete this objects children - * - * RETURN: None. - * - * DESCRIPTION: Delete all children of the parent object. In other words, - * deletes a "scope". - * - ******************************************************************************/ - -void -AcpiNsDeleteChildren ( - ACPI_NAMESPACE_NODE *ParentNode) -{ - ACPI_NAMESPACE_NODE *NextNode; - ACPI_NAMESPACE_NODE *NodeToDelete; - - - ACPI_FUNCTION_TRACE_PTR (NsDeleteChildren, ParentNode); - - - if (!ParentNode) - { - return_VOID; - } - - /* Deallocate all children at this level */ - - NextNode = ParentNode->Child; - while (NextNode) - { - /* Grandchildren should have all been deleted already */ - - if (NextNode->Child) - { - ACPI_ERROR ((AE_INFO, "Found a grandchild! P=%p C=%p", - ParentNode, NextNode)); - } - - /* - * Delete this child node and move on to the next child in the list. - * No need to unlink the node since we are deleting the entire branch. - */ - NodeToDelete = NextNode; - NextNode = NextNode->Peer; - AcpiNsDeleteNode (NodeToDelete); - } - - /* Clear the parent's child pointer */ - - ParentNode->Child = NULL; - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsDeleteNamespaceSubtree - * - * PARAMETERS: ParentNode - Root of the subtree to be deleted - * - * RETURN: None. - * - * DESCRIPTION: Delete a subtree of the namespace. This includes all objects - * stored within the subtree. - * - ******************************************************************************/ - -void -AcpiNsDeleteNamespaceSubtree ( - ACPI_NAMESPACE_NODE *ParentNode) -{ - ACPI_NAMESPACE_NODE *ChildNode = NULL; - UINT32 Level = 1; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (NsDeleteNamespaceSubtree); - - - if (!ParentNode) - { - return_VOID; - } - - /* Lock namespace for possible update */ - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return_VOID; - } - - /* - * Traverse the tree of objects until we bubble back up - * to where we started. - */ - while (Level > 0) - { - /* Get the next node in this scope (NULL if none) */ - - ChildNode = AcpiNsGetNextNode (ParentNode, ChildNode); - if (ChildNode) - { - /* Found a child node - detach any attached object */ - - AcpiNsDetachObject (ChildNode); - - /* Check if this node has any children */ - - if (ChildNode->Child) - { - /* - * There is at least one child of this node, - * visit the node - */ - Level++; - ParentNode = ChildNode; - ChildNode = NULL; - } - } - else - { - /* - * No more children of this parent node. - * Move up to the grandparent. - */ - Level--; - - /* - * Now delete all of the children of this parent - * all at the same time. - */ - AcpiNsDeleteChildren (ParentNode); - - /* New "last child" is this parent node */ - - ChildNode = ParentNode; - - /* Move up the tree to the grandparent */ - - ParentNode = ParentNode->Parent; - } - } - - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsDeleteNamespaceByOwner - * - * PARAMETERS: OwnerId - All nodes with this owner will be deleted - * - * RETURN: Status - * - * DESCRIPTION: Delete entries within the namespace that are owned by a - * specific ID. Used to delete entire ACPI tables. All - * reference counts are updated. - * - * MUTEX: Locks namespace during deletion walk. - * - ******************************************************************************/ - -void -AcpiNsDeleteNamespaceByOwner ( - ACPI_OWNER_ID OwnerId) -{ - ACPI_NAMESPACE_NODE *ChildNode; - ACPI_NAMESPACE_NODE *DeletionNode; - ACPI_NAMESPACE_NODE *ParentNode; - UINT32 Level; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE_U32 (NsDeleteNamespaceByOwner, OwnerId); - - - if (OwnerId == 0) - { - return_VOID; - } - - /* Lock namespace for possible update */ - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return_VOID; - } - - DeletionNode = NULL; - ParentNode = AcpiGbl_RootNode; - ChildNode = NULL; - Level = 1; - - /* - * Traverse the tree of nodes until we bubble back up - * to where we started. - */ - while (Level > 0) - { - /* - * Get the next child of this parent node. When ChildNode is NULL, - * the first child of the parent is returned - */ - ChildNode = AcpiNsGetNextNode (ParentNode, ChildNode); - - if (DeletionNode) - { - AcpiNsDeleteChildren (DeletionNode); - AcpiNsRemoveNode (DeletionNode); - DeletionNode = NULL; - } - - if (ChildNode) - { - if (ChildNode->OwnerId == OwnerId) - { - /* Found a matching child node - detach any attached object */ - - AcpiNsDetachObject (ChildNode); - } - - /* Check if this node has any children */ - - if (ChildNode->Child) - { - /* - * There is at least one child of this node, - * visit the node - */ - Level++; - ParentNode = ChildNode; - ChildNode = NULL; - } - else if (ChildNode->OwnerId == OwnerId) - { - DeletionNode = ChildNode; - } - } - else - { - /* - * No more children of this parent node. - * Move up to the grandparent. - */ - Level--; - if (Level != 0) - { - if (ParentNode->OwnerId == OwnerId) - { - DeletionNode = ParentNode; - } - } - - /* New "last child" is this parent node */ - - ChildNode = ParentNode; - - /* Move up the tree to the grandparent */ - - ParentNode = ParentNode->Parent; - } - } - - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return_VOID; -} diff --git a/drivers/acpica/nsarguments.c b/drivers/acpica/nsarguments.c deleted file mode 100644 index 6676abe..0000000 --- a/drivers/acpica/nsarguments.c +++ /dev/null @@ -1,429 +0,0 @@ -/****************************************************************************** - * - * Module Name: nsarguments - Validation of args for ACPI predefined methods - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" -#include "acpredef.h" - - -#define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nsarguments") - - -/******************************************************************************* - * - * FUNCTION: AcpiNsCheckArgumentTypes - * - * PARAMETERS: Info - Method execution information block - * - * RETURN: None - * - * DESCRIPTION: Check the incoming argument count and all argument types - * against the argument type list for a predefined name. - * - ******************************************************************************/ - -void -AcpiNsCheckArgumentTypes ( - ACPI_EVALUATE_INFO *Info) -{ - UINT16 ArgTypeList; - UINT8 ArgCount; - UINT8 ArgType; - UINT8 UserArgType; - UINT32 i; - - - /* - * If not a predefined name, cannot typecheck args, because - * we have no idea what argument types are expected. - * Also, ignore typecheck if warnings/errors if this method - * has already been evaluated at least once -- in order - * to suppress repetitive messages. - */ - if (!Info->Predefined || (Info->Node->Flags & ANOBJ_EVALUATED)) - { - return; - } - - ArgTypeList = Info->Predefined->Info.ArgumentList; - ArgCount = METHOD_GET_ARG_COUNT (ArgTypeList); - - /* Typecheck all arguments */ - - for (i = 0; ((i < ArgCount) && (i < Info->ParamCount)); i++) - { - ArgType = METHOD_GET_NEXT_TYPE (ArgTypeList); - UserArgType = Info->Parameters[i]->Common.Type; - - /* No typechecking for ACPI_TYPE_ANY */ - - if ((UserArgType != ArgType) && (ArgType != ACPI_TYPE_ANY)) - { - ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, ACPI_WARN_ALWAYS, - "Argument #%u type mismatch - " - "Found [%s], ACPI requires [%s]", (i + 1), - AcpiUtGetTypeName (UserArgType), - AcpiUtGetTypeName (ArgType))); - - /* Prevent any additional typechecking for this method */ - - Info->Node->Flags |= ANOBJ_EVALUATED; - } - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsCheckAcpiCompliance - * - * PARAMETERS: Pathname - Full pathname to the node (for error msgs) - * Node - Namespace node for the method/object - * Predefined - Pointer to entry in predefined name table - * - * RETURN: None - * - * DESCRIPTION: Check that the declared parameter count (in ASL/AML) for a - * predefined name is what is expected (matches what is defined in - * the ACPI specification for this predefined name.) - * - ******************************************************************************/ - -void -AcpiNsCheckAcpiCompliance ( - char *Pathname, - ACPI_NAMESPACE_NODE *Node, - const ACPI_PREDEFINED_INFO *Predefined) -{ - UINT32 AmlParamCount; - UINT32 RequiredParamCount; - - - if (!Predefined || (Node->Flags & ANOBJ_EVALUATED)) - { - return; - } - - /* Get the ACPI-required arg count from the predefined info table */ - - RequiredParamCount = - METHOD_GET_ARG_COUNT (Predefined->Info.ArgumentList); - - /* - * If this object is not a control method, we can check if the ACPI - * spec requires that it be a method. - */ - if (Node->Type != ACPI_TYPE_METHOD) - { - if (RequiredParamCount > 0) - { - /* Object requires args, must be implemented as a method */ - - ACPI_BIOS_ERROR_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, - "Object (%s) must be a control method with %u arguments", - AcpiUtGetTypeName (Node->Type), RequiredParamCount)); - } - else if (!RequiredParamCount && !Predefined->Info.ExpectedBtypes) - { - /* Object requires no args and no return value, must be a method */ - - ACPI_BIOS_ERROR_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, - "Object (%s) must be a control method " - "with no arguments and no return value", - AcpiUtGetTypeName (Node->Type))); - } - - return; - } - - /* - * This is a control method. - * Check that the ASL/AML-defined parameter count for this method - * matches the ACPI-required parameter count - * - * Some methods are allowed to have a "minimum" number of args (_SCP) - * because their definition in ACPI has changed over time. - * - * Note: These are BIOS errors in the declaration of the object - */ - AmlParamCount = Node->Object->Method.ParamCount; - - if (AmlParamCount < RequiredParamCount) - { - ACPI_BIOS_ERROR_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, - "Insufficient arguments - " - "ASL declared %u, ACPI requires %u", - AmlParamCount, RequiredParamCount)); - } - else if ((AmlParamCount > RequiredParamCount) && - !(Predefined->Info.ArgumentList & ARG_COUNT_IS_MINIMUM)) - { - ACPI_BIOS_ERROR_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, - "Excess arguments - " - "ASL declared %u, ACPI requires %u", - AmlParamCount, RequiredParamCount)); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsCheckArgumentCount - * - * PARAMETERS: Pathname - Full pathname to the node (for error msgs) - * Node - Namespace node for the method/object - * UserParamCount - Number of args passed in by the caller - * Predefined - Pointer to entry in predefined name table - * - * RETURN: None - * - * DESCRIPTION: Check that incoming argument count matches the declared - * parameter count (in the ASL/AML) for an object. - * - ******************************************************************************/ - -void -AcpiNsCheckArgumentCount ( - char *Pathname, - ACPI_NAMESPACE_NODE *Node, - UINT32 UserParamCount, - const ACPI_PREDEFINED_INFO *Predefined) -{ - UINT32 AmlParamCount; - UINT32 RequiredParamCount; - - - if (Node->Flags & ANOBJ_EVALUATED) - { - return; - } - - if (!Predefined) - { - /* - * Not a predefined name. Check the incoming user argument count - * against the count that is specified in the method/object. - */ - if (Node->Type != ACPI_TYPE_METHOD) - { - if (UserParamCount) - { - ACPI_INFO_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, - "%u arguments were passed to a non-method ACPI object (%s)", - UserParamCount, AcpiUtGetTypeName (Node->Type))); - } - - return; - } - - /* - * This is a control method. Check the parameter count. - * We can only check the incoming argument count against the - * argument count declared for the method in the ASL/AML. - * - * Emit a message if too few or too many arguments have been passed - * by the caller. - * - * Note: Too many arguments will not cause the method to - * fail. However, the method will fail if there are too few - * arguments and the method attempts to use one of the missing ones. - */ - AmlParamCount = Node->Object->Method.ParamCount; - - if (UserParamCount < AmlParamCount) - { - ACPI_WARN_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, - "Insufficient arguments - " - "Caller passed %u, method requires %u", - UserParamCount, AmlParamCount)); - } - else if (UserParamCount > AmlParamCount) - { - ACPI_INFO_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, - "Excess arguments - " - "Caller passed %u, method requires %u", - UserParamCount, AmlParamCount)); - } - - return; - } - - /* - * This is a predefined name. Validate the user-supplied parameter - * count against the ACPI specification. We don't validate against - * the method itself because what is important here is that the - * caller is in conformance with the spec. (The arg count for the - * method was checked against the ACPI spec earlier.) - * - * Some methods are allowed to have a "minimum" number of args (_SCP) - * because their definition in ACPI has changed over time. - */ - RequiredParamCount = - METHOD_GET_ARG_COUNT (Predefined->Info.ArgumentList); - - if (UserParamCount < RequiredParamCount) - { - ACPI_WARN_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, - "Insufficient arguments - " - "Caller passed %u, ACPI requires %u", - UserParamCount, RequiredParamCount)); - } - else if ((UserParamCount > RequiredParamCount) && - !(Predefined->Info.ArgumentList & ARG_COUNT_IS_MINIMUM)) - { - ACPI_INFO_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, - "Excess arguments - " - "Caller passed %u, ACPI requires %u", - UserParamCount, RequiredParamCount)); - } -} diff --git a/drivers/acpica/nsconvert.c b/drivers/acpica/nsconvert.c deleted file mode 100644 index ae039a1..0000000 --- a/drivers/acpica/nsconvert.c +++ /dev/null @@ -1,674 +0,0 @@ -/****************************************************************************** - * - * Module Name: nsconvert - Object conversions for objects returned by - * predefined methods - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" -#include "acinterp.h" -#include "acpredef.h" -#include "amlresrc.h" - -#define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nsconvert") - - -/******************************************************************************* - * - * FUNCTION: AcpiNsConvertToInteger - * - * PARAMETERS: OriginalObject - Object to be converted - * ReturnObject - Where the new converted object is returned - * - * RETURN: Status. AE_OK if conversion was successful. - * - * DESCRIPTION: Attempt to convert a String/Buffer object to an Integer. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsConvertToInteger ( - ACPI_OPERAND_OBJECT *OriginalObject, - ACPI_OPERAND_OBJECT **ReturnObject) -{ - ACPI_OPERAND_OBJECT *NewObject; - ACPI_STATUS Status; - UINT64 Value = 0; - UINT32 i; - - - switch (OriginalObject->Common.Type) - { - case ACPI_TYPE_STRING: - - /* String-to-Integer conversion */ - - Status = AcpiUtStrtoul64 (OriginalObject->String.Pointer, &Value); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - break; - - case ACPI_TYPE_BUFFER: - - /* Buffer-to-Integer conversion. Max buffer size is 64 bits. */ - - if (OriginalObject->Buffer.Length > 8) - { - return (AE_AML_OPERAND_TYPE); - } - - /* Extract each buffer byte to create the integer */ - - for (i = 0; i < OriginalObject->Buffer.Length; i++) - { - Value |= ((UINT64) - OriginalObject->Buffer.Pointer[i] << (i * 8)); - } - break; - - default: - - return (AE_AML_OPERAND_TYPE); - } - - NewObject = AcpiUtCreateIntegerObject (Value); - if (!NewObject) - { - return (AE_NO_MEMORY); - } - - *ReturnObject = NewObject; - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsConvertToString - * - * PARAMETERS: OriginalObject - Object to be converted - * ReturnObject - Where the new converted object is returned - * - * RETURN: Status. AE_OK if conversion was successful. - * - * DESCRIPTION: Attempt to convert a Integer/Buffer object to a String. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsConvertToString ( - ACPI_OPERAND_OBJECT *OriginalObject, - ACPI_OPERAND_OBJECT **ReturnObject) -{ - ACPI_OPERAND_OBJECT *NewObject; - ACPI_SIZE Length; - ACPI_STATUS Status; - - - switch (OriginalObject->Common.Type) - { - case ACPI_TYPE_INTEGER: - /* - * Integer-to-String conversion. Commonly, convert - * an integer of value 0 to a NULL string. The last element of - * _BIF and _BIX packages occasionally need this fix. - */ - if (OriginalObject->Integer.Value == 0) - { - /* Allocate a new NULL string object */ - - NewObject = AcpiUtCreateStringObject (0); - if (!NewObject) - { - return (AE_NO_MEMORY); - } - } - else - { - Status = AcpiExConvertToString (OriginalObject, - &NewObject, ACPI_IMPLICIT_CONVERT_HEX); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - break; - - case ACPI_TYPE_BUFFER: - /* - * Buffer-to-String conversion. Use a ToString - * conversion, no transform performed on the buffer data. The best - * example of this is the _BIF method, where the string data from - * the battery is often (incorrectly) returned as buffer object(s). - */ - Length = 0; - while ((Length < OriginalObject->Buffer.Length) && - (OriginalObject->Buffer.Pointer[Length])) - { - Length++; - } - - /* Allocate a new string object */ - - NewObject = AcpiUtCreateStringObject (Length); - if (!NewObject) - { - return (AE_NO_MEMORY); - } - - /* - * Copy the raw buffer data with no transform. String is already NULL - * terminated at Length+1. - */ - memcpy (NewObject->String.Pointer, - OriginalObject->Buffer.Pointer, Length); - break; - - default: - - return (AE_AML_OPERAND_TYPE); - } - - *ReturnObject = NewObject; - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsConvertToBuffer - * - * PARAMETERS: OriginalObject - Object to be converted - * ReturnObject - Where the new converted object is returned - * - * RETURN: Status. AE_OK if conversion was successful. - * - * DESCRIPTION: Attempt to convert a Integer/String/Package object to a Buffer. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsConvertToBuffer ( - ACPI_OPERAND_OBJECT *OriginalObject, - ACPI_OPERAND_OBJECT **ReturnObject) -{ - ACPI_OPERAND_OBJECT *NewObject; - ACPI_STATUS Status; - ACPI_OPERAND_OBJECT **Elements; - UINT32 *DwordBuffer; - UINT32 Count; - UINT32 i; - - - switch (OriginalObject->Common.Type) - { - case ACPI_TYPE_INTEGER: - /* - * Integer-to-Buffer conversion. - * Convert the Integer to a packed-byte buffer. _MAT and other - * objects need this sometimes, if a read has been performed on a - * Field object that is less than or equal to the global integer - * size (32 or 64 bits). - */ - Status = AcpiExConvertToBuffer (OriginalObject, &NewObject); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - break; - - case ACPI_TYPE_STRING: - - /* String-to-Buffer conversion. Simple data copy */ - - NewObject = AcpiUtCreateBufferObject - (OriginalObject->String.Length); - if (!NewObject) - { - return (AE_NO_MEMORY); - } - - memcpy (NewObject->Buffer.Pointer, - OriginalObject->String.Pointer, OriginalObject->String.Length); - break; - - case ACPI_TYPE_PACKAGE: - /* - * This case is often seen for predefined names that must return a - * Buffer object with multiple DWORD integers within. For example, - * _FDE and _GTM. The Package can be converted to a Buffer. - */ - - /* All elements of the Package must be integers */ - - Elements = OriginalObject->Package.Elements; - Count = OriginalObject->Package.Count; - - for (i = 0; i < Count; i++) - { - if ((!*Elements) || - ((*Elements)->Common.Type != ACPI_TYPE_INTEGER)) - { - return (AE_AML_OPERAND_TYPE); - } - Elements++; - } - - /* Create the new buffer object to replace the Package */ - - NewObject = AcpiUtCreateBufferObject (ACPI_MUL_4 (Count)); - if (!NewObject) - { - return (AE_NO_MEMORY); - } - - /* Copy the package elements (integers) to the buffer as DWORDs */ - - Elements = OriginalObject->Package.Elements; - DwordBuffer = ACPI_CAST_PTR (UINT32, NewObject->Buffer.Pointer); - - for (i = 0; i < Count; i++) - { - *DwordBuffer = (UINT32) (*Elements)->Integer.Value; - DwordBuffer++; - Elements++; - } - break; - - default: - - return (AE_AML_OPERAND_TYPE); - } - - *ReturnObject = NewObject; - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsConvertToUnicode - * - * PARAMETERS: Scope - Namespace node for the method/object - * OriginalObject - ASCII String Object to be converted - * ReturnObject - Where the new converted object is returned - * - * RETURN: Status. AE_OK if conversion was successful. - * - * DESCRIPTION: Attempt to convert a String object to a Unicode string Buffer. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsConvertToUnicode ( - ACPI_NAMESPACE_NODE *Scope, - ACPI_OPERAND_OBJECT *OriginalObject, - ACPI_OPERAND_OBJECT **ReturnObject) -{ - ACPI_OPERAND_OBJECT *NewObject; - char *AsciiString; - UINT16 *UnicodeBuffer; - UINT32 UnicodeLength; - UINT32 i; - - - if (!OriginalObject) - { - return (AE_OK); - } - - /* If a Buffer was returned, it must be at least two bytes long */ - - if (OriginalObject->Common.Type == ACPI_TYPE_BUFFER) - { - if (OriginalObject->Buffer.Length < 2) - { - return (AE_AML_OPERAND_VALUE); - } - - *ReturnObject = NULL; - return (AE_OK); - } - - /* - * The original object is an ASCII string. Convert this string to - * a unicode buffer. - */ - AsciiString = OriginalObject->String.Pointer; - UnicodeLength = (OriginalObject->String.Length * 2) + 2; - - /* Create a new buffer object for the Unicode data */ - - NewObject = AcpiUtCreateBufferObject (UnicodeLength); - if (!NewObject) - { - return (AE_NO_MEMORY); - } - - UnicodeBuffer = ACPI_CAST_PTR (UINT16, NewObject->Buffer.Pointer); - - /* Convert ASCII to Unicode */ - - for (i = 0; i < OriginalObject->String.Length; i++) - { - UnicodeBuffer[i] = (UINT16) AsciiString[i]; - } - - *ReturnObject = NewObject; - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsConvertToResource - * - * PARAMETERS: Scope - Namespace node for the method/object - * OriginalObject - Object to be converted - * ReturnObject - Where the new converted object is returned - * - * RETURN: Status. AE_OK if conversion was successful - * - * DESCRIPTION: Attempt to convert a Integer object to a ResourceTemplate - * Buffer. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsConvertToResource ( - ACPI_NAMESPACE_NODE *Scope, - ACPI_OPERAND_OBJECT *OriginalObject, - ACPI_OPERAND_OBJECT **ReturnObject) -{ - ACPI_OPERAND_OBJECT *NewObject; - UINT8 *Buffer; - - - /* - * We can fix the following cases for an expected resource template: - * 1. No return value (interpreter slack mode is disabled) - * 2. A "Return (Zero)" statement - * 3. A "Return empty buffer" statement - * - * We will return a buffer containing a single EndTag - * resource descriptor. - */ - if (OriginalObject) - { - switch (OriginalObject->Common.Type) - { - case ACPI_TYPE_INTEGER: - - /* We can only repair an Integer==0 */ - - if (OriginalObject->Integer.Value) - { - return (AE_AML_OPERAND_TYPE); - } - break; - - case ACPI_TYPE_BUFFER: - - if (OriginalObject->Buffer.Length) - { - /* Additional checks can be added in the future */ - - *ReturnObject = NULL; - return (AE_OK); - } - break; - - case ACPI_TYPE_STRING: - default: - - return (AE_AML_OPERAND_TYPE); - } - } - - /* Create the new buffer object for the resource descriptor */ - - NewObject = AcpiUtCreateBufferObject (2); - if (!NewObject) - { - return (AE_NO_MEMORY); - } - - Buffer = ACPI_CAST_PTR (UINT8, NewObject->Buffer.Pointer); - - /* Initialize the Buffer with a single EndTag descriptor */ - - Buffer[0] = (ACPI_RESOURCE_NAME_END_TAG | ASL_RDESC_END_TAG_SIZE); - Buffer[1] = 0x00; - - *ReturnObject = NewObject; - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsConvertToReference - * - * PARAMETERS: Scope - Namespace node for the method/object - * OriginalObject - Object to be converted - * ReturnObject - Where the new converted object is returned - * - * RETURN: Status. AE_OK if conversion was successful - * - * DESCRIPTION: Attempt to convert a Integer object to a ObjectReference. - * Buffer. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsConvertToReference ( - ACPI_NAMESPACE_NODE *Scope, - ACPI_OPERAND_OBJECT *OriginalObject, - ACPI_OPERAND_OBJECT **ReturnObject) -{ - ACPI_OPERAND_OBJECT *NewObject = NULL; - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node; - ACPI_GENERIC_STATE ScopeInfo; - char *Name; - - - ACPI_FUNCTION_NAME (NsConvertToReference); - - - /* Convert path into internal presentation */ - - Status = AcpiNsInternalizeName (OriginalObject->String.Pointer, &Name); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Find the namespace node */ - - ScopeInfo.Scope.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Scope); - Status = AcpiNsLookup (&ScopeInfo, Name, - ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node); - if (ACPI_FAILURE (Status)) - { - /* Check if we are resolving a named reference within a package */ - - ACPI_ERROR_NAMESPACE (&ScopeInfo, - OriginalObject->String.Pointer, Status); - goto ErrorExit; - } - - /* Create and init a new internal ACPI object */ - - NewObject = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_REFERENCE); - if (!NewObject) - { - Status = AE_NO_MEMORY; - goto ErrorExit; - } - NewObject->Reference.Node = Node; - NewObject->Reference.Object = Node->Object; - NewObject->Reference.Class = ACPI_REFCLASS_NAME; - - /* - * Increase reference of the object if needed (the object is likely a - * null for device nodes). - */ - AcpiUtAddReference (Node->Object); - -ErrorExit: - ACPI_FREE (Name); - *ReturnObject = NewObject; - return (Status); -} diff --git a/drivers/acpica/nsdump.c b/drivers/acpica/nsdump.c deleted file mode 100644 index e3db14a..0000000 --- a/drivers/acpica/nsdump.c +++ /dev/null @@ -1,1058 +0,0 @@ -/****************************************************************************** - * - * Module Name: nsdump - table dumping routines for debug - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" -#include "acoutput.h" - - -#define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nsdump") - -/* Local prototypes */ - -#ifdef ACPI_OBSOLETE_FUNCTIONS -void -AcpiNsDumpRootDevices ( - void); - -static ACPI_STATUS -AcpiNsDumpOneDevice ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue); -#endif - - -#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) - -static ACPI_STATUS -AcpiNsDumpOneObjectPath ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue); - -static ACPI_STATUS -AcpiNsGetMaxDepth ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue); - - -/******************************************************************************* - * - * FUNCTION: AcpiNsPrintPathname - * - * PARAMETERS: NumSegments - Number of ACPI name segments - * Pathname - The compressed (internal) path - * - * RETURN: None - * - * DESCRIPTION: Print an object's full namespace pathname - * - ******************************************************************************/ - -void -AcpiNsPrintPathname ( - UINT32 NumSegments, - const char *Pathname) -{ - UINT32 i; - - - ACPI_FUNCTION_NAME (NsPrintPathname); - - - /* Check if debug output enabled */ - - if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_NAMES, ACPI_NAMESPACE)) - { - return; - } - - /* Print the entire name */ - - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[")); - - while (NumSegments) - { - for (i = 0; i < 4; i++) - { - isprint ((int) Pathname[i]) ? - AcpiOsPrintf ("%c", Pathname[i]) : - AcpiOsPrintf ("?"); - } - - Pathname += ACPI_NAMESEG_SIZE; - NumSegments--; - if (NumSegments) - { - AcpiOsPrintf ("."); - } - } - - AcpiOsPrintf ("]\n"); -} - - -#ifdef ACPI_OBSOLETE_FUNCTIONS -/* Not used at this time, perhaps later */ - -/******************************************************************************* - * - * FUNCTION: AcpiNsDumpPathname - * - * PARAMETERS: Handle - Object - * Msg - Prefix message - * Level - Desired debug level - * Component - Caller's component ID - * - * RETURN: None - * - * DESCRIPTION: Print an object's full namespace pathname - * Manages allocation/freeing of a pathname buffer - * - ******************************************************************************/ - -void -AcpiNsDumpPathname ( - ACPI_HANDLE Handle, - const char *Msg, - UINT32 Level, - UINT32 Component) -{ - - ACPI_FUNCTION_TRACE (NsDumpPathname); - - - /* Do this only if the requested debug level and component are enabled */ - - if (!ACPI_IS_DEBUG_ENABLED (Level, Component)) - { - return_VOID; - } - - /* Convert handle to a full pathname and print it (with supplied message) */ - - AcpiNsPrintNodePathname (Handle, Msg); - AcpiOsPrintf ("\n"); - return_VOID; -} -#endif - - -/******************************************************************************* - * - * FUNCTION: AcpiNsDumpOneObject - * - * PARAMETERS: ObjHandle - Node to be dumped - * Level - Nesting level of the handle - * Context - Passed into WalkNamespace - * ReturnValue - Not used - * - * RETURN: Status - * - * DESCRIPTION: Dump a single Node - * This procedure is a UserFunction called by AcpiNsWalkNamespace. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsDumpOneObject ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue) -{ - ACPI_WALK_INFO *Info = (ACPI_WALK_INFO *) Context; - ACPI_NAMESPACE_NODE *ThisNode; - ACPI_OPERAND_OBJECT *ObjDesc = NULL; - ACPI_OBJECT_TYPE ObjType; - ACPI_OBJECT_TYPE Type; - UINT32 BytesToDump; - UINT32 DbgLevel; - UINT32 i; - - - ACPI_FUNCTION_NAME (NsDumpOneObject); - - - /* Is output enabled? */ - - if (!(AcpiDbgLevel & Info->DebugLevel)) - { - return (AE_OK); - } - - if (!ObjHandle) - { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null object handle\n")); - return (AE_OK); - } - - ThisNode = AcpiNsValidateHandle (ObjHandle); - if (!ThisNode) - { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Invalid object handle %p\n", - ObjHandle)); - return (AE_OK); - } - - Type = ThisNode->Type; - Info->Count++; - - /* Check if the owner matches */ - - if ((Info->OwnerId != ACPI_OWNER_ID_MAX) && - (Info->OwnerId != ThisNode->OwnerId)) - { - return (AE_OK); - } - - if (!(Info->DisplayType & ACPI_DISPLAY_SHORT)) - { - /* Indent the object according to the level */ - - AcpiOsPrintf ("%2d%*s", (UINT32) Level - 1, (int) Level * 2, " "); - - /* Check the node type and name */ - - if (Type > ACPI_TYPE_LOCAL_MAX) - { - ACPI_WARNING ((AE_INFO, - "Invalid ACPI Object Type 0x%08X", Type)); - } - - AcpiOsPrintf ("%4.4s", AcpiUtGetNodeName (ThisNode)); - } - - /* Now we can print out the pertinent information */ - - AcpiOsPrintf (" %-12s %p %3.3X ", - AcpiUtGetTypeName (Type), ThisNode, ThisNode->OwnerId); - - DbgLevel = AcpiDbgLevel; - AcpiDbgLevel = 0; - ObjDesc = AcpiNsGetAttachedObject (ThisNode); - AcpiDbgLevel = DbgLevel; - - /* Temp nodes are those nodes created by a control method */ - - if (ThisNode->Flags & ANOBJ_TEMPORARY) - { - AcpiOsPrintf ("(T) "); - } - - switch (Info->DisplayType & ACPI_DISPLAY_MASK) - { - case ACPI_DISPLAY_SUMMARY: - - if (!ObjDesc) - { - /* No attached object. Some types should always have an object */ - - switch (Type) - { - case ACPI_TYPE_INTEGER: - case ACPI_TYPE_PACKAGE: - case ACPI_TYPE_BUFFER: - case ACPI_TYPE_STRING: - case ACPI_TYPE_METHOD: - - AcpiOsPrintf (""); - break; - - default: - - break; - } - - AcpiOsPrintf ("\n"); - return (AE_OK); - } - - switch (Type) - { - case ACPI_TYPE_PROCESSOR: - - AcpiOsPrintf ("ID %02X Len %02X Addr %8.8X%8.8X\n", - ObjDesc->Processor.ProcId, ObjDesc->Processor.Length, - ACPI_FORMAT_UINT64 (ObjDesc->Processor.Address)); - break; - - case ACPI_TYPE_DEVICE: - - AcpiOsPrintf ("Notify Object: %p\n", ObjDesc); - break; - - case ACPI_TYPE_METHOD: - - AcpiOsPrintf ("Args %X Len %.4X Aml %p\n", - (UINT32) ObjDesc->Method.ParamCount, - ObjDesc->Method.AmlLength, ObjDesc->Method.AmlStart); - break; - - case ACPI_TYPE_INTEGER: - - AcpiOsPrintf ("= %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); - break; - - case ACPI_TYPE_PACKAGE: - - if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) - { - AcpiOsPrintf ("Elements %.2X\n", - ObjDesc->Package.Count); - } - else - { - AcpiOsPrintf ("[Length not yet evaluated]\n"); - } - break; - - case ACPI_TYPE_BUFFER: - - if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) - { - AcpiOsPrintf ("Len %.2X", - ObjDesc->Buffer.Length); - - /* Dump some of the buffer */ - - if (ObjDesc->Buffer.Length > 0) - { - AcpiOsPrintf (" ="); - for (i = 0; (i < ObjDesc->Buffer.Length && i < 12); i++) - { - AcpiOsPrintf (" %2.2X", ObjDesc->Buffer.Pointer[i]); - } - } - AcpiOsPrintf ("\n"); - } - else - { - AcpiOsPrintf ("[Length not yet evaluated]\n"); - } - break; - - case ACPI_TYPE_STRING: - - AcpiOsPrintf ("Len %.2X ", ObjDesc->String.Length); - AcpiUtPrintString (ObjDesc->String.Pointer, 80); - AcpiOsPrintf ("\n"); - break; - - case ACPI_TYPE_REGION: - - AcpiOsPrintf ("[%s]", - AcpiUtGetRegionName (ObjDesc->Region.SpaceId)); - if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID) - { - AcpiOsPrintf (" Addr %8.8X%8.8X Len %.4X\n", - ACPI_FORMAT_UINT64 (ObjDesc->Region.Address), - ObjDesc->Region.Length); - } - else - { - AcpiOsPrintf (" [Address/Length not yet evaluated]\n"); - } - break; - - case ACPI_TYPE_LOCAL_REFERENCE: - - AcpiOsPrintf ("[%s]\n", AcpiUtGetReferenceName (ObjDesc)); - break; - - case ACPI_TYPE_BUFFER_FIELD: - - if (ObjDesc->BufferField.BufferObj && - ObjDesc->BufferField.BufferObj->Buffer.Node) - { - AcpiOsPrintf ("Buf [%4.4s]", - AcpiUtGetNodeName ( - ObjDesc->BufferField.BufferObj->Buffer.Node)); - } - break; - - case ACPI_TYPE_LOCAL_REGION_FIELD: - - AcpiOsPrintf ("Rgn [%4.4s]", - AcpiUtGetNodeName ( - ObjDesc->CommonField.RegionObj->Region.Node)); - break; - - case ACPI_TYPE_LOCAL_BANK_FIELD: - - AcpiOsPrintf ("Rgn [%4.4s] Bnk [%4.4s]", - AcpiUtGetNodeName ( - ObjDesc->CommonField.RegionObj->Region.Node), - AcpiUtGetNodeName ( - ObjDesc->BankField.BankObj->CommonField.Node)); - break; - - case ACPI_TYPE_LOCAL_INDEX_FIELD: - - AcpiOsPrintf ("Idx [%4.4s] Dat [%4.4s]", - AcpiUtGetNodeName ( - ObjDesc->IndexField.IndexObj->CommonField.Node), - AcpiUtGetNodeName ( - ObjDesc->IndexField.DataObj->CommonField.Node)); - break; - - case ACPI_TYPE_LOCAL_ALIAS: - case ACPI_TYPE_LOCAL_METHOD_ALIAS: - - AcpiOsPrintf ("Target %4.4s (%p)\n", - AcpiUtGetNodeName (ObjDesc), ObjDesc); - break; - - default: - - AcpiOsPrintf ("Object %p\n", ObjDesc); - break; - } - - /* Common field handling */ - - switch (Type) - { - case ACPI_TYPE_BUFFER_FIELD: - case ACPI_TYPE_LOCAL_REGION_FIELD: - case ACPI_TYPE_LOCAL_BANK_FIELD: - case ACPI_TYPE_LOCAL_INDEX_FIELD: - - AcpiOsPrintf (" Off %.3X Len %.2X Acc %.2X\n", - (ObjDesc->CommonField.BaseByteOffset * 8) - + ObjDesc->CommonField.StartFieldBitOffset, - ObjDesc->CommonField.BitLength, - ObjDesc->CommonField.AccessByteWidth); - break; - - default: - - break; - } - break; - - case ACPI_DISPLAY_OBJECTS: - - AcpiOsPrintf ("O:%p", ObjDesc); - if (!ObjDesc) - { - /* No attached object, we are done */ - - AcpiOsPrintf ("\n"); - return (AE_OK); - } - - AcpiOsPrintf ("(R%u)", ObjDesc->Common.ReferenceCount); - - switch (Type) - { - case ACPI_TYPE_METHOD: - - /* Name is a Method and its AML offset/length are set */ - - AcpiOsPrintf (" M:%p-%X\n", ObjDesc->Method.AmlStart, - ObjDesc->Method.AmlLength); - break; - - case ACPI_TYPE_INTEGER: - - AcpiOsPrintf (" I:%8.8X8.8%X\n", - ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); - break; - - case ACPI_TYPE_STRING: - - AcpiOsPrintf (" S:%p-%X\n", ObjDesc->String.Pointer, - ObjDesc->String.Length); - break; - - case ACPI_TYPE_BUFFER: - - AcpiOsPrintf (" B:%p-%X\n", ObjDesc->Buffer.Pointer, - ObjDesc->Buffer.Length); - break; - - default: - - AcpiOsPrintf ("\n"); - break; - } - break; - - default: - AcpiOsPrintf ("\n"); - break; - } - - /* If debug turned off, done */ - - if (!(AcpiDbgLevel & ACPI_LV_VALUES)) - { - return (AE_OK); - } - - /* If there is an attached object, display it */ - - DbgLevel = AcpiDbgLevel; - AcpiDbgLevel = 0; - ObjDesc = AcpiNsGetAttachedObject (ThisNode); - AcpiDbgLevel = DbgLevel; - - /* Dump attached objects */ - - while (ObjDesc) - { - ObjType = ACPI_TYPE_INVALID; - AcpiOsPrintf ("Attached Object %p: ", ObjDesc); - - /* Decode the type of attached object and dump the contents */ - - switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc)) - { - case ACPI_DESC_TYPE_NAMED: - - AcpiOsPrintf ("(Ptr to Node)\n"); - BytesToDump = sizeof (ACPI_NAMESPACE_NODE); - ACPI_DUMP_BUFFER (ObjDesc, BytesToDump); - break; - - case ACPI_DESC_TYPE_OPERAND: - - ObjType = ObjDesc->Common.Type; - - if (ObjType > ACPI_TYPE_LOCAL_MAX) - { - AcpiOsPrintf ( - "(Pointer to ACPI Object type %.2X [UNKNOWN])\n", - ObjType); - - BytesToDump = 32; - } - else - { - AcpiOsPrintf ( - "(Pointer to ACPI Object type %.2X [%s])\n", - ObjType, AcpiUtGetTypeName (ObjType)); - - BytesToDump = sizeof (ACPI_OPERAND_OBJECT); - } - - ACPI_DUMP_BUFFER (ObjDesc, BytesToDump); - break; - - default: - - break; - } - - /* If value is NOT an internal object, we are done */ - - if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) - { - goto Cleanup; - } - - /* Valid object, get the pointer to next level, if any */ - - switch (ObjType) - { - case ACPI_TYPE_BUFFER: - case ACPI_TYPE_STRING: - /* - * NOTE: takes advantage of common fields between string/buffer - */ - BytesToDump = ObjDesc->String.Length; - ObjDesc = (void *) ObjDesc->String.Pointer; - - AcpiOsPrintf ("(Buffer/String pointer %p length %X)\n", - ObjDesc, BytesToDump); - ACPI_DUMP_BUFFER (ObjDesc, BytesToDump); - goto Cleanup; - - case ACPI_TYPE_BUFFER_FIELD: - - ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->BufferField.BufferObj; - break; - - case ACPI_TYPE_PACKAGE: - - ObjDesc = (void *) ObjDesc->Package.Elements; - break; - - case ACPI_TYPE_METHOD: - - ObjDesc = (void *) ObjDesc->Method.AmlStart; - break; - - case ACPI_TYPE_LOCAL_REGION_FIELD: - - ObjDesc = (void *) ObjDesc->Field.RegionObj; - break; - - case ACPI_TYPE_LOCAL_BANK_FIELD: - - ObjDesc = (void *) ObjDesc->BankField.RegionObj; - break; - - case ACPI_TYPE_LOCAL_INDEX_FIELD: - - ObjDesc = (void *) ObjDesc->IndexField.IndexObj; - break; - - default: - - goto Cleanup; - } - } - -Cleanup: - AcpiOsPrintf ("\n"); - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsDumpObjects - * - * PARAMETERS: Type - Object type to be dumped - * DisplayType - 0 or ACPI_DISPLAY_SUMMARY - * MaxDepth - Maximum depth of dump. Use ACPI_UINT32_MAX - * for an effectively unlimited depth. - * OwnerId - Dump only objects owned by this ID. Use - * ACPI_UINT32_MAX to match all owners. - * StartHandle - Where in namespace to start/end search - * - * RETURN: None - * - * DESCRIPTION: Dump typed objects within the loaded namespace. Uses - * AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObject. - * - ******************************************************************************/ - -void -AcpiNsDumpObjects ( - ACPI_OBJECT_TYPE Type, - UINT8 DisplayType, - UINT32 MaxDepth, - ACPI_OWNER_ID OwnerId, - ACPI_HANDLE StartHandle) -{ - ACPI_WALK_INFO Info; - ACPI_STATUS Status; - - - ACPI_FUNCTION_ENTRY (); - - - /* - * Just lock the entire namespace for the duration of the dump. - * We don't want any changes to the namespace during this time, - * especially the temporary nodes since we are going to display - * them also. - */ - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not acquire namespace mutex\n"); - return; - } - - Info.Count = 0; - Info.DebugLevel = ACPI_LV_TABLES; - Info.OwnerId = OwnerId; - Info.DisplayType = DisplayType; - - (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, - ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES, - AcpiNsDumpOneObject, NULL, (void *) &Info, NULL); - - AcpiOsPrintf ("\nNamespace node count: %u\n\n", Info.Count); - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsDumpOneObjectPath, AcpiNsGetMaxDepth - * - * PARAMETERS: ObjHandle - Node to be dumped - * Level - Nesting level of the handle - * Context - Passed into WalkNamespace - * ReturnValue - Not used - * - * RETURN: Status - * - * DESCRIPTION: Dump the full pathname to a namespace object. AcpNsGetMaxDepth - * computes the maximum nesting depth in the namespace tree, in - * order to simplify formatting in AcpiNsDumpOneObjectPath. - * These procedures are UserFunctions called by AcpiNsWalkNamespace. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiNsDumpOneObjectPath ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue) -{ - UINT32 MaxLevel = *((UINT32 *) Context); - char *Pathname; - ACPI_NAMESPACE_NODE *Node; - int PathIndent; - - - if (!ObjHandle) - { - return (AE_OK); - } - - Node = AcpiNsValidateHandle (ObjHandle); - if (!Node) - { - /* Ignore bad node during namespace walk */ - - return (AE_OK); - } - - Pathname = AcpiNsGetNormalizedPathname (Node, TRUE); - - PathIndent = 1; - if (Level <= MaxLevel) - { - PathIndent = MaxLevel - Level + 1; - } - - AcpiOsPrintf ("%2d%*s%-12s%*s", - Level, Level, " ", AcpiUtGetTypeName (Node->Type), - PathIndent, " "); - - AcpiOsPrintf ("%s\n", &Pathname[1]); - ACPI_FREE (Pathname); - return (AE_OK); -} - - -static ACPI_STATUS -AcpiNsGetMaxDepth ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue) -{ - UINT32 *MaxLevel = (UINT32 *) Context; - - - if (Level > *MaxLevel) - { - *MaxLevel = Level; - } - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsDumpObjectPaths - * - * PARAMETERS: Type - Object type to be dumped - * DisplayType - 0 or ACPI_DISPLAY_SUMMARY - * MaxDepth - Maximum depth of dump. Use ACPI_UINT32_MAX - * for an effectively unlimited depth. - * OwnerId - Dump only objects owned by this ID. Use - * ACPI_UINT32_MAX to match all owners. - * StartHandle - Where in namespace to start/end search - * - * RETURN: None - * - * DESCRIPTION: Dump full object pathnames within the loaded namespace. Uses - * AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObjectPath. - * - ******************************************************************************/ - -void -AcpiNsDumpObjectPaths ( - ACPI_OBJECT_TYPE Type, - UINT8 DisplayType, - UINT32 MaxDepth, - ACPI_OWNER_ID OwnerId, - ACPI_HANDLE StartHandle) -{ - ACPI_STATUS Status; - UINT32 MaxLevel = 0; - - - ACPI_FUNCTION_ENTRY (); - - - /* - * Just lock the entire namespace for the duration of the dump. - * We don't want any changes to the namespace during this time, - * especially the temporary nodes since we are going to display - * them also. - */ - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not acquire namespace mutex\n"); - return; - } - - /* Get the max depth of the namespace tree, for formatting later */ - - (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, - ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES, - AcpiNsGetMaxDepth, NULL, (void *) &MaxLevel, NULL); - - /* Now dump the entire namespace */ - - (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, - ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES, - AcpiNsDumpOneObjectPath, NULL, (void *) &MaxLevel, NULL); - - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsDumpEntry - * - * PARAMETERS: Handle - Node to be dumped - * DebugLevel - Output level - * - * RETURN: None - * - * DESCRIPTION: Dump a single Node - * - ******************************************************************************/ - -void -AcpiNsDumpEntry ( - ACPI_HANDLE Handle, - UINT32 DebugLevel) -{ - ACPI_WALK_INFO Info; - - - ACPI_FUNCTION_ENTRY (); - - - Info.DebugLevel = DebugLevel; - Info.OwnerId = ACPI_OWNER_ID_MAX; - Info.DisplayType = ACPI_DISPLAY_SUMMARY; - - (void) AcpiNsDumpOneObject (Handle, 1, &Info, NULL); -} - - -#ifdef ACPI_ASL_COMPILER -/******************************************************************************* - * - * FUNCTION: AcpiNsDumpTables - * - * PARAMETERS: SearchBase - Root of subtree to be dumped, or - * NS_ALL to dump the entire namespace - * MaxDepth - Maximum depth of dump. Use INT_MAX - * for an effectively unlimited depth. - * - * RETURN: None - * - * DESCRIPTION: Dump the name space, or a portion of it. - * - ******************************************************************************/ - -void -AcpiNsDumpTables ( - ACPI_HANDLE SearchBase, - UINT32 MaxDepth) -{ - ACPI_HANDLE SearchHandle = SearchBase; - - - ACPI_FUNCTION_TRACE (NsDumpTables); - - - if (!AcpiGbl_RootNode) - { - /* - * If the name space has not been initialized, - * there is nothing to dump. - */ - ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, - "namespace not initialized!\n")); - return_VOID; - } - - if (ACPI_NS_ALL == SearchBase) - { - /* Entire namespace */ - - SearchHandle = AcpiGbl_RootNode; - ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n")); - } - - AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, MaxDepth, - ACPI_OWNER_ID_MAX, SearchHandle); - return_VOID; -} -#endif -#endif diff --git a/drivers/acpica/nsdumpdv.c b/drivers/acpica/nsdumpdv.c deleted file mode 100644 index 86471b8..0000000 --- a/drivers/acpica/nsdumpdv.c +++ /dev/null @@ -1,265 +0,0 @@ -/****************************************************************************** - * - * Module Name: nsdump - table dumping routines for debug - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" - - -/* TBD: This entire module is apparently obsolete and should be removed */ - -#define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nsdumpdv") - -#ifdef ACPI_OBSOLETE_FUNCTIONS -#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) - -#include "acnamesp.h" - -/******************************************************************************* - * - * FUNCTION: AcpiNsDumpOneDevice - * - * PARAMETERS: Handle - Node to be dumped - * Level - Nesting level of the handle - * Context - Passed into WalkNamespace - * ReturnValue - Not used - * - * RETURN: Status - * - * DESCRIPTION: Dump a single Node that represents a device - * This procedure is a UserFunction called by AcpiNsWalkNamespace. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiNsDumpOneDevice ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue) -{ - ACPI_BUFFER Buffer; - ACPI_DEVICE_INFO *Info; - ACPI_STATUS Status; - UINT32 i; - - - ACPI_FUNCTION_NAME (NsDumpOneDevice); - - - Status = AcpiNsDumpOneObject (ObjHandle, Level, Context, ReturnValue); - - Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiGetObjectInfo (ObjHandle, &Buffer); - if (ACPI_SUCCESS (Status)) - { - Info = Buffer.Pointer; - for (i = 0; i < Level; i++) - { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " ")); - } - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, - " HID: %s, ADR: %8.8X%8.8X\n", - Info->HardwareId.Value, ACPI_FORMAT_UINT64 (Info->Address))); - ACPI_FREE (Info); - } - - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsDumpRootDevices - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Dump all objects of type "device" - * - ******************************************************************************/ - -void -AcpiNsDumpRootDevices ( - void) -{ - ACPI_HANDLE SysBusHandle; - ACPI_STATUS Status; - - - ACPI_FUNCTION_NAME (NsDumpRootDevices); - - - /* Only dump the table if tracing is enabled */ - - if (!(ACPI_LV_TABLES & AcpiDbgLevel)) - { - return; - } - - Status = AcpiGetHandle (NULL, METHOD_NAME__SB_, &SysBusHandle); - if (ACPI_FAILURE (Status)) - { - return; - } - - ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, - "Display of all devices in the namespace:\n")); - - Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, SysBusHandle, - ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, - AcpiNsDumpOneDevice, NULL, NULL, NULL); -} - -#endif -#endif diff --git a/drivers/acpica/nseval.c b/drivers/acpica/nseval.c deleted file mode 100644 index 98353ea..0000000 --- a/drivers/acpica/nseval.c +++ /dev/null @@ -1,460 +0,0 @@ -/******************************************************************************* - * - * Module Name: nseval - Object evaluation, includes control method execution - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acparser.h" -#include "acinterp.h" -#include "acnamesp.h" - - -#define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nseval") - - -/******************************************************************************* - * - * FUNCTION: AcpiNsEvaluate - * - * PARAMETERS: Info - Evaluation info block, contains these fields - * and more: - * PrefixNode - Prefix or Method/Object Node to execute - * RelativePath - Name of method to execute, If NULL, the - * Node is the object to execute - * Parameters - List of parameters to pass to the method, - * terminated by NULL. Params itself may be - * NULL if no parameters are being passed. - * ParameterType - Type of Parameter list - * ReturnObject - Where to put method's return value (if - * any). If NULL, no value is returned. - * Flags - ACPI_IGNORE_RETURN_VALUE to delete return - * - * RETURN: Status - * - * DESCRIPTION: Execute a control method or return the current value of an - * ACPI namespace object. - * - * MUTEX: Locks interpreter - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsEvaluate ( - ACPI_EVALUATE_INFO *Info) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (NsEvaluate); - - - if (!Info) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - if (!Info->Node) - { - /* - * Get the actual namespace node for the target object if we - * need to. Handles these cases: - * - * 1) Null node, valid pathname from root (absolute path) - * 2) Node and valid pathname (path relative to Node) - * 3) Node, Null pathname - */ - Status = AcpiNsGetNode (Info->PrefixNode, Info->RelativePathname, - ACPI_NS_NO_UPSEARCH, &Info->Node); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - /* - * For a method alias, we must grab the actual method node so that - * proper scoping context will be established before execution. - */ - if (AcpiNsGetType (Info->Node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) - { - Info->Node = ACPI_CAST_PTR ( - ACPI_NAMESPACE_NODE, Info->Node->Object); - } - - /* Complete the info block initialization */ - - Info->ReturnObject = NULL; - Info->NodeFlags = Info->Node->Flags; - Info->ObjDesc = AcpiNsGetAttachedObject (Info->Node); - - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n", - Info->RelativePathname, Info->Node, - AcpiNsGetAttachedObject (Info->Node))); - - /* Get info if we have a predefined name (_HID, etc.) */ - - Info->Predefined = AcpiUtMatchPredefinedMethod (Info->Node->Name.Ascii); - - /* Get the full pathname to the object, for use in warning messages */ - - Info->FullPathname = AcpiNsGetNormalizedPathname (Info->Node, TRUE); - if (!Info->FullPathname) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Optional object evaluation log */ - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EVALUATION, - "%-26s: %s (%s)\n", " Enter evaluation", - &Info->FullPathname[1], AcpiUtGetTypeName (Info->Node->Type))); - - /* Count the number of arguments being passed in */ - - Info->ParamCount = 0; - if (Info->Parameters) - { - while (Info->Parameters[Info->ParamCount]) - { - Info->ParamCount++; - } - - /* Warn on impossible argument count */ - - if (Info->ParamCount > ACPI_METHOD_NUM_ARGS) - { - ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, ACPI_WARN_ALWAYS, - "Excess arguments (%u) - using only %u", - Info->ParamCount, ACPI_METHOD_NUM_ARGS)); - - Info->ParamCount = ACPI_METHOD_NUM_ARGS; - } - } - - /* - * For predefined names: Check that the declared argument count - * matches the ACPI spec -- otherwise this is a BIOS error. - */ - AcpiNsCheckAcpiCompliance (Info->FullPathname, Info->Node, - Info->Predefined); - - /* - * For all names: Check that the incoming argument count for - * this method/object matches the actual ASL/AML definition. - */ - AcpiNsCheckArgumentCount (Info->FullPathname, Info->Node, - Info->ParamCount, Info->Predefined); - - /* For predefined names: Typecheck all incoming arguments */ - - AcpiNsCheckArgumentTypes (Info); - - /* - * Three major evaluation cases: - * - * 1) Object types that cannot be evaluated by definition - * 2) The object is a control method -- execute it - * 3) The object is not a method -- just return it's current value - */ - switch (AcpiNsGetType (Info->Node)) - { - case ACPI_TYPE_ANY: - case ACPI_TYPE_DEVICE: - case ACPI_TYPE_EVENT: - case ACPI_TYPE_MUTEX: - case ACPI_TYPE_REGION: - case ACPI_TYPE_THERMAL: - case ACPI_TYPE_LOCAL_SCOPE: - /* - * 1) Disallow evaluation of these object types. For these, - * object evaluation is undefined. - */ - ACPI_ERROR ((AE_INFO, - "%s: This object type [%s] " - "never contains data and cannot be evaluated", - Info->FullPathname, AcpiUtGetTypeName (Info->Node->Type))); - - Status = AE_TYPE; - goto Cleanup; - - case ACPI_TYPE_METHOD: - /* - * 2) Object is a control method - execute it - */ - - /* Verify that there is a method object associated with this node */ - - if (!Info->ObjDesc) - { - ACPI_ERROR ((AE_INFO, "%s: Method has no attached sub-object", - Info->FullPathname)); - Status = AE_NULL_OBJECT; - goto Cleanup; - } - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "**** Execute method [%s] at AML address %p length %X\n", - Info->FullPathname, - Info->ObjDesc->Method.AmlStart + 1, - Info->ObjDesc->Method.AmlLength - 1)); - - /* - * Any namespace deletion must acquire both the namespace and - * interpreter locks to ensure that no thread is using the portion of - * the namespace that is being deleted. - * - * Execute the method via the interpreter. The interpreter is locked - * here before calling into the AML parser - */ - AcpiExEnterInterpreter (); - Status = AcpiPsExecuteMethod (Info); - AcpiExExitInterpreter (); - break; - - default: - /* - * 3) All other non-method objects -- get the current object value - */ - - /* - * Some objects require additional resolution steps (e.g., the Node - * may be a field that must be read, etc.) -- we can't just grab - * the object out of the node. - * - * Use ResolveNodeToValue() to get the associated value. - * - * NOTE: we can get away with passing in NULL for a walk state because - * the Node is guaranteed to not be a reference to either a method - * local or a method argument (because this interface is never called - * from a running method.) - * - * Even though we do not directly invoke the interpreter for object - * resolution, we must lock it because we could access an OpRegion. - * The OpRegion access code assumes that the interpreter is locked. - */ - AcpiExEnterInterpreter (); - - /* TBD: ResolveNodeToValue has a strange interface, fix */ - - Info->ReturnObject = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Info->Node); - - Status = AcpiExResolveNodeToValue (ACPI_CAST_INDIRECT_PTR ( - ACPI_NAMESPACE_NODE, &Info->ReturnObject), NULL); - AcpiExExitInterpreter (); - - if (ACPI_FAILURE (Status)) - { - Info->ReturnObject = NULL; - goto Cleanup; - } - - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Returned object %p [%s]\n", - Info->ReturnObject, - AcpiUtGetObjectTypeName (Info->ReturnObject))); - - Status = AE_CTRL_RETURN_VALUE; /* Always has a "return value" */ - break; - } - - /* - * For predefined names, check the return value against the ACPI - * specification. Some incorrect return value types are repaired. - */ - (void) AcpiNsCheckReturnValue (Info->Node, Info, Info->ParamCount, - Status, &Info->ReturnObject); - - /* Check if there is a return value that must be dealt with */ - - if (Status == AE_CTRL_RETURN_VALUE) - { - /* If caller does not want the return value, delete it */ - - if (Info->Flags & ACPI_IGNORE_RETURN_VALUE) - { - AcpiUtRemoveReference (Info->ReturnObject); - Info->ReturnObject = NULL; - } - - /* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */ - - Status = AE_OK; - } - else if (ACPI_FAILURE(Status)) - { - /* If ReturnObject exists, delete it */ - - if (Info->ReturnObject) - { - AcpiUtRemoveReference (Info->ReturnObject); - Info->ReturnObject = NULL; - } - } - - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "*** Completed evaluation of object %s ***\n", - Info->RelativePathname)); - -Cleanup: - /* Optional object evaluation log */ - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EVALUATION, - "%-26s: %s\n", " Exit evaluation", - &Info->FullPathname[1])); - - /* - * Namespace was unlocked by the handling AcpiNs* function, so we - * just free the pathname and return - */ - ACPI_FREE (Info->FullPathname); - Info->FullPathname = NULL; - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/nsinit.c b/drivers/acpica/nsinit.c deleted file mode 100644 index 50a2290..0000000 --- a/drivers/acpica/nsinit.c +++ /dev/null @@ -1,877 +0,0 @@ -/****************************************************************************** - * - * Module Name: nsinit - namespace initialization - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" -#include "acdispat.h" -#include "acinterp.h" -#include "acevents.h" - -#define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nsinit") - -/* Local prototypes */ - -static ACPI_STATUS -AcpiNsInitOneObject ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue); - -static ACPI_STATUS -AcpiNsInitOneDevice ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue); - -static ACPI_STATUS -AcpiNsFindIniMethods ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue); - - -/******************************************************************************* - * - * FUNCTION: AcpiNsInitializeObjects - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Walk the entire namespace and perform any necessary - * initialization on the objects found therein - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsInitializeObjects ( - void) -{ - ACPI_STATUS Status; - ACPI_INIT_WALK_INFO Info; - - - ACPI_FUNCTION_TRACE (NsInitializeObjects); - - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "[Init] Completing Initialization of ACPI Objects\n")); - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "**** Starting initialization of namespace objects ****\n")); - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - "Final data object initialization: ")); - - /* Clear the info block */ - - memset (&Info, 0, sizeof (ACPI_INIT_WALK_INFO)); - - /* Walk entire namespace from the supplied root */ - - /* - * TBD: will become ACPI_TYPE_PACKAGE as this type object - * is now the only one that supports deferred initialization - * (forward references). - */ - Status = AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, AcpiNsInitOneObject, NULL, &Info, NULL); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace")); - } - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - "Namespace contains %u (0x%X) objects\n", - Info.ObjectCount, - Info.ObjectCount)); - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "%u Control Methods found\n%u Op Regions found\n", - Info.MethodCount, Info.OpRegionCount)); - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsInitializeDevices - * - * PARAMETERS: None - * - * RETURN: ACPI_STATUS - * - * DESCRIPTION: Walk the entire namespace and initialize all ACPI devices. - * This means running _INI on all present devices. - * - * Note: We install PCI config space handler on region access, - * not here. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsInitializeDevices ( - UINT32 Flags) -{ - ACPI_STATUS Status = AE_OK; - ACPI_DEVICE_WALK_INFO Info; - ACPI_HANDLE Handle; - - - ACPI_FUNCTION_TRACE (NsInitializeDevices); - - - if (!(Flags & ACPI_NO_DEVICE_INIT)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "[Init] Initializing ACPI Devices\n")); - - /* Init counters */ - - Info.DeviceCount = 0; - Info.Num_STA = 0; - Info.Num_INI = 0; - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - "Initializing Device/Processor/Thermal objects " - "and executing _INI/_STA methods:\n")); - - /* Tree analysis: find all subtrees that contain _INI methods */ - - Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, FALSE, AcpiNsFindIniMethods, NULL, &Info, NULL); - if (ACPI_FAILURE (Status)) - { - goto ErrorExit; - } - - /* Allocate the evaluation information block */ - - Info.EvaluateInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO)); - if (!Info.EvaluateInfo) - { - Status = AE_NO_MEMORY; - goto ErrorExit; - } - - /* - * Execute the "global" _INI method that may appear at the root. - * This support is provided for Windows compatibility (Vista+) and - * is not part of the ACPI specification. - */ - Info.EvaluateInfo->PrefixNode = AcpiGbl_RootNode; - Info.EvaluateInfo->RelativePathname = METHOD_NAME__INI; - Info.EvaluateInfo->Parameters = NULL; - Info.EvaluateInfo->Flags = ACPI_IGNORE_RETURN_VALUE; - - Status = AcpiNsEvaluate (Info.EvaluateInfo); - if (ACPI_SUCCESS (Status)) - { - Info.Num_INI++; - } - - /* - * Execute \_SB._INI. - * There appears to be a strict order requirement for \_SB._INI, - * which should be evaluated before any _REG evaluations. - */ - Status = AcpiGetHandle (NULL, "\\_SB", &Handle); - if (ACPI_SUCCESS (Status)) - { - memset (Info.EvaluateInfo, 0, sizeof (ACPI_EVALUATE_INFO)); - Info.EvaluateInfo->PrefixNode = Handle; - Info.EvaluateInfo->RelativePathname = METHOD_NAME__INI; - Info.EvaluateInfo->Parameters = NULL; - Info.EvaluateInfo->Flags = ACPI_IGNORE_RETURN_VALUE; - - Status = AcpiNsEvaluate (Info.EvaluateInfo); - if (ACPI_SUCCESS (Status)) - { - Info.Num_INI++; - } - } - } - - /* - * Run all _REG methods - * - * Note: Any objects accessed by the _REG methods will be automatically - * initialized, even if they contain executable AML (see the call to - * AcpiNsInitializeObjects below). - * - * Note: According to the ACPI specification, we actually needn't execute - * _REG for SystemMemory/SystemIo operation regions, but for PCI_Config - * operation regions, it is required to evaluate _REG for those on a PCI - * root bus that doesn't contain _BBN object. So this code is kept here - * in order not to break things. - */ - if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "[Init] Executing _REG OpRegion methods\n")); - - Status = AcpiEvInitializeOpRegions (); - if (ACPI_FAILURE (Status)) - { - goto ErrorExit; - } - } - - if (!(Flags & ACPI_NO_DEVICE_INIT)) - { - /* Walk namespace to execute all _INIs on present devices */ - - Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, FALSE, AcpiNsInitOneDevice, NULL, &Info, NULL); - - /* - * Any _OSI requests should be completed by now. If the BIOS has - * requested any Windows OSI strings, we will always truncate - * I/O addresses to 16 bits -- for Windows compatibility. - */ - if (AcpiGbl_OsiData >= ACPI_OSI_WIN_2000) - { - AcpiGbl_TruncateIoAddresses = TRUE; - } - - ACPI_FREE (Info.EvaluateInfo); - if (ACPI_FAILURE (Status)) - { - goto ErrorExit; - } - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - " Executed %u _INI methods requiring %u _STA executions " - "(examined %u objects)\n", - Info.Num_INI, Info.Num_STA, Info.DeviceCount)); - } - - return_ACPI_STATUS (Status); - - -ErrorExit: - ACPI_EXCEPTION ((AE_INFO, Status, "During device initialization")); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsInitOnePackage - * - * PARAMETERS: ObjHandle - Node - * Level - Current nesting level - * Context - Not used - * ReturnValue - Not used - * - * RETURN: Status - * - * DESCRIPTION: Callback from AcpiWalkNamespace. Invoked for every package - * within the namespace. Used during dynamic load of an SSDT. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsInitOnePackage ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue) -{ - ACPI_STATUS Status; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; - - - ObjDesc = AcpiNsGetAttachedObject (Node); - if (!ObjDesc) - { - return (AE_OK); - } - - /* Exit if package is already initialized */ - - if (ObjDesc->Package.Flags & AOPOBJ_DATA_VALID) - { - return (AE_OK); - } - - Status = AcpiDsGetPackageArguments (ObjDesc); - if (ACPI_FAILURE (Status)) - { - return (AE_OK); - } - - Status = AcpiUtWalkPackageTree (ObjDesc, NULL, AcpiDsInitPackageElement, - NULL); - if (ACPI_FAILURE (Status)) - { - return (AE_OK); - } - - ObjDesc->Package.Flags |= AOPOBJ_DATA_VALID; - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsInitOneObject - * - * PARAMETERS: ObjHandle - Node - * Level - Current nesting level - * Context - Points to a init info struct - * ReturnValue - Not used - * - * RETURN: Status - * - * DESCRIPTION: Callback from AcpiWalkNamespace. Invoked for every object - * within the namespace. - * - * Currently, the only objects that require initialization are: - * 1) Methods - * 2) Op Regions - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiNsInitOneObject ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue) -{ - ACPI_OBJECT_TYPE Type; - ACPI_STATUS Status = AE_OK; - ACPI_INIT_WALK_INFO *Info = (ACPI_INIT_WALK_INFO *) Context; - ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; - ACPI_OPERAND_OBJECT *ObjDesc; - - - ACPI_FUNCTION_NAME (NsInitOneObject); - - - Info->ObjectCount++; - - /* And even then, we are only interested in a few object types */ - - Type = AcpiNsGetType (ObjHandle); - ObjDesc = AcpiNsGetAttachedObject (Node); - if (!ObjDesc) - { - return (AE_OK); - } - - /* Increment counters for object types we are looking for */ - - switch (Type) - { - case ACPI_TYPE_REGION: - - Info->OpRegionCount++; - break; - - case ACPI_TYPE_BUFFER_FIELD: - - Info->FieldCount++; - break; - - case ACPI_TYPE_LOCAL_BANK_FIELD: - - Info->FieldCount++; - break; - - case ACPI_TYPE_BUFFER: - - Info->BufferCount++; - break; - - case ACPI_TYPE_PACKAGE: - - Info->PackageCount++; - break; - - default: - - /* No init required, just exit now */ - - return (AE_OK); - } - - /* If the object is already initialized, nothing else to do */ - - if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) - { - return (AE_OK); - } - - /* Must lock the interpreter before executing AML code */ - - AcpiExEnterInterpreter (); - - /* - * Only initialization of Package objects can be deferred, in order - * to support forward references. - */ - switch (Type) - { - case ACPI_TYPE_LOCAL_BANK_FIELD: - - /* TBD: BankFields do not require deferred init, remove this code */ - - Info->FieldInit++; - Status = AcpiDsGetBankFieldArguments (ObjDesc); - break; - - case ACPI_TYPE_PACKAGE: - - /* Complete the initialization/resolution of the package object */ - - Info->PackageInit++; - Status = AcpiNsInitOnePackage (ObjHandle, Level, NULL, NULL); - break; - - default: - - /* No other types should get here */ - - Status = AE_TYPE; - ACPI_EXCEPTION ((AE_INFO, Status, - "Opcode is not deferred [%4.4s] (%s)", - AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Type))); - break; - } - - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Could not execute arguments for [%4.4s] (%s)", - AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Type))); - } - - /* - * We ignore errors from above, and always return OK, since we don't want - * to abort the walk on any single error. - */ - AcpiExExitInterpreter (); - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsFindIniMethods - * - * PARAMETERS: ACPI_WALK_CALLBACK - * - * RETURN: ACPI_STATUS - * - * DESCRIPTION: Called during namespace walk. Finds objects named _INI under - * device/processor/thermal objects, and marks the entire subtree - * with a SUBTREE_HAS_INI flag. This flag is used during the - * subsequent device initialization walk to avoid entire subtrees - * that do not contain an _INI. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiNsFindIniMethods ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue) -{ - ACPI_DEVICE_WALK_INFO *Info = ACPI_CAST_PTR (ACPI_DEVICE_WALK_INFO, Context); - ACPI_NAMESPACE_NODE *Node; - ACPI_NAMESPACE_NODE *ParentNode; - - - /* Keep count of device/processor/thermal objects */ - - Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle); - if ((Node->Type == ACPI_TYPE_DEVICE) || - (Node->Type == ACPI_TYPE_PROCESSOR) || - (Node->Type == ACPI_TYPE_THERMAL)) - { - Info->DeviceCount++; - return (AE_OK); - } - - /* We are only looking for methods named _INI */ - - if (!ACPI_COMPARE_NAMESEG (Node->Name.Ascii, METHOD_NAME__INI)) - { - return (AE_OK); - } - - /* - * The only _INI methods that we care about are those that are - * present under Device, Processor, and Thermal objects. - */ - ParentNode = Node->Parent; - switch (ParentNode->Type) - { - case ACPI_TYPE_DEVICE: - case ACPI_TYPE_PROCESSOR: - case ACPI_TYPE_THERMAL: - - /* Mark parent and bubble up the INI present flag to the root */ - - while (ParentNode) - { - ParentNode->Flags |= ANOBJ_SUBTREE_HAS_INI; - ParentNode = ParentNode->Parent; - } - break; - - default: - - break; - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsInitOneDevice - * - * PARAMETERS: ACPI_WALK_CALLBACK - * - * RETURN: ACPI_STATUS - * - * DESCRIPTION: This is called once per device soon after ACPI is enabled - * to initialize each device. It determines if the device is - * present, and if so, calls _INI. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiNsInitOneDevice ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue) -{ - ACPI_DEVICE_WALK_INFO *WalkInfo = ACPI_CAST_PTR (ACPI_DEVICE_WALK_INFO, Context); - ACPI_EVALUATE_INFO *Info = WalkInfo->EvaluateInfo; - UINT32 Flags; - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *DeviceNode; - - - ACPI_FUNCTION_TRACE (NsInitOneDevice); - - - /* We are interested in Devices, Processors and ThermalZones only */ - - DeviceNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle); - if ((DeviceNode->Type != ACPI_TYPE_DEVICE) && - (DeviceNode->Type != ACPI_TYPE_PROCESSOR) && - (DeviceNode->Type != ACPI_TYPE_THERMAL)) - { - return_ACPI_STATUS (AE_OK); - } - - /* - * Because of an earlier namespace analysis, all subtrees that contain an - * _INI method are tagged. - * - * If this device subtree does not contain any _INI methods, we - * can exit now and stop traversing this entire subtree. - */ - if (!(DeviceNode->Flags & ANOBJ_SUBTREE_HAS_INI)) - { - return_ACPI_STATUS (AE_CTRL_DEPTH); - } - - /* - * Run _STA to determine if this device is present and functioning. We - * must know this information for two important reasons (from ACPI spec): - * - * 1) We can only run _INI if the device is present. - * 2) We must abort the device tree walk on this subtree if the device is - * not present and is not functional (we will not examine the children) - * - * The _STA method is not required to be present under the device, we - * assume the device is present if _STA does not exist. - */ - ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname ( - ACPI_TYPE_METHOD, DeviceNode, METHOD_NAME__STA)); - - Status = AcpiUtExecute_STA (DeviceNode, &Flags); - if (ACPI_FAILURE (Status)) - { - /* Ignore error and move on to next device */ - - return_ACPI_STATUS (AE_OK); - } - - /* - * Flags == -1 means that _STA was not found. In this case, we assume that - * the device is both present and functional. - * - * From the ACPI spec, description of _STA: - * - * "If a device object (including the processor object) does not have an - * _STA object, then OSPM assumes that all of the above bits are set (in - * other words, the device is present, ..., and functioning)" - */ - if (Flags != ACPI_UINT32_MAX) - { - WalkInfo->Num_STA++; - } - - /* - * Examine the PRESENT and FUNCTIONING status bits - * - * Note: ACPI spec does not seem to specify behavior for the present but - * not functioning case, so we assume functioning if present. - */ - if (!(Flags & ACPI_STA_DEVICE_PRESENT)) - { - /* Device is not present, we must examine the Functioning bit */ - - if (Flags & ACPI_STA_DEVICE_FUNCTIONING) - { - /* - * Device is not present but is "functioning". In this case, - * we will not run _INI, but we continue to examine the children - * of this device. - * - * From the ACPI spec, description of _STA: (Note - no mention - * of whether to run _INI or not on the device in question) - * - * "_STA may return bit 0 clear (not present) with bit 3 set - * (device is functional). This case is used to indicate a valid - * device for which no device driver should be loaded (for example, - * a bridge device.) Children of this device may be present and - * valid. OSPM should continue enumeration below a device whose - * _STA returns this bit combination" - */ - return_ACPI_STATUS (AE_OK); - } - else - { - /* - * Device is not present and is not functioning. We must abort the - * walk of this subtree immediately -- don't look at the children - * of such a device. - * - * From the ACPI spec, description of _INI: - * - * "If the _STA method indicates that the device is not present, - * OSPM will not run the _INI and will not examine the children - * of the device for _INI methods" - */ - return_ACPI_STATUS (AE_CTRL_DEPTH); - } - } - - /* - * The device is present or is assumed present if no _STA exists. - * Run the _INI if it exists (not required to exist) - * - * Note: We know there is an _INI within this subtree, but it may not be - * under this particular device, it may be lower in the branch. - */ - if (!ACPI_COMPARE_NAMESEG (DeviceNode->Name.Ascii, "_SB_") || - DeviceNode->Parent != AcpiGbl_RootNode) - { - ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname ( - ACPI_TYPE_METHOD, DeviceNode, METHOD_NAME__INI)); - - memset (Info, 0, sizeof (ACPI_EVALUATE_INFO)); - Info->PrefixNode = DeviceNode; - Info->RelativePathname = METHOD_NAME__INI; - Info->Parameters = NULL; - Info->Flags = ACPI_IGNORE_RETURN_VALUE; - - Status = AcpiNsEvaluate (Info); - if (ACPI_SUCCESS (Status)) - { - WalkInfo->Num_INI++; - } - -#ifdef ACPI_DEBUG_OUTPUT - else if (Status != AE_NOT_FOUND) - { - /* Ignore error and move on to next device */ - - char *ScopeName = AcpiNsGetNormalizedPathname (DeviceNode, TRUE); - - ACPI_EXCEPTION ((AE_INFO, Status, "during %s._INI execution", - ScopeName)); - ACPI_FREE (ScopeName); - } -#endif - } - - /* Ignore errors from above */ - - Status = AE_OK; - - /* - * The _INI method has been run if present; call the Global Initialization - * Handler for this device. - */ - if (AcpiGbl_InitHandler) - { - Status = AcpiGbl_InitHandler (DeviceNode, ACPI_INIT_DEVICE_INI); - } - - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/nsload.c b/drivers/acpica/nsload.c deleted file mode 100644 index 5e90b3b..0000000 --- a/drivers/acpica/nsload.c +++ /dev/null @@ -1,466 +0,0 @@ -/****************************************************************************** - * - * Module Name: nsload - namespace loading/expanding/contracting procedures - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" -#include "acdispat.h" -#include "actables.h" -#include "acinterp.h" - - -#define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nsload") - -/* Local prototypes */ - -#ifdef ACPI_FUTURE_IMPLEMENTATION -ACPI_STATUS -AcpiNsUnloadNamespace ( - ACPI_HANDLE Handle); - -static ACPI_STATUS -AcpiNsDeleteSubtree ( - ACPI_HANDLE StartHandle); -#endif - - -/******************************************************************************* - * - * FUNCTION: AcpiNsLoadTable - * - * PARAMETERS: TableIndex - Index for table to be loaded - * Node - Owning NS node - * - * RETURN: Status - * - * DESCRIPTION: Load one ACPI table into the namespace - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsLoadTable ( - UINT32 TableIndex, - ACPI_NAMESPACE_NODE *Node) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (NsLoadTable); - - - /* If table already loaded into namespace, just return */ - - if (AcpiTbIsTableLoaded (TableIndex)) - { - Status = AE_ALREADY_EXISTS; - goto Unlock; - } - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "**** Loading table into namespace ****\n")); - - Status = AcpiTbAllocateOwnerId (TableIndex); - if (ACPI_FAILURE (Status)) - { - goto Unlock; - } - - /* - * Parse the table and load the namespace with all named - * objects found within. Control methods are NOT parsed - * at this time. In fact, the control methods cannot be - * parsed until the entire namespace is loaded, because - * if a control method makes a forward reference (call) - * to another control method, we can't continue parsing - * because we don't know how many arguments to parse next! - */ - Status = AcpiNsParseTable (TableIndex, Node); - if (ACPI_SUCCESS (Status)) - { - AcpiTbSetTableLoadedFlag (TableIndex, TRUE); - } - else - { - /* - * On error, delete any namespace objects created by this table. - * We cannot initialize these objects, so delete them. There are - * a couple of especially bad cases: - * AE_ALREADY_EXISTS - namespace collision. - * AE_NOT_FOUND - the target of a Scope operator does not - * exist. This target of Scope must already exist in the - * namespace, as per the ACPI specification. - */ - AcpiNsDeleteNamespaceByOwner ( - AcpiGbl_RootTableList.Tables[TableIndex].OwnerId); - - AcpiTbReleaseOwnerId (TableIndex); - return_ACPI_STATUS (Status); - } - -Unlock: - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* - * Now we can parse the control methods. We always parse - * them here for a sanity check, and if configured for - * just-in-time parsing, we delete the control method - * parse trees. - */ - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "**** Begin Table Object Initialization\n")); - - AcpiExEnterInterpreter (); - Status = AcpiDsInitializeObjects (TableIndex, Node); - AcpiExExitInterpreter (); - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "**** Completed Table Object Initialization\n")); - - return_ACPI_STATUS (Status); -} - - -#ifdef ACPI_OBSOLETE_FUNCTIONS -/******************************************************************************* - * - * FUNCTION: AcpiLoadNamespace - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Load the name space from what ever is pointed to by DSDT. - * (DSDT points to either the BIOS or a buffer.) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsLoadNamespace ( - void) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiLoadNameSpace); - - - /* There must be at least a DSDT installed */ - - if (AcpiGbl_DSDT == NULL) - { - ACPI_ERROR ((AE_INFO, "DSDT is not in memory")); - return_ACPI_STATUS (AE_NO_ACPI_TABLES); - } - - /* - * Load the namespace. The DSDT is required, - * but the SSDT and PSDT tables are optional. - */ - Status = AcpiNsLoadTableByType (ACPI_TABLE_ID_DSDT); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Ignore exceptions from these */ - - (void) AcpiNsLoadTableByType (ACPI_TABLE_ID_SSDT); - (void) AcpiNsLoadTableByType (ACPI_TABLE_ID_PSDT); - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - "ACPI Namespace successfully loaded at root %p\n", - AcpiGbl_RootNode)); - - return_ACPI_STATUS (Status); -} -#endif - -#ifdef ACPI_FUTURE_IMPLEMENTATION -/******************************************************************************* - * - * FUNCTION: AcpiNsDeleteSubtree - * - * PARAMETERS: StartHandle - Handle in namespace where search begins - * - * RETURNS Status - * - * DESCRIPTION: Walks the namespace starting at the given handle and deletes - * all objects, entries, and scopes in the entire subtree. - * - * Namespace/Interpreter should be locked or the subsystem should - * be in shutdown before this routine is called. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiNsDeleteSubtree ( - ACPI_HANDLE StartHandle) -{ - ACPI_STATUS Status; - ACPI_HANDLE ChildHandle; - ACPI_HANDLE ParentHandle; - ACPI_HANDLE NextChildHandle; - ACPI_HANDLE Dummy; - UINT32 Level; - - - ACPI_FUNCTION_TRACE (NsDeleteSubtree); - - - ParentHandle = StartHandle; - ChildHandle = NULL; - Level = 1; - - /* - * Traverse the tree of objects until we bubble back up - * to where we started. - */ - while (Level > 0) - { - /* Attempt to get the next object in this scope */ - - Status = AcpiGetNextObject (ACPI_TYPE_ANY, ParentHandle, - ChildHandle, &NextChildHandle); - - ChildHandle = NextChildHandle; - - /* Did we get a new object? */ - - if (ACPI_SUCCESS (Status)) - { - /* Check if this object has any children */ - - if (ACPI_SUCCESS (AcpiGetNextObject (ACPI_TYPE_ANY, ChildHandle, - NULL, &Dummy))) - { - /* - * There is at least one child of this object, - * visit the object - */ - Level++; - ParentHandle = ChildHandle; - ChildHandle = NULL; - } - } - else - { - /* - * No more children in this object, go back up to - * the object's parent - */ - Level--; - - /* Delete all children now */ - - AcpiNsDeleteChildren (ChildHandle); - - ChildHandle = ParentHandle; - Status = AcpiGetParent (ParentHandle, &ParentHandle); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - } - - /* Now delete the starting object, and we are done */ - - AcpiNsRemoveNode (ChildHandle); - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsUnloadNameSpace - * - * PARAMETERS: Handle - Root of namespace subtree to be deleted - * - * RETURN: Status - * - * DESCRIPTION: Shrinks the namespace, typically in response to an undocking - * event. Deletes an entire subtree starting from (and - * including) the given handle. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsUnloadNamespace ( - ACPI_HANDLE Handle) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (NsUnloadNameSpace); - - - /* Parameter validation */ - - if (!AcpiGbl_RootNode) - { - return_ACPI_STATUS (AE_NO_NAMESPACE); - } - - if (!Handle) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* This function does the real work */ - - Status = AcpiNsDeleteSubtree (Handle); - return_ACPI_STATUS (Status); -} -#endif diff --git a/drivers/acpica/nsnames.c b/drivers/acpica/nsnames.c deleted file mode 100644 index 64a9109..0000000 --- a/drivers/acpica/nsnames.c +++ /dev/null @@ -1,678 +0,0 @@ -/******************************************************************************* - * - * Module Name: nsnames - Name manipulation and search - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "amlcode.h" -#include "acnamesp.h" - - -#define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nsnames") - - -/******************************************************************************* - * - * FUNCTION: AcpiNsGetExternalPathname - * - * PARAMETERS: Node - Namespace node whose pathname is needed - * - * RETURN: Pointer to storage containing the fully qualified name of - * the node, In external format (name segments separated by path - * separators.) - * - * DESCRIPTION: Used to obtain the full pathname to a namespace node, usually - * for error and debug statements. - * - ******************************************************************************/ - -char * -AcpiNsGetExternalPathname ( - ACPI_NAMESPACE_NODE *Node) -{ - char *NameBuffer; - - - ACPI_FUNCTION_TRACE_PTR (NsGetExternalPathname, Node); - - - NameBuffer = AcpiNsGetNormalizedPathname (Node, FALSE); - return_PTR (NameBuffer); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsGetPathnameLength - * - * PARAMETERS: Node - Namespace node - * - * RETURN: Length of path, including prefix - * - * DESCRIPTION: Get the length of the pathname string for this node - * - ******************************************************************************/ - -ACPI_SIZE -AcpiNsGetPathnameLength ( - ACPI_NAMESPACE_NODE *Node) -{ - ACPI_SIZE Size; - - - /* Validate the Node */ - - if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) - { - ACPI_ERROR ((AE_INFO, - "Invalid/cached reference target node: %p, descriptor type %d", - Node, ACPI_GET_DESCRIPTOR_TYPE (Node))); - return (0); - } - - Size = AcpiNsBuildNormalizedPath (Node, NULL, 0, FALSE); - return (Size); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsHandleToName - * - * PARAMETERS: TargetHandle - Handle of named object whose name is - * to be found - * Buffer - Where the name is returned - * - * RETURN: Status, Buffer is filled with name if status is AE_OK - * - * DESCRIPTION: Build and return a full namespace name - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsHandleToName ( - ACPI_HANDLE TargetHandle, - ACPI_BUFFER *Buffer) -{ - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node; - const char *NodeName; - - - ACPI_FUNCTION_TRACE_PTR (NsHandleToName, TargetHandle); - - - Node = AcpiNsValidateHandle (TargetHandle); - if (!Node) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* Validate/Allocate/Clear caller buffer */ - - Status = AcpiUtInitializeBuffer (Buffer, ACPI_PATH_SEGMENT_LENGTH); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Just copy the ACPI name from the Node and zero terminate it */ - - NodeName = AcpiUtGetNodeName (Node); - ACPI_COPY_NAMESEG (Buffer->Pointer, NodeName); - ((char *) Buffer->Pointer) [ACPI_NAMESEG_SIZE] = 0; - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%4.4s\n", (char *) Buffer->Pointer)); - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsHandleToPathname - * - * PARAMETERS: TargetHandle - Handle of named object whose name is - * to be found - * Buffer - Where the pathname is returned - * NoTrailing - Remove trailing '_' for each name - * segment - * - * RETURN: Status, Buffer is filled with pathname if status is AE_OK - * - * DESCRIPTION: Build and return a full namespace pathname - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsHandleToPathname ( - ACPI_HANDLE TargetHandle, - ACPI_BUFFER *Buffer, - BOOLEAN NoTrailing) -{ - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node; - ACPI_SIZE RequiredSize; - - - ACPI_FUNCTION_TRACE_PTR (NsHandleToPathname, TargetHandle); - - - Node = AcpiNsValidateHandle (TargetHandle); - if (!Node) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* Determine size required for the caller buffer */ - - RequiredSize = AcpiNsBuildNormalizedPath (Node, NULL, 0, NoTrailing); - if (!RequiredSize) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* Validate/Allocate/Clear caller buffer */ - - Status = AcpiUtInitializeBuffer (Buffer, RequiredSize); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Build the path in the caller buffer */ - - (void) AcpiNsBuildNormalizedPath (Node, Buffer->Pointer, - (UINT32) RequiredSize, NoTrailing); - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s [%X]\n", - (char *) Buffer->Pointer, (UINT32) RequiredSize)); - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsBuildNormalizedPath - * - * PARAMETERS: Node - Namespace node - * FullPath - Where the path name is returned - * PathSize - Size of returned path name buffer - * NoTrailing - Remove trailing '_' from each name segment - * - * RETURN: Return 1 if the AML path is empty, otherwise returning (length - * of pathname + 1) which means the 'FullPath' contains a trailing - * null. - * - * DESCRIPTION: Build and return a full namespace pathname. - * Note that if the size of 'FullPath' isn't large enough to - * contain the namespace node's path name, the actual required - * buffer length is returned, and it should be greater than - * 'PathSize'. So callers are able to check the returning value - * to determine the buffer size of 'FullPath'. - * - ******************************************************************************/ - -UINT32 -AcpiNsBuildNormalizedPath ( - ACPI_NAMESPACE_NODE *Node, - char *FullPath, - UINT32 PathSize, - BOOLEAN NoTrailing) -{ - UINT32 Length = 0, i; - char Name[ACPI_NAMESEG_SIZE] ACPI_NONSTRING; - BOOLEAN DoNoTrailing; - char c, *Left, *Right; - ACPI_NAMESPACE_NODE *NextNode; - - - ACPI_FUNCTION_TRACE_PTR (NsBuildNormalizedPath, Node); - - -#define ACPI_PATH_PUT8(Path, Size, Byte, Length) \ - do { \ - if ((Length) < (Size)) \ - { \ - (Path)[(Length)] = (Byte); \ - } \ - (Length)++; \ - } while (0) - - /* - * Make sure the PathSize is correct, so that we don't need to - * validate both FullPath and PathSize. - */ - if (!FullPath) - { - PathSize = 0; - } - - if (!Node) - { - goto BuildTrailingNull; - } - - NextNode = Node; - while (NextNode && NextNode != AcpiGbl_RootNode) - { - if (NextNode != Node) - { - ACPI_PATH_PUT8(FullPath, PathSize, AML_DUAL_NAME_PREFIX, Length); - } - - ACPI_MOVE_32_TO_32 (Name, &NextNode->Name); - DoNoTrailing = NoTrailing; - for (i = 0; i < 4; i++) - { - c = Name[4-i-1]; - if (DoNoTrailing && c != '_') - { - DoNoTrailing = FALSE; - } - if (!DoNoTrailing) - { - ACPI_PATH_PUT8(FullPath, PathSize, c, Length); - } - } - - NextNode = NextNode->Parent; - } - - ACPI_PATH_PUT8(FullPath, PathSize, AML_ROOT_PREFIX, Length); - - /* Reverse the path string */ - - if (Length <= PathSize) - { - Left = FullPath; - Right = FullPath+Length - 1; - - while (Left < Right) - { - c = *Left; - *Left++ = *Right; - *Right-- = c; - } - } - - /* Append the trailing null */ - -BuildTrailingNull: - ACPI_PATH_PUT8 (FullPath, PathSize, '\0', Length); - -#undef ACPI_PATH_PUT8 - - return_UINT32 (Length); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsGetNormalizedPathname - * - * PARAMETERS: Node - Namespace node whose pathname is needed - * NoTrailing - Remove trailing '_' from each name segment - * - * RETURN: Pointer to storage containing the fully qualified name of - * the node, In external format (name segments separated by path - * separators.) - * - * DESCRIPTION: Used to obtain the full pathname to a namespace node, usually - * for error and debug statements. All trailing '_' will be - * removed from the full pathname if 'NoTrailing' is specified.. - * - ******************************************************************************/ - -char * -AcpiNsGetNormalizedPathname ( - ACPI_NAMESPACE_NODE *Node, - BOOLEAN NoTrailing) -{ - char *NameBuffer; - ACPI_SIZE Size; - - - ACPI_FUNCTION_TRACE_PTR (NsGetNormalizedPathname, Node); - - - /* Calculate required buffer size based on depth below root */ - - Size = AcpiNsBuildNormalizedPath (Node, NULL, 0, NoTrailing); - if (!Size) - { - return_PTR (NULL); - } - - /* Allocate a buffer to be returned to caller */ - - NameBuffer = ACPI_ALLOCATE_ZEROED (Size); - if (!NameBuffer) - { - ACPI_ERROR ((AE_INFO, - "Could not allocate %u bytes", (UINT32) Size)); - return_PTR (NULL); - } - - /* Build the path in the allocated buffer */ - - (void) AcpiNsBuildNormalizedPath (Node, NameBuffer, (UINT32) Size, NoTrailing); - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_NAMES, "%s: Path \"%s\"\n", - ACPI_GET_FUNCTION_NAME, NameBuffer)); - - return_PTR (NameBuffer); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsBuildPrefixedPathname - * - * PARAMETERS: PrefixScope - Scope/Path that prefixes the internal path - * InternalPath - Name or path of the namespace node - * - * RETURN: None - * - * DESCRIPTION: Construct a fully qualified pathname from a concatenation of: - * 1) Path associated with the PrefixScope namespace node - * 2) External path representation of the Internal path - * - ******************************************************************************/ - -char * -AcpiNsBuildPrefixedPathname ( - ACPI_GENERIC_STATE *PrefixScope, - const char *InternalPath) -{ - ACPI_STATUS Status; - char *FullPath = NULL; - char *ExternalPath = NULL; - char *PrefixPath = NULL; - ACPI_SIZE PrefixPathLength = 0; - - - /* If there is a prefix, get the pathname to it */ - - if (PrefixScope && PrefixScope->Scope.Node) - { - PrefixPath = AcpiNsGetNormalizedPathname (PrefixScope->Scope.Node, TRUE); - if (PrefixPath) - { - PrefixPathLength = strlen (PrefixPath); - } - } - - Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, InternalPath, - NULL, &ExternalPath); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - /* Merge the prefix path and the path. 2 is for one dot and trailing null */ - - FullPath = ACPI_ALLOCATE_ZEROED ( - PrefixPathLength + strlen (ExternalPath) + 2); - if (!FullPath) - { - goto Cleanup; - } - - /* Don't merge if the External path is already fully qualified */ - - if (PrefixPath && - (*ExternalPath != '\\') && - (*ExternalPath != '^')) - { - strcat (FullPath, PrefixPath); - if (PrefixPath[1]) - { - strcat (FullPath, "."); - } - } - - AcpiNsNormalizePathname (ExternalPath); - strcat (FullPath, ExternalPath); - -Cleanup: - if (PrefixPath) - { - ACPI_FREE (PrefixPath); - } - if (ExternalPath) - { - ACPI_FREE (ExternalPath); - } - - return (FullPath); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsNormalizePathname - * - * PARAMETERS: OriginalPath - Path to be normalized, in External format - * - * RETURN: The original path is processed in-place - * - * DESCRIPTION: Remove trailing underscores from each element of a path. - * - * For example: \A___.B___.C___ becomes \A.B.C - * - ******************************************************************************/ - -void -AcpiNsNormalizePathname ( - char *OriginalPath) -{ - char *InputPath = OriginalPath; - char *NewPathBuffer; - char *NewPath; - UINT32 i; - - - /* Allocate a temp buffer in which to construct the new path */ - - NewPathBuffer = ACPI_ALLOCATE_ZEROED (strlen (InputPath) + 1); - NewPath = NewPathBuffer; - if (!NewPathBuffer) - { - return; - } - - /* Special characters may appear at the beginning of the path */ - - if (*InputPath == '\\') - { - *NewPath = *InputPath; - NewPath++; - InputPath++; - } - - while (*InputPath == '^') - { - *NewPath = *InputPath; - NewPath++; - InputPath++; - } - - /* Remainder of the path */ - - while (*InputPath) - { - /* Do one nameseg at a time */ - - for (i = 0; (i < ACPI_NAMESEG_SIZE) && *InputPath; i++) - { - if ((i == 0) || (*InputPath != '_')) /* First char is allowed to be underscore */ - { - *NewPath = *InputPath; - NewPath++; - } - - InputPath++; - } - - /* Dot means that there are more namesegs to come */ - - if (*InputPath == '.') - { - *NewPath = *InputPath; - NewPath++; - InputPath++; - } - } - - *NewPath = 0; - strcpy (OriginalPath, NewPathBuffer); - ACPI_FREE (NewPathBuffer); -} diff --git a/drivers/acpica/nsobject.c b/drivers/acpica/nsobject.c deleted file mode 100644 index aec3991..0000000 --- a/drivers/acpica/nsobject.c +++ /dev/null @@ -1,628 +0,0 @@ -/******************************************************************************* - * - * Module Name: nsobject - Utilities for objects attached to namespace - * table entries - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" - - -#define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nsobject") - - -/******************************************************************************* - * - * FUNCTION: AcpiNsAttachObject - * - * PARAMETERS: Node - Parent Node - * Object - Object to be attached - * Type - Type of object, or ACPI_TYPE_ANY if not - * known - * - * RETURN: Status - * - * DESCRIPTION: Record the given object as the value associated with the - * name whose ACPI_HANDLE is passed. If Object is NULL - * and Type is ACPI_TYPE_ANY, set the name as having no value. - * Note: Future may require that the Node->Flags field be passed - * as a parameter. - * - * MUTEX: Assumes namespace is locked - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsAttachObject ( - ACPI_NAMESPACE_NODE *Node, - ACPI_OPERAND_OBJECT *Object, - ACPI_OBJECT_TYPE Type) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_OPERAND_OBJECT *LastObjDesc; - ACPI_OBJECT_TYPE ObjectType = ACPI_TYPE_ANY; - - - ACPI_FUNCTION_TRACE (NsAttachObject); - - - /* - * Parameter validation - */ - if (!Node) - { - /* Invalid handle */ - - ACPI_ERROR ((AE_INFO, "Null NamedObj handle")); - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - if (!Object && (ACPI_TYPE_ANY != Type)) - { - /* Null object */ - - ACPI_ERROR ((AE_INFO, - "Null object, but type not ACPI_TYPE_ANY")); - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) - { - /* Not a name handle */ - - ACPI_ERROR ((AE_INFO, "Invalid handle %p [%s]", - Node, AcpiUtGetDescriptorName (Node))); - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* Check if this object is already attached */ - - if (Node->Object == Object) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Obj %p already installed in NameObj %p\n", - Object, Node)); - - return_ACPI_STATUS (AE_OK); - } - - /* If null object, we will just install it */ - - if (!Object) - { - ObjDesc = NULL; - ObjectType = ACPI_TYPE_ANY; - } - - /* - * If the source object is a namespace Node with an attached object, - * we will use that (attached) object - */ - else if ((ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED) && - ((ACPI_NAMESPACE_NODE *) Object)->Object) - { - /* - * Value passed is a name handle and that name has a - * non-null value. Use that name's value and type. - */ - ObjDesc = ((ACPI_NAMESPACE_NODE *) Object)->Object; - ObjectType = ((ACPI_NAMESPACE_NODE *) Object)->Type; - } - - /* - * Otherwise, we will use the parameter object, but we must type - * it first - */ - else - { - ObjDesc = (ACPI_OPERAND_OBJECT *) Object; - - /* Use the given type */ - - ObjectType = Type; - } - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Installing %p into Node %p [%4.4s]\n", - ObjDesc, Node, AcpiUtGetNodeName (Node))); - - /* Detach an existing attached object if present */ - - if (Node->Object) - { - AcpiNsDetachObject (Node); - } - - if (ObjDesc) - { - /* - * Must increment the new value's reference count - * (if it is an internal object) - */ - AcpiUtAddReference (ObjDesc); - - /* - * Handle objects with multiple descriptors - walk - * to the end of the descriptor list - */ - LastObjDesc = ObjDesc; - while (LastObjDesc->Common.NextObject) - { - LastObjDesc = LastObjDesc->Common.NextObject; - } - - /* Install the object at the front of the object list */ - - LastObjDesc->Common.NextObject = Node->Object; - } - - Node->Type = (UINT8) ObjectType; - Node->Object = ObjDesc; - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsDetachObject - * - * PARAMETERS: Node - A Namespace node whose object will be detached - * - * RETURN: None. - * - * DESCRIPTION: Detach/delete an object associated with a namespace node. - * if the object is an allocated object, it is freed. - * Otherwise, the field is simply cleared. - * - ******************************************************************************/ - -void -AcpiNsDetachObject ( - ACPI_NAMESPACE_NODE *Node) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - - - ACPI_FUNCTION_TRACE (NsDetachObject); - - - ObjDesc = Node->Object; - - if (!ObjDesc || - (ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA)) - { - return_VOID; - } - - if (Node->Flags & ANOBJ_ALLOCATED_BUFFER) - { - /* Free the dynamic aml buffer */ - - if (ObjDesc->Common.Type == ACPI_TYPE_METHOD) - { - ACPI_FREE (ObjDesc->Method.AmlStart); - } - } - - if (ObjDesc->Common.Type == ACPI_TYPE_REGION) - { - AcpiUtRemoveAddressRange(ObjDesc->Region.SpaceId, Node); - } - - /* Clear the Node entry in all cases */ - - Node->Object = NULL; - if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND) - { - /* Unlink object from front of possible object list */ - - Node->Object = ObjDesc->Common.NextObject; - - /* Handle possible 2-descriptor object */ - - if (Node->Object && - (Node->Object->Common.Type != ACPI_TYPE_LOCAL_DATA)) - { - Node->Object = Node->Object->Common.NextObject; - } - - /* - * Detach the object from any data objects (which are still held by - * the namespace node) - */ - if (ObjDesc->Common.NextObject && - ((ObjDesc->Common.NextObject)->Common.Type == ACPI_TYPE_LOCAL_DATA)) - { - ObjDesc->Common.NextObject = NULL; - } - } - - /* Reset the node type to untyped */ - - Node->Type = ACPI_TYPE_ANY; - - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Node %p [%4.4s] Object %p\n", - Node, AcpiUtGetNodeName (Node), ObjDesc)); - - /* Remove one reference on the object (and all subobjects) */ - - AcpiUtRemoveReference (ObjDesc); - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsGetAttachedObject - * - * PARAMETERS: Node - Namespace node - * - * RETURN: Current value of the object field from the Node whose - * handle is passed - * - * DESCRIPTION: Obtain the object attached to a namespace node. - * - ******************************************************************************/ - -ACPI_OPERAND_OBJECT * -AcpiNsGetAttachedObject ( - ACPI_NAMESPACE_NODE *Node) -{ - ACPI_FUNCTION_TRACE_PTR (NsGetAttachedObject, Node); - - - if (!Node) - { - ACPI_WARNING ((AE_INFO, "Null Node ptr")); - return_PTR (NULL); - } - - if (!Node->Object || - ((ACPI_GET_DESCRIPTOR_TYPE (Node->Object) != ACPI_DESC_TYPE_OPERAND) && - (ACPI_GET_DESCRIPTOR_TYPE (Node->Object) != ACPI_DESC_TYPE_NAMED)) || - ((Node->Object)->Common.Type == ACPI_TYPE_LOCAL_DATA)) - { - return_PTR (NULL); - } - - return_PTR (Node->Object); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsGetSecondaryObject - * - * PARAMETERS: Node - Namespace node - * - * RETURN: Current value of the object field from the Node whose - * handle is passed. - * - * DESCRIPTION: Obtain a secondary object associated with a namespace node. - * - ******************************************************************************/ - -ACPI_OPERAND_OBJECT * -AcpiNsGetSecondaryObject ( - ACPI_OPERAND_OBJECT *ObjDesc) -{ - ACPI_FUNCTION_TRACE_PTR (NsGetSecondaryObject, ObjDesc); - - - if ((!ObjDesc) || - (ObjDesc->Common.Type== ACPI_TYPE_LOCAL_DATA) || - (!ObjDesc->Common.NextObject) || - ((ObjDesc->Common.NextObject)->Common.Type == ACPI_TYPE_LOCAL_DATA)) - { - return_PTR (NULL); - } - - return_PTR (ObjDesc->Common.NextObject); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsAttachData - * - * PARAMETERS: Node - Namespace node - * Handler - Handler to be associated with the data - * Data - Data to be attached - * - * RETURN: Status - * - * DESCRIPTION: Low-level attach data. Create and attach a Data object. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsAttachData ( - ACPI_NAMESPACE_NODE *Node, - ACPI_OBJECT_HANDLER Handler, - void *Data) -{ - ACPI_OPERAND_OBJECT *PrevObjDesc; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_OPERAND_OBJECT *DataDesc; - - - /* We only allow one attachment per handler */ - - PrevObjDesc = NULL; - ObjDesc = Node->Object; - while (ObjDesc) - { - if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA) && - (ObjDesc->Data.Handler == Handler)) - { - return (AE_ALREADY_EXISTS); - } - - PrevObjDesc = ObjDesc; - ObjDesc = ObjDesc->Common.NextObject; - } - - /* Create an internal object for the data */ - - DataDesc = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_DATA); - if (!DataDesc) - { - return (AE_NO_MEMORY); - } - - DataDesc->Data.Handler = Handler; - DataDesc->Data.Pointer = Data; - - /* Install the data object */ - - if (PrevObjDesc) - { - PrevObjDesc->Common.NextObject = DataDesc; - } - else - { - Node->Object = DataDesc; - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsDetachData - * - * PARAMETERS: Node - Namespace node - * Handler - Handler associated with the data - * - * RETURN: Status - * - * DESCRIPTION: Low-level detach data. Delete the data node, but the caller - * is responsible for the actual data. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsDetachData ( - ACPI_NAMESPACE_NODE *Node, - ACPI_OBJECT_HANDLER Handler) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_OPERAND_OBJECT *PrevObjDesc; - - - PrevObjDesc = NULL; - ObjDesc = Node->Object; - while (ObjDesc) - { - if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA) && - (ObjDesc->Data.Handler == Handler)) - { - if (PrevObjDesc) - { - PrevObjDesc->Common.NextObject = ObjDesc->Common.NextObject; - } - else - { - Node->Object = ObjDesc->Common.NextObject; - } - - AcpiUtRemoveReference (ObjDesc); - return (AE_OK); - } - - PrevObjDesc = ObjDesc; - ObjDesc = ObjDesc->Common.NextObject; - } - - return (AE_NOT_FOUND); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsGetAttachedData - * - * PARAMETERS: Node - Namespace node - * Handler - Handler associated with the data - * Data - Where the data is returned - * - * RETURN: Status - * - * DESCRIPTION: Low level interface to obtain data previously associated with - * a namespace node. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsGetAttachedData ( - ACPI_NAMESPACE_NODE *Node, - ACPI_OBJECT_HANDLER Handler, - void **Data) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - - - ObjDesc = Node->Object; - while (ObjDesc) - { - if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA) && - (ObjDesc->Data.Handler == Handler)) - { - *Data = ObjDesc->Data.Pointer; - return (AE_OK); - } - - ObjDesc = ObjDesc->Common.NextObject; - } - - return (AE_NOT_FOUND); -} diff --git a/drivers/acpica/nsparse.c b/drivers/acpica/nsparse.c deleted file mode 100644 index 32c7d30..0000000 --- a/drivers/acpica/nsparse.c +++ /dev/null @@ -1,439 +0,0 @@ -/****************************************************************************** - * - * Module Name: nsparse - namespace interface to AML parser - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" -#include "acparser.h" -#include "acdispat.h" -#include "actables.h" -#include "acinterp.h" - - -#define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nsparse") - - -/******************************************************************************* - * - * FUNCTION: NsExecuteTable - * - * PARAMETERS: TableDesc - An ACPI table descriptor for table to parse - * StartNode - Where to enter the table into the namespace - * - * RETURN: Status - * - * DESCRIPTION: Load ACPI/AML table by executing the entire table as a single - * large control method. - * - * NOTE: The point of this is to execute any module-level code in-place - * as the table is parsed. Some AML code depends on this behavior. - * - * It is a run-time option at this time, but will eventually become - * the default. - * - * Note: This causes the table to only have a single-pass parse. - * However, this is compatible with other ACPI implementations. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsExecuteTable ( - UINT32 TableIndex, - ACPI_NAMESPACE_NODE *StartNode) -{ - ACPI_STATUS Status; - ACPI_TABLE_HEADER *Table; - ACPI_OWNER_ID OwnerId; - ACPI_EVALUATE_INFO *Info = NULL; - UINT32 AmlLength; - UINT8 *AmlStart; - ACPI_OPERAND_OBJECT *MethodObj = NULL; - - - ACPI_FUNCTION_TRACE (NsExecuteTable); - - - Status = AcpiGetTableByIndex (TableIndex, &Table); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Table must consist of at least a complete header */ - - if (Table->Length < sizeof (ACPI_TABLE_HEADER)) - { - return_ACPI_STATUS (AE_BAD_HEADER); - } - - AmlStart = (UINT8 *) Table + sizeof (ACPI_TABLE_HEADER); - AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER); - - Status = AcpiTbGetOwnerId (TableIndex, &OwnerId); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Create, initialize, and link a new temporary method object */ - - MethodObj = AcpiUtCreateInternalObject (ACPI_TYPE_METHOD); - if (!MethodObj) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Allocate the evaluation information block */ - - Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO)); - if (!Info) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_PARSE, - "%s: Create table pseudo-method for [%4.4s] @%p, method %p\n", - ACPI_GET_FUNCTION_NAME, Table->Signature, Table, MethodObj)); - - MethodObj->Method.AmlStart = AmlStart; - MethodObj->Method.AmlLength = AmlLength; - MethodObj->Method.OwnerId = OwnerId; - MethodObj->Method.InfoFlags |= ACPI_METHOD_MODULE_LEVEL; - - Info->PassNumber = ACPI_IMODE_EXECUTE; - Info->Node = StartNode; - Info->ObjDesc = MethodObj; - Info->NodeFlags = Info->Node->Flags; - Info->FullPathname = AcpiNsGetNormalizedPathname (Info->Node, TRUE); - if (!Info->FullPathname) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - /* Optional object evaluation log */ - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EVALUATION, - "%-26s: (Definition Block level)\n", "Module-level evaluation")); - - Status = AcpiPsExecuteTable (Info); - - /* Optional object evaluation log */ - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EVALUATION, - "%-26s: (Definition Block level)\n", "Module-level complete")); - -Cleanup: - if (Info) - { - ACPI_FREE (Info->FullPathname); - Info->FullPathname = NULL; - } - ACPI_FREE (Info); - AcpiUtRemoveReference (MethodObj); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: NsOneCompleteParse - * - * PARAMETERS: PassNumber - 1 or 2 - * TableDesc - The table to be parsed. - * - * RETURN: Status - * - * DESCRIPTION: Perform one complete parse of an ACPI/AML table. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsOneCompleteParse ( - UINT32 PassNumber, - UINT32 TableIndex, - ACPI_NAMESPACE_NODE *StartNode) -{ - ACPI_PARSE_OBJECT *ParseRoot; - ACPI_STATUS Status; - UINT32 AmlLength; - UINT8 *AmlStart; - ACPI_WALK_STATE *WalkState; - ACPI_TABLE_HEADER *Table; - ACPI_OWNER_ID OwnerId; - - - ACPI_FUNCTION_TRACE (NsOneCompleteParse); - - - Status = AcpiGetTableByIndex (TableIndex, &Table); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Table must consist of at least a complete header */ - - if (Table->Length < sizeof (ACPI_TABLE_HEADER)) - { - return_ACPI_STATUS (AE_BAD_HEADER); - } - - AmlStart = (UINT8 *) Table + sizeof (ACPI_TABLE_HEADER); - AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER); - - Status = AcpiTbGetOwnerId (TableIndex, &OwnerId); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Create and init a Root Node */ - - ParseRoot = AcpiPsCreateScopeOp (AmlStart); - if (!ParseRoot) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Create and initialize a new walk state */ - - WalkState = AcpiDsCreateWalkState (OwnerId, NULL, NULL, NULL); - if (!WalkState) - { - AcpiPsFreeOp (ParseRoot); - return_ACPI_STATUS (AE_NO_MEMORY); - } - - Status = AcpiDsInitAmlWalk (WalkState, ParseRoot, NULL, - AmlStart, AmlLength, NULL, (UINT8) PassNumber); - if (ACPI_FAILURE (Status)) - { - AcpiDsDeleteWalkState (WalkState); - goto Cleanup; - } - - /* Found OSDT table, enable the namespace override feature */ - - if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_OSDT) && - PassNumber == ACPI_IMODE_LOAD_PASS1) - { - WalkState->NamespaceOverride = TRUE; - } - - /* StartNode is the default location to load the table */ - - if (StartNode && StartNode != AcpiGbl_RootNode) - { - Status = AcpiDsScopeStackPush ( - StartNode, ACPI_TYPE_METHOD, WalkState); - if (ACPI_FAILURE (Status)) - { - AcpiDsDeleteWalkState (WalkState); - goto Cleanup; - } - } - - /* Parse the AML */ - - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "*PARSE* pass %u parse\n", PassNumber)); - AcpiExEnterInterpreter (); - Status = AcpiPsParseAml (WalkState); - AcpiExExitInterpreter (); - -Cleanup: - AcpiPsDeleteParseTree (ParseRoot); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsParseTable - * - * PARAMETERS: TableDesc - An ACPI table descriptor for table to parse - * StartNode - Where to enter the table into the namespace - * - * RETURN: Status - * - * DESCRIPTION: Parse AML within an ACPI table and return a tree of ops - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsParseTable ( - UINT32 TableIndex, - ACPI_NAMESPACE_NODE *StartNode) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (NsParseTable); - - - /* - * Executes the AML table as one large control method. - * The point of this is to execute any module-level code in-place - * as the table is parsed. Some AML code depends on this behavior. - * - * Note: This causes the table to only have a single-pass parse. - * However, this is compatible with other ACPI implementations. - */ - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_PARSE, - "%s: **** Start table execution pass\n", ACPI_GET_FUNCTION_NAME)); - - Status = AcpiNsExecuteTable (TableIndex, StartNode); - - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/nspredef.c b/drivers/acpica/nspredef.c deleted file mode 100644 index 7a0e500..0000000 --- a/drivers/acpica/nspredef.c +++ /dev/null @@ -1,544 +0,0 @@ -/****************************************************************************** - * - * Module Name: nspredef - Validation of ACPI predefined methods and objects - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#define ACPI_CREATE_PREDEFINED_TABLE - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" -#include "acpredef.h" - - -#define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nspredef") - - -/******************************************************************************* - * - * This module validates predefined ACPI objects that appear in the namespace, - * at the time they are evaluated (via AcpiEvaluateObject). The purpose of this - * validation is to detect problems with BIOS-exposed predefined ACPI objects - * before the results are returned to the ACPI-related drivers. - * - * There are several areas that are validated: - * - * 1) The number of input arguments as defined by the method/object in the - * ASL is validated against the ACPI specification. - * 2) The type of the return object (if any) is validated against the ACPI - * specification. - * 3) For returned package objects, the count of package elements is - * validated, as well as the type of each package element. Nested - * packages are supported. - * - * For any problems found, a warning message is issued. - * - ******************************************************************************/ - - -/* Local prototypes */ - -static ACPI_STATUS -AcpiNsCheckReference ( - ACPI_EVALUATE_INFO *Info, - ACPI_OPERAND_OBJECT *ReturnObject); - -static UINT32 -AcpiNsGetBitmappedType ( - ACPI_OPERAND_OBJECT *ReturnObject); - - -/******************************************************************************* - * - * FUNCTION: AcpiNsCheckReturnValue - * - * PARAMETERS: Node - Namespace node for the method/object - * Info - Method execution information block - * UserParamCount - Number of parameters actually passed - * ReturnStatus - Status from the object evaluation - * ReturnObjectPtr - Pointer to the object returned from the - * evaluation of a method or object - * - * RETURN: Status - * - * DESCRIPTION: Check the value returned from a predefined name. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsCheckReturnValue ( - ACPI_NAMESPACE_NODE *Node, - ACPI_EVALUATE_INFO *Info, - UINT32 UserParamCount, - ACPI_STATUS ReturnStatus, - ACPI_OPERAND_OBJECT **ReturnObjectPtr) -{ - ACPI_STATUS Status; - const ACPI_PREDEFINED_INFO *Predefined; - - ACPI_FUNCTION_TRACE (NsCheckReturnValue); - - /* If not a predefined name, we cannot validate the return object */ - - Predefined = Info->Predefined; - if (!Predefined) - { - return_ACPI_STATUS (AE_OK); - } - - /* - * If the method failed or did not actually return an object, we cannot - * validate the return object - */ - if ((ReturnStatus != AE_OK) && - (ReturnStatus != AE_CTRL_RETURN_VALUE)) - { - return_ACPI_STATUS (AE_OK); - } - - /* - * Return value validation and possible repair. - * - * 1) Don't perform return value validation/repair if this feature - * has been disabled via a global option. - * - * 2) We have a return value, but if one wasn't expected, just exit, - * this is not a problem. For example, if the "Implicit Return" - * feature is enabled, methods will always return a value. - * - * 3) If the return value can be of any type, then we cannot perform - * any validation, just exit. - */ - if (AcpiGbl_DisableAutoRepair || - (!Predefined->Info.ExpectedBtypes) || - (Predefined->Info.ExpectedBtypes == ACPI_RTYPE_ALL)) - { - return_ACPI_STATUS (AE_OK); - } - - /* - * Check that the type of the main return object is what is expected - * for this predefined name - */ - Status = AcpiNsCheckObjectType (Info, ReturnObjectPtr, - Predefined->Info.ExpectedBtypes, ACPI_NOT_PACKAGE_ELEMENT); - if (ACPI_FAILURE (Status)) - { - goto Exit; - } - - /* - * - * 4) If there is no return value and it is optional, just return - * AE_OK (_WAK). - */ - if (!(*ReturnObjectPtr)) - { - goto Exit; - } - - /* - * For returned Package objects, check the type of all sub-objects. - * Note: Package may have been newly created by call above. - */ - if ((*ReturnObjectPtr)->Common.Type == ACPI_TYPE_PACKAGE) - { - Info->ParentPackage = *ReturnObjectPtr; - Status = AcpiNsCheckPackage (Info, ReturnObjectPtr); - if (ACPI_FAILURE (Status)) - { - /* We might be able to fix some errors */ - - if ((Status != AE_AML_OPERAND_TYPE) && - (Status != AE_AML_OPERAND_VALUE)) - { - goto Exit; - } - } - } - - /* - * The return object was OK, or it was successfully repaired above. - * Now make some additional checks such as verifying that package - * objects are sorted correctly (if required) or buffer objects have - * the correct data width (bytes vs. dwords). These repairs are - * performed on a per-name basis, i.e., the code is specific to - * particular predefined names. - */ - Status = AcpiNsComplexRepairs (Info, Node, Status, ReturnObjectPtr); - -Exit: - /* - * If the object validation failed or if we successfully repaired one - * or more objects, mark the parent node to suppress further warning - * messages during the next evaluation of the same method/object. - */ - if (ACPI_FAILURE (Status) || - (Info->ReturnFlags & ACPI_OBJECT_REPAIRED)) - { - Node->Flags |= ANOBJ_EVALUATED; - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsCheckObjectType - * - * PARAMETERS: Info - Method execution information block - * ReturnObjectPtr - Pointer to the object returned from the - * evaluation of a method or object - * ExpectedBtypes - Bitmap of expected return type(s) - * PackageIndex - Index of object within parent package (if - * applicable - ACPI_NOT_PACKAGE_ELEMENT - * otherwise) - * - * RETURN: Status - * - * DESCRIPTION: Check the type of the return object against the expected object - * type(s). Use of Btype allows multiple expected object types. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsCheckObjectType ( - ACPI_EVALUATE_INFO *Info, - ACPI_OPERAND_OBJECT **ReturnObjectPtr, - UINT32 ExpectedBtypes, - UINT32 PackageIndex) -{ - ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr; - ACPI_STATUS Status = AE_OK; - char TypeBuffer[96]; /* Room for 10 types */ - - - /* A Namespace node should not get here, but make sure */ - - if (ReturnObject && - ACPI_GET_DESCRIPTOR_TYPE (ReturnObject) == ACPI_DESC_TYPE_NAMED) - { - ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, - "Invalid return type - Found a Namespace node [%4.4s] type %s", - ReturnObject->Node.Name.Ascii, - AcpiUtGetTypeName (ReturnObject->Node.Type))); - return (AE_AML_OPERAND_TYPE); - } - - /* - * Convert the object type (ACPI_TYPE_xxx) to a bitmapped object type. - * The bitmapped type allows multiple possible return types. - * - * Note, the cases below must handle all of the possible types returned - * from all of the predefined names (including elements of returned - * packages) - */ - Info->ReturnBtype = AcpiNsGetBitmappedType (ReturnObject); - if (Info->ReturnBtype == ACPI_RTYPE_ANY) - { - /* Not one of the supported objects, must be incorrect */ - goto TypeErrorExit; - } - - /* For reference objects, check that the reference type is correct */ - - if ((Info->ReturnBtype & ExpectedBtypes) == ACPI_RTYPE_REFERENCE) - { - Status = AcpiNsCheckReference (Info, ReturnObject); - return (Status); - } - - /* Attempt simple repair of the returned object if necessary */ - - Status = AcpiNsSimpleRepair (Info, ExpectedBtypes, - PackageIndex, ReturnObjectPtr); - if (ACPI_SUCCESS (Status)) - { - return (AE_OK); /* Successful repair */ - } - - -TypeErrorExit: - - /* Create a string with all expected types for this predefined object */ - - AcpiUtGetExpectedReturnTypes (TypeBuffer, ExpectedBtypes); - - if (!ReturnObject) - { - ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, - "Expected return object of type %s", - TypeBuffer)); - } - else if (PackageIndex == ACPI_NOT_PACKAGE_ELEMENT) - { - ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, - "Return type mismatch - found %s, expected %s", - AcpiUtGetObjectTypeName (ReturnObject), TypeBuffer)); - } - else - { - ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, - "Return Package type mismatch at index %u - " - "found %s, expected %s", PackageIndex, - AcpiUtGetObjectTypeName (ReturnObject), TypeBuffer)); - } - - return (AE_AML_OPERAND_TYPE); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsCheckReference - * - * PARAMETERS: Info - Method execution information block - * ReturnObject - Object returned from the evaluation of a - * method or object - * - * RETURN: Status - * - * DESCRIPTION: Check a returned reference object for the correct reference - * type. The only reference type that can be returned from a - * predefined method is a named reference. All others are invalid. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiNsCheckReference ( - ACPI_EVALUATE_INFO *Info, - ACPI_OPERAND_OBJECT *ReturnObject) -{ - - /* - * Check the reference object for the correct reference type (opcode). - * The only type of reference that can be converted to an ACPI_OBJECT is - * a reference to a named object (reference class: NAME) - */ - if (ReturnObject->Reference.Class == ACPI_REFCLASS_NAME) - { - return (AE_OK); - } - - ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, - "Return type mismatch - unexpected reference object type [%s] %2.2X", - AcpiUtGetReferenceName (ReturnObject), - ReturnObject->Reference.Class)); - - return (AE_AML_OPERAND_TYPE); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsGetBitmappedType - * - * PARAMETERS: ReturnObject - Object returned from method/obj evaluation - * - * RETURN: Object return type. ACPI_RTYPE_ANY indicates that the object - * type is not supported. ACPI_RTYPE_NONE indicates that no - * object was returned (ReturnObject is NULL). - * - * DESCRIPTION: Convert object type into a bitmapped object return type. - * - ******************************************************************************/ - -static UINT32 -AcpiNsGetBitmappedType ( - ACPI_OPERAND_OBJECT *ReturnObject) -{ - UINT32 ReturnBtype; - - - if (!ReturnObject) - { - return (ACPI_RTYPE_NONE); - } - - /* Map ACPI_OBJECT_TYPE to internal bitmapped type */ - - switch (ReturnObject->Common.Type) - { - case ACPI_TYPE_INTEGER: - - ReturnBtype = ACPI_RTYPE_INTEGER; - break; - - case ACPI_TYPE_BUFFER: - - ReturnBtype = ACPI_RTYPE_BUFFER; - break; - - case ACPI_TYPE_STRING: - - ReturnBtype = ACPI_RTYPE_STRING; - break; - - case ACPI_TYPE_PACKAGE: - - ReturnBtype = ACPI_RTYPE_PACKAGE; - break; - - case ACPI_TYPE_LOCAL_REFERENCE: - - ReturnBtype = ACPI_RTYPE_REFERENCE; - break; - - default: - - /* Not one of the supported objects, must be incorrect */ - - ReturnBtype = ACPI_RTYPE_ANY; - break; - } - - return (ReturnBtype); -} diff --git a/drivers/acpica/nsprepkg.c b/drivers/acpica/nsprepkg.c deleted file mode 100644 index e26269a..0000000 --- a/drivers/acpica/nsprepkg.c +++ /dev/null @@ -1,900 +0,0 @@ -/****************************************************************************** - * - * Module Name: nsprepkg - Validation of package objects for predefined names - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" -#include "acpredef.h" - - -#define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nsprepkg") - - -/* Local prototypes */ - -static ACPI_STATUS -AcpiNsCheckPackageList ( - ACPI_EVALUATE_INFO *Info, - const ACPI_PREDEFINED_INFO *Package, - ACPI_OPERAND_OBJECT **Elements, - UINT32 Count); - -static ACPI_STATUS -AcpiNsCheckPackageElements ( - ACPI_EVALUATE_INFO *Info, - ACPI_OPERAND_OBJECT **Elements, - UINT8 Type1, - UINT32 Count1, - UINT8 Type2, - UINT32 Count2, - UINT32 StartIndex); - -static ACPI_STATUS -AcpiNsCustomPackage ( - ACPI_EVALUATE_INFO *Info, - ACPI_OPERAND_OBJECT **Elements, - UINT32 Count); - - -/******************************************************************************* - * - * FUNCTION: AcpiNsCheckPackage - * - * PARAMETERS: Info - Method execution information block - * ReturnObjectPtr - Pointer to the object returned from the - * evaluation of a method or object - * - * RETURN: Status - * - * DESCRIPTION: Check a returned package object for the correct count and - * correct type of all sub-objects. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsCheckPackage ( - ACPI_EVALUATE_INFO *Info, - ACPI_OPERAND_OBJECT **ReturnObjectPtr) -{ - ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr; - const ACPI_PREDEFINED_INFO *Package; - ACPI_OPERAND_OBJECT **Elements; - ACPI_STATUS Status = AE_OK; - UINT32 ExpectedCount; - UINT32 Count; - UINT32 i; - - - ACPI_FUNCTION_TRACE (NsCheckPackage); - - - /* The package info for this name is in the next table entry */ - - Package = Info->Predefined + 1; - - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "%s Validating return Package of Type %X, Count %X\n", - Info->FullPathname, Package->RetInfo.Type, - ReturnObject->Package.Count)); - - /* - * For variable-length Packages, we can safely remove all embedded - * and trailing NULL package elements - */ - AcpiNsRemoveNullElements (Info, Package->RetInfo.Type, ReturnObject); - - /* Extract package count and elements array */ - - Elements = ReturnObject->Package.Elements; - Count = ReturnObject->Package.Count; - - /* - * Most packages must have at least one element. The only exception - * is the variable-length package (ACPI_PTYPE1_VAR). - */ - if (!Count) - { - if (Package->RetInfo.Type == ACPI_PTYPE1_VAR) - { - return_ACPI_STATUS (AE_OK); - } - - ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, - "Return Package has no elements (empty)")); - - return_ACPI_STATUS (AE_AML_OPERAND_VALUE); - } - - /* - * Decode the type of the expected package contents - * - * PTYPE1 packages contain no subpackages - * PTYPE2 packages contain subpackages - */ - switch (Package->RetInfo.Type) - { - case ACPI_PTYPE_CUSTOM: - - Status = AcpiNsCustomPackage (Info, Elements, Count); - break; - - case ACPI_PTYPE1_FIXED: - /* - * The package count is fixed and there are no subpackages - * - * If package is too small, exit. - * If package is larger than expected, issue warning but continue - */ - ExpectedCount = Package->RetInfo.Count1 + Package->RetInfo.Count2; - if (Count < ExpectedCount) - { - goto PackageTooSmall; - } - else if (Count > ExpectedCount) - { - ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR, - "%s: Return Package is larger than needed - " - "found %u, expected %u\n", - Info->FullPathname, Count, ExpectedCount)); - } - - /* Validate all elements of the returned package */ - - Status = AcpiNsCheckPackageElements (Info, Elements, - Package->RetInfo.ObjectType1, Package->RetInfo.Count1, - Package->RetInfo.ObjectType2, Package->RetInfo.Count2, 0); - break; - - case ACPI_PTYPE1_VAR: - /* - * The package count is variable, there are no subpackages, and all - * elements must be of the same type - */ - for (i = 0; i < Count; i++) - { - Status = AcpiNsCheckObjectType (Info, Elements, - Package->RetInfo.ObjectType1, i); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Elements++; - } - break; - - case ACPI_PTYPE1_OPTION: - /* - * The package count is variable, there are no subpackages. There are - * a fixed number of required elements, and a variable number of - * optional elements. - * - * Check if package is at least as large as the minimum required - */ - ExpectedCount = Package->RetInfo3.Count; - if (Count < ExpectedCount) - { - goto PackageTooSmall; - } - - /* Variable number of sub-objects */ - - for (i = 0; i < Count; i++) - { - if (i < Package->RetInfo3.Count) - { - /* These are the required package elements (0, 1, or 2) */ - - Status = AcpiNsCheckObjectType (Info, Elements, - Package->RetInfo3.ObjectType[i], i); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - else - { - /* These are the optional package elements */ - - Status = AcpiNsCheckObjectType (Info, Elements, - Package->RetInfo3.TailObjectType, i); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - Elements++; - } - break; - - case ACPI_PTYPE2_REV_FIXED: - - /* First element is the (Integer) revision */ - - Status = AcpiNsCheckObjectType ( - Info, Elements, ACPI_RTYPE_INTEGER, 0); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Elements++; - Count--; - - /* Examine the subpackages */ - - Status = AcpiNsCheckPackageList (Info, Package, Elements, Count); - break; - - case ACPI_PTYPE2_PKG_COUNT: - - /* First element is the (Integer) count of subpackages to follow */ - - Status = AcpiNsCheckObjectType ( - Info, Elements, ACPI_RTYPE_INTEGER, 0); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* - * Count cannot be larger than the parent package length, but allow it - * to be smaller. The >= accounts for the Integer above. - */ - ExpectedCount = (UINT32) (*Elements)->Integer.Value; - if (ExpectedCount >= Count) - { - goto PackageTooSmall; - } - - Count = ExpectedCount; - Elements++; - - /* Examine the subpackages */ - - Status = AcpiNsCheckPackageList (Info, Package, Elements, Count); - break; - - case ACPI_PTYPE2: - case ACPI_PTYPE2_FIXED: - case ACPI_PTYPE2_MIN: - case ACPI_PTYPE2_COUNT: - case ACPI_PTYPE2_FIX_VAR: - /* - * These types all return a single Package that consists of a - * variable number of subpackages. - * - * First, ensure that the first element is a subpackage. If not, - * the BIOS may have incorrectly returned the object as a single - * package instead of a Package of Packages (a common error if - * there is only one entry). We may be able to repair this by - * wrapping the returned Package with a new outer Package. - */ - if (*Elements && ((*Elements)->Common.Type != ACPI_TYPE_PACKAGE)) - { - /* Create the new outer package and populate it */ - - Status = AcpiNsWrapWithPackage ( - Info, ReturnObject, ReturnObjectPtr); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Update locals to point to the new package (of 1 element) */ - - ReturnObject = *ReturnObjectPtr; - Elements = ReturnObject->Package.Elements; - Count = 1; - } - - /* Examine the subpackages */ - - Status = AcpiNsCheckPackageList (Info, Package, Elements, Count); - break; - - case ACPI_PTYPE2_VAR_VAR: - /* - * Returns a variable list of packages, each with a variable list - * of objects. - */ - break; - - case ACPI_PTYPE2_UUID_PAIR: - - /* The package must contain pairs of (UUID + type) */ - - if (Count & 1) - { - ExpectedCount = Count + 1; - goto PackageTooSmall; - } - - while (Count > 0) - { - Status = AcpiNsCheckObjectType(Info, Elements, - Package->RetInfo.ObjectType1, 0); - if (ACPI_FAILURE(Status)) - { - return_ACPI_STATUS (Status); - } - - /* Validate length of the UUID buffer */ - - if ((*Elements)->Buffer.Length != 16) - { - ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, - Info->NodeFlags, "Invalid length for UUID Buffer")); - return_ACPI_STATUS (AE_AML_OPERAND_VALUE); - } - - Status = AcpiNsCheckObjectType(Info, Elements + 1, - Package->RetInfo.ObjectType2, 0); - if (ACPI_FAILURE(Status)) - { - return_ACPI_STATUS (Status); - } - - Elements += 2; - Count -= 2; - } - break; - - default: - - /* Should not get here if predefined info table is correct */ - - ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, - "Invalid internal return type in table entry: %X", - Package->RetInfo.Type)); - - return_ACPI_STATUS (AE_AML_INTERNAL); - } - - return_ACPI_STATUS (Status); - - -PackageTooSmall: - - /* Error exit for the case with an incorrect package count */ - - ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, - "Return Package is too small - found %u elements, expected %u", - Count, ExpectedCount)); - - return_ACPI_STATUS (AE_AML_OPERAND_VALUE); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsCheckPackageList - * - * PARAMETERS: Info - Method execution information block - * Package - Pointer to package-specific info for method - * Elements - Element list of parent package. All elements - * of this list should be of type Package. - * Count - Count of subpackages - * - * RETURN: Status - * - * DESCRIPTION: Examine a list of subpackages - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiNsCheckPackageList ( - ACPI_EVALUATE_INFO *Info, - const ACPI_PREDEFINED_INFO *Package, - ACPI_OPERAND_OBJECT **Elements, - UINT32 Count) -{ - ACPI_OPERAND_OBJECT *SubPackage; - ACPI_OPERAND_OBJECT **SubElements; - ACPI_STATUS Status; - UINT32 ExpectedCount; - UINT32 i; - UINT32 j; - - - /* - * Validate each subpackage in the parent Package - * - * NOTE: assumes list of subpackages contains no NULL elements. - * Any NULL elements should have been removed by earlier call - * to AcpiNsRemoveNullElements. - */ - for (i = 0; i < Count; i++) - { - SubPackage = *Elements; - SubElements = SubPackage->Package.Elements; - Info->ParentPackage = SubPackage; - - /* Each sub-object must be of type Package */ - - Status = AcpiNsCheckObjectType (Info, &SubPackage, - ACPI_RTYPE_PACKAGE, i); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Examine the different types of expected subpackages */ - - Info->ParentPackage = SubPackage; - switch (Package->RetInfo.Type) - { - case ACPI_PTYPE2: - case ACPI_PTYPE2_PKG_COUNT: - case ACPI_PTYPE2_REV_FIXED: - - /* Each subpackage has a fixed number of elements */ - - ExpectedCount = Package->RetInfo.Count1 + Package->RetInfo.Count2; - if (SubPackage->Package.Count < ExpectedCount) - { - goto PackageTooSmall; - } - - Status = AcpiNsCheckPackageElements (Info, SubElements, - Package->RetInfo.ObjectType1, - Package->RetInfo.Count1, - Package->RetInfo.ObjectType2, - Package->RetInfo.Count2, 0); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - break; - - case ACPI_PTYPE2_FIX_VAR: - /* - * Each subpackage has a fixed number of elements and an - * optional element - */ - ExpectedCount = Package->RetInfo.Count1 + Package->RetInfo.Count2; - if (SubPackage->Package.Count < ExpectedCount) - { - goto PackageTooSmall; - } - - Status = AcpiNsCheckPackageElements (Info, SubElements, - Package->RetInfo.ObjectType1, - Package->RetInfo.Count1, - Package->RetInfo.ObjectType2, - SubPackage->Package.Count - Package->RetInfo.Count1, 0); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - break; - - case ACPI_PTYPE2_VAR_VAR: - /* - * Each subpackage has a fixed or variable number of elements - */ - break; - - case ACPI_PTYPE2_FIXED: - - /* Each subpackage has a fixed length */ - - ExpectedCount = Package->RetInfo2.Count; - if (SubPackage->Package.Count < ExpectedCount) - { - goto PackageTooSmall; - } - - /* Check the type of each subpackage element */ - - for (j = 0; j < ExpectedCount; j++) - { - Status = AcpiNsCheckObjectType (Info, &SubElements[j], - Package->RetInfo2.ObjectType[j], j); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - break; - - case ACPI_PTYPE2_MIN: - - /* Each subpackage has a variable but minimum length */ - - ExpectedCount = Package->RetInfo.Count1; - if (SubPackage->Package.Count < ExpectedCount) - { - goto PackageTooSmall; - } - - /* Check the type of each subpackage element */ - - Status = AcpiNsCheckPackageElements (Info, SubElements, - Package->RetInfo.ObjectType1, - SubPackage->Package.Count, 0, 0, 0); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - break; - - case ACPI_PTYPE2_COUNT: - /* - * First element is the (Integer) count of elements, including - * the count field (the ACPI name is NumElements) - */ - Status = AcpiNsCheckObjectType (Info, SubElements, - ACPI_RTYPE_INTEGER, 0); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* - * Make sure package is large enough for the Count and is - * is as large as the minimum size - */ - ExpectedCount = (UINT32) (*SubElements)->Integer.Value; - if (SubPackage->Package.Count < ExpectedCount) - { - goto PackageTooSmall; - } - - if (SubPackage->Package.Count < Package->RetInfo.Count1) - { - ExpectedCount = Package->RetInfo.Count1; - goto PackageTooSmall; - } - - if (ExpectedCount == 0) - { - /* - * Either the NumEntries element was originally zero or it was - * a NULL element and repaired to an Integer of value zero. - * In either case, repair it by setting NumEntries to be the - * actual size of the subpackage. - */ - ExpectedCount = SubPackage->Package.Count; - (*SubElements)->Integer.Value = ExpectedCount; - } - - /* Check the type of each subpackage element */ - - Status = AcpiNsCheckPackageElements (Info, (SubElements + 1), - Package->RetInfo.ObjectType1, - (ExpectedCount - 1), 0, 0, 1); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - break; - - default: /* Should not get here, type was validated by caller */ - - ACPI_ERROR ((AE_INFO, "Invalid Package type: %X", - Package->RetInfo.Type)); - return (AE_AML_INTERNAL); - } - - Elements++; - } - - return (AE_OK); - - -PackageTooSmall: - - /* The subpackage count was smaller than required */ - - ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, - "Return SubPackage[%u] is too small - found %u elements, expected %u", - i, SubPackage->Package.Count, ExpectedCount)); - - return (AE_AML_OPERAND_VALUE); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsCustomPackage - * - * PARAMETERS: Info - Method execution information block - * Elements - Pointer to the package elements array - * Count - Element count for the package - * - * RETURN: Status - * - * DESCRIPTION: Check a returned package object for the correct count and - * correct type of all sub-objects. - * - * NOTE: Currently used for the _BIX method only. When needed for two or more - * methods, probably a detect/dispatch mechanism will be required. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiNsCustomPackage ( - ACPI_EVALUATE_INFO *Info, - ACPI_OPERAND_OBJECT **Elements, - UINT32 Count) -{ - UINT32 ExpectedCount; - UINT32 Version; - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_NAME (NsCustomPackage); - - - /* Get version number, must be Integer */ - - if ((*Elements)->Common.Type != ACPI_TYPE_INTEGER) - { - ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, - "Return Package has invalid object type for version number")); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - - Version = (UINT32) (*Elements)->Integer.Value; - ExpectedCount = 21; /* Version 1 */ - - if (Version == 0) - { - ExpectedCount = 20; /* Version 0 */ - } - - if (Count < ExpectedCount) - { - ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, - "Return Package is too small - found %u elements, expected %u", - Count, ExpectedCount)); - return_ACPI_STATUS (AE_AML_OPERAND_VALUE); - } - else if (Count > ExpectedCount) - { - ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR, - "%s: Return Package is larger than needed - " - "found %u, expected %u\n", - Info->FullPathname, Count, ExpectedCount)); - } - - /* Validate all elements of the returned package */ - - Status = AcpiNsCheckPackageElements (Info, Elements, - ACPI_RTYPE_INTEGER, 16, - ACPI_RTYPE_STRING, 4, 0); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Version 1 has a single trailing integer */ - - if (Version > 0) - { - Status = AcpiNsCheckPackageElements (Info, Elements + 20, - ACPI_RTYPE_INTEGER, 1, 0, 0, 20); - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsCheckPackageElements - * - * PARAMETERS: Info - Method execution information block - * Elements - Pointer to the package elements array - * Type1 - Object type for first group - * Count1 - Count for first group - * Type2 - Object type for second group - * Count2 - Count for second group - * StartIndex - Start of the first group of elements - * - * RETURN: Status - * - * DESCRIPTION: Check that all elements of a package are of the correct object - * type. Supports up to two groups of different object types. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiNsCheckPackageElements ( - ACPI_EVALUATE_INFO *Info, - ACPI_OPERAND_OBJECT **Elements, - UINT8 Type1, - UINT32 Count1, - UINT8 Type2, - UINT32 Count2, - UINT32 StartIndex) -{ - ACPI_OPERAND_OBJECT **ThisElement = Elements; - ACPI_STATUS Status; - UINT32 i; - - - ACPI_FUNCTION_TRACE (NsCheckPackageElements); - - /* - * Up to two groups of package elements are supported by the data - * structure. All elements in each group must be of the same type. - * The second group can have a count of zero. - */ - for (i = 0; i < Count1; i++) - { - Status = AcpiNsCheckObjectType (Info, ThisElement, - Type1, i + StartIndex); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - ThisElement++; - } - - for (i = 0; i < Count2; i++) - { - Status = AcpiNsCheckObjectType (Info, ThisElement, - Type2, (i + Count1 + StartIndex)); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - ThisElement++; - } - - return_ACPI_STATUS (AE_OK); -} diff --git a/drivers/acpica/nsrepair.c b/drivers/acpica/nsrepair.c deleted file mode 100644 index 21f0c92..0000000 --- a/drivers/acpica/nsrepair.c +++ /dev/null @@ -1,739 +0,0 @@ -/****************************************************************************** - * - * Module Name: nsrepair - Repair for objects returned by predefined methods - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" -#include "acinterp.h" -#include "acpredef.h" -#include "amlresrc.h" - -#define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nsrepair") - - -/******************************************************************************* - * - * This module attempts to repair or convert objects returned by the - * predefined methods to an object type that is expected, as per the ACPI - * specification. The need for this code is dictated by the many machines that - * return incorrect types for the standard predefined methods. Performing these - * conversions here, in one place, eliminates the need for individual ACPI - * device drivers to do the same. Note: Most of these conversions are different - * than the internal object conversion routines used for implicit object - * conversion. - * - * The following conversions can be performed as necessary: - * - * Integer -> String - * Integer -> Buffer - * String -> Integer - * String -> Buffer - * Buffer -> Integer - * Buffer -> String - * Buffer -> Package of Integers - * Package -> Package of one Package - * - * Additional conversions that are available: - * Convert a null return or zero return value to an EndTag descriptor - * Convert an ASCII string to a Unicode buffer - * - * An incorrect standalone object is wrapped with required outer package - * - * Additional possible repairs: - * Required package elements that are NULL replaced by Integer/String/Buffer - * - ******************************************************************************/ - - -/* Local prototypes */ - -static const ACPI_SIMPLE_REPAIR_INFO * -AcpiNsMatchSimpleRepair ( - ACPI_NAMESPACE_NODE *Node, - UINT32 ReturnBtype, - UINT32 PackageIndex); - - -/* - * Special but simple repairs for some names. - * - * 2nd argument: Unexpected types that can be repaired - */ -static const ACPI_SIMPLE_REPAIR_INFO AcpiObjectRepairInfo[] = -{ - /* Resource descriptor conversions */ - - { "_CRS", ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER | ACPI_RTYPE_NONE, - ACPI_NOT_PACKAGE_ELEMENT, - AcpiNsConvertToResource }, - { "_DMA", ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER | ACPI_RTYPE_NONE, - ACPI_NOT_PACKAGE_ELEMENT, - AcpiNsConvertToResource }, - { "_PRS", ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER | ACPI_RTYPE_NONE, - ACPI_NOT_PACKAGE_ELEMENT, - AcpiNsConvertToResource }, - - /* Object reference conversions */ - - { "_DEP", ACPI_RTYPE_STRING, ACPI_ALL_PACKAGE_ELEMENTS, - AcpiNsConvertToReference }, - - /* Unicode conversions */ - - { "_MLS", ACPI_RTYPE_STRING, 1, - AcpiNsConvertToUnicode }, - { "_STR", ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER, - ACPI_NOT_PACKAGE_ELEMENT, - AcpiNsConvertToUnicode }, - { {0,0,0,0}, 0, 0, NULL } /* Table terminator */ -}; - - -/******************************************************************************* - * - * FUNCTION: AcpiNsSimpleRepair - * - * PARAMETERS: Info - Method execution information block - * ExpectedBtypes - Object types expected - * PackageIndex - Index of object within parent package (if - * applicable - ACPI_NOT_PACKAGE_ELEMENT - * otherwise) - * ReturnObjectPtr - Pointer to the object returned from the - * evaluation of a method or object - * - * RETURN: Status. AE_OK if repair was successful. - * - * DESCRIPTION: Attempt to repair/convert a return object of a type that was - * not expected. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsSimpleRepair ( - ACPI_EVALUATE_INFO *Info, - UINT32 ExpectedBtypes, - UINT32 PackageIndex, - ACPI_OPERAND_OBJECT **ReturnObjectPtr) -{ - ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr; - ACPI_OPERAND_OBJECT *NewObject = NULL; - ACPI_STATUS Status; - const ACPI_SIMPLE_REPAIR_INFO *Predefined; - - - ACPI_FUNCTION_NAME (NsSimpleRepair); - - - /* - * Special repairs for certain names that are in the repair table. - * Check if this name is in the list of repairable names. - */ - Predefined = AcpiNsMatchSimpleRepair (Info->Node, - Info->ReturnBtype, PackageIndex); - if (Predefined) - { - if (!ReturnObject) - { - ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, - ACPI_WARN_ALWAYS, "Missing expected return value")); - } - - Status = Predefined->ObjectConverter (Info->Node, ReturnObject, - &NewObject); - if (ACPI_FAILURE (Status)) - { - /* A fatal error occurred during a conversion */ - - ACPI_EXCEPTION ((AE_INFO, Status, - "During return object analysis")); - return (Status); - } - if (NewObject) - { - goto ObjectRepaired; - } - } - - /* - * Do not perform simple object repair unless the return type is not - * expected. - */ - if (Info->ReturnBtype & ExpectedBtypes) - { - return (AE_OK); - } - - /* - * At this point, we know that the type of the returned object was not - * one of the expected types for this predefined name. Attempt to - * repair the object by converting it to one of the expected object - * types for this predefined name. - */ - - /* - * If there is no return value, check if we require a return value for - * this predefined name. Either one return value is expected, or none, - * for both methods and other objects. - * - * Try to fix if there was no return object. Warning if failed to fix. - */ - if (!ReturnObject) - { - if (ExpectedBtypes) - { - if (!(ExpectedBtypes & ACPI_RTYPE_NONE) && - PackageIndex != ACPI_NOT_PACKAGE_ELEMENT) - { - ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, - ACPI_WARN_ALWAYS, "Found unexpected NULL package element")); - - Status = AcpiNsRepairNullElement (Info, ExpectedBtypes, - PackageIndex, ReturnObjectPtr); - if (ACPI_SUCCESS (Status)) - { - return (AE_OK); /* Repair was successful */ - } - } - - if (ExpectedBtypes != ACPI_RTYPE_NONE) - { - ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, - ACPI_WARN_ALWAYS, - "Missing expected return value")); - return (AE_AML_NO_RETURN_VALUE); - } - } - } - - if (ExpectedBtypes & ACPI_RTYPE_INTEGER) - { - Status = AcpiNsConvertToInteger (ReturnObject, &NewObject); - if (ACPI_SUCCESS (Status)) - { - goto ObjectRepaired; - } - } - if (ExpectedBtypes & ACPI_RTYPE_STRING) - { - Status = AcpiNsConvertToString (ReturnObject, &NewObject); - if (ACPI_SUCCESS (Status)) - { - goto ObjectRepaired; - } - } - if (ExpectedBtypes & ACPI_RTYPE_BUFFER) - { - Status = AcpiNsConvertToBuffer (ReturnObject, &NewObject); - if (ACPI_SUCCESS (Status)) - { - goto ObjectRepaired; - } - } - if (ExpectedBtypes & ACPI_RTYPE_PACKAGE) - { - /* - * A package is expected. We will wrap the existing object with a - * new package object. It is often the case that if a variable-length - * package is required, but there is only a single object needed, the - * BIOS will return that object instead of wrapping it with a Package - * object. Note: after the wrapping, the package will be validated - * for correct contents (expected object type or types). - */ - Status = AcpiNsWrapWithPackage (Info, ReturnObject, &NewObject); - if (ACPI_SUCCESS (Status)) - { - /* - * The original object just had its reference count - * incremented for being inserted into the new package. - */ - *ReturnObjectPtr = NewObject; /* New Package object */ - Info->ReturnFlags |= ACPI_OBJECT_REPAIRED; - return (AE_OK); - } - } - - /* We cannot repair this object */ - - return (AE_AML_OPERAND_TYPE); - - -ObjectRepaired: - - /* Object was successfully repaired */ - - if (PackageIndex != ACPI_NOT_PACKAGE_ELEMENT) - { - /* Update reference count of new object */ - - if (!(Info->ReturnFlags & ACPI_OBJECT_WRAPPED)) - { - NewObject->Common.ReferenceCount = - ReturnObject->Common.ReferenceCount; - } - - ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR, - "%s: Converted %s to expected %s at Package index %u\n", - Info->FullPathname, AcpiUtGetObjectTypeName (ReturnObject), - AcpiUtGetObjectTypeName (NewObject), PackageIndex)); - } - else - { - ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR, - "%s: Converted %s to expected %s\n", - Info->FullPathname, AcpiUtGetObjectTypeName (ReturnObject), - AcpiUtGetObjectTypeName (NewObject))); - } - - /* Delete old object, install the new return object */ - - AcpiUtRemoveReference (ReturnObject); - *ReturnObjectPtr = NewObject; - Info->ReturnFlags |= ACPI_OBJECT_REPAIRED; - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiNsMatchSimpleRepair - * - * PARAMETERS: Node - Namespace node for the method/object - * ReturnBtype - Object type that was returned - * PackageIndex - Index of object within parent package (if - * applicable - ACPI_NOT_PACKAGE_ELEMENT - * otherwise) - * - * RETURN: Pointer to entry in repair table. NULL indicates not found. - * - * DESCRIPTION: Check an object name against the repairable object list. - * - *****************************************************************************/ - -static const ACPI_SIMPLE_REPAIR_INFO * -AcpiNsMatchSimpleRepair ( - ACPI_NAMESPACE_NODE *Node, - UINT32 ReturnBtype, - UINT32 PackageIndex) -{ - const ACPI_SIMPLE_REPAIR_INFO *ThisName; - - - /* Search info table for a repairable predefined method/object name */ - - ThisName = AcpiObjectRepairInfo; - while (ThisName->ObjectConverter) - { - if (ACPI_COMPARE_NAMESEG (Node->Name.Ascii, ThisName->Name)) - { - /* Check if we can actually repair this name/type combination */ - - if ((ReturnBtype & ThisName->UnexpectedBtypes) && - (ThisName->PackageIndex == ACPI_ALL_PACKAGE_ELEMENTS || - PackageIndex == ThisName->PackageIndex)) - { - return (ThisName); - } - - return (NULL); - } - - ThisName++; - } - - return (NULL); /* Name was not found in the repair table */ -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsRepairNullElement - * - * PARAMETERS: Info - Method execution information block - * ExpectedBtypes - Object types expected - * PackageIndex - Index of object within parent package (if - * applicable - ACPI_NOT_PACKAGE_ELEMENT - * otherwise) - * ReturnObjectPtr - Pointer to the object returned from the - * evaluation of a method or object - * - * RETURN: Status. AE_OK if repair was successful. - * - * DESCRIPTION: Attempt to repair a NULL element of a returned Package object. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsRepairNullElement ( - ACPI_EVALUATE_INFO *Info, - UINT32 ExpectedBtypes, - UINT32 PackageIndex, - ACPI_OPERAND_OBJECT **ReturnObjectPtr) -{ - ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr; - ACPI_OPERAND_OBJECT *NewObject; - - - ACPI_FUNCTION_NAME (NsRepairNullElement); - - - /* No repair needed if return object is non-NULL */ - - if (ReturnObject) - { - return (AE_OK); - } - - /* - * Attempt to repair a NULL element of a Package object. This applies to - * predefined names that return a fixed-length package and each element - * is required. It does not apply to variable-length packages where NULL - * elements are allowed, especially at the end of the package. - */ - if (ExpectedBtypes & ACPI_RTYPE_INTEGER) - { - /* Need an Integer - create a zero-value integer */ - - NewObject = AcpiUtCreateIntegerObject ((UINT64) 0); - } - else if (ExpectedBtypes & ACPI_RTYPE_STRING) - { - /* Need a String - create a NULL string */ - - NewObject = AcpiUtCreateStringObject (0); - } - else if (ExpectedBtypes & ACPI_RTYPE_BUFFER) - { - /* Need a Buffer - create a zero-length buffer */ - - NewObject = AcpiUtCreateBufferObject (0); - } - else - { - /* Error for all other expected types */ - - return (AE_AML_OPERAND_TYPE); - } - - if (!NewObject) - { - return (AE_NO_MEMORY); - } - - /* Set the reference count according to the parent Package object */ - - NewObject->Common.ReferenceCount = - Info->ParentPackage->Common.ReferenceCount; - - ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR, - "%s: Converted NULL package element to expected %s at index %u\n", - Info->FullPathname, AcpiUtGetObjectTypeName (NewObject), - PackageIndex)); - - *ReturnObjectPtr = NewObject; - Info->ReturnFlags |= ACPI_OBJECT_REPAIRED; - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiNsRemoveNullElements - * - * PARAMETERS: Info - Method execution information block - * PackageType - An AcpiReturnPackageTypes value - * ObjDesc - A Package object - * - * RETURN: None. - * - * DESCRIPTION: Remove all NULL package elements from packages that contain - * a variable number of subpackages. For these types of - * packages, NULL elements can be safely removed. - * - *****************************************************************************/ - -void -AcpiNsRemoveNullElements ( - ACPI_EVALUATE_INFO *Info, - UINT8 PackageType, - ACPI_OPERAND_OBJECT *ObjDesc) -{ - ACPI_OPERAND_OBJECT **Source; - ACPI_OPERAND_OBJECT **Dest; - UINT32 Count; - UINT32 NewCount; - UINT32 i; - - - ACPI_FUNCTION_NAME (NsRemoveNullElements); - - - /* - * We can safely remove all NULL elements from these package types: - * PTYPE1_VAR packages contain a variable number of simple data types. - * PTYPE2 packages contain a variable number of subpackages. - */ - switch (PackageType) - { - case ACPI_PTYPE1_VAR: - case ACPI_PTYPE2: - case ACPI_PTYPE2_COUNT: - case ACPI_PTYPE2_PKG_COUNT: - case ACPI_PTYPE2_FIXED: - case ACPI_PTYPE2_MIN: - case ACPI_PTYPE2_REV_FIXED: - case ACPI_PTYPE2_FIX_VAR: - break; - - default: - case ACPI_PTYPE2_VAR_VAR: - case ACPI_PTYPE1_FIXED: - case ACPI_PTYPE1_OPTION: - return; - } - - Count = ObjDesc->Package.Count; - NewCount = Count; - - Source = ObjDesc->Package.Elements; - Dest = Source; - - /* Examine all elements of the package object, remove nulls */ - - for (i = 0; i < Count; i++) - { - if (!*Source) - { - NewCount--; - } - else - { - *Dest = *Source; - Dest++; - } - - Source++; - } - - /* Update parent package if any null elements were removed */ - - if (NewCount < Count) - { - ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR, - "%s: Found and removed %u NULL elements\n", - Info->FullPathname, (Count - NewCount))); - - /* NULL terminate list and update the package count */ - - *Dest = NULL; - ObjDesc->Package.Count = NewCount; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsWrapWithPackage - * - * PARAMETERS: Info - Method execution information block - * OriginalObject - Pointer to the object to repair. - * ObjDescPtr - The new package object is returned here - * - * RETURN: Status, new object in *ObjDescPtr - * - * DESCRIPTION: Repair a common problem with objects that are defined to - * return a variable-length Package of sub-objects. If there is - * only one sub-object, some BIOS code mistakenly simply declares - * the single object instead of a Package with one sub-object. - * This function attempts to repair this error by wrapping a - * Package object around the original object, creating the - * correct and expected Package with one sub-object. - * - * Names that can be repaired in this manner include: - * _ALR, _CSD, _HPX, _MLS, _PLD, _PRT, _PSS, _TRT, _TSS, - * _BCL, _DOD, _FIX, _Sx - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsWrapWithPackage ( - ACPI_EVALUATE_INFO *Info, - ACPI_OPERAND_OBJECT *OriginalObject, - ACPI_OPERAND_OBJECT **ObjDescPtr) -{ - ACPI_OPERAND_OBJECT *PkgObjDesc; - - - ACPI_FUNCTION_NAME (NsWrapWithPackage); - - - /* - * Create the new outer package and populate it. The new - * package will have a single element, the lone sub-object. - */ - PkgObjDesc = AcpiUtCreatePackageObject (1); - if (!PkgObjDesc) - { - return (AE_NO_MEMORY); - } - - PkgObjDesc->Package.Elements[0] = OriginalObject; - - ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR, - "%s: Wrapped %s with expected Package object\n", - Info->FullPathname, AcpiUtGetObjectTypeName (OriginalObject))); - - /* Return the new object in the object pointer */ - - *ObjDescPtr = PkgObjDesc; - Info->ReturnFlags |= ACPI_OBJECT_REPAIRED | ACPI_OBJECT_WRAPPED; - return (AE_OK); -} diff --git a/drivers/acpica/nsrepair2.c b/drivers/acpica/nsrepair2.c deleted file mode 100644 index 0b43412..0000000 --- a/drivers/acpica/nsrepair2.c +++ /dev/null @@ -1,1190 +0,0 @@ -/****************************************************************************** - * - * Module Name: nsrepair2 - Repair for objects returned by specific - * predefined methods - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" - -#define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nsrepair2") - - -/* - * Information structure and handler for ACPI predefined names that can - * be repaired on a per-name basis. - */ -typedef -ACPI_STATUS (*ACPI_REPAIR_FUNCTION) ( - ACPI_EVALUATE_INFO *Info, - ACPI_OPERAND_OBJECT **ReturnObjectPtr); - -typedef struct acpi_repair_info -{ - char Name[ACPI_NAMESEG_SIZE] ACPI_NONSTRING; - ACPI_REPAIR_FUNCTION RepairFunction; - -} ACPI_REPAIR_INFO; - - -/* Local prototypes */ - -static const ACPI_REPAIR_INFO * -AcpiNsMatchComplexRepair ( - ACPI_NAMESPACE_NODE *Node); - -static ACPI_STATUS -AcpiNsRepair_ALR ( - ACPI_EVALUATE_INFO *Info, - ACPI_OPERAND_OBJECT **ReturnObjectPtr); - -static ACPI_STATUS -AcpiNsRepair_CID ( - ACPI_EVALUATE_INFO *Info, - ACPI_OPERAND_OBJECT **ReturnObjectPtr); - -static ACPI_STATUS -AcpiNsRepair_CST ( - ACPI_EVALUATE_INFO *Info, - ACPI_OPERAND_OBJECT **ReturnObjectPtr); - -static ACPI_STATUS -AcpiNsRepair_FDE ( - ACPI_EVALUATE_INFO *Info, - ACPI_OPERAND_OBJECT **ReturnObjectPtr); - -static ACPI_STATUS -AcpiNsRepair_HID ( - ACPI_EVALUATE_INFO *Info, - ACPI_OPERAND_OBJECT **ReturnObjectPtr); - -static ACPI_STATUS -AcpiNsRepair_PRT ( - ACPI_EVALUATE_INFO *Info, - ACPI_OPERAND_OBJECT **ReturnObjectPtr); - -static ACPI_STATUS -AcpiNsRepair_PSS ( - ACPI_EVALUATE_INFO *Info, - ACPI_OPERAND_OBJECT **ReturnObjectPtr); - -static ACPI_STATUS -AcpiNsRepair_TSS ( - ACPI_EVALUATE_INFO *Info, - ACPI_OPERAND_OBJECT **ReturnObjectPtr); - -static ACPI_STATUS -AcpiNsCheckSortedList ( - ACPI_EVALUATE_INFO *Info, - ACPI_OPERAND_OBJECT *ReturnObject, - UINT32 StartIndex, - UINT32 ExpectedCount, - UINT32 SortIndex, - UINT8 SortDirection, - char *SortKeyName); - -/* Values for SortDirection above */ - -#define ACPI_SORT_ASCENDING 0 -#define ACPI_SORT_DESCENDING 1 - -static void -AcpiNsRemoveElement ( - ACPI_OPERAND_OBJECT *ObjDesc, - UINT32 Index); - -static void -AcpiNsSortList ( - ACPI_OPERAND_OBJECT **Elements, - UINT32 Count, - UINT32 Index, - UINT8 SortDirection); - - -/* - * This table contains the names of the predefined methods for which we can - * perform more complex repairs. - * - * As necessary: - * - * _ALR: Sort the list ascending by AmbientIlluminance - * _CID: Strings: uppercase all, remove any leading asterisk - * _CST: Sort the list ascending by C state type - * _FDE: Convert Buffer of BYTEs to a Buffer of DWORDs - * _GTM: Convert Buffer of BYTEs to a Buffer of DWORDs - * _HID: Strings: uppercase all, remove any leading asterisk - * _PRT: Fix reversed SourceName and SourceIndex - * _PSS: Sort the list descending by Power - * _TSS: Sort the list descending by Power - * - * Names that must be packages, but cannot be sorted: - * - * _BCL: Values are tied to the Package index where they appear, and cannot - * be moved or sorted. These index values are used for _BQC and _BCM. - * However, we can fix the case where a buffer is returned, by converting - * it to a Package of integers. - */ -static const ACPI_REPAIR_INFO AcpiNsRepairableNames[] = -{ - {"_ALR", AcpiNsRepair_ALR}, - {"_CID", AcpiNsRepair_CID}, - {"_CST", AcpiNsRepair_CST}, - {"_FDE", AcpiNsRepair_FDE}, - {"_GTM", AcpiNsRepair_FDE}, /* _GTM has same repair as _FDE */ - {"_HID", AcpiNsRepair_HID}, - {"_PRT", AcpiNsRepair_PRT}, - {"_PSS", AcpiNsRepair_PSS}, - {"_TSS", AcpiNsRepair_TSS}, - {{0,0,0,0}, NULL} /* Table terminator */ -}; - - -#define ACPI_FDE_FIELD_COUNT 5 -#define ACPI_FDE_BYTE_BUFFER_SIZE 5 -#define ACPI_FDE_DWORD_BUFFER_SIZE (ACPI_FDE_FIELD_COUNT * (UINT32) sizeof (UINT32)) - - -/****************************************************************************** - * - * FUNCTION: AcpiNsComplexRepairs - * - * PARAMETERS: Info - Method execution information block - * Node - Namespace node for the method/object - * ValidateStatus - Original status of earlier validation - * ReturnObjectPtr - Pointer to the object returned from the - * evaluation of a method or object - * - * RETURN: Status. AE_OK if repair was successful. If name is not - * matched, ValidateStatus is returned. - * - * DESCRIPTION: Attempt to repair/convert a return object of a type that was - * not expected. - * - *****************************************************************************/ - -ACPI_STATUS -AcpiNsComplexRepairs ( - ACPI_EVALUATE_INFO *Info, - ACPI_NAMESPACE_NODE *Node, - ACPI_STATUS ValidateStatus, - ACPI_OPERAND_OBJECT **ReturnObjectPtr) -{ - const ACPI_REPAIR_INFO *Predefined; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (NsComplexRepairs); - - /* Check if this name is in the list of repairable names */ - - Predefined = AcpiNsMatchComplexRepair (Node); - if (!Predefined) - { - return_ACPI_STATUS (ValidateStatus); - } - - Status = Predefined->RepairFunction (Info, ReturnObjectPtr); - return_ACPI_STATUS (Status); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiNsMatchComplexRepair - * - * PARAMETERS: Node - Namespace node for the method/object - * - * RETURN: Pointer to entry in repair table. NULL indicates not found. - * - * DESCRIPTION: Check an object name against the repairable object list. - * - *****************************************************************************/ - -static const ACPI_REPAIR_INFO * -AcpiNsMatchComplexRepair ( - ACPI_NAMESPACE_NODE *Node) -{ - const ACPI_REPAIR_INFO *ThisName; - - - /* Search info table for a repairable predefined method/object name */ - - ThisName = AcpiNsRepairableNames; - while (ThisName->RepairFunction) - { - if (ACPI_COMPARE_NAMESEG (Node->Name.Ascii, ThisName->Name)) - { - return (ThisName); - } - - ThisName++; - } - - return (NULL); /* Not found */ -} - - -/****************************************************************************** - * - * FUNCTION: AcpiNsRepair_ALR - * - * PARAMETERS: Info - Method execution information block - * ReturnObjectPtr - Pointer to the object returned from the - * evaluation of a method or object - * - * RETURN: Status. AE_OK if object is OK or was repaired successfully - * - * DESCRIPTION: Repair for the _ALR object. If necessary, sort the object list - * ascending by the ambient illuminance values. - * - *****************************************************************************/ - -static ACPI_STATUS -AcpiNsRepair_ALR ( - ACPI_EVALUATE_INFO *Info, - ACPI_OPERAND_OBJECT **ReturnObjectPtr) -{ - ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr; - ACPI_STATUS Status; - - - Status = AcpiNsCheckSortedList (Info, ReturnObject, 0, 2, 1, - ACPI_SORT_ASCENDING, "AmbientIlluminance"); - - return (Status); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiNsRepair_FDE - * - * PARAMETERS: Info - Method execution information block - * ReturnObjectPtr - Pointer to the object returned from the - * evaluation of a method or object - * - * RETURN: Status. AE_OK if object is OK or was repaired successfully - * - * DESCRIPTION: Repair for the _FDE and _GTM objects. The expected return - * value is a Buffer of 5 DWORDs. This function repairs a common - * problem where the return value is a Buffer of BYTEs, not - * DWORDs. - * - *****************************************************************************/ - -static ACPI_STATUS -AcpiNsRepair_FDE ( - ACPI_EVALUATE_INFO *Info, - ACPI_OPERAND_OBJECT **ReturnObjectPtr) -{ - ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr; - ACPI_OPERAND_OBJECT *BufferObject; - UINT8 *ByteBuffer; - UINT32 *DwordBuffer; - UINT32 i; - - - ACPI_FUNCTION_NAME (NsRepair_FDE); - - - switch (ReturnObject->Common.Type) - { - case ACPI_TYPE_BUFFER: - - /* This is the expected type. Length should be (at least) 5 DWORDs */ - - if (ReturnObject->Buffer.Length >= ACPI_FDE_DWORD_BUFFER_SIZE) - { - return (AE_OK); - } - - /* We can only repair if we have exactly 5 BYTEs */ - - if (ReturnObject->Buffer.Length != ACPI_FDE_BYTE_BUFFER_SIZE) - { - ACPI_WARN_PREDEFINED ((AE_INFO, - Info->FullPathname, Info->NodeFlags, - "Incorrect return buffer length %u, expected %u", - ReturnObject->Buffer.Length, ACPI_FDE_DWORD_BUFFER_SIZE)); - - return (AE_AML_OPERAND_TYPE); - } - - /* Create the new (larger) buffer object */ - - BufferObject = AcpiUtCreateBufferObject ( - ACPI_FDE_DWORD_BUFFER_SIZE); - if (!BufferObject) - { - return (AE_NO_MEMORY); - } - - /* Expand each byte to a DWORD */ - - ByteBuffer = ReturnObject->Buffer.Pointer; - DwordBuffer = ACPI_CAST_PTR (UINT32, - BufferObject->Buffer.Pointer); - - for (i = 0; i < ACPI_FDE_FIELD_COUNT; i++) - { - *DwordBuffer = (UINT32) *ByteBuffer; - DwordBuffer++; - ByteBuffer++; - } - - ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR, - "%s Expanded Byte Buffer to expected DWord Buffer\n", - Info->FullPathname)); - break; - - default: - - return (AE_AML_OPERAND_TYPE); - } - - /* Delete the original return object, return the new buffer object */ - - AcpiUtRemoveReference (ReturnObject); - *ReturnObjectPtr = BufferObject; - - Info->ReturnFlags |= ACPI_OBJECT_REPAIRED; - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiNsRepair_CID - * - * PARAMETERS: Info - Method execution information block - * ReturnObjectPtr - Pointer to the object returned from the - * evaluation of a method or object - * - * RETURN: Status. AE_OK if object is OK or was repaired successfully - * - * DESCRIPTION: Repair for the _CID object. If a string, ensure that all - * letters are uppercase and that there is no leading asterisk. - * If a Package, ensure same for all string elements. - * - *****************************************************************************/ - -static ACPI_STATUS -AcpiNsRepair_CID ( - ACPI_EVALUATE_INFO *Info, - ACPI_OPERAND_OBJECT **ReturnObjectPtr) -{ - ACPI_STATUS Status; - ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr; - ACPI_OPERAND_OBJECT **ElementPtr; - ACPI_OPERAND_OBJECT *OriginalElement; - UINT16 OriginalRefCount; - UINT32 i; - - ACPI_FUNCTION_TRACE (NsRepair_CID); - - /* Check for _CID as a simple string */ - - if (ReturnObject->Common.Type == ACPI_TYPE_STRING) - { - Status = AcpiNsRepair_HID (Info, ReturnObjectPtr); - return_ACPI_STATUS (Status); - } - - /* Exit if not a Package */ - - if (ReturnObject->Common.Type != ACPI_TYPE_PACKAGE) - { - return_ACPI_STATUS (AE_OK); - } - - /* Examine each element of the _CID package */ - - ElementPtr = ReturnObject->Package.Elements; - for (i = 0; i < ReturnObject->Package.Count; i++) - { - OriginalElement = *ElementPtr; - OriginalRefCount = OriginalElement->Common.ReferenceCount; - - Status = AcpiNsRepair_HID (Info, ElementPtr); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - if (OriginalElement != *ElementPtr) - { - /* Update reference count of new object */ - - (*ElementPtr)->Common.ReferenceCount = - OriginalRefCount; - } - - ElementPtr++; - } - - return_ACPI_STATUS (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiNsRepair_CST - * - * PARAMETERS: Info - Method execution information block - * ReturnObjectPtr - Pointer to the object returned from the - * evaluation of a method or object - * - * RETURN: Status. AE_OK if object is OK or was repaired successfully - * - * DESCRIPTION: Repair for the _CST object: - * 1. Sort the list ascending by C state type - * 2. Ensure type cannot be zero - * 3. A subpackage count of zero means _CST is meaningless - * 4. Count must match the number of C state subpackages - * - *****************************************************************************/ - -static ACPI_STATUS -AcpiNsRepair_CST ( - ACPI_EVALUATE_INFO *Info, - ACPI_OPERAND_OBJECT **ReturnObjectPtr) -{ - ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr; - ACPI_OPERAND_OBJECT **OuterElements; - UINT32 OuterElementCount; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_STATUS Status; - BOOLEAN Removing; - UINT32 i; - - - ACPI_FUNCTION_NAME (NsRepair_CST); - - - /* - * Check if the C-state type values are proportional. - */ - OuterElementCount = ReturnObject->Package.Count - 1; - i = 0; - while (i < OuterElementCount) - { - OuterElements = &ReturnObject->Package.Elements[i + 1]; - Removing = FALSE; - - if ((*OuterElements)->Package.Count == 0) - { - ACPI_WARN_PREDEFINED ((AE_INFO, - Info->FullPathname, Info->NodeFlags, - "SubPackage[%u] - removing entry due to zero count", i)); - Removing = TRUE; - goto RemoveElement; - } - - ObjDesc = (*OuterElements)->Package.Elements[1]; /* Index1 = Type */ - if ((UINT32) ObjDesc->Integer.Value == 0) - { - ACPI_WARN_PREDEFINED ((AE_INFO, - Info->FullPathname, Info->NodeFlags, - "SubPackage[%u] - removing entry due to invalid Type(0)", i)); - Removing = TRUE; - } - -RemoveElement: - if (Removing) - { - AcpiNsRemoveElement (ReturnObject, i + 1); - OuterElementCount--; - } - else - { - i++; - } - } - - /* Update top-level package count, Type "Integer" checked elsewhere */ - - ObjDesc = ReturnObject->Package.Elements[0]; - ObjDesc->Integer.Value = OuterElementCount; - - /* - * Entries (subpackages) in the _CST Package must be sorted by the - * C-state type, in ascending order. - */ - Status = AcpiNsCheckSortedList (Info, ReturnObject, 1, 4, 1, - ACPI_SORT_ASCENDING, "C-State Type"); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiNsRepair_HID - * - * PARAMETERS: Info - Method execution information block - * ReturnObjectPtr - Pointer to the object returned from the - * evaluation of a method or object - * - * RETURN: Status. AE_OK if object is OK or was repaired successfully - * - * DESCRIPTION: Repair for the _HID object. If a string, ensure that all - * letters are uppercase and that there is no leading asterisk. - * - *****************************************************************************/ - -static ACPI_STATUS -AcpiNsRepair_HID ( - ACPI_EVALUATE_INFO *Info, - ACPI_OPERAND_OBJECT **ReturnObjectPtr) -{ - ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr; - ACPI_OPERAND_OBJECT *NewString; - char *Source; - char *Dest; - - - ACPI_FUNCTION_TRACE (NsRepair_HID); - - - /* We only care about string _HID objects (not integers) */ - - if (ReturnObject->Common.Type != ACPI_TYPE_STRING) - { - return_ACPI_STATUS (AE_OK); - } - - if (ReturnObject->String.Length == 0) - { - ACPI_WARN_PREDEFINED ((AE_INFO, - Info->FullPathname, Info->NodeFlags, - "Invalid zero-length _HID or _CID string")); - - /* Return AE_OK anyway, let driver handle it */ - - Info->ReturnFlags |= ACPI_OBJECT_REPAIRED; - return_ACPI_STATUS (AE_OK); - } - - /* It is simplest to always create a new string object */ - - NewString = AcpiUtCreateStringObject (ReturnObject->String.Length); - if (!NewString) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* - * Remove a leading asterisk if present. For some unknown reason, there - * are many machines in the field that contains IDs like this. - * - * Examples: "*PNP0C03", "*ACPI0003" - */ - Source = ReturnObject->String.Pointer; - if (*Source == '*') - { - Source++; - NewString->String.Length--; - - ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR, - "%s: Removed invalid leading asterisk\n", Info->FullPathname)); - } - - /* - * Copy and uppercase the string. From the ACPI 5.0 specification: - * - * A valid PNP ID must be of the form "AAA####" where A is an uppercase - * letter and # is a hex digit. A valid ACPI ID must be of the form - * "NNNN####" where N is an uppercase letter or decimal digit, and - * # is a hex digit. - */ - for (Dest = NewString->String.Pointer; *Source; Dest++, Source++) - { - *Dest = (char) toupper ((int) *Source); - } - - AcpiUtRemoveReference (ReturnObject); - *ReturnObjectPtr = NewString; - return_ACPI_STATUS (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiNsRepair_PRT - * - * PARAMETERS: Info - Method execution information block - * ReturnObjectPtr - Pointer to the object returned from the - * evaluation of a method or object - * - * RETURN: Status. AE_OK if object is OK or was repaired successfully - * - * DESCRIPTION: Repair for the _PRT object. If necessary, fix reversed - * SourceName and SourceIndex field, a common BIOS bug. - * - *****************************************************************************/ - -static ACPI_STATUS -AcpiNsRepair_PRT ( - ACPI_EVALUATE_INFO *Info, - ACPI_OPERAND_OBJECT **ReturnObjectPtr) -{ - ACPI_OPERAND_OBJECT *PackageObject = *ReturnObjectPtr; - ACPI_OPERAND_OBJECT **TopObjectList; - ACPI_OPERAND_OBJECT **SubObjectList; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_OPERAND_OBJECT *SubPackage; - UINT32 ElementCount; - UINT32 Index; - - - /* Each element in the _PRT package is a subpackage */ - - TopObjectList = PackageObject->Package.Elements; - ElementCount = PackageObject->Package.Count; - - /* Examine each subpackage */ - - for (Index = 0; Index < ElementCount; Index++, TopObjectList++) - { - SubPackage = *TopObjectList; - SubObjectList = SubPackage->Package.Elements; - - /* Check for minimum required element count */ - - if (SubPackage->Package.Count < 4) - { - continue; - } - - /* - * If the BIOS has erroneously reversed the _PRT SourceName (index 2) - * and the SourceIndex (index 3), fix it. _PRT is important enough to - * workaround this BIOS error. This also provides compatibility with - * other ACPI implementations. - */ - ObjDesc = SubObjectList[3]; - if (!ObjDesc || (ObjDesc->Common.Type != ACPI_TYPE_INTEGER)) - { - SubObjectList[3] = SubObjectList[2]; - SubObjectList[2] = ObjDesc; - Info->ReturnFlags |= ACPI_OBJECT_REPAIRED; - - ACPI_WARN_PREDEFINED ((AE_INFO, - Info->FullPathname, Info->NodeFlags, - "PRT[%X]: Fixed reversed SourceName and SourceIndex", - Index)); - } - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiNsRepair_PSS - * - * PARAMETERS: Info - Method execution information block - * ReturnObjectPtr - Pointer to the object returned from the - * evaluation of a method or object - * - * RETURN: Status. AE_OK if object is OK or was repaired successfully - * - * DESCRIPTION: Repair for the _PSS object. If necessary, sort the object list - * by the CPU frequencies. Check that the power dissipation values - * are all proportional to CPU frequency (i.e., sorting by - * frequency should be the same as sorting by power.) - * - *****************************************************************************/ - -static ACPI_STATUS -AcpiNsRepair_PSS ( - ACPI_EVALUATE_INFO *Info, - ACPI_OPERAND_OBJECT **ReturnObjectPtr) -{ - ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr; - ACPI_OPERAND_OBJECT **OuterElements; - UINT32 OuterElementCount; - ACPI_OPERAND_OBJECT **Elements; - ACPI_OPERAND_OBJECT *ObjDesc; - UINT32 PreviousValue; - ACPI_STATUS Status; - UINT32 i; - - - /* - * Entries (subpackages) in the _PSS Package must be sorted by power - * dissipation, in descending order. If it appears that the list is - * incorrectly sorted, sort it. We sort by CpuFrequency, since this - * should be proportional to the power. - */ - Status = AcpiNsCheckSortedList (Info, ReturnObject, 0, 6, 0, - ACPI_SORT_DESCENDING, "CpuFrequency"); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* - * We now know the list is correctly sorted by CPU frequency. Check if - * the power dissipation values are proportional. - */ - PreviousValue = ACPI_UINT32_MAX; - OuterElements = ReturnObject->Package.Elements; - OuterElementCount = ReturnObject->Package.Count; - - for (i = 0; i < OuterElementCount; i++) - { - Elements = (*OuterElements)->Package.Elements; - ObjDesc = Elements[1]; /* Index1 = PowerDissipation */ - - if ((UINT32) ObjDesc->Integer.Value > PreviousValue) - { - ACPI_WARN_PREDEFINED ((AE_INFO, - Info->FullPathname, Info->NodeFlags, - "SubPackage[%u,%u] - suspicious power dissipation values", - i-1, i)); - } - - PreviousValue = (UINT32) ObjDesc->Integer.Value; - OuterElements++; - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiNsRepair_TSS - * - * PARAMETERS: Info - Method execution information block - * ReturnObjectPtr - Pointer to the object returned from the - * evaluation of a method or object - * - * RETURN: Status. AE_OK if object is OK or was repaired successfully - * - * DESCRIPTION: Repair for the _TSS object. If necessary, sort the object list - * descending by the power dissipation values. - * - *****************************************************************************/ - -static ACPI_STATUS -AcpiNsRepair_TSS ( - ACPI_EVALUATE_INFO *Info, - ACPI_OPERAND_OBJECT **ReturnObjectPtr) -{ - ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr; - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node; - - - /* - * We can only sort the _TSS return package if there is no _PSS in the - * same scope. This is because if _PSS is present, the ACPI specification - * dictates that the _TSS Power Dissipation field is to be ignored, and - * therefore some BIOSs leave garbage values in the _TSS Power field(s). - * In this case, it is best to just return the _TSS package as-is. - * (May, 2011) - */ - Status = AcpiNsGetNode (Info->Node, "^_PSS", - ACPI_NS_NO_UPSEARCH, &Node); - if (ACPI_SUCCESS (Status)) - { - return (AE_OK); - } - - Status = AcpiNsCheckSortedList (Info, ReturnObject, 0, 5, 1, - ACPI_SORT_DESCENDING, "PowerDissipation"); - - return (Status); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiNsCheckSortedList - * - * PARAMETERS: Info - Method execution information block - * ReturnObject - Pointer to the top-level returned object - * StartIndex - Index of the first subpackage - * ExpectedCount - Minimum length of each subpackage - * SortIndex - Subpackage entry to sort on - * SortDirection - Ascending or descending - * SortKeyName - Name of the SortIndex field - * - * RETURN: Status. AE_OK if the list is valid and is sorted correctly or - * has been repaired by sorting the list. - * - * DESCRIPTION: Check if the package list is valid and sorted correctly by the - * SortIndex. If not, then sort the list. - * - *****************************************************************************/ - -static ACPI_STATUS -AcpiNsCheckSortedList ( - ACPI_EVALUATE_INFO *Info, - ACPI_OPERAND_OBJECT *ReturnObject, - UINT32 StartIndex, - UINT32 ExpectedCount, - UINT32 SortIndex, - UINT8 SortDirection, - char *SortKeyName) -{ - UINT32 OuterElementCount; - ACPI_OPERAND_OBJECT **OuterElements; - ACPI_OPERAND_OBJECT **Elements; - ACPI_OPERAND_OBJECT *ObjDesc; - UINT32 i; - UINT32 PreviousValue; - - - ACPI_FUNCTION_NAME (NsCheckSortedList); - - - /* The top-level object must be a package */ - - if (ReturnObject->Common.Type != ACPI_TYPE_PACKAGE) - { - return (AE_AML_OPERAND_TYPE); - } - - /* - * NOTE: assumes list of subpackages contains no NULL elements. - * Any NULL elements should have been removed by earlier call - * to AcpiNsRemoveNullElements. - */ - OuterElementCount = ReturnObject->Package.Count; - if (!OuterElementCount || StartIndex >= OuterElementCount) - { - return (AE_AML_PACKAGE_LIMIT); - } - - OuterElements = &ReturnObject->Package.Elements[StartIndex]; - OuterElementCount -= StartIndex; - - PreviousValue = 0; - if (SortDirection == ACPI_SORT_DESCENDING) - { - PreviousValue = ACPI_UINT32_MAX; - } - - /* Examine each subpackage */ - - for (i = 0; i < OuterElementCount; i++) - { - /* Each element of the top-level package must also be a package */ - - if ((*OuterElements)->Common.Type != ACPI_TYPE_PACKAGE) - { - return (AE_AML_OPERAND_TYPE); - } - - /* Each subpackage must have the minimum length */ - - if ((*OuterElements)->Package.Count < ExpectedCount) - { - return (AE_AML_PACKAGE_LIMIT); - } - - Elements = (*OuterElements)->Package.Elements; - ObjDesc = Elements[SortIndex]; - - if (ObjDesc->Common.Type != ACPI_TYPE_INTEGER) - { - return (AE_AML_OPERAND_TYPE); - } - - /* - * The list must be sorted in the specified order. If we detect a - * discrepancy, sort the entire list. - */ - if (((SortDirection == ACPI_SORT_ASCENDING) && - (ObjDesc->Integer.Value < PreviousValue)) || - ((SortDirection == ACPI_SORT_DESCENDING) && - (ObjDesc->Integer.Value > PreviousValue))) - { - AcpiNsSortList (&ReturnObject->Package.Elements[StartIndex], - OuterElementCount, SortIndex, SortDirection); - - Info->ReturnFlags |= ACPI_OBJECT_REPAIRED; - - ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR, - "%s: Repaired unsorted list - now sorted by %s\n", - Info->FullPathname, SortKeyName)); - return (AE_OK); - } - - PreviousValue = (UINT32) ObjDesc->Integer.Value; - OuterElements++; - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiNsSortList - * - * PARAMETERS: Elements - Package object element list - * Count - Element count for above - * Index - Sort by which package element - * SortDirection - Ascending or Descending sort - * - * RETURN: None - * - * DESCRIPTION: Sort the objects that are in a package element list. - * - * NOTE: Assumes that all NULL elements have been removed from the package, - * and that all elements have been verified to be of type Integer. - * - *****************************************************************************/ - -static void -AcpiNsSortList ( - ACPI_OPERAND_OBJECT **Elements, - UINT32 Count, - UINT32 Index, - UINT8 SortDirection) -{ - ACPI_OPERAND_OBJECT *ObjDesc1; - ACPI_OPERAND_OBJECT *ObjDesc2; - ACPI_OPERAND_OBJECT *TempObj; - UINT32 i; - UINT32 j; - - - /* Simple bubble sort */ - - for (i = 1; i < Count; i++) - { - for (j = (Count - 1); j >= i; j--) - { - ObjDesc1 = Elements[j-1]->Package.Elements[Index]; - ObjDesc2 = Elements[j]->Package.Elements[Index]; - - if (((SortDirection == ACPI_SORT_ASCENDING) && - (ObjDesc1->Integer.Value > ObjDesc2->Integer.Value)) || - - ((SortDirection == ACPI_SORT_DESCENDING) && - (ObjDesc1->Integer.Value < ObjDesc2->Integer.Value))) - { - TempObj = Elements[j-1]; - Elements[j-1] = Elements[j]; - Elements[j] = TempObj; - } - } - } -} - - -/****************************************************************************** - * - * FUNCTION: AcpiNsRemoveElement - * - * PARAMETERS: ObjDesc - Package object element list - * Index - Index of element to remove - * - * RETURN: None - * - * DESCRIPTION: Remove the requested element of a package and delete it. - * - *****************************************************************************/ - -static void -AcpiNsRemoveElement ( - ACPI_OPERAND_OBJECT *ObjDesc, - UINT32 Index) -{ - ACPI_OPERAND_OBJECT **Source; - ACPI_OPERAND_OBJECT **Dest; - UINT32 Count; - UINT32 NewCount; - UINT32 i; - - - ACPI_FUNCTION_NAME (NsRemoveElement); - - - Count = ObjDesc->Package.Count; - NewCount = Count - 1; - - Source = ObjDesc->Package.Elements; - Dest = Source; - - /* Examine all elements of the package object, remove matched index */ - - for (i = 0; i < Count; i++) - { - if (i == Index) - { - AcpiUtRemoveReference (*Source); /* Remove one ref for being in pkg */ - AcpiUtRemoveReference (*Source); - } - else - { - *Dest = *Source; - Dest++; - } - - Source++; - } - - /* NULL terminate list and update the package count */ - - *Dest = NULL; - ObjDesc->Package.Count = NewCount; -} diff --git a/drivers/acpica/nssearch.c b/drivers/acpica/nssearch.c deleted file mode 100644 index df61f28..0000000 --- a/drivers/acpica/nssearch.c +++ /dev/null @@ -1,561 +0,0 @@ -/******************************************************************************* - * - * Module Name: nssearch - Namespace search - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" - -#ifdef ACPI_ASL_COMPILER -#include "amlcode.h" -#endif - -#define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nssearch") - -/* Local prototypes */ - -static ACPI_STATUS -AcpiNsSearchParentTree ( - UINT32 TargetName, - ACPI_NAMESPACE_NODE *Node, - ACPI_OBJECT_TYPE Type, - ACPI_NAMESPACE_NODE **ReturnNode); - - -/******************************************************************************* - * - * FUNCTION: AcpiNsSearchOneScope - * - * PARAMETERS: TargetName - Ascii ACPI name to search for - * ParentNode - Starting node where search will begin - * Type - Object type to match - * ReturnNode - Where the matched Named obj is returned - * - * RETURN: Status - * - * DESCRIPTION: Search a single level of the namespace. Performs a - * simple search of the specified level, and does not add - * entries or search parents. - * - * - * Named object lists are built (and subsequently dumped) in the - * order in which the names are encountered during the namespace load; - * - * All namespace searching is linear in this implementation, but - * could be easily modified to support any improved search - * algorithm. However, the linear search was chosen for simplicity - * and because the trees are small and the other interpreter - * execution overhead is relatively high. - * - * Note: CPU execution analysis has shown that the AML interpreter spends - * a very small percentage of its time searching the namespace. Therefore, - * the linear search seems to be sufficient, as there would seem to be - * little value in improving the search. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsSearchOneScope ( - UINT32 TargetName, - ACPI_NAMESPACE_NODE *ParentNode, - ACPI_OBJECT_TYPE Type, - ACPI_NAMESPACE_NODE **ReturnNode) -{ - ACPI_NAMESPACE_NODE *Node; - - - ACPI_FUNCTION_TRACE (NsSearchOneScope); - - -#ifdef ACPI_DEBUG_OUTPUT - if (ACPI_LV_NAMES & AcpiDbgLevel) - { - char *ScopeName; - - ScopeName = AcpiNsGetNormalizedPathname (ParentNode, TRUE); - if (ScopeName) - { - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Searching %s (%p) For [%4.4s] (%s)\n", - ScopeName, ParentNode, ACPI_CAST_PTR (char, &TargetName), - AcpiUtGetTypeName (Type))); - - ACPI_FREE (ScopeName); - } - } -#endif - - /* - * Search for name at this namespace level, which is to say that we - * must search for the name among the children of this object - */ - Node = ParentNode->Child; - while (Node) - { - /* Check for match against the name */ - - if (Node->Name.Integer == TargetName) - { - /* Resolve a control method alias if any */ - - if (AcpiNsGetType (Node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) - { - Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Node->Object); - } - - /* Found matching entry */ - - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n", - ACPI_CAST_PTR (char, &TargetName), - AcpiUtGetTypeName (Node->Type), - Node, AcpiUtGetNodeName (ParentNode), ParentNode)); - - *ReturnNode = Node; - return_ACPI_STATUS (AE_OK); - } - - /* Didn't match name, move on to the next peer object */ - - Node = Node->Peer; - } - - /* Searched entire namespace level, not found */ - - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Name [%4.4s] (%s) not found in search in scope [%4.4s] " - "%p first child %p\n", - ACPI_CAST_PTR (char, &TargetName), AcpiUtGetTypeName (Type), - AcpiUtGetNodeName (ParentNode), ParentNode, ParentNode->Child)); - - return_ACPI_STATUS (AE_NOT_FOUND); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsSearchParentTree - * - * PARAMETERS: TargetName - Ascii ACPI name to search for - * Node - Starting node where search will begin - * Type - Object type to match - * ReturnNode - Where the matched Node is returned - * - * RETURN: Status - * - * DESCRIPTION: Called when a name has not been found in the current namespace - * level. Before adding it or giving up, ACPI scope rules require - * searching enclosing scopes in cases identified by AcpiNsLocal(). - * - * "A name is located by finding the matching name in the current - * name space, and then in the parent name space. If the parent - * name space does not contain the name, the search continues - * recursively until either the name is found or the name space - * does not have a parent (the root of the name space). This - * indicates that the name is not found" (From ACPI Specification, - * section 5.3) - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiNsSearchParentTree ( - UINT32 TargetName, - ACPI_NAMESPACE_NODE *Node, - ACPI_OBJECT_TYPE Type, - ACPI_NAMESPACE_NODE **ReturnNode) -{ - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *ParentNode; - - - ACPI_FUNCTION_TRACE (NsSearchParentTree); - - - ParentNode = Node->Parent; - - /* - * If there is no parent (i.e., we are at the root) or type is "local", - * we won't be searching the parent tree. - */ - if (!ParentNode) - { - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] has no parent\n", - ACPI_CAST_PTR (char, &TargetName))); - return_ACPI_STATUS (AE_NOT_FOUND); - } - - if (AcpiNsLocal (Type)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "[%4.4s] type [%s] must be local to this scope (no parent search)\n", - ACPI_CAST_PTR (char, &TargetName), AcpiUtGetTypeName (Type))); - return_ACPI_STATUS (AE_NOT_FOUND); - } - - /* Search the parent tree */ - - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Searching parent [%4.4s] for [%4.4s]\n", - AcpiUtGetNodeName (ParentNode), ACPI_CAST_PTR (char, &TargetName))); - - /* Search parents until target is found or we have backed up to the root */ - - while (ParentNode) - { - /* - * Search parent scope. Use TYPE_ANY because we don't care about the - * object type at this point, we only care about the existence of - * the actual name we are searching for. Typechecking comes later. - */ - Status = AcpiNsSearchOneScope ( - TargetName, ParentNode, ACPI_TYPE_ANY, ReturnNode); - if (ACPI_SUCCESS (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Not found here, go up another level (until we reach the root) */ - - ParentNode = ParentNode->Parent; - } - - /* Not found in parent tree */ - - return_ACPI_STATUS (AE_NOT_FOUND); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsSearchAndEnter - * - * PARAMETERS: TargetName - Ascii ACPI name to search for (4 chars) - * WalkState - Current state of the walk - * Node - Starting node where search will begin - * InterpreterMode - Add names only in ACPI_MODE_LOAD_PASS_x. - * Otherwise,search only. - * Type - Object type to match - * Flags - Flags describing the search restrictions - * ReturnNode - Where the Node is returned - * - * RETURN: Status - * - * DESCRIPTION: Search for a name segment in a single namespace level, - * optionally adding it if it is not found. If the passed - * Type is not Any and the type previously stored in the - * entry was Any (i.e. unknown), update the stored type. - * - * In ACPI_IMODE_EXECUTE, search only. - * In other modes, search and add if not found. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsSearchAndEnter ( - UINT32 TargetName, - ACPI_WALK_STATE *WalkState, - ACPI_NAMESPACE_NODE *Node, - ACPI_INTERPRETER_MODE InterpreterMode, - ACPI_OBJECT_TYPE Type, - UINT32 Flags, - ACPI_NAMESPACE_NODE **ReturnNode) -{ - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *NewNode; - - - ACPI_FUNCTION_TRACE (NsSearchAndEnter); - - - /* Parameter validation */ - - if (!Node || !TargetName || !ReturnNode) - { - ACPI_ERROR ((AE_INFO, - "Null parameter: Node %p Name 0x%X ReturnNode %p", - Node, TargetName, ReturnNode)); - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* - * Name must consist of valid ACPI characters. We will repair the name if - * necessary because we don't want to abort because of this, but we want - * all namespace names to be printable. A warning message is appropriate. - * - * This issue came up because there are in fact machines that exhibit - * this problem, and we want to be able to enable ACPI support for them, - * even though there are a few bad names. - */ - AcpiUtRepairName (ACPI_CAST_PTR (char, &TargetName)); - - /* Try to find the name in the namespace level specified by the caller */ - - *ReturnNode = ACPI_ENTRY_NOT_FOUND; - Status = AcpiNsSearchOneScope (TargetName, Node, Type, ReturnNode); - if (Status != AE_NOT_FOUND) - { - /* - * If we found it AND the request specifies that a find is an error, - * return the error - */ - if (Status == AE_OK) - { - /* The node was found in the namespace */ - - /* - * If the namespace override feature is enabled for this node, - * delete any existing attached sub-object and make the node - * look like a new node that is owned by the override table. - */ - if (Flags & ACPI_NS_OVERRIDE_IF_FOUND) - { - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Namespace override: %4.4s pass %u type %X Owner %X\n", - ACPI_CAST_PTR(char, &TargetName), InterpreterMode, - (*ReturnNode)->Type, WalkState->OwnerId)); - - AcpiNsDeleteChildren (*ReturnNode); - if (AcpiGbl_RuntimeNamespaceOverride) - { - AcpiUtRemoveReference ((*ReturnNode)->Object); - (*ReturnNode)->Object = NULL; - (*ReturnNode)->OwnerId = WalkState->OwnerId; - } - else - { - AcpiNsRemoveNode (*ReturnNode); - *ReturnNode = ACPI_ENTRY_NOT_FOUND; - } - } - - /* Return an error if we don't expect to find the object */ - - else if (Flags & ACPI_NS_ERROR_IF_FOUND) - { - Status = AE_ALREADY_EXISTS; - } - } - -#ifdef ACPI_ASL_COMPILER - if (*ReturnNode && (*ReturnNode)->Type == ACPI_TYPE_ANY) - { - (*ReturnNode)->Flags |= ANOBJ_IS_EXTERNAL; - } -#endif - - /* Either found it or there was an error: finished either way */ - - return_ACPI_STATUS (Status); - } - - /* - * The name was not found. If we are NOT performing the first pass - * (name entry) of loading the namespace, search the parent tree (all the - * way to the root if necessary.) We don't want to perform the parent - * search when the namespace is actually being loaded. We want to perform - * the search when namespace references are being resolved (load pass 2) - * and during the execution phase. - */ - if ((InterpreterMode != ACPI_IMODE_LOAD_PASS1) && - (Flags & ACPI_NS_SEARCH_PARENT)) - { - /* - * Not found at this level - search parent tree according to the - * ACPI specification - */ - Status = AcpiNsSearchParentTree (TargetName, Node, Type, ReturnNode); - if (ACPI_SUCCESS (Status)) - { - return_ACPI_STATUS (Status); - } - } - - /* In execute mode, just search, never add names. Exit now */ - - if (InterpreterMode == ACPI_IMODE_EXECUTE) - { - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "%4.4s Not found in %p [Not adding]\n", - ACPI_CAST_PTR (char, &TargetName), Node)); - - return_ACPI_STATUS (AE_NOT_FOUND); - } - - /* Create the new named object */ - - NewNode = AcpiNsCreateNode (TargetName); - if (!NewNode) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - -#ifdef ACPI_ASL_COMPILER - - /* Node is an object defined by an External() statement */ - - if (Flags & ACPI_NS_EXTERNAL || - (WalkState && WalkState->Opcode == AML_SCOPE_OP)) - { - NewNode->Flags |= ANOBJ_IS_EXTERNAL; - } -#endif - - if (Flags & ACPI_NS_TEMPORARY) - { - NewNode->Flags |= ANOBJ_TEMPORARY; - } - - /* Install the new object into the parent's list of children */ - - AcpiNsInstallNode (WalkState, Node, NewNode, Type); - *ReturnNode = NewNode; - return_ACPI_STATUS (AE_OK); -} diff --git a/drivers/acpica/nsutils.c b/drivers/acpica/nsutils.c deleted file mode 100644 index 5f9faa8..0000000 --- a/drivers/acpica/nsutils.c +++ /dev/null @@ -1,994 +0,0 @@ -/****************************************************************************** - * - * Module Name: nsutils - Utilities for accessing ACPI namespace, accessing - * parents and siblings and Scope manipulation - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" -#include "amlcode.h" - -#define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nsutils") - -/* Local prototypes */ - -#ifdef ACPI_OBSOLETE_FUNCTIONS -ACPI_NAME -AcpiNsFindParentName ( - ACPI_NAMESPACE_NODE *NodeToSearch); -#endif - - -/******************************************************************************* - * - * FUNCTION: AcpiNsPrintNodePathname - * - * PARAMETERS: Node - Object - * Message - Prefix message - * - * DESCRIPTION: Print an object's full namespace pathname - * Manages allocation/freeing of a pathname buffer - * - ******************************************************************************/ - -void -AcpiNsPrintNodePathname ( - ACPI_NAMESPACE_NODE *Node, - const char *Message) -{ - ACPI_BUFFER Buffer; - ACPI_STATUS Status; - - - if (!Node) - { - AcpiOsPrintf ("[NULL NAME]"); - return; - } - - /* Convert handle to full pathname and print it (with supplied message) */ - - Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - - Status = AcpiNsHandleToPathname (Node, &Buffer, TRUE); - if (ACPI_SUCCESS (Status)) - { - if (Message) - { - AcpiOsPrintf ("%s ", Message); - } - - AcpiOsPrintf ("%s", (char *) Buffer.Pointer); - ACPI_FREE (Buffer.Pointer); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsGetType - * - * PARAMETERS: Node - Parent Node to be examined - * - * RETURN: Type field from Node whose handle is passed - * - * DESCRIPTION: Return the type of a Namespace node - * - ******************************************************************************/ - -ACPI_OBJECT_TYPE -AcpiNsGetType ( - ACPI_NAMESPACE_NODE *Node) -{ - ACPI_FUNCTION_TRACE (NsGetType); - - - if (!Node) - { - ACPI_WARNING ((AE_INFO, "Null Node parameter")); - return_UINT8 (ACPI_TYPE_ANY); - } - - return_UINT8 (Node->Type); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsLocal - * - * PARAMETERS: Type - A namespace object type - * - * RETURN: LOCAL if names must be found locally in objects of the - * passed type, 0 if enclosing scopes should be searched - * - * DESCRIPTION: Returns scope rule for the given object type. - * - ******************************************************************************/ - -UINT32 -AcpiNsLocal ( - ACPI_OBJECT_TYPE Type) -{ - ACPI_FUNCTION_TRACE (NsLocal); - - - if (!AcpiUtValidObjectType (Type)) - { - /* Type code out of range */ - - ACPI_WARNING ((AE_INFO, "Invalid Object Type 0x%X", Type)); - return_UINT32 (ACPI_NS_NORMAL); - } - - return_UINT32 (AcpiGbl_NsProperties[Type] & ACPI_NS_LOCAL); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsGetInternalNameLength - * - * PARAMETERS: Info - Info struct initialized with the - * external name pointer. - * - * RETURN: None - * - * DESCRIPTION: Calculate the length of the internal (AML) namestring - * corresponding to the external (ASL) namestring. - * - ******************************************************************************/ - -void -AcpiNsGetInternalNameLength ( - ACPI_NAMESTRING_INFO *Info) -{ - const char *NextExternalChar; - UINT32 i; - - - ACPI_FUNCTION_ENTRY (); - - - NextExternalChar = Info->ExternalName; - Info->NumCarats = 0; - Info->NumSegments = 0; - Info->FullyQualified = FALSE; - - /* - * For the internal name, the required length is 4 bytes per segment, - * plus 1 each for RootPrefix, MultiNamePrefixOp, segment count, - * trailing null (which is not really needed, but no there's harm in - * putting it there) - * - * strlen() + 1 covers the first NameSeg, which has no path separator - */ - if (ACPI_IS_ROOT_PREFIX (*NextExternalChar)) - { - Info->FullyQualified = TRUE; - NextExternalChar++; - - /* Skip redundant RootPrefix, like \\_SB.PCI0.SBRG.EC0 */ - - while (ACPI_IS_ROOT_PREFIX (*NextExternalChar)) - { - NextExternalChar++; - } - } - else - { - /* Handle Carat prefixes */ - - while (ACPI_IS_PARENT_PREFIX (*NextExternalChar)) - { - Info->NumCarats++; - NextExternalChar++; - } - } - - /* - * Determine the number of ACPI name "segments" by counting the number of - * path separators within the string. Start with one segment since the - * segment count is [(# separators) + 1], and zero separators is ok. - */ - if (*NextExternalChar) - { - Info->NumSegments = 1; - for (i = 0; NextExternalChar[i]; i++) - { - if (ACPI_IS_PATH_SEPARATOR (NextExternalChar[i])) - { - Info->NumSegments++; - } - } - } - - Info->Length = (ACPI_NAMESEG_SIZE * Info->NumSegments) + - 4 + Info->NumCarats; - - Info->NextExternalChar = NextExternalChar; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsBuildInternalName - * - * PARAMETERS: Info - Info struct fully initialized - * - * RETURN: Status - * - * DESCRIPTION: Construct the internal (AML) namestring - * corresponding to the external (ASL) namestring. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsBuildInternalName ( - ACPI_NAMESTRING_INFO *Info) -{ - UINT32 NumSegments = Info->NumSegments; - char *InternalName = Info->InternalName; - const char *ExternalName = Info->NextExternalChar; - char *Result = NULL; - UINT32 i; - - - ACPI_FUNCTION_TRACE (NsBuildInternalName); - - - /* Setup the correct prefixes, counts, and pointers */ - - if (Info->FullyQualified) - { - InternalName[0] = AML_ROOT_PREFIX; - - if (NumSegments <= 1) - { - Result = &InternalName[1]; - } - else if (NumSegments == 2) - { - InternalName[1] = AML_DUAL_NAME_PREFIX; - Result = &InternalName[2]; - } - else - { - InternalName[1] = AML_MULTI_NAME_PREFIX; - InternalName[2] = (char) NumSegments; - Result = &InternalName[3]; - } - } - else - { - /* - * Not fully qualified. - * Handle Carats first, then append the name segments - */ - i = 0; - if (Info->NumCarats) - { - for (i = 0; i < Info->NumCarats; i++) - { - InternalName[i] = AML_PARENT_PREFIX; - } - } - - if (NumSegments <= 1) - { - Result = &InternalName[i]; - } - else if (NumSegments == 2) - { - InternalName[i] = AML_DUAL_NAME_PREFIX; - Result = &InternalName[(ACPI_SIZE) i+1]; - } - else - { - InternalName[i] = AML_MULTI_NAME_PREFIX; - InternalName[(ACPI_SIZE) i+1] = (char) NumSegments; - Result = &InternalName[(ACPI_SIZE) i+2]; - } - } - - /* Build the name (minus path separators) */ - - for (; NumSegments; NumSegments--) - { - for (i = 0; i < ACPI_NAMESEG_SIZE; i++) - { - if (ACPI_IS_PATH_SEPARATOR (*ExternalName) || - (*ExternalName == 0)) - { - /* Pad the segment with underscore(s) if segment is short */ - - Result[i] = '_'; - } - else - { - /* Convert the character to uppercase and save it */ - - Result[i] = (char) toupper ((int) *ExternalName); - ExternalName++; - } - } - - /* Now we must have a path separator, or the pathname is bad */ - - if (!ACPI_IS_PATH_SEPARATOR (*ExternalName) && - (*ExternalName != 0)) - { - return_ACPI_STATUS (AE_BAD_PATHNAME); - } - - /* Move on the next segment */ - - ExternalName++; - Result += ACPI_NAMESEG_SIZE; - } - - /* Terminate the string */ - - *Result = 0; - - if (Info->FullyQualified) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Returning [%p] (abs) \"\\%s\"\n", - InternalName, InternalName)); - } - else - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Returning [%p] (rel) \"%s\"\n", - InternalName, InternalName)); - } - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsInternalizeName - * - * PARAMETERS: *ExternalName - External representation of name - * **Converted Name - Where to return the resulting - * internal representation of the name - * - * RETURN: Status - * - * DESCRIPTION: Convert an external representation (e.g. "\_PR_.CPU0") - * to internal form (e.g. 5c 2f 02 5f 50 52 5f 43 50 55 30) - * - *******************************************************************************/ - -ACPI_STATUS -AcpiNsInternalizeName ( - const char *ExternalName, - char **ConvertedName) -{ - char *InternalName; - ACPI_NAMESTRING_INFO Info; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (NsInternalizeName); - - - if ((!ExternalName) || - (*ExternalName == 0) || - (!ConvertedName)) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* Get the length of the new internal name */ - - Info.ExternalName = ExternalName; - AcpiNsGetInternalNameLength (&Info); - - /* We need a segment to store the internal name */ - - InternalName = ACPI_ALLOCATE_ZEROED (Info.Length); - if (!InternalName) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Build the name */ - - Info.InternalName = InternalName; - Status = AcpiNsBuildInternalName (&Info); - if (ACPI_FAILURE (Status)) - { - ACPI_FREE (InternalName); - return_ACPI_STATUS (Status); - } - - *ConvertedName = InternalName; - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsExternalizeName - * - * PARAMETERS: InternalNameLength - Length of the internal name below - * InternalName - Internal representation of name - * ConvertedNameLength - Where the length is returned - * ConvertedName - Where the resulting external name - * is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert internal name (e.g. 5c 2f 02 5f 50 52 5f 43 50 55 30) - * to its external (printable) form (e.g. "\_PR_.CPU0") - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsExternalizeName ( - UINT32 InternalNameLength, - const char *InternalName, - UINT32 *ConvertedNameLength, - char **ConvertedName) -{ - UINT32 NamesIndex = 0; - UINT32 NumSegments = 0; - UINT32 RequiredLength; - UINT32 PrefixLength = 0; - UINT32 i = 0; - UINT32 j = 0; - - - ACPI_FUNCTION_TRACE (NsExternalizeName); - - - if (!InternalNameLength || - !InternalName || - !ConvertedName) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* Check for a prefix (one '\' | one or more '^') */ - - switch (InternalName[0]) - { - case AML_ROOT_PREFIX: - - PrefixLength = 1; - break; - - case AML_PARENT_PREFIX: - - for (i = 0; i < InternalNameLength; i++) - { - if (ACPI_IS_PARENT_PREFIX (InternalName[i])) - { - PrefixLength = i + 1; - } - else - { - break; - } - } - - if (i == InternalNameLength) - { - PrefixLength = i; - } - - break; - - default: - - break; - } - - /* - * Check for object names. Note that there could be 0-255 of these - * 4-byte elements. - */ - if (PrefixLength < InternalNameLength) - { - switch (InternalName[PrefixLength]) - { - case AML_MULTI_NAME_PREFIX: - - /* 4-byte names */ - - NamesIndex = PrefixLength + 2; - NumSegments = (UINT8) - InternalName[(ACPI_SIZE) PrefixLength + 1]; - break; - - case AML_DUAL_NAME_PREFIX: - - /* Two 4-byte names */ - - NamesIndex = PrefixLength + 1; - NumSegments = 2; - break; - - case 0: - - /* NullName */ - - NamesIndex = 0; - NumSegments = 0; - break; - - default: - - /* one 4-byte name */ - - NamesIndex = PrefixLength; - NumSegments = 1; - break; - } - } - - /* - * Calculate the length of ConvertedName, which equals the length - * of the prefix, length of all object names, length of any required - * punctuation ('.') between object names, plus the NULL terminator. - */ - RequiredLength = PrefixLength + (4 * NumSegments) + - ((NumSegments > 0) ? (NumSegments - 1) : 0) + 1; - - /* - * Check to see if we're still in bounds. If not, there's a problem - * with InternalName (invalid format). - */ - if (RequiredLength > InternalNameLength) - { - ACPI_ERROR ((AE_INFO, "Invalid internal name")); - return_ACPI_STATUS (AE_BAD_PATHNAME); - } - - /* Build the ConvertedName */ - - *ConvertedName = ACPI_ALLOCATE_ZEROED (RequiredLength); - if (!(*ConvertedName)) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - j = 0; - - for (i = 0; i < PrefixLength; i++) - { - (*ConvertedName)[j++] = InternalName[i]; - } - - if (NumSegments > 0) - { - for (i = 0; i < NumSegments; i++) - { - if (i > 0) - { - (*ConvertedName)[j++] = '.'; - } - - /* Copy and validate the 4-char name segment */ - - ACPI_COPY_NAMESEG (&(*ConvertedName)[j], - &InternalName[NamesIndex]); - AcpiUtRepairName (&(*ConvertedName)[j]); - - j += ACPI_NAMESEG_SIZE; - NamesIndex += ACPI_NAMESEG_SIZE; - } - } - - if (ConvertedNameLength) - { - *ConvertedNameLength = (UINT32) RequiredLength; - } - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsValidateHandle - * - * PARAMETERS: Handle - Handle to be validated and typecast to a - * namespace node. - * - * RETURN: A pointer to a namespace node - * - * DESCRIPTION: Convert a namespace handle to a namespace node. Handles special - * cases for the root node. - * - * NOTE: Real integer handles would allow for more verification - * and keep all pointers within this subsystem - however this introduces - * more overhead and has not been necessary to this point. Drivers - * holding handles are typically notified before a node becomes invalid - * due to a table unload. - * - ******************************************************************************/ - -ACPI_NAMESPACE_NODE * -AcpiNsValidateHandle ( - ACPI_HANDLE Handle) -{ - - ACPI_FUNCTION_ENTRY (); - - - /* Parameter validation */ - - if ((!Handle) || (Handle == ACPI_ROOT_OBJECT)) - { - return (AcpiGbl_RootNode); - } - - /* We can at least attempt to verify the handle */ - - if (ACPI_GET_DESCRIPTOR_TYPE (Handle) != ACPI_DESC_TYPE_NAMED) - { - return (NULL); - } - - return (ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Handle)); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsTerminate - * - * PARAMETERS: none - * - * RETURN: none - * - * DESCRIPTION: free memory allocated for namespace and ACPI table storage. - * - ******************************************************************************/ - -void -AcpiNsTerminate ( - void) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (NsTerminate); - - - /* - * Free the entire namespace -- all nodes and all objects - * attached to the nodes - */ - AcpiNsDeleteNamespaceSubtree (AcpiGbl_RootNode); - - /* Delete any objects attached to the root node */ - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return_VOID; - } - - AcpiNsDeleteNode (AcpiGbl_RootNode); - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace freed\n")); - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsOpensScope - * - * PARAMETERS: Type - A valid namespace type - * - * RETURN: NEWSCOPE if the passed type "opens a name scope" according - * to the ACPI specification, else 0 - * - ******************************************************************************/ - -UINT32 -AcpiNsOpensScope ( - ACPI_OBJECT_TYPE Type) -{ - ACPI_FUNCTION_ENTRY (); - - - if (Type > ACPI_TYPE_LOCAL_MAX) - { - /* type code out of range */ - - ACPI_WARNING ((AE_INFO, "Invalid Object Type 0x%X", Type)); - return (ACPI_NS_NORMAL); - } - - return (((UINT32) AcpiGbl_NsProperties[Type]) & ACPI_NS_NEWSCOPE); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsGetNodeUnlocked - * - * PARAMETERS: *Pathname - Name to be found, in external (ASL) format. The - * \ (backslash) and ^ (carat) prefixes, and the - * . (period) to separate segments are supported. - * PrefixNode - Root of subtree to be searched, or NS_ALL for the - * root of the name space. If Name is fully - * qualified (first INT8 is '\'), the passed value - * of Scope will not be accessed. - * Flags - Used to indicate whether to perform upsearch or - * not. - * ReturnNode - Where the Node is returned - * - * DESCRIPTION: Look up a name relative to a given scope and return the - * corresponding Node. NOTE: Scope can be null. - * - * MUTEX: Doesn't locks namespace - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsGetNodeUnlocked ( - ACPI_NAMESPACE_NODE *PrefixNode, - const char *Pathname, - UINT32 Flags, - ACPI_NAMESPACE_NODE **ReturnNode) -{ - ACPI_GENERIC_STATE ScopeInfo; - ACPI_STATUS Status; - char *InternalPath; - - - ACPI_FUNCTION_TRACE_PTR (NsGetNodeUnlocked, ACPI_CAST_PTR (char, Pathname)); - - - /* Simplest case is a null pathname */ - - if (!Pathname) - { - *ReturnNode = PrefixNode; - if (!PrefixNode) - { - *ReturnNode = AcpiGbl_RootNode; - } - - return_ACPI_STATUS (AE_OK); - } - - /* Quick check for a reference to the root */ - - if (ACPI_IS_ROOT_PREFIX (Pathname[0]) && (!Pathname[1])) - { - *ReturnNode = AcpiGbl_RootNode; - return_ACPI_STATUS (AE_OK); - } - - /* Convert path to internal representation */ - - Status = AcpiNsInternalizeName (Pathname, &InternalPath); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Setup lookup scope (search starting point) */ - - ScopeInfo.Scope.Node = PrefixNode; - - /* Lookup the name in the namespace */ - - Status = AcpiNsLookup (&ScopeInfo, InternalPath, ACPI_TYPE_ANY, - ACPI_IMODE_EXECUTE, (Flags | ACPI_NS_DONT_OPEN_SCOPE), - NULL, ReturnNode); - if (ACPI_FAILURE (Status)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s, %s\n", - Pathname, AcpiFormatException (Status))); - } - - ACPI_FREE (InternalPath); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsGetNode - * - * PARAMETERS: *Pathname - Name to be found, in external (ASL) format. The - * \ (backslash) and ^ (carat) prefixes, and the - * . (period) to separate segments are supported. - * PrefixNode - Root of subtree to be searched, or NS_ALL for the - * root of the name space. If Name is fully - * qualified (first INT8 is '\'), the passed value - * of Scope will not be accessed. - * Flags - Used to indicate whether to perform upsearch or - * not. - * ReturnNode - Where the Node is returned - * - * DESCRIPTION: Look up a name relative to a given scope and return the - * corresponding Node. NOTE: Scope can be null. - * - * MUTEX: Locks namespace - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsGetNode ( - ACPI_NAMESPACE_NODE *PrefixNode, - const char *Pathname, - UINT32 Flags, - ACPI_NAMESPACE_NODE **ReturnNode) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE_PTR (NsGetNode, ACPI_CAST_PTR (char, Pathname)); - - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Status = AcpiNsGetNodeUnlocked (PrefixNode, Pathname, - Flags, ReturnNode); - - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/nswalk.c b/drivers/acpica/nswalk.c deleted file mode 100644 index ca5f394..0000000 --- a/drivers/acpica/nswalk.c +++ /dev/null @@ -1,496 +0,0 @@ -/****************************************************************************** - * - * Module Name: nswalk - Functions for walking the ACPI namespace - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" - - -#define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nswalk") - - -/******************************************************************************* - * - * FUNCTION: AcpiNsGetNextNode - * - * PARAMETERS: ParentNode - Parent node whose children we are - * getting - * ChildNode - Previous child that was found. - * The NEXT child will be returned - * - * RETURN: ACPI_NAMESPACE_NODE - Pointer to the NEXT child or NULL if - * none is found. - * - * DESCRIPTION: Return the next peer node within the namespace. If Handle - * is valid, Scope is ignored. Otherwise, the first node - * within Scope is returned. - * - ******************************************************************************/ - -ACPI_NAMESPACE_NODE * -AcpiNsGetNextNode ( - ACPI_NAMESPACE_NODE *ParentNode, - ACPI_NAMESPACE_NODE *ChildNode) -{ - ACPI_FUNCTION_ENTRY (); - - - if (!ChildNode) - { - /* It's really the parent's _scope_ that we want */ - - return (ParentNode->Child); - } - - /* Otherwise just return the next peer */ - - return (ChildNode->Peer); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsGetNextNodeTyped - * - * PARAMETERS: Type - Type of node to be searched for - * ParentNode - Parent node whose children we are - * getting - * ChildNode - Previous child that was found. - * The NEXT child will be returned - * - * RETURN: ACPI_NAMESPACE_NODE - Pointer to the NEXT child or NULL if - * none is found. - * - * DESCRIPTION: Return the next peer node within the namespace. If Handle - * is valid, Scope is ignored. Otherwise, the first node - * within Scope is returned. - * - ******************************************************************************/ - -ACPI_NAMESPACE_NODE * -AcpiNsGetNextNodeTyped ( - ACPI_OBJECT_TYPE Type, - ACPI_NAMESPACE_NODE *ParentNode, - ACPI_NAMESPACE_NODE *ChildNode) -{ - ACPI_NAMESPACE_NODE *NextNode = NULL; - - - ACPI_FUNCTION_ENTRY (); - - - NextNode = AcpiNsGetNextNode (ParentNode, ChildNode); - - /* If any type is OK, we are done */ - - if (Type == ACPI_TYPE_ANY) - { - /* NextNode is NULL if we are at the end-of-list */ - - return (NextNode); - } - - /* Must search for the node -- but within this scope only */ - - while (NextNode) - { - /* If type matches, we are done */ - - if (NextNode->Type == Type) - { - return (NextNode); - } - - /* Otherwise, move on to the next peer node */ - - NextNode = NextNode->Peer; - } - - /* Not found */ - - return (NULL); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsWalkNamespace - * - * PARAMETERS: Type - ACPI_OBJECT_TYPE to search for - * StartNode - Handle in namespace where search begins - * MaxDepth - Depth to which search is to reach - * Flags - Whether to unlock the NS before invoking - * the callback routine - * DescendingCallback - Called during tree descent - * when an object of "Type" is found - * AscendingCallback - Called during tree ascent - * when an object of "Type" is found - * Context - Passed to user function(s) above - * ReturnValue - from the UserFunction if terminated - * early. Otherwise, returns NULL. - * RETURNS: Status - * - * DESCRIPTION: Performs a modified depth-first walk of the namespace tree, - * starting (and ending) at the node specified by StartHandle. - * The callback function is called whenever a node that matches - * the type parameter is found. If the callback function returns - * a non-zero value, the search is terminated immediately and - * this value is returned to the caller. - * - * The point of this procedure is to provide a generic namespace - * walk routine that can be called from multiple places to - * provide multiple services; the callback function(s) can be - * tailored to each task, whether it is a print function, - * a compare function, etc. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsWalkNamespace ( - ACPI_OBJECT_TYPE Type, - ACPI_HANDLE StartNode, - UINT32 MaxDepth, - UINT32 Flags, - ACPI_WALK_CALLBACK DescendingCallback, - ACPI_WALK_CALLBACK AscendingCallback, - void *Context, - void **ReturnValue) -{ - ACPI_STATUS Status; - ACPI_STATUS MutexStatus; - ACPI_NAMESPACE_NODE *ChildNode; - ACPI_NAMESPACE_NODE *ParentNode; - ACPI_OBJECT_TYPE ChildType; - UINT32 Level; - BOOLEAN NodePreviouslyVisited = FALSE; - - - ACPI_FUNCTION_TRACE (NsWalkNamespace); - - - /* Special case for the namespace Root Node */ - - if (StartNode == ACPI_ROOT_OBJECT) - { - StartNode = AcpiGbl_RootNode; - } - - /* Avoid walking the namespace if the StartNode is NULL */ - - if (!StartNode) - { - return_ACPI_STATUS (AE_NO_NAMESPACE); - } - - /* Null child means "get first node" */ - - ParentNode = StartNode; - ChildNode = AcpiNsGetNextNode (ParentNode, NULL); - ChildType = ACPI_TYPE_ANY; - Level = 1; - - /* - * Traverse the tree of nodes until we bubble back up to where we - * started. When Level is zero, the loop is done because we have - * bubbled up to (and passed) the original parent handle (StartEntry) - */ - while (Level > 0 && ChildNode) - { - Status = AE_OK; - - /* Found next child, get the type if we are not searching for ANY */ - - if (Type != ACPI_TYPE_ANY) - { - ChildType = ChildNode->Type; - } - - /* - * Ignore all temporary namespace nodes (created during control - * method execution) unless told otherwise. These temporary nodes - * can cause a race condition because they can be deleted during - * the execution of the user function (if the namespace is - * unlocked before invocation of the user function.) Only the - * debugger namespace dump will examine the temporary nodes. - */ - if ((ChildNode->Flags & ANOBJ_TEMPORARY) && - !(Flags & ACPI_NS_WALK_TEMP_NODES)) - { - Status = AE_CTRL_DEPTH; - } - - /* Type must match requested type */ - - else if (ChildType == Type) - { - /* - * Found a matching node, invoke the user callback function. - * Unlock the namespace if flag is set. - */ - if (Flags & ACPI_NS_WALK_UNLOCK) - { - MutexStatus = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (MutexStatus)) - { - return_ACPI_STATUS (MutexStatus); - } - } - - /* - * Invoke the user function, either descending, ascending, - * or both. - */ - if (!NodePreviouslyVisited) - { - if (DescendingCallback) - { - Status = DescendingCallback (ChildNode, Level, - Context, ReturnValue); - } - } - else - { - if (AscendingCallback) - { - Status = AscendingCallback (ChildNode, Level, - Context, ReturnValue); - } - } - - if (Flags & ACPI_NS_WALK_UNLOCK) - { - MutexStatus = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (MutexStatus)) - { - return_ACPI_STATUS (MutexStatus); - } - } - - switch (Status) - { - case AE_OK: - case AE_CTRL_DEPTH: - - /* Just keep going */ - break; - - case AE_CTRL_TERMINATE: - - /* Exit now, with OK status */ - - return_ACPI_STATUS (AE_OK); - - default: - - /* All others are valid exceptions */ - - return_ACPI_STATUS (Status); - } - } - - /* - * Depth first search: Attempt to go down another level in the - * namespace if we are allowed to. Don't go any further if we have - * reached the caller specified maximum depth or if the user - * function has specified that the maximum depth has been reached. - */ - if (!NodePreviouslyVisited && - (Level < MaxDepth) && - (Status != AE_CTRL_DEPTH)) - { - if (ChildNode->Child) - { - /* There is at least one child of this node, visit it */ - - Level++; - ParentNode = ChildNode; - ChildNode = AcpiNsGetNextNode (ParentNode, NULL); - continue; - } - } - - /* No more children, re-visit this node */ - - if (!NodePreviouslyVisited) - { - NodePreviouslyVisited = TRUE; - continue; - } - - /* No more children, visit peers */ - - ChildNode = AcpiNsGetNextNode (ParentNode, ChildNode); - if (ChildNode) - { - NodePreviouslyVisited = FALSE; - } - - /* No peers, re-visit parent */ - - else - { - /* - * No more children of this node (AcpiNsGetNextNode failed), go - * back upwards in the namespace tree to the node's parent. - */ - Level--; - ChildNode = ParentNode; - ParentNode = ParentNode->Parent; - - NodePreviouslyVisited = TRUE; - } - } - - /* Complete walk, not terminated by user function */ - - return_ACPI_STATUS (AE_OK); -} diff --git a/drivers/acpica/nsxfeval.c b/drivers/acpica/nsxfeval.c deleted file mode 100644 index 244817c..0000000 --- a/drivers/acpica/nsxfeval.c +++ /dev/null @@ -1,1213 +0,0 @@ -/******************************************************************************* - * - * Module Name: nsxfeval - Public interfaces to the ACPI subsystem - * ACPI Object evaluation interfaces - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#define EXPORT_ACPI_INTERFACES - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" -#include "acinterp.h" - - -#define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nsxfeval") - -/* Local prototypes */ - -static void -AcpiNsResolveReferences ( - ACPI_EVALUATE_INFO *Info); - - -/******************************************************************************* - * - * FUNCTION: AcpiEvaluateObjectTyped - * - * PARAMETERS: Handle - Object handle (optional) - * Pathname - Object pathname (optional) - * ExternalParams - List of parameters to pass to a method, - * terminated by NULL. May be NULL - * if no parameters are being passed. - * ReturnBuffer - Where to put the object return value (if - * any). Required. - * ReturnType - Expected type of return object - * - * RETURN: Status - * - * DESCRIPTION: Find and evaluate the given object, passing the given - * parameters if necessary. One of "Handle" or "Pathname" must - * be valid (non-null) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvaluateObjectTyped ( - ACPI_HANDLE Handle, - ACPI_STRING Pathname, - ACPI_OBJECT_LIST *ExternalParams, - ACPI_BUFFER *ReturnBuffer, - ACPI_OBJECT_TYPE ReturnType) -{ - ACPI_STATUS Status; - BOOLEAN FreeBufferOnError = FALSE; - ACPI_HANDLE TargetHandle; - char *FullPathname; - - - ACPI_FUNCTION_TRACE (AcpiEvaluateObjectTyped); - - - /* Return buffer must be valid */ - - if (!ReturnBuffer) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - if (ReturnBuffer->Length == ACPI_ALLOCATE_BUFFER) - { - FreeBufferOnError = TRUE; - } - - /* Get a handle here, in order to build an error message if needed */ - - TargetHandle = Handle; - if (Pathname) - { - Status = AcpiGetHandle (Handle, Pathname, &TargetHandle); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - FullPathname = AcpiNsGetExternalPathname (TargetHandle); - if (!FullPathname) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Evaluate the object */ - - Status = AcpiEvaluateObject (TargetHandle, NULL, ExternalParams, - ReturnBuffer); - if (ACPI_FAILURE (Status)) - { - goto Exit; - } - - /* Type ANY means "don't care about return value type" */ - - if (ReturnType == ACPI_TYPE_ANY) - { - goto Exit; - } - - if (ReturnBuffer->Length == 0) - { - /* Error because caller specifically asked for a return value */ - - ACPI_ERROR ((AE_INFO, "%s did not return any object", - FullPathname)); - Status = AE_NULL_OBJECT; - goto Exit; - } - - /* Examine the object type returned from EvaluateObject */ - - if (((ACPI_OBJECT *) ReturnBuffer->Pointer)->Type == ReturnType) - { - goto Exit; - } - - /* Return object type does not match requested type */ - - ACPI_ERROR ((AE_INFO, - "Incorrect return type from %s - received [%s], requested [%s]", - FullPathname, - AcpiUtGetTypeName (((ACPI_OBJECT *) ReturnBuffer->Pointer)->Type), - AcpiUtGetTypeName (ReturnType))); - - if (FreeBufferOnError) - { - /* - * Free a buffer created via ACPI_ALLOCATE_BUFFER. - * Note: We use AcpiOsFree here because AcpiOsAllocate was used - * to allocate the buffer. This purposefully bypasses the - * (optionally enabled) allocation tracking mechanism since we - * only want to track internal allocations. - */ - AcpiOsFree (ReturnBuffer->Pointer); - ReturnBuffer->Pointer = NULL; - } - - ReturnBuffer->Length = 0; - Status = AE_TYPE; - -Exit: - ACPI_FREE (FullPathname); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiEvaluateObjectTyped) - - -/******************************************************************************* - * - * FUNCTION: AcpiEvaluateObject - * - * PARAMETERS: Handle - Object handle (optional) - * Pathname - Object pathname (optional) - * ExternalParams - List of parameters to pass to method, - * terminated by NULL. May be NULL - * if no parameters are being passed. - * ReturnBuffer - Where to put method's return value (if - * any). If NULL, no value is returned. - * - * RETURN: Status - * - * DESCRIPTION: Find and evaluate the given object, passing the given - * parameters if necessary. One of "Handle" or "Pathname" must - * be valid (non-null) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvaluateObject ( - ACPI_HANDLE Handle, - ACPI_STRING Pathname, - ACPI_OBJECT_LIST *ExternalParams, - ACPI_BUFFER *ReturnBuffer) -{ - ACPI_STATUS Status; - ACPI_EVALUATE_INFO *Info; - ACPI_SIZE BufferSpaceNeeded; - UINT32 i; - - - ACPI_FUNCTION_TRACE (AcpiEvaluateObject); - - - /* Allocate and initialize the evaluation information block */ - - Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO)); - if (!Info) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Convert and validate the device handle */ - - Info->PrefixNode = AcpiNsValidateHandle (Handle); - if (!Info->PrefixNode) - { - Status = AE_BAD_PARAMETER; - goto Cleanup; - } - - /* - * Get the actual namespace node for the target object. - * Handles these cases: - * - * 1) Null node, valid pathname from root (absolute path) - * 2) Node and valid pathname (path relative to Node) - * 3) Node, Null pathname - */ - if ((Pathname) && - (ACPI_IS_ROOT_PREFIX (Pathname[0]))) - { - /* The path is fully qualified, just evaluate by name */ - - Info->PrefixNode = NULL; - } - else if (!Handle) - { - /* - * A handle is optional iff a fully qualified pathname is specified. - * Since we've already handled fully qualified names above, this is - * an error. - */ - if (!Pathname) - { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Both Handle and Pathname are NULL")); - } - else - { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Null Handle with relative pathname [%s]", Pathname)); - } - - Status = AE_BAD_PARAMETER; - goto Cleanup; - } - - Info->RelativePathname = Pathname; - - /* - * Convert all external objects passed as arguments to the - * internal version(s). - */ - if (ExternalParams && ExternalParams->Count) - { - Info->ParamCount = (UINT16) ExternalParams->Count; - - /* Warn on impossible argument count */ - - if (Info->ParamCount > ACPI_METHOD_NUM_ARGS) - { - ACPI_WARN_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, - "Excess arguments (%u) - using only %u", - Info->ParamCount, ACPI_METHOD_NUM_ARGS)); - - Info->ParamCount = ACPI_METHOD_NUM_ARGS; - } - - /* - * Allocate a new parameter block for the internal objects - * Add 1 to count to allow for null terminated internal list - */ - Info->Parameters = ACPI_ALLOCATE_ZEROED ( - ((ACPI_SIZE) Info->ParamCount + 1) * sizeof (void *)); - if (!Info->Parameters) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - /* Convert each external object in the list to an internal object */ - - for (i = 0; i < Info->ParamCount; i++) - { - Status = AcpiUtCopyEobjectToIobject ( - &ExternalParams->Pointer[i], &Info->Parameters[i]); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - } - - Info->Parameters[Info->ParamCount] = NULL; - } - - -#ifdef _FUTURE_FEATURE - - /* - * Begin incoming argument count analysis. Check for too few args - * and too many args. - */ - switch (AcpiNsGetType (Info->Node)) - { - case ACPI_TYPE_METHOD: - - /* Check incoming argument count against the method definition */ - - if (Info->ObjDesc->Method.ParamCount > Info->ParamCount) - { - ACPI_ERROR ((AE_INFO, - "Insufficient arguments (%u) - %u are required", - Info->ParamCount, - Info->ObjDesc->Method.ParamCount)); - - Status = AE_MISSING_ARGUMENTS; - goto Cleanup; - } - - else if (Info->ObjDesc->Method.ParamCount < Info->ParamCount) - { - ACPI_WARNING ((AE_INFO, - "Excess arguments (%u) - only %u are required", - Info->ParamCount, - Info->ObjDesc->Method.ParamCount)); - - /* Just pass the required number of arguments */ - - Info->ParamCount = Info->ObjDesc->Method.ParamCount; - } - - /* - * Any incoming external objects to be passed as arguments to the - * method must be converted to internal objects - */ - if (Info->ParamCount) - { - /* - * Allocate a new parameter block for the internal objects - * Add 1 to count to allow for null terminated internal list - */ - Info->Parameters = ACPI_ALLOCATE_ZEROED ( - ((ACPI_SIZE) Info->ParamCount + 1) * sizeof (void *)); - if (!Info->Parameters) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - /* Convert each external object in the list to an internal object */ - - for (i = 0; i < Info->ParamCount; i++) - { - Status = AcpiUtCopyEobjectToIobject ( - &ExternalParams->Pointer[i], &Info->Parameters[i]); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - } - - Info->Parameters[Info->ParamCount] = NULL; - } - break; - - default: - - /* Warn if arguments passed to an object that is not a method */ - - if (Info->ParamCount) - { - ACPI_WARNING ((AE_INFO, - "%u arguments were passed to a non-method ACPI object", - Info->ParamCount)); - } - break; - } - -#endif - - - /* Now we can evaluate the object */ - - Status = AcpiNsEvaluate (Info); - - /* - * If we are expecting a return value, and all went well above, - * copy the return value to an external object. - */ - if (!ReturnBuffer) - { - goto CleanupReturnObject; - } - - if (!Info->ReturnObject) - { - ReturnBuffer->Length = 0; - goto Cleanup; - } - - if (ACPI_GET_DESCRIPTOR_TYPE (Info->ReturnObject) == - ACPI_DESC_TYPE_NAMED) - { - /* - * If we received a NS Node as a return object, this means that - * the object we are evaluating has nothing interesting to - * return (such as a mutex, etc.) We return an error because - * these types are essentially unsupported by this interface. - * We don't check up front because this makes it easier to add - * support for various types at a later date if necessary. - */ - Status = AE_TYPE; - Info->ReturnObject = NULL; /* No need to delete a NS Node */ - ReturnBuffer->Length = 0; - } - - if (ACPI_FAILURE (Status)) - { - goto CleanupReturnObject; - } - - /* Dereference Index and RefOf references */ - - AcpiNsResolveReferences (Info); - - /* Get the size of the returned object */ - - Status = AcpiUtGetObjectSize (Info->ReturnObject, - &BufferSpaceNeeded); - if (ACPI_SUCCESS (Status)) - { - /* Validate/Allocate/Clear caller buffer */ - - Status = AcpiUtInitializeBuffer (ReturnBuffer, - BufferSpaceNeeded); - if (ACPI_FAILURE (Status)) - { - /* - * Caller's buffer is too small or a new one can't - * be allocated - */ - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Needed buffer size %X, %s\n", - (UINT32) BufferSpaceNeeded, - AcpiFormatException (Status))); - } - else - { - /* We have enough space for the object, build it */ - - Status = AcpiUtCopyIobjectToEobject ( - Info->ReturnObject, ReturnBuffer); - } - } - -CleanupReturnObject: - - if (Info->ReturnObject) - { - /* - * Delete the internal return object. NOTE: Interpreter must be - * locked to avoid race condition. - */ - AcpiExEnterInterpreter (); - - /* Remove one reference on the return object (should delete it) */ - - AcpiUtRemoveReference (Info->ReturnObject); - AcpiExExitInterpreter (); - } - - -Cleanup: - - /* Free the input parameter list (if we created one) */ - - if (Info->Parameters) - { - /* Free the allocated parameter block */ - - AcpiUtDeleteInternalObjectList (Info->Parameters); - } - - ACPI_FREE (Info); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiEvaluateObject) - - -/******************************************************************************* - * - * FUNCTION: AcpiNsResolveReferences - * - * PARAMETERS: Info - Evaluation info block - * - * RETURN: Info->ReturnObject is replaced with the dereferenced object - * - * DESCRIPTION: Dereference certain reference objects. Called before an - * internal return object is converted to an external ACPI_OBJECT. - * - * Performs an automatic dereference of Index and RefOf reference objects. - * These reference objects are not supported by the ACPI_OBJECT, so this is a - * last resort effort to return something useful. Also, provides compatibility - * with other ACPI implementations. - * - * NOTE: does not handle references within returned package objects or nested - * references, but this support could be added later if found to be necessary. - * - ******************************************************************************/ - -static void -AcpiNsResolveReferences ( - ACPI_EVALUATE_INFO *Info) -{ - ACPI_OPERAND_OBJECT *ObjDesc = NULL; - ACPI_NAMESPACE_NODE *Node; - - - /* We are interested in reference objects only */ - - if ((Info->ReturnObject)->Common.Type != ACPI_TYPE_LOCAL_REFERENCE) - { - return; - } - - /* - * Two types of references are supported - those created by Index and - * RefOf operators. A name reference (AML_NAMEPATH_OP) can be converted - * to an ACPI_OBJECT, so it is not dereferenced here. A DdbHandle - * (AML_LOAD_OP) cannot be dereferenced, nor can it be converted to - * an ACPI_OBJECT. - */ - switch (Info->ReturnObject->Reference.Class) - { - case ACPI_REFCLASS_INDEX: - - ObjDesc = *(Info->ReturnObject->Reference.Where); - break; - - case ACPI_REFCLASS_REFOF: - - Node = Info->ReturnObject->Reference.Object; - if (Node) - { - ObjDesc = Node->Object; - } - break; - - default: - - return; - } - - /* Replace the existing reference object */ - - if (ObjDesc) - { - AcpiUtAddReference (ObjDesc); - AcpiUtRemoveReference (Info->ReturnObject); - Info->ReturnObject = ObjDesc; - } - - return; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiWalkNamespace - * - * PARAMETERS: Type - ACPI_OBJECT_TYPE to search for - * StartObject - Handle in namespace where search begins - * MaxDepth - Depth to which search is to reach - * DescendingCallback - Called during tree descent - * when an object of "Type" is found - * AscendingCallback - Called during tree ascent - * when an object of "Type" is found - * Context - Passed to user function(s) above - * ReturnValue - Location where return value of - * UserFunction is put if terminated early - * - * RETURNS Return value from the UserFunction if terminated early. - * Otherwise, returns NULL. - * - * DESCRIPTION: Performs a modified depth-first walk of the namespace tree, - * starting (and ending) at the object specified by StartHandle. - * The callback function is called whenever an object that matches - * the type parameter is found. If the callback function returns - * a non-zero value, the search is terminated immediately and this - * value is returned to the caller. - * - * The point of this procedure is to provide a generic namespace - * walk routine that can be called from multiple places to - * provide multiple services; the callback function(s) can be - * tailored to each task, whether it is a print function, - * a compare function, etc. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiWalkNamespace ( - ACPI_OBJECT_TYPE Type, - ACPI_HANDLE StartObject, - UINT32 MaxDepth, - ACPI_WALK_CALLBACK DescendingCallback, - ACPI_WALK_CALLBACK AscendingCallback, - void *Context, - void **ReturnValue) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiWalkNamespace); - - - /* Parameter validation */ - - if ((Type > ACPI_TYPE_LOCAL_MAX) || - (!MaxDepth) || - (!DescendingCallback && !AscendingCallback)) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* - * Need to acquire the namespace reader lock to prevent interference - * with any concurrent table unloads (which causes the deletion of - * namespace objects). We cannot allow the deletion of a namespace node - * while the user function is using it. The exception to this are the - * nodes created and deleted during control method execution -- these - * nodes are marked as temporary nodes and are ignored by the namespace - * walk. Thus, control methods can be executed while holding the - * namespace deletion lock (and the user function can execute control - * methods.) - */ - Status = AcpiUtAcquireReadLock (&AcpiGbl_NamespaceRwLock); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* - * Lock the namespace around the walk. The namespace will be - * unlocked/locked around each call to the user function - since the user - * function must be allowed to make ACPICA calls itself (for example, it - * will typically execute control methods during device enumeration.) - */ - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - goto UnlockAndExit; - } - - /* Now we can validate the starting node */ - - if (!AcpiNsValidateHandle (StartObject)) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit2; - } - - Status = AcpiNsWalkNamespace (Type, StartObject, MaxDepth, - ACPI_NS_WALK_UNLOCK, DescendingCallback, - AscendingCallback, Context, ReturnValue); - -UnlockAndExit2: - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - -UnlockAndExit: - (void) AcpiUtReleaseReadLock (&AcpiGbl_NamespaceRwLock); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiWalkNamespace) - - -/******************************************************************************* - * - * FUNCTION: AcpiNsGetDeviceCallback - * - * PARAMETERS: Callback from AcpiGetDevice - * - * RETURN: Status - * - * DESCRIPTION: Takes callbacks from WalkNamespace and filters out all non- - * present devices, or if they specified a HID, it filters based - * on that. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiNsGetDeviceCallback ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue) -{ - ACPI_GET_DEVICES_INFO *Info = Context; - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node; - UINT32 Flags; - ACPI_PNP_DEVICE_ID *Hid; - ACPI_PNP_DEVICE_ID_LIST *Cid; - UINT32 i; - BOOLEAN Found; - int NoMatch; - - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - Node = AcpiNsValidateHandle (ObjHandle); - Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - if (!Node) - { - return (AE_BAD_PARAMETER); - } - - /* - * First, filter based on the device HID and CID. - * - * 01/2010: For this case where a specific HID is requested, we don't - * want to run _STA until we have an actual HID match. Thus, we will - * not unnecessarily execute _STA on devices for which the caller - * doesn't care about. Previously, _STA was executed unconditionally - * on all devices found here. - * - * A side-effect of this change is that now we will continue to search - * for a matching HID even under device trees where the parent device - * would have returned a _STA that indicates it is not present or - * not functioning (thus aborting the search on that branch). - */ - if (Info->Hid != NULL) - { - Status = AcpiUtExecute_HID (Node, &Hid); - if (Status == AE_NOT_FOUND) - { - return (AE_OK); - } - else if (ACPI_FAILURE (Status)) - { - return (AE_CTRL_DEPTH); - } - - NoMatch = strcmp (Hid->String, Info->Hid); - ACPI_FREE (Hid); - - if (NoMatch) - { - /* - * HID does not match, attempt match within the - * list of Compatible IDs (CIDs) - */ - Status = AcpiUtExecute_CID (Node, &Cid); - if (Status == AE_NOT_FOUND) - { - return (AE_OK); - } - else if (ACPI_FAILURE (Status)) - { - return (AE_CTRL_DEPTH); - } - - /* Walk the CID list */ - - Found = FALSE; - for (i = 0; i < Cid->Count; i++) - { - if (strcmp (Cid->Ids[i].String, Info->Hid) == 0) - { - /* Found a matching CID */ - - Found = TRUE; - break; - } - } - - ACPI_FREE (Cid); - if (!Found) - { - return (AE_OK); - } - } - } - - /* Run _STA to determine if device is present */ - - Status = AcpiUtExecute_STA (Node, &Flags); - if (ACPI_FAILURE (Status)) - { - return (AE_CTRL_DEPTH); - } - - if (!(Flags & ACPI_STA_DEVICE_PRESENT) && - !(Flags & ACPI_STA_DEVICE_FUNCTIONING)) - { - /* - * Don't examine the children of the device only when the - * device is neither present nor functional. See ACPI spec, - * description of _STA for more information. - */ - return (AE_CTRL_DEPTH); - } - - /* We have a valid device, invoke the user function */ - - Status = Info->UserFunction (ObjHandle, NestingLevel, - Info->Context, ReturnValue); - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiGetDevices - * - * PARAMETERS: HID - HID to search for. Can be NULL. - * UserFunction - Called when a matching object is found - * Context - Passed to user function - * ReturnValue - Location where return value of - * UserFunction is put if terminated early - * - * RETURNS Return value from the UserFunction if terminated early. - * Otherwise, returns NULL. - * - * DESCRIPTION: Performs a modified depth-first walk of the namespace tree, - * starting (and ending) at the object specified by StartHandle. - * The UserFunction is called whenever an object of type - * Device is found. If the user function returns - * a non-zero value, the search is terminated immediately and this - * value is returned to the caller. - * - * This is a wrapper for WalkNamespace, but the callback performs - * additional filtering. Please see AcpiNsGetDeviceCallback. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiGetDevices ( - char *HID, - ACPI_WALK_CALLBACK UserFunction, - void *Context, - void **ReturnValue) -{ - ACPI_STATUS Status; - ACPI_GET_DEVICES_INFO Info; - - - ACPI_FUNCTION_TRACE (AcpiGetDevices); - - - /* Parameter validation */ - - if (!UserFunction) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* - * We're going to call their callback from OUR callback, so we need - * to know what it is, and their context parameter. - */ - Info.Hid = HID; - Info.Context = Context; - Info.UserFunction = UserFunction; - - /* - * Lock the namespace around the walk. - * The namespace will be unlocked/locked around each call - * to the user function - since this function - * must be allowed to make Acpi calls itself. - */ - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, - AcpiNsGetDeviceCallback, NULL, &Info, ReturnValue); - - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiGetDevices) - - -/******************************************************************************* - * - * FUNCTION: AcpiAttachData - * - * PARAMETERS: ObjHandle - Namespace node - * Handler - Handler for this attachment - * Data - Pointer to data to be attached - * - * RETURN: Status - * - * DESCRIPTION: Attach arbitrary data and handler to a namespace node. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiAttachData ( - ACPI_HANDLE ObjHandle, - ACPI_OBJECT_HANDLER Handler, - void *Data) -{ - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - - - /* Parameter validation */ - - if (!ObjHandle || - !Handler || - !Data) - { - return (AE_BAD_PARAMETER); - } - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Convert and validate the handle */ - - Node = AcpiNsValidateHandle (ObjHandle); - if (!Node) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - Status = AcpiNsAttachData (Node, Handler, Data); - -UnlockAndExit: - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiAttachData) - - -/******************************************************************************* - * - * FUNCTION: AcpiDetachData - * - * PARAMETERS: ObjHandle - Namespace node handle - * Handler - Handler used in call to AcpiAttachData - * - * RETURN: Status - * - * DESCRIPTION: Remove data that was previously attached to a node. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDetachData ( - ACPI_HANDLE ObjHandle, - ACPI_OBJECT_HANDLER Handler) -{ - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - - - /* Parameter validation */ - - if (!ObjHandle || - !Handler) - { - return (AE_BAD_PARAMETER); - } - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Convert and validate the handle */ - - Node = AcpiNsValidateHandle (ObjHandle); - if (!Node) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - Status = AcpiNsDetachData (Node, Handler); - -UnlockAndExit: - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiDetachData) - - -/******************************************************************************* - * - * FUNCTION: AcpiGetData - * - * PARAMETERS: ObjHandle - Namespace node - * Handler - Handler used in call to AttachData - * Data - Where the data is returned - * - * RETURN: Status - * - * DESCRIPTION: Retrieve data that was previously attached to a namespace node. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiGetData ( - ACPI_HANDLE ObjHandle, - ACPI_OBJECT_HANDLER Handler, - void **Data) -{ - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - - - /* Parameter validation */ - - if (!ObjHandle || - !Handler || - !Data) - { - return (AE_BAD_PARAMETER); - } - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Convert and validate the handle */ - - Node = AcpiNsValidateHandle (ObjHandle); - if (!Node) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - Status = AcpiNsGetAttachedData (Node, Handler, Data); - -UnlockAndExit: - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiGetData) diff --git a/drivers/acpica/nsxfname.c b/drivers/acpica/nsxfname.c deleted file mode 100644 index 939ad04..0000000 --- a/drivers/acpica/nsxfname.c +++ /dev/null @@ -1,812 +0,0 @@ -/****************************************************************************** - * - * Module Name: nsxfname - Public interfaces to the ACPI subsystem - * ACPI Namespace oriented interfaces - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#define EXPORT_ACPI_INTERFACES - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" -#include "acparser.h" -#include "amlcode.h" - - -#define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nsxfname") - -/* Local prototypes */ - -static char * -AcpiNsCopyDeviceId ( - ACPI_PNP_DEVICE_ID *Dest, - ACPI_PNP_DEVICE_ID *Source, - char *StringArea); - - -/****************************************************************************** - * - * FUNCTION: AcpiGetHandle - * - * PARAMETERS: Parent - Object to search under (search scope). - * Pathname - Pointer to an asciiz string containing the - * name - * RetHandle - Where the return handle is returned - * - * RETURN: Status - * - * DESCRIPTION: This routine will search for a caller specified name in the - * name space. The caller can restrict the search region by - * specifying a non NULL parent. The parent value is itself a - * namespace handle. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiGetHandle ( - ACPI_HANDLE Parent, - const char *Pathname, - ACPI_HANDLE *RetHandle) -{ - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node = NULL; - ACPI_NAMESPACE_NODE *PrefixNode = NULL; - - - ACPI_FUNCTION_ENTRY (); - - - /* Parameter Validation */ - - if (!RetHandle || !Pathname) - { - return (AE_BAD_PARAMETER); - } - - /* Convert a parent handle to a prefix node */ - - if (Parent) - { - PrefixNode = AcpiNsValidateHandle (Parent); - if (!PrefixNode) - { - return (AE_BAD_PARAMETER); - } - } - - /* - * Valid cases are: - * 1) Fully qualified pathname - * 2) Parent + Relative pathname - * - * Error for - */ - if (ACPI_IS_ROOT_PREFIX (Pathname[0])) - { - /* Pathname is fully qualified (starts with '\') */ - - /* Special case for root-only, since we can't search for it */ - - if (!strcmp (Pathname, ACPI_NS_ROOT_PATH)) - { - *RetHandle = ACPI_CAST_PTR (ACPI_HANDLE, AcpiGbl_RootNode); - return (AE_OK); - } - } - else if (!PrefixNode) - { - /* Relative path with null prefix is disallowed */ - - return (AE_BAD_PARAMETER); - } - - /* Find the Node and convert to a handle */ - - Status = AcpiNsGetNode (PrefixNode, Pathname, ACPI_NS_NO_UPSEARCH, &Node); - if (ACPI_SUCCESS (Status)) - { - *RetHandle = ACPI_CAST_PTR (ACPI_HANDLE, Node); - } - - return (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiGetHandle) - - -/****************************************************************************** - * - * FUNCTION: AcpiGetName - * - * PARAMETERS: Handle - Handle to be converted to a pathname - * NameType - Full pathname or single segment - * Buffer - Buffer for returned path - * - * RETURN: Pointer to a string containing the fully qualified Name. - * - * DESCRIPTION: This routine returns the fully qualified name associated with - * the Handle parameter. This and the AcpiPathnameToHandle are - * complementary functions. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiGetName ( - ACPI_HANDLE Handle, - UINT32 NameType, - ACPI_BUFFER *Buffer) -{ - ACPI_STATUS Status; - - - /* Parameter validation */ - - if (NameType > ACPI_NAME_TYPE_MAX) - { - return (AE_BAD_PARAMETER); - } - - Status = AcpiUtValidateBuffer (Buffer); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* - * Wants the single segment ACPI name. - * Validate handle and convert to a namespace Node - */ - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - if (NameType == ACPI_FULL_PATHNAME || - NameType == ACPI_FULL_PATHNAME_NO_TRAILING) - { - /* Get the full pathname (From the namespace root) */ - - Status = AcpiNsHandleToPathname (Handle, Buffer, - NameType == ACPI_FULL_PATHNAME ? FALSE : TRUE); - } - else - { - /* Get the single name */ - - Status = AcpiNsHandleToName (Handle, Buffer); - } - - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiGetName) - - -/****************************************************************************** - * - * FUNCTION: AcpiNsCopyDeviceId - * - * PARAMETERS: Dest - Pointer to the destination PNP_DEVICE_ID - * Source - Pointer to the source PNP_DEVICE_ID - * StringArea - Pointer to where to copy the dest string - * - * RETURN: Pointer to the next string area - * - * DESCRIPTION: Copy a single PNP_DEVICE_ID, including the string data. - * - ******************************************************************************/ - -static char * -AcpiNsCopyDeviceId ( - ACPI_PNP_DEVICE_ID *Dest, - ACPI_PNP_DEVICE_ID *Source, - char *StringArea) -{ - /* Create the destination PNP_DEVICE_ID */ - - Dest->String = StringArea; - Dest->Length = Source->Length; - - /* Copy actual string and return a pointer to the next string area */ - - memcpy (StringArea, Source->String, Source->Length); - return (StringArea + Source->Length); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiGetObjectInfo - * - * PARAMETERS: Handle - Object Handle - * ReturnBuffer - Where the info is returned - * - * RETURN: Status - * - * DESCRIPTION: Returns information about an object as gleaned from the - * namespace node and possibly by running several standard - * control methods (Such as in the case of a device.) - * - * For Device and Processor objects, run the Device _HID, _UID, _CID, - * _CLS, _ADR, _SxW, and _SxD methods. - * - * Note: Allocates the return buffer, must be freed by the caller. - * - * Note: This interface is intended to be used during the initial device - * discovery namespace traversal. Therefore, no complex methods can be - * executed, especially those that access operation regions. Therefore, do - * not add any additional methods that could cause problems in this area. - * Because of this reason support for the following methods has been removed: - * 1) _SUB method was removed (11/2015) - * 2) _STA method was removed (02/2018) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiGetObjectInfo ( - ACPI_HANDLE Handle, - ACPI_DEVICE_INFO **ReturnBuffer) -{ - ACPI_NAMESPACE_NODE *Node; - ACPI_DEVICE_INFO *Info; - ACPI_PNP_DEVICE_ID_LIST *CidList = NULL; - ACPI_PNP_DEVICE_ID *Hid = NULL; - ACPI_PNP_DEVICE_ID *Uid = NULL; - ACPI_PNP_DEVICE_ID *Cls = NULL; - char *NextIdString; - ACPI_OBJECT_TYPE Type; - ACPI_NAME Name; - UINT8 ParamCount= 0; - UINT16 Valid = 0; - UINT32 InfoSize; - UINT32 i; - ACPI_STATUS Status; - - - /* Parameter validation */ - - if (!Handle || !ReturnBuffer) - { - return (AE_BAD_PARAMETER); - } - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - Node = AcpiNsValidateHandle (Handle); - if (!Node) - { - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return (AE_BAD_PARAMETER); - } - - /* Get the namespace node data while the namespace is locked */ - - InfoSize = sizeof (ACPI_DEVICE_INFO); - Type = Node->Type; - Name = Node->Name.Integer; - - if (Node->Type == ACPI_TYPE_METHOD) - { - ParamCount = Node->Object->Method.ParamCount; - } - - Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - if ((Type == ACPI_TYPE_DEVICE) || - (Type == ACPI_TYPE_PROCESSOR)) - { - /* - * Get extra info for ACPI Device/Processor objects only: - * Run the Device _HID, _UID, _CLS, and _CID methods. - * - * Note: none of these methods are required, so they may or may - * not be present for this device. The Info->Valid bitfield is used - * to indicate which methods were found and run successfully. - */ - - /* Execute the Device._HID method */ - - Status = AcpiUtExecute_HID (Node, &Hid); - if (ACPI_SUCCESS (Status)) - { - InfoSize += Hid->Length; - Valid |= ACPI_VALID_HID; - } - - /* Execute the Device._UID method */ - - Status = AcpiUtExecute_UID (Node, &Uid); - if (ACPI_SUCCESS (Status)) - { - InfoSize += Uid->Length; - Valid |= ACPI_VALID_UID; - } - - /* Execute the Device._CID method */ - - Status = AcpiUtExecute_CID (Node, &CidList); - if (ACPI_SUCCESS (Status)) - { - /* Add size of CID strings and CID pointer array */ - - InfoSize += (CidList->ListSize - sizeof (ACPI_PNP_DEVICE_ID_LIST)); - Valid |= ACPI_VALID_CID; - } - - /* Execute the Device._CLS method */ - - Status = AcpiUtExecute_CLS (Node, &Cls); - if (ACPI_SUCCESS (Status)) - { - InfoSize += Cls->Length; - Valid |= ACPI_VALID_CLS; - } - } - - /* - * Now that we have the variable-length data, we can allocate the - * return buffer - */ - Info = ACPI_ALLOCATE_ZEROED (InfoSize); - if (!Info) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - /* Get the fixed-length data */ - - if ((Type == ACPI_TYPE_DEVICE) || - (Type == ACPI_TYPE_PROCESSOR)) - { - /* - * Get extra info for ACPI Device/Processor objects only: - * Run the _ADR and, SxW, and _SxD methods. - * - * Notes: none of these methods are required, so they may or may - * not be present for this device. The Info->Valid bitfield is used - * to indicate which methods were found and run successfully. - */ - - /* Execute the Device._ADR method */ - - Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, Node, - &Info->Address); - if (ACPI_SUCCESS (Status)) - { - Valid |= ACPI_VALID_ADR; - } - - /* Execute the Device._SxW methods */ - - Status = AcpiUtExecutePowerMethods (Node, - AcpiGbl_LowestDstateNames, ACPI_NUM_SxW_METHODS, - Info->LowestDstates); - if (ACPI_SUCCESS (Status)) - { - Valid |= ACPI_VALID_SXWS; - } - - /* Execute the Device._SxD methods */ - - Status = AcpiUtExecutePowerMethods (Node, - AcpiGbl_HighestDstateNames, ACPI_NUM_SxD_METHODS, - Info->HighestDstates); - if (ACPI_SUCCESS (Status)) - { - Valid |= ACPI_VALID_SXDS; - } - } - - /* - * Create a pointer to the string area of the return buffer. - * Point to the end of the base ACPI_DEVICE_INFO structure. - */ - NextIdString = ACPI_CAST_PTR (char, Info->CompatibleIdList.Ids); - if (CidList) - { - /* Point past the CID PNP_DEVICE_ID array */ - - NextIdString += ((ACPI_SIZE) CidList->Count * sizeof (ACPI_PNP_DEVICE_ID)); - } - - /* - * Copy the HID, UID, and CIDs to the return buffer. The variable-length - * strings are copied to the reserved area at the end of the buffer. - * - * For HID and CID, check if the ID is a PCI Root Bridge. - */ - if (Hid) - { - NextIdString = AcpiNsCopyDeviceId (&Info->HardwareId, - Hid, NextIdString); - - if (AcpiUtIsPciRootBridge (Hid->String)) - { - Info->Flags |= ACPI_PCI_ROOT_BRIDGE; - } - } - - if (Uid) - { - NextIdString = AcpiNsCopyDeviceId (&Info->UniqueId, - Uid, NextIdString); - } - - if (CidList) - { - Info->CompatibleIdList.Count = CidList->Count; - Info->CompatibleIdList.ListSize = CidList->ListSize; - - /* Copy each CID */ - - for (i = 0; i < CidList->Count; i++) - { - NextIdString = AcpiNsCopyDeviceId (&Info->CompatibleIdList.Ids[i], - &CidList->Ids[i], NextIdString); - - if (AcpiUtIsPciRootBridge (CidList->Ids[i].String)) - { - Info->Flags |= ACPI_PCI_ROOT_BRIDGE; - } - } - } - - if (Cls) - { - (void) AcpiNsCopyDeviceId (&Info->ClassCode, - Cls, NextIdString); - } - - /* Copy the fixed-length data */ - - Info->InfoSize = InfoSize; - Info->Type = Type; - Info->Name = Name; - Info->ParamCount = ParamCount; - Info->Valid = Valid; - - *ReturnBuffer = Info; - Status = AE_OK; - - -Cleanup: - if (Hid) - { - ACPI_FREE (Hid); - } - if (Uid) - { - ACPI_FREE (Uid); - } - if (CidList) - { - ACPI_FREE (CidList); - } - if (Cls) - { - ACPI_FREE (Cls); - } - return (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiGetObjectInfo) - - -/****************************************************************************** - * - * FUNCTION: AcpiInstallMethod - * - * PARAMETERS: Buffer - An ACPI table containing one control method - * - * RETURN: Status - * - * DESCRIPTION: Install a control method into the namespace. If the method - * name already exists in the namespace, it is overwritten. The - * input buffer must contain a valid DSDT or SSDT containing a - * single control method. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiInstallMethod ( - UINT8 *Buffer) -{ - ACPI_TABLE_HEADER *Table = ACPI_CAST_PTR (ACPI_TABLE_HEADER, Buffer); - UINT8 *AmlBuffer; - UINT8 *AmlStart; - char *Path; - ACPI_NAMESPACE_NODE *Node; - ACPI_OPERAND_OBJECT *MethodObj; - ACPI_PARSE_STATE ParserState; - UINT32 AmlLength; - UINT16 Opcode; - UINT8 MethodFlags; - ACPI_STATUS Status; - - - /* Parameter validation */ - - if (!Buffer) - { - return (AE_BAD_PARAMETER); - } - - /* Table must be a DSDT or SSDT */ - - if (!ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_DSDT) && - !ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_SSDT)) - { - return (AE_BAD_HEADER); - } - - /* First AML opcode in the table must be a control method */ - - ParserState.Aml = Buffer + sizeof (ACPI_TABLE_HEADER); - Opcode = AcpiPsPeekOpcode (&ParserState); - if (Opcode != AML_METHOD_OP) - { - return (AE_BAD_PARAMETER); - } - - /* Extract method information from the raw AML */ - - ParserState.Aml += AcpiPsGetOpcodeSize (Opcode); - ParserState.PkgEnd = AcpiPsGetNextPackageEnd (&ParserState); - Path = AcpiPsGetNextNamestring (&ParserState); - - MethodFlags = *ParserState.Aml++; - AmlStart = ParserState.Aml; - AmlLength = (UINT32) ACPI_PTR_DIFF (ParserState.PkgEnd, AmlStart); - - /* - * Allocate resources up-front. We don't want to have to delete a new - * node from the namespace if we cannot allocate memory. - */ - AmlBuffer = ACPI_ALLOCATE (AmlLength); - if (!AmlBuffer) - { - return (AE_NO_MEMORY); - } - - MethodObj = AcpiUtCreateInternalObject (ACPI_TYPE_METHOD); - if (!MethodObj) - { - ACPI_FREE (AmlBuffer); - return (AE_NO_MEMORY); - } - - /* Lock namespace for AcpiNsLookup, we may be creating a new node */ - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - goto ErrorExit; - } - - /* The lookup either returns an existing node or creates a new one */ - - Status = AcpiNsLookup (NULL, Path, ACPI_TYPE_METHOD, ACPI_IMODE_LOAD_PASS1, - ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND, NULL, &Node); - - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - - if (ACPI_FAILURE (Status)) /* NsLookup */ - { - if (Status != AE_ALREADY_EXISTS) - { - goto ErrorExit; - } - - /* Node existed previously, make sure it is a method node */ - - if (Node->Type != ACPI_TYPE_METHOD) - { - Status = AE_TYPE; - goto ErrorExit; - } - } - - /* Copy the method AML to the local buffer */ - - memcpy (AmlBuffer, AmlStart, AmlLength); - - /* Initialize the method object with the new method's information */ - - MethodObj->Method.AmlStart = AmlBuffer; - MethodObj->Method.AmlLength = AmlLength; - - MethodObj->Method.ParamCount = (UINT8) - (MethodFlags & AML_METHOD_ARG_COUNT); - - if (MethodFlags & AML_METHOD_SERIALIZED) - { - MethodObj->Method.InfoFlags = ACPI_METHOD_SERIALIZED; - - MethodObj->Method.SyncLevel = (UINT8) - ((MethodFlags & AML_METHOD_SYNC_LEVEL) >> 4); - } - - /* - * Now that it is complete, we can attach the new method object to - * the method Node (detaches/deletes any existing object) - */ - Status = AcpiNsAttachObject (Node, MethodObj, ACPI_TYPE_METHOD); - - /* - * Flag indicates AML buffer is dynamic, must be deleted later. - * Must be set only after attach above. - */ - Node->Flags |= ANOBJ_ALLOCATED_BUFFER; - - /* Remove local reference to the method object */ - - AcpiUtRemoveReference (MethodObj); - return (Status); - - -ErrorExit: - - ACPI_FREE (AmlBuffer); - AcpiUtDeleteObjectDesc (MethodObj); - return (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiInstallMethod) diff --git a/drivers/acpica/nsxfobj.c b/drivers/acpica/nsxfobj.c deleted file mode 100644 index aa906f9..0000000 --- a/drivers/acpica/nsxfobj.c +++ /dev/null @@ -1,389 +0,0 @@ -/******************************************************************************* - * - * Module Name: nsxfobj - Public interfaces to the ACPI subsystem - * ACPI Object oriented interfaces - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#define EXPORT_ACPI_INTERFACES - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" - - -#define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nsxfobj") - -/******************************************************************************* - * - * FUNCTION: AcpiGetType - * - * PARAMETERS: Handle - Handle of object whose type is desired - * RetType - Where the type will be placed - * - * RETURN: Status - * - * DESCRIPTION: This routine returns the type associated with a particular - * handle - * - ******************************************************************************/ - -ACPI_STATUS -AcpiGetType ( - ACPI_HANDLE Handle, - ACPI_OBJECT_TYPE *RetType) -{ - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - - - /* Parameter Validation */ - - if (!RetType) - { - return (AE_BAD_PARAMETER); - } - - /* Special case for the predefined Root Node (return type ANY) */ - - if (Handle == ACPI_ROOT_OBJECT) - { - *RetType = ACPI_TYPE_ANY; - return (AE_OK); - } - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Convert and validate the handle */ - - Node = AcpiNsValidateHandle (Handle); - if (!Node) - { - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return (AE_BAD_PARAMETER); - } - - *RetType = Node->Type; - - Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiGetType) - - -/******************************************************************************* - * - * FUNCTION: AcpiGetParent - * - * PARAMETERS: Handle - Handle of object whose parent is desired - * RetHandle - Where the parent handle will be placed - * - * RETURN: Status - * - * DESCRIPTION: Returns a handle to the parent of the object represented by - * Handle. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiGetParent ( - ACPI_HANDLE Handle, - ACPI_HANDLE *RetHandle) -{ - ACPI_NAMESPACE_NODE *Node; - ACPI_NAMESPACE_NODE *ParentNode; - ACPI_STATUS Status; - - - if (!RetHandle) - { - return (AE_BAD_PARAMETER); - } - - /* Special case for the predefined Root Node (no parent) */ - - if (Handle == ACPI_ROOT_OBJECT) - { - return (AE_NULL_ENTRY); - } - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Convert and validate the handle */ - - Node = AcpiNsValidateHandle (Handle); - if (!Node) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - /* Get the parent entry */ - - ParentNode = Node->Parent; - *RetHandle = ACPI_CAST_PTR (ACPI_HANDLE, ParentNode); - - /* Return exception if parent is null */ - - if (!ParentNode) - { - Status = AE_NULL_ENTRY; - } - - -UnlockAndExit: - - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiGetParent) - - -/******************************************************************************* - * - * FUNCTION: AcpiGetNextObject - * - * PARAMETERS: Type - Type of object to be searched for - * Parent - Parent object whose children we are getting - * LastChild - Previous child that was found. - * The NEXT child will be returned - * RetHandle - Where handle to the next object is placed - * - * RETURN: Status - * - * DESCRIPTION: Return the next peer object within the namespace. If Handle is - * valid, Scope is ignored. Otherwise, the first object within - * Scope is returned. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiGetNextObject ( - ACPI_OBJECT_TYPE Type, - ACPI_HANDLE Parent, - ACPI_HANDLE Child, - ACPI_HANDLE *RetHandle) -{ - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node; - ACPI_NAMESPACE_NODE *ParentNode = NULL; - ACPI_NAMESPACE_NODE *ChildNode = NULL; - - - /* Parameter validation */ - - if (Type > ACPI_TYPE_EXTERNAL_MAX) - { - return (AE_BAD_PARAMETER); - } - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* If null handle, use the parent */ - - if (!Child) - { - /* Start search at the beginning of the specified scope */ - - ParentNode = AcpiNsValidateHandle (Parent); - if (!ParentNode) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - } - else - { - /* Non-null handle, ignore the parent */ - /* Convert and validate the handle */ - - ChildNode = AcpiNsValidateHandle (Child); - if (!ChildNode) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - } - - /* Internal function does the real work */ - - Node = AcpiNsGetNextNodeTyped (Type, ParentNode, ChildNode); - if (!Node) - { - Status = AE_NOT_FOUND; - goto UnlockAndExit; - } - - if (RetHandle) - { - *RetHandle = ACPI_CAST_PTR (ACPI_HANDLE, Node); - } - - -UnlockAndExit: - - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiGetNextObject) diff --git a/drivers/acpica/psargs.c b/drivers/acpica/psargs.c deleted file mode 100644 index 36afbd7..0000000 --- a/drivers/acpica/psargs.c +++ /dev/null @@ -1,1159 +0,0 @@ -/****************************************************************************** - * - * Module Name: psargs - Parse AML opcode arguments - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acparser.h" -#include "amlcode.h" -#include "acnamesp.h" -#include "acdispat.h" -#include "acconvert.h" - -#define _COMPONENT ACPI_PARSER - ACPI_MODULE_NAME ("psargs") - -/* Local prototypes */ - -static UINT32 -AcpiPsGetNextPackageLength ( - ACPI_PARSE_STATE *ParserState); - -static ACPI_PARSE_OBJECT * -AcpiPsGetNextField ( - ACPI_PARSE_STATE *ParserState); - -static void -AcpiPsFreeFieldList ( - ACPI_PARSE_OBJECT *Start); - - -/******************************************************************************* - * - * FUNCTION: AcpiPsGetNextPackageLength - * - * PARAMETERS: ParserState - Current parser state object - * - * RETURN: Decoded package length. On completion, the AML pointer points - * past the length byte or bytes. - * - * DESCRIPTION: Decode and return a package length field. - * Note: Largest package length is 28 bits, from ACPI specification - * - ******************************************************************************/ - -static UINT32 -AcpiPsGetNextPackageLength ( - ACPI_PARSE_STATE *ParserState) -{ - UINT8 *Aml = ParserState->Aml; - UINT32 PackageLength = 0; - UINT32 ByteCount; - UINT8 ByteZeroMask = 0x3F; /* Default [0:5] */ - - - ACPI_FUNCTION_TRACE (PsGetNextPackageLength); - - - /* - * Byte 0 bits [6:7] contain the number of additional bytes - * used to encode the package length, either 0,1,2, or 3 - */ - ByteCount = (Aml[0] >> 6); - ParserState->Aml += ((ACPI_SIZE) ByteCount + 1); - - /* Get bytes 3, 2, 1 as needed */ - - while (ByteCount) - { - /* - * Final bit positions for the package length bytes: - * Byte3->[20:27] - * Byte2->[12:19] - * Byte1->[04:11] - * Byte0->[00:03] - */ - PackageLength |= (Aml[ByteCount] << ((ByteCount << 3) - 4)); - - ByteZeroMask = 0x0F; /* Use bits [0:3] of byte 0 */ - ByteCount--; - } - - /* Byte 0 is a special case, either bits [0:3] or [0:5] are used */ - - PackageLength |= (Aml[0] & ByteZeroMask); - return_UINT32 (PackageLength); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiPsGetNextPackageEnd - * - * PARAMETERS: ParserState - Current parser state object - * - * RETURN: Pointer to end-of-package +1 - * - * DESCRIPTION: Get next package length and return a pointer past the end of - * the package. Consumes the package length field - * - ******************************************************************************/ - -UINT8 * -AcpiPsGetNextPackageEnd ( - ACPI_PARSE_STATE *ParserState) -{ - UINT8 *Start = ParserState->Aml; - UINT32 PackageLength; - - - ACPI_FUNCTION_TRACE (PsGetNextPackageEnd); - - - /* Function below updates ParserState->Aml */ - - PackageLength = AcpiPsGetNextPackageLength (ParserState); - - return_PTR (Start + PackageLength); /* end of package */ -} - - -/******************************************************************************* - * - * FUNCTION: AcpiPsGetNextNamestring - * - * PARAMETERS: ParserState - Current parser state object - * - * RETURN: Pointer to the start of the name string (pointer points into - * the AML. - * - * DESCRIPTION: Get next raw namestring within the AML stream. Handles all name - * prefix characters. Set parser state to point past the string. - * (Name is consumed from the AML.) - * - ******************************************************************************/ - -char * -AcpiPsGetNextNamestring ( - ACPI_PARSE_STATE *ParserState) -{ - UINT8 *Start = ParserState->Aml; - UINT8 *End = ParserState->Aml; - - - ACPI_FUNCTION_TRACE (PsGetNextNamestring); - - - /* Point past any namestring prefix characters (backslash or carat) */ - - while (ACPI_IS_ROOT_PREFIX (*End) || - ACPI_IS_PARENT_PREFIX (*End)) - { - End++; - } - - /* Decode the path prefix character */ - - switch (*End) - { - case 0: - - /* NullName */ - - if (End == Start) - { - Start = NULL; - } - End++; - break; - - case AML_DUAL_NAME_PREFIX: - - /* Two name segments */ - - End += 1 + (2 * ACPI_NAMESEG_SIZE); - break; - - case AML_MULTI_NAME_PREFIX: - - /* Multiple name segments, 4 chars each, count in next byte */ - - End += 2 + (*(End + 1) * ACPI_NAMESEG_SIZE); - break; - - default: - - /* Single name segment */ - - End += ACPI_NAMESEG_SIZE; - break; - } - - ParserState->Aml = End; - return_PTR ((char *) Start); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiPsGetNextNamepath - * - * PARAMETERS: ParserState - Current parser state object - * Arg - Where the namepath will be stored - * ArgCount - If the namepath points to a control method - * the method's argument is returned here. - * PossibleMethodCall - Whether the namepath can possibly be the - * start of a method call - * - * RETURN: Status - * - * DESCRIPTION: Get next name (if method call, return # of required args). - * Names are looked up in the internal namespace to determine - * if the name represents a control method. If a method - * is found, the number of arguments to the method is returned. - * This information is critical for parsing to continue correctly. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiPsGetNextNamepath ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_STATE *ParserState, - ACPI_PARSE_OBJECT *Arg, - BOOLEAN PossibleMethodCall) -{ - ACPI_STATUS Status; - char *Path; - ACPI_PARSE_OBJECT *NameOp; - ACPI_OPERAND_OBJECT *MethodDesc; - ACPI_NAMESPACE_NODE *Node; - UINT8 *Start = ParserState->Aml; - - - ACPI_FUNCTION_TRACE (PsGetNextNamepath); - - - Path = AcpiPsGetNextNamestring (ParserState); - AcpiPsInitOp (Arg, AML_INT_NAMEPATH_OP); - - /* Null path case is allowed, just exit */ - - if (!Path) - { - Arg->Common.Value.Name = Path; - return_ACPI_STATUS (AE_OK); - } - - /* - * Lookup the name in the internal namespace, starting with the current - * scope. We don't want to add anything new to the namespace here, - * however, so we use MODE_EXECUTE. - * Allow searching of the parent tree, but don't open a new scope - - * we just want to lookup the object (must be mode EXECUTE to perform - * the upsearch) - */ - Status = AcpiNsLookup (WalkState->ScopeInfo, Path, - ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node); - - /* - * If this name is a control method invocation, we must - * setup the method call - */ - if (ACPI_SUCCESS (Status) && - PossibleMethodCall && - (Node->Type == ACPI_TYPE_METHOD)) - { - if ((GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) == ARGP_SUPERNAME) || - (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) == ARGP_TARGET)) - { - /* - * AcpiPsGetNextNamestring has increased the AML pointer past - * the method invocation namestring, so we need to restore the - * saved AML pointer back to the original method invocation - * namestring. - */ - WalkState->ParserState.Aml = Start; - WalkState->ArgCount = 1; - AcpiPsInitOp (Arg, AML_INT_METHODCALL_OP); - } - - /* This name is actually a control method invocation */ - - MethodDesc = AcpiNsGetAttachedObject (Node); - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "Control Method invocation %4.4s - %p Desc %p Path=%p\n", - Node->Name.Ascii, Node, MethodDesc, Path)); - - NameOp = AcpiPsAllocOp (AML_INT_NAMEPATH_OP, Start); - if (!NameOp) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Change Arg into a METHOD CALL and attach name to it */ - - AcpiPsInitOp (Arg, AML_INT_METHODCALL_OP); - NameOp->Common.Value.Name = Path; - - /* Point METHODCALL/NAME to the METHOD Node */ - - NameOp->Common.Node = Node; - AcpiPsAppendArg (Arg, NameOp); - - if (!MethodDesc) - { - ACPI_ERROR ((AE_INFO, - "Control Method %p has no attached object", - Node)); - return_ACPI_STATUS (AE_AML_INTERNAL); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "Control Method - %p Args %X\n", - Node, MethodDesc->Method.ParamCount)); - - /* Get the number of arguments to expect */ - - WalkState->ArgCount = MethodDesc->Method.ParamCount; - return_ACPI_STATUS (AE_OK); - } - - /* - * Special handling if the name was not found during the lookup - - * some NotFound cases are allowed - */ - if (Status == AE_NOT_FOUND) - { - /* 1) NotFound is ok during load pass 1/2 (allow forward references) */ - - if ((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) != - ACPI_PARSE_EXECUTE) - { - Status = AE_OK; - } - - /* 2) NotFound during a CondRefOf(x) is ok by definition */ - - else if (WalkState->Op->Common.AmlOpcode == AML_CONDITIONAL_REF_OF_OP) - { - Status = AE_OK; - } - - /* - * 3) NotFound while building a Package is ok at this point, we - * may flag as an error later if slack mode is not enabled. - * (Some ASL code depends on allowing this behavior) - */ - else if ((Arg->Common.Parent) && - ((Arg->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) || - (Arg->Common.Parent->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP))) - { - Status = AE_OK; - } - } - - /* Final exception check (may have been changed from code above) */ - - if (ACPI_FAILURE (Status)) - { - ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, Path, Status); - - if ((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) == - ACPI_PARSE_EXECUTE) - { - /* Report a control method execution error */ - - Status = AcpiDsMethodError (Status, WalkState); - } - } - - /* Save the namepath */ - - Arg->Common.Value.Name = Path; - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiPsGetNextSimpleArg - * - * PARAMETERS: ParserState - Current parser state object - * ArgType - The argument type (AML_*_ARG) - * Arg - Where the argument is returned - * - * RETURN: None - * - * DESCRIPTION: Get the next simple argument (constant, string, or namestring) - * - ******************************************************************************/ - -void -AcpiPsGetNextSimpleArg ( - ACPI_PARSE_STATE *ParserState, - UINT32 ArgType, - ACPI_PARSE_OBJECT *Arg) -{ - UINT32 Length; - UINT16 Opcode; - UINT8 *Aml = ParserState->Aml; - - - ACPI_FUNCTION_TRACE_U32 (PsGetNextSimpleArg, ArgType); - - - switch (ArgType) - { - case ARGP_BYTEDATA: - - /* Get 1 byte from the AML stream */ - - Opcode = AML_BYTE_OP; - Arg->Common.Value.Integer = (UINT64) *Aml; - Length = 1; - break; - - case ARGP_WORDDATA: - - /* Get 2 bytes from the AML stream */ - - Opcode = AML_WORD_OP; - ACPI_MOVE_16_TO_64 (&Arg->Common.Value.Integer, Aml); - Length = 2; - break; - - case ARGP_DWORDDATA: - - /* Get 4 bytes from the AML stream */ - - Opcode = AML_DWORD_OP; - ACPI_MOVE_32_TO_64 (&Arg->Common.Value.Integer, Aml); - Length = 4; - break; - - case ARGP_QWORDDATA: - - /* Get 8 bytes from the AML stream */ - - Opcode = AML_QWORD_OP; - ACPI_MOVE_64_TO_64 (&Arg->Common.Value.Integer, Aml); - Length = 8; - break; - - case ARGP_CHARLIST: - - /* Get a pointer to the string, point past the string */ - - Opcode = AML_STRING_OP; - Arg->Common.Value.String = ACPI_CAST_PTR (char, Aml); - - /* Find the null terminator */ - - Length = 0; - while (Aml[Length]) - { - Length++; - } - Length++; - break; - - case ARGP_NAME: - case ARGP_NAMESTRING: - - AcpiPsInitOp (Arg, AML_INT_NAMEPATH_OP); - Arg->Common.Value.Name = AcpiPsGetNextNamestring (ParserState); - return_VOID; - - default: - - ACPI_ERROR ((AE_INFO, "Invalid ArgType 0x%X", ArgType)); - return_VOID; - } - - AcpiPsInitOp (Arg, Opcode); - ParserState->Aml += Length; - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiPsGetNextField - * - * PARAMETERS: ParserState - Current parser state object - * - * RETURN: A newly allocated FIELD op - * - * DESCRIPTION: Get next field (NamedField, ReservedField, or AccessField) - * - ******************************************************************************/ - -static ACPI_PARSE_OBJECT * -AcpiPsGetNextField ( - ACPI_PARSE_STATE *ParserState) -{ - UINT8 *Aml; - ACPI_PARSE_OBJECT *Field; - ACPI_PARSE_OBJECT *Arg = NULL; - UINT16 Opcode; - UINT32 Name; - UINT8 AccessType; - UINT8 AccessAttribute; - UINT8 AccessLength; - UINT32 PkgLength; - UINT8 *PkgEnd; - UINT32 BufferLength; - - - ACPI_FUNCTION_TRACE (PsGetNextField); - - - ASL_CV_CAPTURE_COMMENTS_ONLY (ParserState); - Aml = ParserState->Aml; - - /* Determine field type */ - - switch (ACPI_GET8 (ParserState->Aml)) - { - case AML_FIELD_OFFSET_OP: - - Opcode = AML_INT_RESERVEDFIELD_OP; - ParserState->Aml++; - break; - - case AML_FIELD_ACCESS_OP: - - Opcode = AML_INT_ACCESSFIELD_OP; - ParserState->Aml++; - break; - - case AML_FIELD_CONNECTION_OP: - - Opcode = AML_INT_CONNECTION_OP; - ParserState->Aml++; - break; - - case AML_FIELD_EXT_ACCESS_OP: - - Opcode = AML_INT_EXTACCESSFIELD_OP; - ParserState->Aml++; - break; - - default: - - Opcode = AML_INT_NAMEDFIELD_OP; - break; - } - - /* Allocate a new field op */ - - Field = AcpiPsAllocOp (Opcode, Aml); - if (!Field) - { - return_PTR (NULL); - } - - /* Decode the field type */ - - ASL_CV_CAPTURE_COMMENTS_ONLY (ParserState); - switch (Opcode) - { - case AML_INT_NAMEDFIELD_OP: - - /* Get the 4-character name */ - - ACPI_MOVE_32_TO_32 (&Name, ParserState->Aml); - AcpiPsSetName (Field, Name); - ParserState->Aml += ACPI_NAMESEG_SIZE; - - - ASL_CV_CAPTURE_COMMENTS_ONLY (ParserState); - -#ifdef ACPI_ASL_COMPILER - /* - * Because the package length isn't represented as a parse tree object, - * take comments surrounding this and add to the previously created - * parse node. - */ - if (Field->Common.InlineComment) - { - Field->Common.NameComment = Field->Common.InlineComment; - } - Field->Common.InlineComment = AcpiGbl_CurrentInlineComment; - AcpiGbl_CurrentInlineComment = NULL; -#endif - - /* Get the length which is encoded as a package length */ - - Field->Common.Value.Size = AcpiPsGetNextPackageLength (ParserState); - break; - - - case AML_INT_RESERVEDFIELD_OP: - - /* Get the length which is encoded as a package length */ - - Field->Common.Value.Size = AcpiPsGetNextPackageLength (ParserState); - break; - - - case AML_INT_ACCESSFIELD_OP: - case AML_INT_EXTACCESSFIELD_OP: - - /* - * Get AccessType and AccessAttrib and merge into the field Op - * AccessType is first operand, AccessAttribute is second. stuff - * these bytes into the node integer value for convenience. - */ - - /* Get the two bytes (Type/Attribute) */ - - AccessType = ACPI_GET8 (ParserState->Aml); - ParserState->Aml++; - AccessAttribute = ACPI_GET8 (ParserState->Aml); - ParserState->Aml++; - - Field->Common.Value.Integer = (UINT8) AccessType; - Field->Common.Value.Integer |= (UINT16) (AccessAttribute << 8); - - /* This opcode has a third byte, AccessLength */ - - if (Opcode == AML_INT_EXTACCESSFIELD_OP) - { - AccessLength = ACPI_GET8 (ParserState->Aml); - ParserState->Aml++; - - Field->Common.Value.Integer |= (UINT32) (AccessLength << 16); - } - break; - - - case AML_INT_CONNECTION_OP: - - /* - * Argument for Connection operator can be either a Buffer - * (resource descriptor), or a NameString. - */ - Aml = ParserState->Aml; - if (ACPI_GET8 (ParserState->Aml) == AML_BUFFER_OP) - { - ParserState->Aml++; - - ASL_CV_CAPTURE_COMMENTS_ONLY (ParserState); - PkgEnd = ParserState->Aml; - PkgLength = AcpiPsGetNextPackageLength (ParserState); - PkgEnd += PkgLength; - - ASL_CV_CAPTURE_COMMENTS_ONLY (ParserState); - if (ParserState->Aml < PkgEnd) - { - /* Non-empty list */ - - Arg = AcpiPsAllocOp (AML_INT_BYTELIST_OP, Aml); - if (!Arg) - { - AcpiPsFreeOp (Field); - return_PTR (NULL); - } - - /* Get the actual buffer length argument */ - - Opcode = ACPI_GET8 (ParserState->Aml); - ParserState->Aml++; - - ASL_CV_CAPTURE_COMMENTS_ONLY (ParserState); - switch (Opcode) - { - case AML_BYTE_OP: /* AML_BYTEDATA_ARG */ - - BufferLength = ACPI_GET8 (ParserState->Aml); - ParserState->Aml += 1; - break; - - case AML_WORD_OP: /* AML_WORDDATA_ARG */ - - BufferLength = ACPI_GET16 (ParserState->Aml); - ParserState->Aml += 2; - break; - - case AML_DWORD_OP: /* AML_DWORDATA_ARG */ - - BufferLength = ACPI_GET32 (ParserState->Aml); - ParserState->Aml += 4; - break; - - default: - - BufferLength = 0; - break; - } - - /* Fill in bytelist data */ - - ASL_CV_CAPTURE_COMMENTS_ONLY (ParserState); - Arg->Named.Value.Size = BufferLength; - Arg->Named.Data = ParserState->Aml; - } - - /* Skip to End of byte data */ - - ParserState->Aml = PkgEnd; - } - else - { - Arg = AcpiPsAllocOp (AML_INT_NAMEPATH_OP, Aml); - if (!Arg) - { - AcpiPsFreeOp (Field); - return_PTR (NULL); - } - - /* Get the Namestring argument */ - - Arg->Common.Value.Name = AcpiPsGetNextNamestring (ParserState); - } - - /* Link the buffer/namestring to parent (CONNECTION_OP) */ - - AcpiPsAppendArg (Field, Arg); - break; - - - default: - - /* Opcode was set in previous switch */ - break; - } - - return_PTR (Field); -} - -/******************************************************************************* - * - * FUNCTION: AcpiPsFreeFieldList - * - * PARAMETERS: Start - First Op in field list - * - * RETURN: None. - * - * DESCRIPTION: Free all Op objects inside a field list. - * - ******************************************************************************/ - -static void -AcpiPsFreeFieldList ( - ACPI_PARSE_OBJECT *Start) -{ - ACPI_PARSE_OBJECT *Current = Start; - ACPI_PARSE_OBJECT *Next; - ACPI_PARSE_OBJECT *Arg; - - while (Current) - { - Next = Current->Common.Next; - - /* AML_INT_CONNECTION_OP can have a single argument */ - - Arg = AcpiPsGetArg (Current, 0); - if (Arg) - { - AcpiPsFreeOp (Arg); - } - - AcpiPsFreeOp(Current); - Current = Next; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiPsGetNextArg - * - * PARAMETERS: WalkState - Current state - * ParserState - Current parser state object - * ArgType - The argument type (AML_*_ARG) - * ReturnArg - Where the next arg is returned - * - * RETURN: Status, and an op object containing the next argument. - * - * DESCRIPTION: Get next argument (including complex list arguments that require - * pushing the parser stack) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiPsGetNextArg ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_STATE *ParserState, - UINT32 ArgType, - ACPI_PARSE_OBJECT **ReturnArg) -{ - ACPI_PARSE_OBJECT *Arg = NULL; - ACPI_PARSE_OBJECT *Prev = NULL; - ACPI_PARSE_OBJECT *Field; - UINT32 Subop; - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE_PTR (PsGetNextArg, ParserState); - - - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "Expected argument type ARGP: %s (%2.2X)\n", - AcpiUtGetArgumentTypeName (ArgType), ArgType)); - - switch (ArgType) - { - case ARGP_BYTEDATA: - case ARGP_WORDDATA: - case ARGP_DWORDDATA: - case ARGP_CHARLIST: - case ARGP_NAME: - case ARGP_NAMESTRING: - - /* Constants, strings, and namestrings are all the same size */ - - Arg = AcpiPsAllocOp (AML_BYTE_OP, ParserState->Aml); - if (!Arg) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - AcpiPsGetNextSimpleArg (ParserState, ArgType, Arg); - break; - - case ARGP_PKGLENGTH: - - /* Package length, nothing returned */ - - ParserState->PkgEnd = AcpiPsGetNextPackageEnd (ParserState); - break; - - case ARGP_FIELDLIST: - - if (ParserState->Aml < ParserState->PkgEnd) - { - /* Non-empty list */ - - while (ParserState->Aml < ParserState->PkgEnd) - { - Field = AcpiPsGetNextField (ParserState); - if (!Field) - { - if (Arg) - { - AcpiPsFreeFieldList(Arg); - } - - return_ACPI_STATUS (AE_NO_MEMORY); - } - - if (Prev) - { - Prev->Common.Next = Field; - } - else - { - Arg = Field; - } - Prev = Field; - } - - /* Skip to End of byte data */ - - ParserState->Aml = ParserState->PkgEnd; - } - break; - - case ARGP_BYTELIST: - - if (ParserState->Aml < ParserState->PkgEnd) - { - /* Non-empty list */ - - Arg = AcpiPsAllocOp (AML_INT_BYTELIST_OP, - ParserState->Aml); - if (!Arg) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Fill in bytelist data */ - - Arg->Common.Value.Size = (UINT32) - ACPI_PTR_DIFF (ParserState->PkgEnd, ParserState->Aml); - Arg->Named.Data = ParserState->Aml; - - /* Skip to End of byte data */ - - ParserState->Aml = ParserState->PkgEnd; - } - break; - - case ARGP_SIMPLENAME: - case ARGP_NAME_OR_REF: - - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "**** SimpleName/NameOrRef: %s (%2.2X)\n", - AcpiUtGetArgumentTypeName (ArgType), ArgType)); - - Subop = AcpiPsPeekOpcode (ParserState); - if (Subop == 0 || - AcpiPsIsLeadingChar (Subop) || - ACPI_IS_ROOT_PREFIX (Subop) || - ACPI_IS_PARENT_PREFIX (Subop)) - { - /* NullName or NameString */ - - Arg = AcpiPsAllocOp (AML_INT_NAMEPATH_OP, ParserState->Aml); - if (!Arg) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - Status = AcpiPsGetNextNamepath (WalkState, ParserState, - Arg, ACPI_NOT_METHOD_CALL); - if (ACPI_FAILURE(Status)) - { - AcpiPsFreeOp (Arg); - return_ACPI_STATUS (Status); - } - } - else - { - /* Single complex argument, nothing returned */ - - WalkState->ArgCount = 1; - } - break; - - case ARGP_TARGET: - case ARGP_SUPERNAME: - - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "**** Target/Supername: %s (%2.2X)\n", - AcpiUtGetArgumentTypeName (ArgType), ArgType)); - - Subop = AcpiPsPeekOpcode (ParserState); - if (Subop == 0 || - AcpiPsIsLeadingChar (Subop) || - ACPI_IS_ROOT_PREFIX (Subop) || - ACPI_IS_PARENT_PREFIX (Subop)) - { - /* NULL target (zero). Convert to a NULL namepath */ - - Arg = AcpiPsAllocOp (AML_INT_NAMEPATH_OP, ParserState->Aml); - if (!Arg) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - Status = AcpiPsGetNextNamepath (WalkState, ParserState, - Arg, ACPI_POSSIBLE_METHOD_CALL); - if (ACPI_FAILURE(Status)) - { - AcpiPsFreeOp (Arg); - return_ACPI_STATUS (Status); - } - - if (Arg->Common.AmlOpcode == AML_INT_METHODCALL_OP) - { - /* Free method call op and corresponding namestring sub-ob */ - - AcpiPsFreeOp (Arg->Common.Value.Arg); - AcpiPsFreeOp (Arg); - Arg = NULL; - WalkState->ArgCount = 1; - } - } - else - { - /* Single complex argument, nothing returned */ - - WalkState->ArgCount = 1; - } - break; - - case ARGP_DATAOBJ: - case ARGP_TERMARG: - - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "**** TermArg/DataObj: %s (%2.2X)\n", - AcpiUtGetArgumentTypeName (ArgType), ArgType)); - - /* Single complex argument, nothing returned */ - - WalkState->ArgCount = 1; - break; - - case ARGP_DATAOBJLIST: - case ARGP_TERMLIST: - case ARGP_OBJLIST: - - if (ParserState->Aml < ParserState->PkgEnd) - { - /* Non-empty list of variable arguments, nothing returned */ - - WalkState->ArgCount = ACPI_VAR_ARGS; - } - break; - - default: - - ACPI_ERROR ((AE_INFO, "Invalid ArgType: 0x%X", ArgType)); - Status = AE_AML_OPERAND_TYPE; - break; - } - - *ReturnArg = Arg; - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/psloop.c b/drivers/acpica/psloop.c deleted file mode 100644 index d46eb6a..0000000 --- a/drivers/acpica/psloop.c +++ /dev/null @@ -1,696 +0,0 @@ -/****************************************************************************** - * - * Module Name: psloop - Main AML parse loop - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -/* - * Parse the AML and build an operation tree as most interpreters, (such as - * Perl) do. Parsing is done by hand rather than with a YACC generated parser - * to tightly constrain stack and dynamic memory usage. Parsing is kept - * flexible and the code fairly compact by parsing based on a list of AML - * opcode templates in AmlOpInfo[]. - */ - -#include "acpi.h" -#include "accommon.h" -#include "acinterp.h" -#include "acparser.h" -#include "acdispat.h" -#include "amlcode.h" -#include "acconvert.h" -#include "acnamesp.h" - -#define _COMPONENT ACPI_PARSER - ACPI_MODULE_NAME ("psloop") - - -/* Local prototypes */ - -static ACPI_STATUS -AcpiPsGetArguments ( - ACPI_WALK_STATE *WalkState, - UINT8 *AmlOpStart, - ACPI_PARSE_OBJECT *Op); - - -/******************************************************************************* - * - * FUNCTION: AcpiPsGetArguments - * - * PARAMETERS: WalkState - Current state - * AmlOpStart - Op start in AML - * Op - Current Op - * - * RETURN: Status - * - * DESCRIPTION: Get arguments for passed Op. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiPsGetArguments ( - ACPI_WALK_STATE *WalkState, - UINT8 *AmlOpStart, - ACPI_PARSE_OBJECT *Op) -{ - ACPI_STATUS Status = AE_OK; - ACPI_PARSE_OBJECT *Arg = NULL; - - - ACPI_FUNCTION_TRACE_PTR (PsGetArguments, WalkState); - - - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "Get arguments for opcode [%s]\n", Op->Common.AmlOpName)); - - switch (Op->Common.AmlOpcode) - { - case AML_BYTE_OP: /* AML_BYTEDATA_ARG */ - case AML_WORD_OP: /* AML_WORDDATA_ARG */ - case AML_DWORD_OP: /* AML_DWORDATA_ARG */ - case AML_QWORD_OP: /* AML_QWORDATA_ARG */ - case AML_STRING_OP: /* AML_ASCIICHARLIST_ARG */ - - /* Fill in constant or string argument directly */ - - AcpiPsGetNextSimpleArg (&(WalkState->ParserState), - GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), Op); - break; - - case AML_INT_NAMEPATH_OP: /* AML_NAMESTRING_ARG */ - - Status = AcpiPsGetNextNamepath (WalkState, - &(WalkState->ParserState), Op, ACPI_POSSIBLE_METHOD_CALL); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - WalkState->ArgTypes = 0; - break; - - default: - /* - * Op is not a constant or string, append each argument to the Op - */ - while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) && - !WalkState->ArgCount) - { - WalkState->Aml = WalkState->ParserState.Aml; - - switch (Op->Common.AmlOpcode) - { - case AML_METHOD_OP: - case AML_BUFFER_OP: - case AML_PACKAGE_OP: - case AML_VARIABLE_PACKAGE_OP: - case AML_WHILE_OP: - - break; - - default: - - ASL_CV_CAPTURE_COMMENTS (WalkState); - break; - } - - Status = AcpiPsGetNextArg (WalkState, &(WalkState->ParserState), - GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), &Arg); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - if (Arg) - { - AcpiPsAppendArg (Op, Arg); - } - - INCREMENT_ARG_LIST (WalkState->ArgTypes); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "Final argument count: %8.8X pass %u\n", - WalkState->ArgCount, WalkState->PassNumber)); - - /* Special processing for certain opcodes */ - - switch (Op->Common.AmlOpcode) - { - case AML_METHOD_OP: - /* - * Skip parsing of control method because we don't have enough - * info in the first pass to parse it correctly. - * - * Save the length and address of the body - */ - Op->Named.Data = WalkState->ParserState.Aml; - Op->Named.Length = (UINT32) - (WalkState->ParserState.PkgEnd - WalkState->ParserState.Aml); - - /* Skip body of method */ - - WalkState->ParserState.Aml = WalkState->ParserState.PkgEnd; - WalkState->ArgCount = 0; - break; - - case AML_BUFFER_OP: - case AML_PACKAGE_OP: - case AML_VARIABLE_PACKAGE_OP: - - if ((Op->Common.Parent) && - (Op->Common.Parent->Common.AmlOpcode == AML_NAME_OP) && - (WalkState->PassNumber <= ACPI_IMODE_LOAD_PASS2)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "Setup Package/Buffer: Pass %u, AML Ptr: %p\n", - WalkState->PassNumber, AmlOpStart)); - - /* - * Skip parsing of Buffers and Packages because we don't have - * enough info in the first pass to parse them correctly. - */ - Op->Named.Data = AmlOpStart; - Op->Named.Length = (UINT32) - (WalkState->ParserState.PkgEnd - AmlOpStart); - - /* Skip body */ - - WalkState->ParserState.Aml = WalkState->ParserState.PkgEnd; - WalkState->ArgCount = 0; - } - break; - - case AML_WHILE_OP: - - if (WalkState->ControlState) - { - WalkState->ControlState->Control.PackageEnd = - WalkState->ParserState.PkgEnd; - } - break; - - default: - - /* No action for all other opcodes */ - - break; - } - - break; - } - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiPsParseLoop - * - * PARAMETERS: WalkState - Current state - * - * RETURN: Status - * - * DESCRIPTION: Parse AML (pointed to by the current parser state) and return - * a tree of ops. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiPsParseLoop ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status = AE_OK; - ACPI_PARSE_OBJECT *Op = NULL; /* current op */ - ACPI_PARSE_STATE *ParserState; - UINT8 *AmlOpStart = NULL; - UINT8 OpcodeLength; - - - ACPI_FUNCTION_TRACE_PTR (PsParseLoop, WalkState); - - - if (WalkState->DescendingCallback == NULL) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - ParserState = &WalkState->ParserState; - WalkState->ArgTypes = 0; - -#ifndef ACPI_CONSTANT_EVAL_ONLY - - if (WalkState->WalkType & ACPI_WALK_METHOD_RESTART) - { - /* We are restarting a preempted control method */ - - if (AcpiPsHasCompletedScope (ParserState)) - { - /* - * We must check if a predicate to an IF or WHILE statement - * was just completed - */ - if ((ParserState->Scope->ParseScope.Op) && - ((ParserState->Scope->ParseScope.Op->Common.AmlOpcode == AML_IF_OP) || - (ParserState->Scope->ParseScope.Op->Common.AmlOpcode == AML_WHILE_OP)) && - (WalkState->ControlState) && - (WalkState->ControlState->Common.State == - ACPI_CONTROL_PREDICATE_EXECUTING)) - { - /* - * A predicate was just completed, get the value of the - * predicate and branch based on that value - */ - WalkState->Op = NULL; - Status = AcpiDsGetPredicateValue (WalkState, ACPI_TO_POINTER (TRUE)); - if (ACPI_FAILURE (Status) && !ACPI_CNTL_EXCEPTION (Status)) - { - if (Status == AE_AML_NO_RETURN_VALUE) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Invoked method did not return a value")); - } - - ACPI_EXCEPTION ((AE_INFO, Status, "GetPredicate Failed")); - return_ACPI_STATUS (Status); - } - - Status = AcpiPsNextParseState (WalkState, Op, Status); - } - - AcpiPsPopScope (ParserState, &Op, - &WalkState->ArgTypes, &WalkState->ArgCount); - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", Op)); - } - else if (WalkState->PrevOp) - { - /* We were in the middle of an op */ - - Op = WalkState->PrevOp; - WalkState->ArgTypes = WalkState->PrevArgTypes; - } - } -#endif - - /* Iterative parsing loop, while there is more AML to process: */ - - while ((ParserState->Aml < ParserState->AmlEnd) || (Op)) - { - ASL_CV_CAPTURE_COMMENTS (WalkState); - - AmlOpStart = ParserState->Aml; - if (!Op) - { - Status = AcpiPsCreateOp (WalkState, AmlOpStart, &Op); - if (ACPI_FAILURE (Status)) - { - /* - * ACPI_PARSE_MODULE_LEVEL means that we are loading a table by - * executing it as a control method. However, if we encounter - * an error while loading the table, we need to keep trying to - * load the table rather than aborting the table load. Set the - * status to AE_OK to proceed with the table load. - */ - if ((WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL) && - ((Status == AE_ALREADY_EXISTS) || (Status == AE_NOT_FOUND))) - { - Status = AE_OK; - } - if (Status == AE_CTRL_PARSE_CONTINUE) - { - continue; - } - - if (Status == AE_CTRL_PARSE_PENDING) - { - Status = AE_OK; - } - - if (Status == AE_CTRL_TERMINATE) - { - return_ACPI_STATUS (Status); - } - - Status = AcpiPsCompleteOp (WalkState, &Op, Status); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - if (AcpiNsOpensScope ( - AcpiPsGetOpcodeInfo (WalkState->Opcode)->ObjectType)) - { - /* - * If the scope/device op fails to parse, skip the body of - * the scope op because the parse failure indicates that - * the device may not exist. - */ - ACPI_INFO (("Skipping parse of AML opcode: %s (0x%4.4X)", - AcpiPsGetOpcodeName (WalkState->Opcode), WalkState->Opcode)); - - /* - * Determine the opcode length before skipping the opcode. - * An opcode can be 1 byte or 2 bytes in length. - */ - OpcodeLength = 1; - if ((WalkState->Opcode & 0xFF00) == AML_EXTENDED_OPCODE) - { - OpcodeLength = 2; - } - WalkState->ParserState.Aml = WalkState->Aml + OpcodeLength; - - WalkState->ParserState.Aml = - AcpiPsGetNextPackageEnd(&WalkState->ParserState); - WalkState->Aml = WalkState->ParserState.Aml; - } - - continue; - } - - AcpiExStartTraceOpcode (Op, WalkState); - } - - /* - * Start ArgCount at zero because we don't know if there are - * any args yet - */ - WalkState->ArgCount = 0; - - switch (Op->Common.AmlOpcode) - { - case AML_BYTE_OP: - case AML_WORD_OP: - case AML_DWORD_OP: - case AML_QWORD_OP: - - break; - - default: - - ASL_CV_CAPTURE_COMMENTS (WalkState); - break; - } - - /* Are there any arguments that must be processed? */ - - if (WalkState->ArgTypes) - { - /* Get arguments */ - - Status = AcpiPsGetArguments (WalkState, AmlOpStart, Op); - if (ACPI_FAILURE (Status)) - { - Status = AcpiPsCompleteOp (WalkState, &Op, Status); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - if ((WalkState->ControlState) && - ((WalkState->ControlState->Control.Opcode == AML_IF_OP) || - (WalkState->ControlState->Control.Opcode == AML_WHILE_OP))) - { - /* - * If the if/while op fails to parse, we will skip parsing - * the body of the op. - */ - ParserState->Aml = - WalkState->ControlState->Control.AmlPredicateStart + 1; - ParserState->Aml = - AcpiPsGetNextPackageEnd (ParserState); - WalkState->Aml = ParserState->Aml; - - ACPI_ERROR ((AE_INFO, "Skipping While/If block")); - if (*WalkState->Aml == AML_ELSE_OP) - { - ACPI_ERROR ((AE_INFO, "Skipping Else block")); - WalkState->ParserState.Aml = WalkState->Aml + 1; - WalkState->ParserState.Aml = - AcpiPsGetNextPackageEnd (ParserState); - WalkState->Aml = ParserState->Aml; - } - ACPI_FREE(AcpiUtPopGenericState (&WalkState->ControlState)); - } - Op = NULL; - continue; - } - } - - /* Check for arguments that need to be processed */ - - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "Parseloop: argument count: %8.8X\n", WalkState->ArgCount)); - - if (WalkState->ArgCount) - { - /* - * There are arguments (complex ones), push Op and - * prepare for argument - */ - Status = AcpiPsPushScope (ParserState, Op, - WalkState->ArgTypes, WalkState->ArgCount); - if (ACPI_FAILURE (Status)) - { - Status = AcpiPsCompleteOp (WalkState, &Op, Status); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - continue; - } - - Op = NULL; - continue; - } - - /* - * All arguments have been processed -- Op is complete, - * prepare for next - */ - WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - if (WalkState->OpInfo->Flags & AML_NAMED) - { - if (Op->Common.AmlOpcode == AML_REGION_OP || - Op->Common.AmlOpcode == AML_DATA_REGION_OP) - { - /* - * Skip parsing of control method or opregion body, - * because we don't have enough info in the first pass - * to parse them correctly. - * - * Completed parsing an OpRegion declaration, we now - * know the length. - */ - Op->Named.Length = (UINT32) (ParserState->Aml - Op->Named.Data); - } - } - - if (WalkState->OpInfo->Flags & AML_CREATE) - { - /* - * Backup to beginning of CreateXXXfield declaration (1 for - * Opcode) - * - * BodyLength is unknown until we parse the body - */ - Op->Named.Length = (UINT32) (ParserState->Aml - Op->Named.Data); - } - - if (Op->Common.AmlOpcode == AML_BANK_FIELD_OP) - { - /* - * Backup to beginning of BankField declaration - * - * BodyLength is unknown until we parse the body - */ - Op->Named.Length = (UINT32) (ParserState->Aml - Op->Named.Data); - } - - /* This op complete, notify the dispatcher */ - - if (WalkState->AscendingCallback != NULL) - { - WalkState->Op = Op; - WalkState->Opcode = Op->Common.AmlOpcode; - - Status = WalkState->AscendingCallback (WalkState); - Status = AcpiPsNextParseState (WalkState, Op, Status); - if (Status == AE_CTRL_PENDING) - { - Status = AE_OK; - } - else if ((WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL) && - (ACPI_AML_EXCEPTION(Status) || Status == AE_ALREADY_EXISTS || - Status == AE_NOT_FOUND)) - { - /* - * ACPI_PARSE_MODULE_LEVEL flag means that we are currently - * loading a table by executing it as a control method. - * However, if we encounter an error while loading the table, - * we need to keep trying to load the table rather than - * aborting the table load (setting the status to AE_OK - * continues the table load). If we get a failure at this - * point, it means that the dispatcher got an error while - * trying to execute the Op. - */ - Status = AE_OK; - } - } - - Status = AcpiPsCompleteOp (WalkState, &Op, Status); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - } /* while ParserState->Aml */ - - Status = AcpiPsCompleteFinalOp (WalkState, Op, Status); - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/psobject.c b/drivers/acpica/psobject.c deleted file mode 100644 index 146a487..0000000 --- a/drivers/acpica/psobject.c +++ /dev/null @@ -1,886 +0,0 @@ -/****************************************************************************** - * - * Module Name: psobject - Support for parse objects - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acparser.h" -#include "amlcode.h" -#include "acconvert.h" -#include "acnamesp.h" - -#define _COMPONENT ACPI_PARSER - ACPI_MODULE_NAME ("psobject") - - -/* Local prototypes */ - -static ACPI_STATUS -AcpiPsGetAmlOpcode ( - ACPI_WALK_STATE *WalkState); - - -/******************************************************************************* - * - * FUNCTION: AcpiPsGetAmlOpcode - * - * PARAMETERS: WalkState - Current state - * - * RETURN: Status - * - * DESCRIPTION: Extract the next AML opcode from the input stream. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiPsGetAmlOpcode ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_ERROR_ONLY (UINT32 AmlOffset); - - - ACPI_FUNCTION_TRACE_PTR (PsGetAmlOpcode, WalkState); - - - WalkState->Aml = WalkState->ParserState.Aml; - WalkState->Opcode = AcpiPsPeekOpcode (&(WalkState->ParserState)); - - /* - * First cut to determine what we have found: - * 1) A valid AML opcode - * 2) A name string - * 3) An unknown/invalid opcode - */ - WalkState->OpInfo = AcpiPsGetOpcodeInfo (WalkState->Opcode); - - switch (WalkState->OpInfo->Class) - { - case AML_CLASS_ASCII: - case AML_CLASS_PREFIX: - /* - * Starts with a valid prefix or ASCII char, this is a name - * string. Convert the bare name string to a namepath. - */ - WalkState->Opcode = AML_INT_NAMEPATH_OP; - WalkState->ArgTypes = ARGP_NAMESTRING; - break; - - case AML_CLASS_UNKNOWN: - - /* The opcode is unrecognized. Complain and skip unknown opcodes */ - - if (WalkState->PassNumber == 2) - { - ACPI_ERROR_ONLY(AmlOffset = (UINT32) ACPI_PTR_DIFF (WalkState->Aml, - WalkState->ParserState.AmlStart)); - - ACPI_ERROR ((AE_INFO, - "Unknown opcode 0x%.2X at table offset 0x%.4X, ignoring", - WalkState->Opcode, - (UINT32) (AmlOffset + sizeof (ACPI_TABLE_HEADER)))); - - ACPI_DUMP_BUFFER ((WalkState->ParserState.Aml - 16), 48); - -#ifdef ACPI_ASL_COMPILER - /* - * This is executed for the disassembler only. Output goes - * to the disassembled ASL output file. - */ - AcpiOsPrintf ( - "/*\nError: Unknown opcode 0x%.2X at table offset 0x%.4X, context:\n", - WalkState->Opcode, - (UINT32) (AmlOffset + sizeof (ACPI_TABLE_HEADER))); - - ACPI_ERROR ((AE_INFO, - "Aborting disassembly, AML byte code is corrupt")); - - /* Dump the context surrounding the invalid opcode */ - - AcpiUtDumpBuffer (((UINT8 *) WalkState->ParserState.Aml - 16), - 48, DB_BYTE_DISPLAY, - (AmlOffset + sizeof (ACPI_TABLE_HEADER) - 16)); - AcpiOsPrintf (" */\n"); - - /* - * Just abort the disassembly, cannot continue because the - * parser is essentially lost. The disassembler can then - * randomly fail because an ill-constructed parse tree - * can result. - */ - return_ACPI_STATUS (AE_AML_BAD_OPCODE); -#endif - } - - /* Increment past one-byte or two-byte opcode */ - - WalkState->ParserState.Aml++; - if (WalkState->Opcode > 0xFF) /* Can only happen if first byte is 0x5B */ - { - WalkState->ParserState.Aml++; - } - - return_ACPI_STATUS (AE_CTRL_PARSE_CONTINUE); - - default: - - /* Found opcode info, this is a normal opcode */ - - WalkState->ParserState.Aml += - AcpiPsGetOpcodeSize (WalkState->Opcode); - WalkState->ArgTypes = WalkState->OpInfo->ParseArgs; - break; - } - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiPsBuildNamedOp - * - * PARAMETERS: WalkState - Current state - * AmlOpStart - Begin of named Op in AML - * UnnamedOp - Early Op (not a named Op) - * Op - Returned Op - * - * RETURN: Status - * - * DESCRIPTION: Parse a named Op - * - ******************************************************************************/ - -ACPI_STATUS -AcpiPsBuildNamedOp ( - ACPI_WALK_STATE *WalkState, - UINT8 *AmlOpStart, - ACPI_PARSE_OBJECT *UnnamedOp, - ACPI_PARSE_OBJECT **Op) -{ - ACPI_STATUS Status = AE_OK; - ACPI_PARSE_OBJECT *Arg = NULL; - - - ACPI_FUNCTION_TRACE_PTR (PsBuildNamedOp, WalkState); - - - UnnamedOp->Common.Value.Arg = NULL; - UnnamedOp->Common.ArgListLength = 0; - UnnamedOp->Common.AmlOpcode = WalkState->Opcode; - - /* - * Get and append arguments until we find the node that contains - * the name (the type ARGP_NAME). - */ - while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) && - (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) != ARGP_NAME)) - { - ASL_CV_CAPTURE_COMMENTS (WalkState); - Status = AcpiPsGetNextArg (WalkState, &(WalkState->ParserState), - GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), &Arg); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - AcpiPsAppendArg (UnnamedOp, Arg); - INCREMENT_ARG_LIST (WalkState->ArgTypes); - } - - /* are there any inline comments associated with the NameSeg?? If so, save this. */ - - ASL_CV_CAPTURE_COMMENTS (WalkState); - -#ifdef ACPI_ASL_COMPILER - if (AcpiGbl_CurrentInlineComment != NULL) - { - UnnamedOp->Common.NameComment = AcpiGbl_CurrentInlineComment; - AcpiGbl_CurrentInlineComment = NULL; - } -#endif - - /* - * Make sure that we found a NAME and didn't run out of arguments - */ - if (!GET_CURRENT_ARG_TYPE (WalkState->ArgTypes)) - { - return_ACPI_STATUS (AE_AML_NO_OPERAND); - } - - /* We know that this arg is a name, move to next arg */ - - INCREMENT_ARG_LIST (WalkState->ArgTypes); - - /* - * Find the object. This will either insert the object into - * the namespace or simply look it up - */ - WalkState->Op = NULL; - - Status = WalkState->DescendingCallback (WalkState, Op); - if (ACPI_FAILURE (Status)) - { - if (Status != AE_CTRL_TERMINATE) - { - ACPI_EXCEPTION ((AE_INFO, Status, "During name lookup/catalog")); - } - return_ACPI_STATUS (Status); - } - - if (!*Op) - { - return_ACPI_STATUS (AE_CTRL_PARSE_CONTINUE); - } - - Status = AcpiPsNextParseState (WalkState, *Op, Status); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_CTRL_PENDING) - { - Status = AE_CTRL_PARSE_PENDING; - } - return_ACPI_STATUS (Status); - } - - AcpiPsAppendArg (*Op, UnnamedOp->Common.Value.Arg); - -#ifdef ACPI_ASL_COMPILER - - /* save any comments that might be associated with UnnamedOp. */ - - (*Op)->Common.InlineComment = UnnamedOp->Common.InlineComment; - (*Op)->Common.EndNodeComment = UnnamedOp->Common.EndNodeComment; - (*Op)->Common.CloseBraceComment = UnnamedOp->Common.CloseBraceComment; - (*Op)->Common.NameComment = UnnamedOp->Common.NameComment; - (*Op)->Common.CommentList = UnnamedOp->Common.CommentList; - (*Op)->Common.EndBlkComment = UnnamedOp->Common.EndBlkComment; - (*Op)->Common.CvFilename = UnnamedOp->Common.CvFilename; - (*Op)->Common.CvParentFilename = UnnamedOp->Common.CvParentFilename; - (*Op)->Named.Aml = UnnamedOp->Common.Aml; - - UnnamedOp->Common.InlineComment = NULL; - UnnamedOp->Common.EndNodeComment = NULL; - UnnamedOp->Common.CloseBraceComment = NULL; - UnnamedOp->Common.NameComment = NULL; - UnnamedOp->Common.CommentList = NULL; - UnnamedOp->Common.EndBlkComment = NULL; -#endif - - if ((*Op)->Common.AmlOpcode == AML_REGION_OP || - (*Op)->Common.AmlOpcode == AML_DATA_REGION_OP) - { - /* - * Defer final parsing of an OperationRegion body, because we don't - * have enough info in the first pass to parse it correctly (i.e., - * there may be method calls within the TermArg elements of the body.) - * - * However, we must continue parsing because the opregion is not a - * standalone package -- we don't know where the end is at this point. - * - * (Length is unknown until parse of the body complete) - */ - (*Op)->Named.Data = AmlOpStart; - (*Op)->Named.Length = 0; - } - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiPsCreateOp - * - * PARAMETERS: WalkState - Current state - * AmlOpStart - Op start in AML - * NewOp - Returned Op - * - * RETURN: Status - * - * DESCRIPTION: Get Op from AML - * - ******************************************************************************/ - -ACPI_STATUS -AcpiPsCreateOp ( - ACPI_WALK_STATE *WalkState, - UINT8 *AmlOpStart, - ACPI_PARSE_OBJECT **NewOp) -{ - ACPI_STATUS Status = AE_OK; - ACPI_PARSE_OBJECT *Op; - ACPI_PARSE_OBJECT *NamedOp = NULL; - ACPI_PARSE_OBJECT *ParentScope; - UINT8 ArgumentCount; - const ACPI_OPCODE_INFO *OpInfo; - - - ACPI_FUNCTION_TRACE_PTR (PsCreateOp, WalkState); - - - Status = AcpiPsGetAmlOpcode (WalkState); - if (Status == AE_CTRL_PARSE_CONTINUE) - { - return_ACPI_STATUS (AE_CTRL_PARSE_CONTINUE); - } - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Create Op structure and append to parent's argument list */ - - WalkState->OpInfo = AcpiPsGetOpcodeInfo (WalkState->Opcode); - Op = AcpiPsAllocOp (WalkState->Opcode, AmlOpStart); - if (!Op) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - if (WalkState->OpInfo->Flags & AML_NAMED) - { - Status = AcpiPsBuildNamedOp (WalkState, AmlOpStart, Op, &NamedOp); - AcpiPsFreeOp (Op); - -#ifdef ACPI_ASL_COMPILER - if (AcpiGbl_DisasmFlag && WalkState->Opcode == AML_EXTERNAL_OP && - Status == AE_NOT_FOUND) - { - /* - * If parsing of AML_EXTERNAL_OP's name path fails, then skip - * past this opcode and keep parsing. This is a much better - * alternative than to abort the entire disassembler. At this - * point, the ParserState is at the end of the namepath of the - * external declaration opcode. Setting WalkState->Aml to - * WalkState->ParserState.Aml + 2 moves increments the - * WalkState->Aml past the object type and the paramcount of the - * external opcode. - */ - WalkState->Aml = WalkState->ParserState.Aml + 2; - WalkState->ParserState.Aml = WalkState->Aml; - return_ACPI_STATUS (AE_CTRL_PARSE_CONTINUE); - } -#endif - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - *NewOp = NamedOp; - return_ACPI_STATUS (AE_OK); - } - - /* Not a named opcode, just allocate Op and append to parent */ - - if (WalkState->OpInfo->Flags & AML_CREATE) - { - /* - * Backup to beginning of CreateXXXfield declaration - * BodyLength is unknown until we parse the body - */ - Op->Named.Data = AmlOpStart; - Op->Named.Length = 0; - } - - if (WalkState->Opcode == AML_BANK_FIELD_OP) - { - /* - * Backup to beginning of BankField declaration - * BodyLength is unknown until we parse the body - */ - Op->Named.Data = AmlOpStart; - Op->Named.Length = 0; - } - - ParentScope = AcpiPsGetParentScope (&(WalkState->ParserState)); - AcpiPsAppendArg (ParentScope, Op); - - if (ParentScope) - { - OpInfo = AcpiPsGetOpcodeInfo (ParentScope->Common.AmlOpcode); - if (OpInfo->Flags & AML_HAS_TARGET) - { - ArgumentCount = AcpiPsGetArgumentCount (OpInfo->Type); - if (ParentScope->Common.ArgListLength > ArgumentCount) - { - Op->Common.Flags |= ACPI_PARSEOP_TARGET; - } - } - - /* - * Special case for both Increment() and Decrement(), where - * the lone argument is both a source and a target. - */ - else if ((ParentScope->Common.AmlOpcode == AML_INCREMENT_OP) || - (ParentScope->Common.AmlOpcode == AML_DECREMENT_OP)) - { - Op->Common.Flags |= ACPI_PARSEOP_TARGET; - } - } - - if (WalkState->DescendingCallback != NULL) - { - /* - * Find the object. This will either insert the object into - * the namespace or simply look it up - */ - WalkState->Op = *NewOp = Op; - - Status = WalkState->DescendingCallback (WalkState, &Op); - Status = AcpiPsNextParseState (WalkState, Op, Status); - if (Status == AE_CTRL_PENDING) - { - Status = AE_CTRL_PARSE_PENDING; - } - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiPsCompleteOp - * - * PARAMETERS: WalkState - Current state - * Op - Returned Op - * Status - Parse status before complete Op - * - * RETURN: Status - * - * DESCRIPTION: Complete Op - * - ******************************************************************************/ - -ACPI_STATUS -AcpiPsCompleteOp ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT **Op, - ACPI_STATUS Status) -{ - ACPI_STATUS Status2; - - - ACPI_FUNCTION_TRACE_PTR (PsCompleteOp, WalkState); - - - /* - * Finished one argument of the containing scope - */ - WalkState->ParserState.Scope->ParseScope.ArgCount--; - - /* Close this Op (will result in parse subtree deletion) */ - - Status2 = AcpiPsCompleteThisOp (WalkState, *Op); - if (ACPI_FAILURE (Status2)) - { - return_ACPI_STATUS (Status2); - } - - *Op = NULL; - - switch (Status) - { - case AE_OK: - - break; - - case AE_CTRL_TRANSFER: - - /* We are about to transfer to a called method */ - - WalkState->PrevOp = NULL; - WalkState->PrevArgTypes = WalkState->ArgTypes; - return_ACPI_STATUS (Status); - - case AE_CTRL_END: - - AcpiPsPopScope (&(WalkState->ParserState), Op, - &WalkState->ArgTypes, &WalkState->ArgCount); - - if (*Op) - { - WalkState->Op = *Op; - WalkState->OpInfo = AcpiPsGetOpcodeInfo ((*Op)->Common.AmlOpcode); - WalkState->Opcode = (*Op)->Common.AmlOpcode; - - Status = WalkState->AscendingCallback (WalkState); - (void) AcpiPsNextParseState (WalkState, *Op, Status); - - Status2 = AcpiPsCompleteThisOp (WalkState, *Op); - if (ACPI_FAILURE (Status2)) - { - return_ACPI_STATUS (Status2); - } - } - - break; - - case AE_CTRL_BREAK: - case AE_CTRL_CONTINUE: - - /* Pop off scopes until we find the While */ - - while (!(*Op) || ((*Op)->Common.AmlOpcode != AML_WHILE_OP)) - { - AcpiPsPopScope (&(WalkState->ParserState), Op, - &WalkState->ArgTypes, &WalkState->ArgCount); - } - - /* Close this iteration of the While loop */ - - WalkState->Op = *Op; - WalkState->OpInfo = AcpiPsGetOpcodeInfo ((*Op)->Common.AmlOpcode); - WalkState->Opcode = (*Op)->Common.AmlOpcode; - - Status = WalkState->AscendingCallback (WalkState); - (void) AcpiPsNextParseState (WalkState, *Op, Status); - - Status2 = AcpiPsCompleteThisOp (WalkState, *Op); - if (ACPI_FAILURE (Status2)) - { - return_ACPI_STATUS (Status2); - } - - break; - - case AE_CTRL_TERMINATE: - - /* Clean up */ - do - { - if (*Op) - { - Status2 = AcpiPsCompleteThisOp (WalkState, *Op); - if (ACPI_FAILURE (Status2)) - { - return_ACPI_STATUS (Status2); - } - - AcpiUtDeleteGenericState ( - AcpiUtPopGenericState (&WalkState->ControlState)); - } - - AcpiPsPopScope (&(WalkState->ParserState), Op, - &WalkState->ArgTypes, &WalkState->ArgCount); - - } while (*Op); - - return_ACPI_STATUS (AE_OK); - - default: /* All other non-AE_OK status */ - - do - { - if (*Op) - { - /* - * These Opcodes need to be removed from the namespace because they - * get created even if these opcodes cannot be created due to - * errors. - */ - if (((*Op)->Common.AmlOpcode == AML_REGION_OP) || - ((*Op)->Common.AmlOpcode == AML_DATA_REGION_OP)) - { - AcpiNsDeleteChildren ((*Op)->Common.Node); - AcpiNsRemoveNode ((*Op)->Common.Node); - (*Op)->Common.Node = NULL; - AcpiPsDeleteParseTree (*Op); - } - - Status2 = AcpiPsCompleteThisOp (WalkState, *Op); - if (ACPI_FAILURE (Status2)) - { - return_ACPI_STATUS (Status2); - } - } - - AcpiPsPopScope (&(WalkState->ParserState), Op, - &WalkState->ArgTypes, &WalkState->ArgCount); - - } while (*Op); - - -#if 0 - /* - * TBD: Cleanup parse ops on error - */ - if (*Op == NULL) - { - AcpiPsPopScope (ParserState, Op, - &WalkState->ArgTypes, &WalkState->ArgCount); - } -#endif - WalkState->PrevOp = NULL; - WalkState->PrevArgTypes = WalkState->ArgTypes; - - if (WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL) - { - /* - * There was something that went wrong while executing code at the - * module-level. We need to skip parsing whatever caused the - * error and keep going. One runtime error during the table load - * should not cause the entire table to not be loaded. This is - * because there could be correct AML beyond the parts that caused - * the runtime error. - */ - ACPI_INFO (("Ignoring error and continuing table load")); - return_ACPI_STATUS (AE_OK); - } - return_ACPI_STATUS (Status); - } - - /* This scope complete? */ - - if (AcpiPsHasCompletedScope (&(WalkState->ParserState))) - { - AcpiPsPopScope (&(WalkState->ParserState), Op, - &WalkState->ArgTypes, &WalkState->ArgCount); - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", *Op)); - } - else - { - *Op = NULL; - } - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiPsCompleteFinalOp - * - * PARAMETERS: WalkState - Current state - * Op - Current Op - * Status - Current parse status before complete last - * Op - * - * RETURN: Status - * - * DESCRIPTION: Complete last Op. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiPsCompleteFinalOp ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op, - ACPI_STATUS Status) -{ - ACPI_STATUS ReturnStatus = Status; - BOOLEAN Ascending = TRUE; - - - ACPI_FUNCTION_TRACE_PTR (PsCompleteFinalOp, WalkState); - - - /* - * Complete the last Op (if not completed), and clear the scope stack. - * It is easily possible to end an AML "package" with an unbounded number - * of open scopes (such as when several ASL blocks are closed with - * sequential closing braces). We want to terminate each one cleanly. - */ - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "AML package complete at Op %p\n", Op)); - do - { - if (Op) - { - if (Ascending && WalkState->AscendingCallback != NULL) - { - WalkState->Op = Op; - WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - WalkState->Opcode = Op->Common.AmlOpcode; - - Status = WalkState->AscendingCallback (WalkState); - Status = AcpiPsNextParseState (WalkState, Op, Status); - if (Status == AE_CTRL_PENDING) - { - Status = AcpiPsCompleteOp (WalkState, &Op, AE_OK); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - if (Status == AE_CTRL_TERMINATE) - { - Ascending = FALSE; - ReturnStatus = AE_CTRL_TERMINATE; - } - - else if (ACPI_FAILURE (Status)) - { - /* First error is most important */ - - Ascending = FALSE; - ReturnStatus = Status; - } - } - - Status = AcpiPsCompleteThisOp (WalkState, Op); - if (ACPI_FAILURE (Status)) - { - Ascending = FALSE; - if (ACPI_SUCCESS (ReturnStatus) || - ReturnStatus == AE_CTRL_TERMINATE) - { - ReturnStatus = Status; - } - } - } - - AcpiPsPopScope (&(WalkState->ParserState), &Op, &WalkState->ArgTypes, - &WalkState->ArgCount); - - } while (Op); - - return_ACPI_STATUS (ReturnStatus); -} diff --git a/drivers/acpica/psopcode.c b/drivers/acpica/psopcode.c deleted file mode 100644 index 9da094f..0000000 --- a/drivers/acpica/psopcode.c +++ /dev/null @@ -1,452 +0,0 @@ -/****************************************************************************** - * - * Module Name: psopcode - Parser/Interpreter opcode information table - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acopcode.h" -#include "amlcode.h" - - -#define _COMPONENT ACPI_PARSER - ACPI_MODULE_NAME ("psopcode") - - -/******************************************************************************* - * - * NAME: AcpiGbl_AmlOpInfo - * - * DESCRIPTION: Opcode table. Each entry contains - * The name is a simple ascii string, the operand specifier is an - * ascii string with one letter per operand. The letter specifies - * the operand type. - * - ******************************************************************************/ - -/* - * Summary of opcode types/flags - * - - Opcodes that have associated namespace objects (AML_NSOBJECT flag) - - AML_SCOPE_OP - AML_DEVICE_OP - AML_THERMAL_ZONE_OP - AML_METHOD_OP - AML_POWER_RESOURCE_OP - AML_PROCESSOR_OP - AML_FIELD_OP - AML_INDEX_FIELD_OP - AML_BANK_FIELD_OP - AML_NAME_OP - AML_ALIAS_OP - AML_MUTEX_OP - AML_EVENT_OP - AML_REGION_OP - AML_CREATE_FIELD_OP - AML_CREATE_BIT_FIELD_OP - AML_CREATE_BYTE_FIELD_OP - AML_CREATE_WORD_FIELD_OP - AML_CREATE_DWORD_FIELD_OP - AML_CREATE_QWORD_FIELD_OP - AML_INT_NAMEDFIELD_OP - AML_INT_METHODCALL_OP - AML_INT_NAMEPATH_OP - - Opcodes that are "namespace" opcodes (AML_NSOPCODE flag) - - AML_SCOPE_OP - AML_DEVICE_OP - AML_THERMAL_ZONE_OP - AML_METHOD_OP - AML_POWER_RESOURCE_OP - AML_PROCESSOR_OP - AML_FIELD_OP - AML_INDEX_FIELD_OP - AML_BANK_FIELD_OP - AML_NAME_OP - AML_ALIAS_OP - AML_MUTEX_OP - AML_EVENT_OP - AML_REGION_OP - AML_INT_NAMEDFIELD_OP - - Opcodes that have an associated namespace node (AML_NSNODE flag) - - AML_SCOPE_OP - AML_DEVICE_OP - AML_THERMAL_ZONE_OP - AML_METHOD_OP - AML_POWER_RESOURCE_OP - AML_PROCESSOR_OP - AML_NAME_OP - AML_ALIAS_OP - AML_MUTEX_OP - AML_EVENT_OP - AML_REGION_OP - AML_CREATE_FIELD_OP - AML_CREATE_BIT_FIELD_OP - AML_CREATE_BYTE_FIELD_OP - AML_CREATE_WORD_FIELD_OP - AML_CREATE_DWORD_FIELD_OP - AML_CREATE_QWORD_FIELD_OP - AML_INT_NAMEDFIELD_OP - AML_INT_METHODCALL_OP - AML_INT_NAMEPATH_OP - - Opcodes that define named ACPI objects (AML_NAMED flag) - - AML_SCOPE_OP - AML_DEVICE_OP - AML_THERMAL_ZONE_OP - AML_METHOD_OP - AML_POWER_RESOURCE_OP - AML_PROCESSOR_OP - AML_NAME_OP - AML_ALIAS_OP - AML_MUTEX_OP - AML_EVENT_OP - AML_REGION_OP - AML_INT_NAMEDFIELD_OP - - Opcodes that contain executable AML as part of the definition that - must be deferred until needed - - AML_METHOD_OP - AML_VARIABLE_PACKAGE_OP - AML_CREATE_FIELD_OP - AML_CREATE_BIT_FIELD_OP - AML_CREATE_BYTE_FIELD_OP - AML_CREATE_WORD_FIELD_OP - AML_CREATE_DWORD_FIELD_OP - AML_CREATE_QWORD_FIELD_OP - AML_REGION_OP - AML_BUFFER_OP - - Field opcodes - - AML_CREATE_FIELD_OP - AML_FIELD_OP - AML_INDEX_FIELD_OP - AML_BANK_FIELD_OP - - Field "Create" opcodes - - AML_CREATE_FIELD_OP - AML_CREATE_BIT_FIELD_OP - AML_CREATE_BYTE_FIELD_OP - AML_CREATE_WORD_FIELD_OP - AML_CREATE_DWORD_FIELD_OP - AML_CREATE_QWORD_FIELD_OP - - ******************************************************************************/ - - -/* - * Master Opcode information table. A summary of everything we know about each - * opcode, all in one place. - */ -const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES] = -{ -/*! [Begin] no source code translation */ -/* Index Name Parser Args Interpreter Args ObjectType Class Type Flags */ - -/* 00 */ ACPI_OP ("Zero", ARGP_ZERO_OP, ARGI_ZERO_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT), -/* 01 */ ACPI_OP ("One", ARGP_ONE_OP, ARGI_ONE_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT), -/* 02 */ ACPI_OP ("Alias", ARGP_ALIAS_OP, ARGI_ALIAS_OP, ACPI_TYPE_LOCAL_ALIAS, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), -/* 03 */ ACPI_OP ("Name", ARGP_NAME_OP, ARGI_NAME_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), -/* 04 */ ACPI_OP ("ByteConst", ARGP_BYTE_OP, ARGI_BYTE_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT), -/* 05 */ ACPI_OP ("WordConst", ARGP_WORD_OP, ARGI_WORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT), -/* 06 */ ACPI_OP ("DwordConst", ARGP_DWORD_OP, ARGI_DWORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT), -/* 07 */ ACPI_OP ("String", ARGP_STRING_OP, ARGI_STRING_OP, ACPI_TYPE_STRING, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT), -/* 08 */ ACPI_OP ("Scope", ARGP_SCOPE_OP, ARGI_SCOPE_OP, ACPI_TYPE_LOCAL_SCOPE, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), -/* 09 */ ACPI_OP ("Buffer", ARGP_BUFFER_OP, ARGI_BUFFER_OP, ACPI_TYPE_BUFFER, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER | AML_CONSTANT), -/* 0A */ ACPI_OP ("Package", ARGP_PACKAGE_OP, ARGI_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER | AML_CONSTANT), -/* 0B */ ACPI_OP ("Method", ARGP_METHOD_OP, ARGI_METHOD_OP, ACPI_TYPE_METHOD, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER), -/* 0C */ ACPI_OP ("Local0", ARGP_LOCAL0, ARGI_LOCAL0, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0), -/* 0D */ ACPI_OP ("Local1", ARGP_LOCAL1, ARGI_LOCAL1, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0), -/* 0E */ ACPI_OP ("Local2", ARGP_LOCAL2, ARGI_LOCAL2, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0), -/* 0F */ ACPI_OP ("Local3", ARGP_LOCAL3, ARGI_LOCAL3, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0), -/* 10 */ ACPI_OP ("Local4", ARGP_LOCAL4, ARGI_LOCAL4, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0), -/* 11 */ ACPI_OP ("Local5", ARGP_LOCAL5, ARGI_LOCAL5, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0), -/* 12 */ ACPI_OP ("Local6", ARGP_LOCAL6, ARGI_LOCAL6, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0), -/* 13 */ ACPI_OP ("Local7", ARGP_LOCAL7, ARGI_LOCAL7, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0), -/* 14 */ ACPI_OP ("Arg0", ARGP_ARG0, ARGI_ARG0, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0), -/* 15 */ ACPI_OP ("Arg1", ARGP_ARG1, ARGI_ARG1, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0), -/* 16 */ ACPI_OP ("Arg2", ARGP_ARG2, ARGI_ARG2, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0), -/* 17 */ ACPI_OP ("Arg3", ARGP_ARG3, ARGI_ARG3, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0), -/* 18 */ ACPI_OP ("Arg4", ARGP_ARG4, ARGI_ARG4, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0), -/* 19 */ ACPI_OP ("Arg5", ARGP_ARG5, ARGI_ARG5, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0), -/* 1A */ ACPI_OP ("Arg6", ARGP_ARG6, ARGI_ARG6, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0), -/* 1B */ ACPI_OP ("Store", ARGP_STORE_OP, ARGI_STORE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), -/* 1C */ ACPI_OP ("RefOf", ARGP_REF_OF_OP, ARGI_REF_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R), -/* 1D */ ACPI_OP ("Add", ARGP_ADD_OP, ARGI_ADD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), -/* 1E */ ACPI_OP ("Concatenate", ARGP_CONCAT_OP, ARGI_CONCAT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), -/* 1F */ ACPI_OP ("Subtract", ARGP_SUBTRACT_OP, ARGI_SUBTRACT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), -/* 20 */ ACPI_OP ("Increment", ARGP_INCREMENT_OP, ARGI_INCREMENT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT), -/* 21 */ ACPI_OP ("Decrement", ARGP_DECREMENT_OP, ARGI_DECREMENT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT), -/* 22 */ ACPI_OP ("Multiply", ARGP_MULTIPLY_OP, ARGI_MULTIPLY_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), -/* 23 */ ACPI_OP ("Divide", ARGP_DIVIDE_OP, ARGI_DIVIDE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_2T_1R, AML_FLAGS_EXEC_2A_2T_1R | AML_CONSTANT), -/* 24 */ ACPI_OP ("ShiftLeft", ARGP_SHIFT_LEFT_OP, ARGI_SHIFT_LEFT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), -/* 25 */ ACPI_OP ("ShiftRight", ARGP_SHIFT_RIGHT_OP, ARGI_SHIFT_RIGHT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), -/* 26 */ ACPI_OP ("And", ARGP_BIT_AND_OP, ARGI_BIT_AND_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), -/* 27 */ ACPI_OP ("NAnd", ARGP_BIT_NAND_OP, ARGI_BIT_NAND_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), -/* 28 */ ACPI_OP ("Or", ARGP_BIT_OR_OP, ARGI_BIT_OR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), -/* 29 */ ACPI_OP ("NOr", ARGP_BIT_NOR_OP, ARGI_BIT_NOR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), -/* 2A */ ACPI_OP ("XOr", ARGP_BIT_XOR_OP, ARGI_BIT_XOR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), -/* 2B */ ACPI_OP ("Not", ARGP_BIT_NOT_OP, ARGI_BIT_NOT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), -/* 2C */ ACPI_OP ("FindSetLeftBit", ARGP_FIND_SET_LEFT_BIT_OP, ARGI_FIND_SET_LEFT_BIT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), -/* 2D */ ACPI_OP ("FindSetRightBit", ARGP_FIND_SET_RIGHT_BIT_OP,ARGI_FIND_SET_RIGHT_BIT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), -/* 2E */ ACPI_OP ("DerefOf", ARGP_DEREF_OF_OP, ARGI_DEREF_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R), -/* 2F */ ACPI_OP ("Notify", ARGP_NOTIFY_OP, ARGI_NOTIFY_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_0R, AML_FLAGS_EXEC_2A_0T_0R), -/* 30 */ ACPI_OP ("SizeOf", ARGP_SIZE_OF_OP, ARGI_SIZE_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R | AML_NO_OPERAND_RESOLVE), -/* 31 */ ACPI_OP ("Index", ARGP_INDEX_OP, ARGI_INDEX_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R), -/* 32 */ ACPI_OP ("Match", ARGP_MATCH_OP, ARGI_MATCH_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R | AML_CONSTANT), -/* 33 */ ACPI_OP ("CreateDWordField", ARGP_CREATE_DWORD_FIELD_OP,ARGI_CREATE_DWORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE), -/* 34 */ ACPI_OP ("CreateWordField", ARGP_CREATE_WORD_FIELD_OP, ARGI_CREATE_WORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE), -/* 35 */ ACPI_OP ("CreateByteField", ARGP_CREATE_BYTE_FIELD_OP, ARGI_CREATE_BYTE_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE), -/* 36 */ ACPI_OP ("CreateBitField", ARGP_CREATE_BIT_FIELD_OP, ARGI_CREATE_BIT_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE), -/* 37 */ ACPI_OP ("ObjectType", ARGP_OBJECT_TYPE_OP, ARGI_OBJECT_TYPE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R | AML_NO_OPERAND_RESOLVE), -/* 38 */ ACPI_OP ("LAnd", ARGP_LAND_OP, ARGI_LAND_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC | AML_CONSTANT), -/* 39 */ ACPI_OP ("LOr", ARGP_LOR_OP, ARGI_LOR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC | AML_CONSTANT), -/* 3A */ ACPI_OP ("LNot", ARGP_LNOT_OP, ARGI_LNOT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT), -/* 3B */ ACPI_OP ("LEqual", ARGP_LEQUAL_OP, ARGI_LEQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT), -/* 3C */ ACPI_OP ("LGreater", ARGP_LGREATER_OP, ARGI_LGREATER_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT), -/* 3D */ ACPI_OP ("LLess", ARGP_LLESS_OP, ARGI_LLESS_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT), -/* 3E */ ACPI_OP ("If", ARGP_IF_OP, ARGI_IF_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS), -/* 3F */ ACPI_OP ("Else", ARGP_ELSE_OP, ARGI_ELSE_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS), -/* 40 */ ACPI_OP ("While", ARGP_WHILE_OP, ARGI_WHILE_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS), -/* 41 */ ACPI_OP ("Noop", ARGP_NOOP_OP, ARGI_NOOP_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), -/* 42 */ ACPI_OP ("Return", ARGP_RETURN_OP, ARGI_RETURN_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS), -/* 43 */ ACPI_OP ("Break", ARGP_BREAK_OP, ARGI_BREAK_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), -/* 44 */ ACPI_OP ("BreakPoint", ARGP_BREAK_POINT_OP, ARGI_BREAK_POINT_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), -/* 45 */ ACPI_OP ("Ones", ARGP_ONES_OP, ARGI_ONES_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT), - -/* Prefixed opcodes (Two-byte opcodes with a prefix op) */ - -/* 46 */ ACPI_OP ("Mutex", ARGP_MUTEX_OP, ARGI_MUTEX_OP, ACPI_TYPE_MUTEX, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), -/* 47 */ ACPI_OP ("Event", ARGP_EVENT_OP, ARGI_EVENT_OP, ACPI_TYPE_EVENT, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED ), -/* 48 */ ACPI_OP ("CondRefOf", ARGP_COND_REF_OF_OP, ARGI_COND_REF_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), -/* 49 */ ACPI_OP ("CreateField", ARGP_CREATE_FIELD_OP, ARGI_CREATE_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_FIELD | AML_CREATE), -/* 4A */ ACPI_OP ("Load", ARGP_LOAD_OP, ARGI_LOAD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), -/* 4B */ ACPI_OP ("Stall", ARGP_STALL_OP, ARGI_STALL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), -/* 4C */ ACPI_OP ("Sleep", ARGP_SLEEP_OP, ARGI_SLEEP_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), -/* 4D */ ACPI_OP ("Acquire", ARGP_ACQUIRE_OP, ARGI_ACQUIRE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R), -/* 4E */ ACPI_OP ("Signal", ARGP_SIGNAL_OP, ARGI_SIGNAL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), -/* 4F */ ACPI_OP ("Wait", ARGP_WAIT_OP, ARGI_WAIT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R), -/* 50 */ ACPI_OP ("Reset", ARGP_RESET_OP, ARGI_RESET_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), -/* 51 */ ACPI_OP ("Release", ARGP_RELEASE_OP, ARGI_RELEASE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), -/* 52 */ ACPI_OP ("FromBCD", ARGP_FROM_BCD_OP, ARGI_FROM_BCD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), -/* 53 */ ACPI_OP ("ToBCD", ARGP_TO_BCD_OP, ARGI_TO_BCD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), -/* 54 */ ACPI_OP ("Unload", ARGP_UNLOAD_OP, ARGI_UNLOAD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), -/* 55 */ ACPI_OP ("Revision", ARGP_REVISION_OP, ARGI_REVISION_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0), -/* 56 */ ACPI_OP ("Debug", ARGP_DEBUG_OP, ARGI_DEBUG_OP, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0), -/* 57 */ ACPI_OP ("Fatal", ARGP_FATAL_OP, ARGI_FATAL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_0T_0R, AML_FLAGS_EXEC_3A_0T_0R), -/* 58 */ ACPI_OP ("OperationRegion", ARGP_REGION_OP, ARGI_REGION_OP, ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER), -/* 59 */ ACPI_OP ("Field", ARGP_FIELD_OP, ARGI_FIELD_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD), -/* 5A */ ACPI_OP ("Device", ARGP_DEVICE_OP, ARGI_DEVICE_OP, ACPI_TYPE_DEVICE, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), -/* 5B */ ACPI_OP ("Processor", ARGP_PROCESSOR_OP, ARGI_PROCESSOR_OP, ACPI_TYPE_PROCESSOR, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), -/* 5C */ ACPI_OP ("PowerResource", ARGP_POWER_RES_OP, ARGI_POWER_RES_OP, ACPI_TYPE_POWER, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), -/* 5D */ ACPI_OP ("ThermalZone", ARGP_THERMAL_ZONE_OP, ARGI_THERMAL_ZONE_OP, ACPI_TYPE_THERMAL, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), -/* 5E */ ACPI_OP ("IndexField", ARGP_INDEX_FIELD_OP, ARGI_INDEX_FIELD_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD), -/* 5F */ ACPI_OP ("BankField", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP, ACPI_TYPE_LOCAL_BANK_FIELD, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD | AML_DEFER), - -/* Internal opcodes that map to invalid AML opcodes */ - -/* 60 */ ACPI_OP ("LNotEqual", ARGP_LNOTEQUAL_OP, ARGI_LNOTEQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT), -/* 61 */ ACPI_OP ("LLessEqual", ARGP_LLESSEQUAL_OP, ARGI_LLESSEQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT), -/* 62 */ ACPI_OP ("LGreaterEqual", ARGP_LGREATEREQUAL_OP, ARGI_LGREATEREQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT), -/* 63 */ ACPI_OP ("-NamePath-", ARGP_NAMEPATH_OP, ARGI_NAMEPATH_OP, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_NSOBJECT | AML_NSNODE ), -/* 64 */ ACPI_OP ("-MethodCall-", ARGP_METHODCALL_OP, ARGI_METHODCALL_OP, ACPI_TYPE_METHOD, AML_CLASS_METHOD_CALL, AML_TYPE_METHOD_CALL, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE), -/* 65 */ ACPI_OP ("-ByteList-", ARGP_BYTELIST_OP, ARGI_BYTELIST_OP, ACPI_TYPE_ANY, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0), -/* 66 */ ACPI_OP ("-ReservedField-", ARGP_RESERVEDFIELD_OP, ARGI_RESERVEDFIELD_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0), -/* 67 */ ACPI_OP ("-NamedField-", ARGP_NAMEDFIELD_OP, ARGI_NAMEDFIELD_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED ), -/* 68 */ ACPI_OP ("-AccessField-", ARGP_ACCESSFIELD_OP, ARGI_ACCESSFIELD_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0), -/* 69 */ ACPI_OP ("-StaticString", ARGP_STATICSTRING_OP, ARGI_STATICSTRING_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0), -/* 6A */ ACPI_OP ("-Return Value-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, AML_CLASS_RETURN_VALUE, AML_TYPE_RETURN, AML_HAS_ARGS | AML_HAS_RETVAL), -/* 6B */ ACPI_OP ("-UNKNOWN_OP-", ARG_NONE, ARG_NONE, ACPI_TYPE_INVALID, AML_CLASS_UNKNOWN, AML_TYPE_BOGUS, AML_HAS_ARGS), -/* 6C */ ACPI_OP ("-ASCII_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, AML_CLASS_ASCII, AML_TYPE_BOGUS, AML_HAS_ARGS), -/* 6D */ ACPI_OP ("-PREFIX_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, AML_CLASS_PREFIX, AML_TYPE_BOGUS, AML_HAS_ARGS), - -/* ACPI 2.0 opcodes */ - -/* 6E */ ACPI_OP ("QwordConst", ARGP_QWORD_OP, ARGI_QWORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT), -/* 6F */ ACPI_OP ("Package", /* Var */ ARGP_VAR_PACKAGE_OP, ARGI_VAR_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER), -/* 70 */ ACPI_OP ("ConcatenateResTemplate", ARGP_CONCAT_RES_OP, ARGI_CONCAT_RES_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), -/* 71 */ ACPI_OP ("Mod", ARGP_MOD_OP, ARGI_MOD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), -/* 72 */ ACPI_OP ("CreateQWordField", ARGP_CREATE_QWORD_FIELD_OP,ARGI_CREATE_QWORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE), -/* 73 */ ACPI_OP ("ToBuffer", ARGP_TO_BUFFER_OP, ARGI_TO_BUFFER_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), -/* 74 */ ACPI_OP ("ToDecimalString", ARGP_TO_DEC_STR_OP, ARGI_TO_DEC_STR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), -/* 75 */ ACPI_OP ("ToHexString", ARGP_TO_HEX_STR_OP, ARGI_TO_HEX_STR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), -/* 76 */ ACPI_OP ("ToInteger", ARGP_TO_INTEGER_OP, ARGI_TO_INTEGER_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), -/* 77 */ ACPI_OP ("ToString", ARGP_TO_STRING_OP, ARGI_TO_STRING_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), -/* 78 */ ACPI_OP ("CopyObject", ARGP_COPY_OP, ARGI_COPY_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), -/* 79 */ ACPI_OP ("Mid", ARGP_MID_OP, ARGI_MID_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_1T_1R, AML_FLAGS_EXEC_3A_1T_1R | AML_CONSTANT), -/* 7A */ ACPI_OP ("Continue", ARGP_CONTINUE_OP, ARGI_CONTINUE_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), -/* 7B */ ACPI_OP ("LoadTable", ARGP_LOAD_TABLE_OP, ARGI_LOAD_TABLE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R), -/* 7C */ ACPI_OP ("DataTableRegion", ARGP_DATA_REGION_OP, ARGI_DATA_REGION_OP, ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER), -/* 7D */ ACPI_OP ("[EvalSubTree]", ARGP_SCOPE_OP, ARGI_SCOPE_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE), - -/* ACPI 3.0 opcodes */ - -/* 7E */ ACPI_OP ("Timer", ARGP_TIMER_OP, ARGI_TIMER_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_0A_0T_1R, AML_FLAGS_EXEC_0A_0T_1R | AML_NO_OPERAND_RESOLVE), - -/* ACPI 5.0 opcodes */ - -/* 7F */ ACPI_OP ("-ConnectField-", ARGP_CONNECTFIELD_OP, ARGI_CONNECTFIELD_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS), -/* 80 */ ACPI_OP ("-ExtAccessField-", ARGP_CONNECTFIELD_OP, ARGI_CONNECTFIELD_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0), - -/* ACPI 6.0 opcodes */ - -/* 81 */ ACPI_OP ("External", ARGP_EXTERNAL_OP, ARGI_EXTERNAL_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), -/* 82 */ ACPI_OP ("Comment", ARGP_COMMENT_OP, ARGI_COMMENT_OP, ACPI_TYPE_STRING, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT) - -/*! [End] no source code translation !*/ -}; diff --git a/drivers/acpica/psopinfo.c b/drivers/acpica/psopinfo.c deleted file mode 100644 index dcc426f..0000000 --- a/drivers/acpica/psopinfo.c +++ /dev/null @@ -1,392 +0,0 @@ -/****************************************************************************** - * - * Module Name: psopinfo - AML opcode information functions and dispatch tables - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acparser.h" -#include "acopcode.h" -#include "amlcode.h" - - -#define _COMPONENT ACPI_PARSER - ACPI_MODULE_NAME ("psopinfo") - - -static const UINT8 AcpiGbl_ArgumentCount[] = {0,1,1,1,1,2,2,2,2,3,3,6}; - - -/******************************************************************************* - * - * FUNCTION: AcpiPsGetOpcodeInfo - * - * PARAMETERS: Opcode - The AML opcode - * - * RETURN: A pointer to the info about the opcode. - * - * DESCRIPTION: Find AML opcode description based on the opcode. - * NOTE: This procedure must ALWAYS return a valid pointer! - * - ******************************************************************************/ - -const ACPI_OPCODE_INFO * -AcpiPsGetOpcodeInfo ( - UINT16 Opcode) -{ -#if defined ACPI_ASL_COMPILER && defined ACPI_DEBUG_OUTPUT - const char *OpcodeName = "Unknown AML opcode"; -#endif - - ACPI_FUNCTION_NAME (PsGetOpcodeInfo); - - - /* - * Detect normal 8-bit opcode or extended 16-bit opcode - */ - if (!(Opcode & 0xFF00)) - { - /* Simple (8-bit) opcode: 0-255, can't index beyond table */ - - return (&AcpiGbl_AmlOpInfo [AcpiGbl_ShortOpIndex [(UINT8) Opcode]]); - } - - if (((Opcode & 0xFF00) == AML_EXTENDED_OPCODE) && - (((UINT8) Opcode) <= MAX_EXTENDED_OPCODE)) - { - /* Valid extended (16-bit) opcode */ - - return (&AcpiGbl_AmlOpInfo [AcpiGbl_LongOpIndex [(UINT8) Opcode]]); - } - -#if defined ACPI_ASL_COMPILER && defined ACPI_DEBUG_OUTPUT -#include "asldefine.h" - - switch (Opcode) - { - case AML_RAW_DATA_BYTE: - OpcodeName = "-Raw Data Byte-"; - break; - - case AML_RAW_DATA_WORD: - OpcodeName = "-Raw Data Word-"; - break; - - case AML_RAW_DATA_DWORD: - OpcodeName = "-Raw Data Dword-"; - break; - - case AML_RAW_DATA_QWORD: - OpcodeName = "-Raw Data Qword-"; - break; - - case AML_RAW_DATA_BUFFER: - OpcodeName = "-Raw Data Buffer-"; - break; - - case AML_RAW_DATA_CHAIN: - OpcodeName = "-Raw Data Buffer Chain-"; - break; - - case AML_PACKAGE_LENGTH: - OpcodeName = "-Package Length-"; - break; - - case AML_UNASSIGNED_OPCODE: - OpcodeName = "-Unassigned Opcode-"; - break; - - case AML_DEFAULT_ARG_OP: - OpcodeName = "-Default Arg-"; - break; - - default: - break; - } - - /* Unknown AML opcode */ - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "%s [%4.4X]\n", OpcodeName, Opcode)); -#endif - - return (&AcpiGbl_AmlOpInfo [_UNK]); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiPsGetOpcodeName - * - * PARAMETERS: Opcode - The AML opcode - * - * RETURN: A pointer to the name of the opcode (ASCII String) - * Note: Never returns NULL. - * - * DESCRIPTION: Translate an opcode into a human-readable string - * - ******************************************************************************/ - -const char * -AcpiPsGetOpcodeName ( - UINT16 Opcode) -{ -#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT) - - const ACPI_OPCODE_INFO *Op; - - - Op = AcpiPsGetOpcodeInfo (Opcode); - - /* Always guaranteed to return a valid pointer */ - - return (Op->Name); - -#else - return ("OpcodeName unavailable"); - -#endif -} - - -/******************************************************************************* - * - * FUNCTION: AcpiPsGetArgumentCount - * - * PARAMETERS: OpType - Type associated with the AML opcode - * - * RETURN: Argument count - * - * DESCRIPTION: Obtain the number of expected arguments for an AML opcode - * - ******************************************************************************/ - -UINT8 -AcpiPsGetArgumentCount ( - UINT32 OpType) -{ - - if (OpType <= AML_TYPE_EXEC_6A_0T_1R) - { - return (AcpiGbl_ArgumentCount[OpType]); - } - - return (0); -} - - -/* - * This table is directly indexed by the opcodes It returns - * an index into the opcode table (AcpiGbl_AmlOpInfo) - */ -const UINT8 AcpiGbl_ShortOpIndex[256] = -{ -/* 0 1 2 3 4 5 6 7 */ -/* 8 9 A B C D E F */ -/* 0x00 */ 0x00, 0x01, _UNK, _UNK, _UNK, _UNK, 0x02, _UNK, -/* 0x08 */ 0x03, _UNK, 0x04, 0x05, 0x06, 0x07, 0x6E, _UNK, -/* 0x10 */ 0x08, 0x09, 0x0a, 0x6F, 0x0b, 0x81, _UNK, _UNK, -/* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0x20 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0x28 */ _UNK, _UNK, _UNK, _UNK, _UNK, 0x63, _PFX, _PFX, -/* 0x30 */ 0x67, 0x66, 0x68, 0x65, 0x69, 0x64, 0x6A, 0x7D, -/* 0x38 */ 0x7F, 0x80, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0x40 */ _UNK, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, -/* 0x48 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, -/* 0x50 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, -/* 0x58 */ _ASC, _ASC, _ASC, _UNK, _PFX, _UNK, _PFX, _ASC, -/* 0x60 */ 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, -/* 0x68 */ 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, _UNK, -/* 0x70 */ 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, -/* 0x78 */ 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, -/* 0x80 */ 0x2b, 0x2c, 0x2d, 0x2e, 0x70, 0x71, 0x2f, 0x30, -/* 0x88 */ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x72, -/* 0x90 */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x73, 0x74, -/* 0x98 */ 0x75, 0x76, _UNK, _UNK, 0x77, 0x78, 0x79, 0x7A, -/* 0xA0 */ 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x60, 0x61, -/* 0xA8 */ 0x62, 0x82, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0xB0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0xB8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0xC0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0xC8 */ _UNK, _UNK, _UNK, _UNK, 0x44, _UNK, _UNK, _UNK, -/* 0xD0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0xD8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0xE0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0xE8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0xF0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0xF8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x45, -}; - -/* - * This table is indexed by the second opcode of the extended opcode - * pair. It returns an index into the opcode table (AcpiGbl_AmlOpInfo) - */ -const UINT8 AcpiGbl_LongOpIndex[NUM_EXTENDED_OPCODE] = -{ -/* 0 1 2 3 4 5 6 7 */ -/* 8 9 A B C D E F */ -/* 0x00 */ _UNK, 0x46, 0x47, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0x08 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0x10 */ _UNK, _UNK, 0x48, 0x49, _UNK, _UNK, _UNK, _UNK, -/* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x7B, -/* 0x20 */ 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, -/* 0x28 */ 0x52, 0x53, 0x54, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0x30 */ 0x55, 0x56, 0x57, 0x7e, _UNK, _UNK, _UNK, _UNK, -/* 0x38 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0x40 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0x48 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0x50 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0x58 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0x60 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0x68 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0x70 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0x78 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0x80 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, -/* 0x88 */ 0x7C, -}; diff --git a/drivers/acpica/psparse.c b/drivers/acpica/psparse.c deleted file mode 100644 index 5b6ddc7..0000000 --- a/drivers/acpica/psparse.c +++ /dev/null @@ -1,843 +0,0 @@ -/****************************************************************************** - * - * Module Name: psparse - Parser top level AML parse routines - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -/* - * Parse the AML and build an operation tree as most interpreters, - * like Perl, do. Parsing is done by hand rather than with a YACC - * generated parser to tightly constrain stack and dynamic memory - * usage. At the same time, parsing is kept flexible and the code - * fairly compact by parsing based on a list of AML opcode - * templates in AmlOpInfo[] - */ - -#include "acpi.h" -#include "accommon.h" -#include "acparser.h" -#include "acdispat.h" -#include "amlcode.h" -#include "acinterp.h" -#include "acnamesp.h" - -#define _COMPONENT ACPI_PARSER - ACPI_MODULE_NAME ("psparse") - - -/******************************************************************************* - * - * FUNCTION: AcpiPsGetOpcodeSize - * - * PARAMETERS: Opcode - An AML opcode - * - * RETURN: Size of the opcode, in bytes (1 or 2) - * - * DESCRIPTION: Get the size of the current opcode. - * - ******************************************************************************/ - -UINT32 -AcpiPsGetOpcodeSize ( - UINT32 Opcode) -{ - - /* Extended (2-byte) opcode if > 255 */ - - if (Opcode > 0x00FF) - { - return (2); - } - - /* Otherwise, just a single byte opcode */ - - return (1); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiPsPeekOpcode - * - * PARAMETERS: ParserState - A parser state object - * - * RETURN: Next AML opcode - * - * DESCRIPTION: Get next AML opcode (without incrementing AML pointer) - * - ******************************************************************************/ - -UINT16 -AcpiPsPeekOpcode ( - ACPI_PARSE_STATE *ParserState) -{ - UINT8 *Aml; - UINT16 Opcode; - - - Aml = ParserState->Aml; - Opcode = (UINT16) ACPI_GET8 (Aml); - - if (Opcode == AML_EXTENDED_PREFIX) - { - /* Extended opcode, get the second opcode byte */ - - Aml++; - Opcode = (UINT16) ((Opcode << 8) | ACPI_GET8 (Aml)); - } - - return (Opcode); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiPsCompleteThisOp - * - * PARAMETERS: WalkState - Current State - * Op - Op to complete - * - * RETURN: Status - * - * DESCRIPTION: Perform any cleanup at the completion of an Op. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiPsCompleteThisOp ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Prev; - ACPI_PARSE_OBJECT *Next; - const ACPI_OPCODE_INFO *ParentInfo; - ACPI_PARSE_OBJECT *ReplacementOp = NULL; - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE_PTR (PsCompleteThisOp, Op); - - - /* Check for null Op, can happen if AML code is corrupt */ - - if (!Op) - { - return_ACPI_STATUS (AE_OK); /* OK for now */ - } - - AcpiExStopTraceOpcode (Op, WalkState); - - /* Delete this op and the subtree below it if asked to */ - - if (((WalkState->ParseFlags & ACPI_PARSE_TREE_MASK) != ACPI_PARSE_DELETE_TREE) || - (WalkState->OpInfo->Class == AML_CLASS_ARGUMENT)) - { - return_ACPI_STATUS (AE_OK); - } - - /* Make sure that we only delete this subtree */ - - if (Op->Common.Parent) - { - Prev = Op->Common.Parent->Common.Value.Arg; - if (!Prev) - { - /* Nothing more to do */ - - goto Cleanup; - } - - /* - * Check if we need to replace the operator and its subtree - * with a return value op (placeholder op) - */ - ParentInfo = AcpiPsGetOpcodeInfo (Op->Common.Parent->Common.AmlOpcode); - - switch (ParentInfo->Class) - { - case AML_CLASS_CONTROL: - - break; - - case AML_CLASS_CREATE: - /* - * These opcodes contain TermArg operands. The current - * op must be replaced by a placeholder return op - */ - ReplacementOp = AcpiPsAllocOp ( - AML_INT_RETURN_VALUE_OP, Op->Common.Aml); - if (!ReplacementOp) - { - Status = AE_NO_MEMORY; - } - break; - - case AML_CLASS_NAMED_OBJECT: - /* - * These opcodes contain TermArg operands. The current - * op must be replaced by a placeholder return op - */ - if ((Op->Common.Parent->Common.AmlOpcode == AML_REGION_OP) || - (Op->Common.Parent->Common.AmlOpcode == AML_DATA_REGION_OP) || - (Op->Common.Parent->Common.AmlOpcode == AML_BUFFER_OP) || - (Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) || - (Op->Common.Parent->Common.AmlOpcode == AML_BANK_FIELD_OP) || - (Op->Common.Parent->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP)) - { - ReplacementOp = AcpiPsAllocOp ( - AML_INT_RETURN_VALUE_OP, Op->Common.Aml); - if (!ReplacementOp) - { - Status = AE_NO_MEMORY; - } - } - else if ((Op->Common.Parent->Common.AmlOpcode == AML_NAME_OP) && - (WalkState->PassNumber <= ACPI_IMODE_LOAD_PASS2)) - { - if ((Op->Common.AmlOpcode == AML_BUFFER_OP) || - (Op->Common.AmlOpcode == AML_PACKAGE_OP) || - (Op->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP)) - { - ReplacementOp = AcpiPsAllocOp (Op->Common.AmlOpcode, - Op->Common.Aml); - if (!ReplacementOp) - { - Status = AE_NO_MEMORY; - } - else - { - ReplacementOp->Named.Data = Op->Named.Data; - ReplacementOp->Named.Length = Op->Named.Length; - } - } - } - break; - - default: - - ReplacementOp = AcpiPsAllocOp ( - AML_INT_RETURN_VALUE_OP, Op->Common.Aml); - if (!ReplacementOp) - { - Status = AE_NO_MEMORY; - } - } - - /* We must unlink this op from the parent tree */ - - if (Prev == Op) - { - /* This op is the first in the list */ - - if (ReplacementOp) - { - ReplacementOp->Common.Parent = Op->Common.Parent; - ReplacementOp->Common.Value.Arg = NULL; - ReplacementOp->Common.Node = Op->Common.Node; - Op->Common.Parent->Common.Value.Arg = ReplacementOp; - ReplacementOp->Common.Next = Op->Common.Next; - } - else - { - Op->Common.Parent->Common.Value.Arg = Op->Common.Next; - } - } - - /* Search the parent list */ - - else while (Prev) - { - /* Traverse all siblings in the parent's argument list */ - - Next = Prev->Common.Next; - if (Next == Op) - { - if (ReplacementOp) - { - ReplacementOp->Common.Parent = Op->Common.Parent; - ReplacementOp->Common.Value.Arg = NULL; - ReplacementOp->Common.Node = Op->Common.Node; - Prev->Common.Next = ReplacementOp; - ReplacementOp->Common.Next = Op->Common.Next; - Next = NULL; - } - else - { - Prev->Common.Next = Op->Common.Next; - Next = NULL; - } - } - Prev = Next; - } - } - - -Cleanup: - - /* Now we can actually delete the subtree rooted at Op */ - - AcpiPsDeleteParseTree (Op); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiPsNextParseState - * - * PARAMETERS: WalkState - Current state - * Op - Current parse op - * CallbackStatus - Status from previous operation - * - * RETURN: Status - * - * DESCRIPTION: Update the parser state based upon the return exception from - * the parser callback. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiPsNextParseState ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op, - ACPI_STATUS CallbackStatus) -{ - ACPI_PARSE_STATE *ParserState = &WalkState->ParserState; - ACPI_STATUS Status = AE_CTRL_PENDING; - - - ACPI_FUNCTION_TRACE_PTR (PsNextParseState, Op); - - - switch (CallbackStatus) - { - case AE_CTRL_TERMINATE: - /* - * A control method was terminated via a RETURN statement. - * The walk of this method is complete. - */ - ParserState->Aml = ParserState->AmlEnd; - Status = AE_CTRL_TERMINATE; - break; - - case AE_CTRL_BREAK: - - ParserState->Aml = WalkState->AmlLastWhile; - WalkState->ControlState->Common.Value = FALSE; - Status = AE_CTRL_BREAK; - break; - - case AE_CTRL_CONTINUE: - - ParserState->Aml = WalkState->AmlLastWhile; - Status = AE_CTRL_CONTINUE; - break; - - case AE_CTRL_PENDING: - - ParserState->Aml = WalkState->AmlLastWhile; - break; - -#if 0 - case AE_CTRL_SKIP: - - ParserState->Aml = ParserState->Scope->ParseScope.PkgEnd; - Status = AE_OK; - break; -#endif - - case AE_CTRL_TRUE: - /* - * Predicate of an IF was true, and we are at the matching ELSE. - * Just close out this package - */ - ParserState->Aml = AcpiPsGetNextPackageEnd (ParserState); - Status = AE_CTRL_PENDING; - break; - - case AE_CTRL_FALSE: - /* - * Either an IF/WHILE Predicate was false or we encountered a BREAK - * opcode. In both cases, we do not execute the rest of the - * package; We simply close out the parent (finishing the walk of - * this branch of the tree) and continue execution at the parent - * level. - */ - ParserState->Aml = ParserState->Scope->ParseScope.PkgEnd; - - /* In the case of a BREAK, just force a predicate (if any) to FALSE */ - - WalkState->ControlState->Common.Value = FALSE; - Status = AE_CTRL_END; - break; - - case AE_CTRL_TRANSFER: - - /* A method call (invocation) -- transfer control */ - - Status = AE_CTRL_TRANSFER; - WalkState->PrevOp = Op; - WalkState->MethodCallOp = Op; - WalkState->MethodCallNode = (Op->Common.Value.Arg)->Common.Node; - - /* Will return value (if any) be used by the caller? */ - - WalkState->ReturnUsed = AcpiDsIsResultUsed (Op, WalkState); - break; - - default: - - Status = CallbackStatus; - if (ACPI_CNTL_EXCEPTION (CallbackStatus)) - { - Status = AE_OK; - } - break; - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiPsParseAml - * - * PARAMETERS: WalkState - Current state - * - * - * RETURN: Status - * - * DESCRIPTION: Parse raw AML and return a tree of ops - * - ******************************************************************************/ - -ACPI_STATUS -AcpiPsParseAml ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status; - ACPI_THREAD_STATE *Thread; - ACPI_THREAD_STATE *PrevWalkList = AcpiGbl_CurrentWalkList; - ACPI_WALK_STATE *PreviousWalkState; - - - ACPI_FUNCTION_TRACE (PsParseAml); - - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "Entered with WalkState=%p Aml=%p size=%X\n", - WalkState, WalkState->ParserState.Aml, - WalkState->ParserState.AmlSize)); - - if (!WalkState->ParserState.Aml) - { - return_ACPI_STATUS (AE_BAD_ADDRESS); - } - - /* Create and initialize a new thread state */ - - Thread = AcpiUtCreateThreadState (); - if (!Thread) - { - if (WalkState->MethodDesc) - { - /* Executing a control method - additional cleanup */ - - AcpiDsTerminateControlMethod (WalkState->MethodDesc, WalkState); - } - - AcpiDsDeleteWalkState (WalkState); - return_ACPI_STATUS (AE_NO_MEMORY); - } - - WalkState->Thread = Thread; - - /* - * If executing a method, the starting SyncLevel is this method's - * SyncLevel - */ - if (WalkState->MethodDesc) - { - WalkState->Thread->CurrentSyncLevel = - WalkState->MethodDesc->Method.SyncLevel; - } - - AcpiDsPushWalkState (WalkState, Thread); - - /* - * This global allows the AML debugger to get a handle to the currently - * executing control method. - */ - AcpiGbl_CurrentWalkList = Thread; - - /* - * Execute the walk loop as long as there is a valid Walk State. This - * handles nested control method invocations without recursion. - */ - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "State=%p\n", WalkState)); - - Status = AE_OK; - while (WalkState) - { - if (ACPI_SUCCESS (Status)) - { - /* - * The ParseLoop executes AML until the method terminates - * or calls another method. - */ - Status = AcpiPsParseLoop (WalkState); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "Completed one call to walk loop, %s State=%p\n", - AcpiFormatException (Status), WalkState)); - - if (WalkState->MethodPathname && WalkState->MethodIsNested) - { - /* Optional object evaluation log */ - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EVALUATION, "%-26s: %*s%s\n", - " Exit nested method", - (WalkState->MethodNestingDepth + 1) * 3, " ", - &WalkState->MethodPathname[1])); - - ACPI_FREE (WalkState->MethodPathname); - WalkState->MethodIsNested = FALSE; - } - if (Status == AE_CTRL_TRANSFER) - { - /* - * A method call was detected. - * Transfer control to the called control method - */ - Status = AcpiDsCallControlMethod (Thread, WalkState, NULL); - if (ACPI_FAILURE (Status)) - { - Status = AcpiDsMethodError (Status, WalkState); - } - - /* - * If the transfer to the new method method call worked, - * a new walk state was created -- get it - */ - WalkState = AcpiDsGetCurrentWalkState (Thread); - continue; - } - else if (Status == AE_CTRL_TERMINATE) - { - Status = AE_OK; - } - else if ((Status != AE_OK) && (WalkState->MethodDesc)) - { - /* Either the method parse or actual execution failed */ - - AcpiExExitInterpreter (); - if (Status == AE_ABORT_METHOD) - { - AcpiNsPrintNodePathname ( - WalkState->MethodNode, "Aborting method"); - AcpiOsPrintf ("\n"); - } - else - { - ACPI_ERROR_METHOD ("Aborting method", - WalkState->MethodNode, NULL, Status); - } - AcpiExEnterInterpreter (); - - /* Check for possible multi-thread reentrancy problem */ - - if ((Status == AE_ALREADY_EXISTS) && - (!(WalkState->MethodDesc->Method.InfoFlags & - ACPI_METHOD_SERIALIZED))) - { - /* - * Method is not serialized and tried to create an object - * twice. The probable cause is that the method cannot - * handle reentrancy. Mark as "pending serialized" now, and - * then mark "serialized" when the last thread exits. - */ - WalkState->MethodDesc->Method.InfoFlags |= - ACPI_METHOD_SERIALIZED_PENDING; - } - } - - /* We are done with this walk, move on to the parent if any */ - - WalkState = AcpiDsPopWalkState (Thread); - - /* Reset the current scope to the beginning of scope stack */ - - AcpiDsScopeStackClear (WalkState); - - /* - * If we just returned from the execution of a control method or if we - * encountered an error during the method parse phase, there's lots of - * cleanup to do - */ - if (((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) == - ACPI_PARSE_EXECUTE && - !(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL)) || - (ACPI_FAILURE (Status))) - { - AcpiDsTerminateControlMethod (WalkState->MethodDesc, WalkState); - } - - /* Delete this walk state and all linked control states */ - - AcpiPsCleanupScope (&WalkState->ParserState); - PreviousWalkState = WalkState; - - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "ReturnValue=%p, ImplicitValue=%p State=%p\n", - WalkState->ReturnDesc, WalkState->ImplicitReturnObj, WalkState)); - - /* Check if we have restarted a preempted walk */ - - WalkState = AcpiDsGetCurrentWalkState (Thread); - if (WalkState) - { - if (ACPI_SUCCESS (Status)) - { - /* - * There is another walk state, restart it. - * If the method return value is not used by the parent, - * The object is deleted - */ - if (!PreviousWalkState->ReturnDesc) - { - /* - * In slack mode execution, if there is no return value - * we should implicitly return zero (0) as a default value. - */ - if (AcpiGbl_EnableInterpreterSlack && - !PreviousWalkState->ImplicitReturnObj) - { - PreviousWalkState->ImplicitReturnObj = - AcpiUtCreateIntegerObject ((UINT64) 0); - if (!PreviousWalkState->ImplicitReturnObj) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - } - - /* Restart the calling control method */ - - Status = AcpiDsRestartControlMethod (WalkState, - PreviousWalkState->ImplicitReturnObj); - } - else - { - /* - * We have a valid return value, delete any implicit - * return value. - */ - AcpiDsClearImplicitReturn (PreviousWalkState); - - Status = AcpiDsRestartControlMethod (WalkState, - PreviousWalkState->ReturnDesc); - } - if (ACPI_SUCCESS (Status)) - { - WalkState->WalkType |= ACPI_WALK_METHOD_RESTART; - } - } - else - { - /* On error, delete any return object or implicit return */ - - AcpiUtRemoveReference (PreviousWalkState->ReturnDesc); - AcpiDsClearImplicitReturn (PreviousWalkState); - } - } - - /* - * Just completed a 1st-level method, save the final internal return - * value (if any) - */ - else if (PreviousWalkState->CallerReturnDesc) - { - if (PreviousWalkState->ImplicitReturnObj) - { - *(PreviousWalkState->CallerReturnDesc) = - PreviousWalkState->ImplicitReturnObj; - } - else - { - /* NULL if no return value */ - - *(PreviousWalkState->CallerReturnDesc) = - PreviousWalkState->ReturnDesc; - } - } - else - { - if (PreviousWalkState->ReturnDesc) - { - /* Caller doesn't want it, must delete it */ - - AcpiUtRemoveReference (PreviousWalkState->ReturnDesc); - } - if (PreviousWalkState->ImplicitReturnObj) - { - /* Caller doesn't want it, must delete it */ - - AcpiUtRemoveReference (PreviousWalkState->ImplicitReturnObj); - } - } - - AcpiDsDeleteWalkState (PreviousWalkState); - } - - /* Normal exit */ - - AcpiExReleaseAllMutexes (Thread); - AcpiUtDeleteGenericState (ACPI_CAST_PTR (ACPI_GENERIC_STATE, Thread)); - AcpiGbl_CurrentWalkList = PrevWalkList; - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/psscope.c b/drivers/acpica/psscope.c deleted file mode 100644 index 5a10f8c..0000000 --- a/drivers/acpica/psscope.c +++ /dev/null @@ -1,408 +0,0 @@ -/****************************************************************************** - * - * Module Name: psscope - Parser scope stack management routines - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acparser.h" - -#define _COMPONENT ACPI_PARSER - ACPI_MODULE_NAME ("psscope") - - -/******************************************************************************* - * - * FUNCTION: AcpiPsGetParentScope - * - * PARAMETERS: ParserState - Current parser state object - * - * RETURN: Pointer to an Op object - * - * DESCRIPTION: Get parent of current op being parsed - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -AcpiPsGetParentScope ( - ACPI_PARSE_STATE *ParserState) -{ - - return (ParserState->Scope->ParseScope.Op); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiPsHasCompletedScope - * - * PARAMETERS: ParserState - Current parser state object - * - * RETURN: Boolean, TRUE = scope completed. - * - * DESCRIPTION: Is parsing of current argument complete? Determined by - * 1) AML pointer is at or beyond the end of the scope - * 2) The scope argument count has reached zero. - * - ******************************************************************************/ - -BOOLEAN -AcpiPsHasCompletedScope ( - ACPI_PARSE_STATE *ParserState) -{ - - return ((BOOLEAN) - ((ParserState->Aml >= ParserState->Scope->ParseScope.ArgEnd || - !ParserState->Scope->ParseScope.ArgCount))); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiPsInitScope - * - * PARAMETERS: ParserState - Current parser state object - * Root - the Root Node of this new scope - * - * RETURN: Status - * - * DESCRIPTION: Allocate and init a new scope object - * - ******************************************************************************/ - -ACPI_STATUS -AcpiPsInitScope ( - ACPI_PARSE_STATE *ParserState, - ACPI_PARSE_OBJECT *RootOp) -{ - ACPI_GENERIC_STATE *Scope; - - - ACPI_FUNCTION_TRACE_PTR (PsInitScope, RootOp); - - - Scope = AcpiUtCreateGenericState (); - if (!Scope) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - Scope->Common.DescriptorType = ACPI_DESC_TYPE_STATE_RPSCOPE; - Scope->ParseScope.Op = RootOp; - Scope->ParseScope.ArgCount = ACPI_VAR_ARGS; - Scope->ParseScope.ArgEnd = ParserState->AmlEnd; - Scope->ParseScope.PkgEnd = ParserState->AmlEnd; - - ParserState->Scope = Scope; - ParserState->StartOp = RootOp; - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiPsPushScope - * - * PARAMETERS: ParserState - Current parser state object - * Op - Current op to be pushed - * RemainingArgs - List of args remaining - * ArgCount - Fixed or variable number of args - * - * RETURN: Status - * - * DESCRIPTION: Push current op to begin parsing its argument - * - ******************************************************************************/ - -ACPI_STATUS -AcpiPsPushScope ( - ACPI_PARSE_STATE *ParserState, - ACPI_PARSE_OBJECT *Op, - UINT32 RemainingArgs, - UINT32 ArgCount) -{ - ACPI_GENERIC_STATE *Scope; - - - ACPI_FUNCTION_TRACE_PTR (PsPushScope, Op); - - - Scope = AcpiUtCreateGenericState (); - if (!Scope) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - Scope->Common.DescriptorType = ACPI_DESC_TYPE_STATE_PSCOPE; - Scope->ParseScope.Op = Op; - Scope->ParseScope.ArgList = RemainingArgs; - Scope->ParseScope.ArgCount = ArgCount; - Scope->ParseScope.PkgEnd = ParserState->PkgEnd; - - /* Push onto scope stack */ - - AcpiUtPushGenericState (&ParserState->Scope, Scope); - - if (ArgCount == ACPI_VAR_ARGS) - { - /* Multiple arguments */ - - Scope->ParseScope.ArgEnd = ParserState->PkgEnd; - } - else - { - /* Single argument */ - - Scope->ParseScope.ArgEnd = ACPI_TO_POINTER (ACPI_MAX_PTR); - } - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiPsPopScope - * - * PARAMETERS: ParserState - Current parser state object - * Op - Where the popped op is returned - * ArgList - Where the popped "next argument" is - * returned - * ArgCount - Count of objects in ArgList - * - * RETURN: Status - * - * DESCRIPTION: Return to parsing a previous op - * - ******************************************************************************/ - -void -AcpiPsPopScope ( - ACPI_PARSE_STATE *ParserState, - ACPI_PARSE_OBJECT **Op, - UINT32 *ArgList, - UINT32 *ArgCount) -{ - ACPI_GENERIC_STATE *Scope = ParserState->Scope; - - - ACPI_FUNCTION_TRACE (PsPopScope); - - - /* Only pop the scope if there is in fact a next scope */ - - if (Scope->Common.Next) - { - Scope = AcpiUtPopGenericState (&ParserState->Scope); - - /* Return to parsing previous op */ - - *Op = Scope->ParseScope.Op; - *ArgList = Scope->ParseScope.ArgList; - *ArgCount = Scope->ParseScope.ArgCount; - ParserState->PkgEnd = Scope->ParseScope.PkgEnd; - - /* All done with this scope state structure */ - - AcpiUtDeleteGenericState (Scope); - } - else - { - /* Empty parse stack, prepare to fetch next opcode */ - - *Op = NULL; - *ArgList = 0; - *ArgCount = 0; - } - - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "Popped Op %p Args %X\n", *Op, *ArgCount)); - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiPsCleanupScope - * - * PARAMETERS: ParserState - Current parser state object - * - * RETURN: None - * - * DESCRIPTION: Destroy available list, remaining stack levels, and return - * root scope - * - ******************************************************************************/ - -void -AcpiPsCleanupScope ( - ACPI_PARSE_STATE *ParserState) -{ - ACPI_GENERIC_STATE *Scope; - - - ACPI_FUNCTION_TRACE_PTR (PsCleanupScope, ParserState); - - - if (!ParserState) - { - return_VOID; - } - - /* Delete anything on the scope stack */ - - while (ParserState->Scope) - { - Scope = AcpiUtPopGenericState (&ParserState->Scope); - AcpiUtDeleteGenericState (Scope); - } - - return_VOID; -} diff --git a/drivers/acpica/pstree.c b/drivers/acpica/pstree.c deleted file mode 100644 index 71485e7..0000000 --- a/drivers/acpica/pstree.c +++ /dev/null @@ -1,471 +0,0 @@ -/****************************************************************************** - * - * Module Name: pstree - Parser op tree manipulation/traversal/search - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acparser.h" -#include "amlcode.h" -#include "acconvert.h" - -#define _COMPONENT ACPI_PARSER - ACPI_MODULE_NAME ("pstree") - -/* Local prototypes */ - -#ifdef ACPI_OBSOLETE_FUNCTIONS -ACPI_PARSE_OBJECT * -AcpiPsGetChild ( - ACPI_PARSE_OBJECT *op); -#endif - - -/******************************************************************************* - * - * FUNCTION: AcpiPsGetArg - * - * PARAMETERS: Op - Get an argument for this op - * Argn - Nth argument to get - * - * RETURN: The argument (as an Op object). NULL if argument does not exist - * - * DESCRIPTION: Get the specified op's argument. - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -AcpiPsGetArg ( - ACPI_PARSE_OBJECT *Op, - UINT32 Argn) -{ - ACPI_PARSE_OBJECT *Arg = NULL; - const ACPI_OPCODE_INFO *OpInfo; - - - ACPI_FUNCTION_ENTRY (); - -/* - if (Op->Common.AmlOpcode == AML_INT_CONNECTION_OP) - { - return (Op->Common.Value.Arg); - } -*/ - /* Get the info structure for this opcode */ - - OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - if (OpInfo->Class == AML_CLASS_UNKNOWN) - { - /* Invalid opcode or ASCII character */ - - return (NULL); - } - - /* Check if this opcode requires argument sub-objects */ - - if (!(OpInfo->Flags & AML_HAS_ARGS)) - { - /* Has no linked argument objects */ - - return (NULL); - } - - /* Get the requested argument object */ - - Arg = Op->Common.Value.Arg; - while (Arg && Argn) - { - Argn--; - Arg = Arg->Common.Next; - } - - return (Arg); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiPsAppendArg - * - * PARAMETERS: Op - Append an argument to this Op. - * Arg - Argument Op to append - * - * RETURN: None. - * - * DESCRIPTION: Append an argument to an op's argument list (a NULL arg is OK) - * - ******************************************************************************/ - -void -AcpiPsAppendArg ( - ACPI_PARSE_OBJECT *Op, - ACPI_PARSE_OBJECT *Arg) -{ - ACPI_PARSE_OBJECT *PrevArg; - const ACPI_OPCODE_INFO *OpInfo; - - - ACPI_FUNCTION_TRACE (PsAppendArg); - - - if (!Op) - { - return_VOID; - } - - /* Get the info structure for this opcode */ - - OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - if (OpInfo->Class == AML_CLASS_UNKNOWN) - { - /* Invalid opcode */ - - ACPI_ERROR ((AE_INFO, "Invalid AML Opcode: 0x%2.2X", - Op->Common.AmlOpcode)); - return_VOID; - } - - /* Check if this opcode requires argument sub-objects */ - - if (!(OpInfo->Flags & AML_HAS_ARGS)) - { - /* Has no linked argument objects */ - - return_VOID; - } - - /* Append the argument to the linked argument list */ - - if (Op->Common.Value.Arg) - { - /* Append to existing argument list */ - - PrevArg = Op->Common.Value.Arg; - while (PrevArg->Common.Next) - { - PrevArg = PrevArg->Common.Next; - } - PrevArg->Common.Next = Arg; - } - else - { - /* No argument list, this will be the first argument */ - - Op->Common.Value.Arg = Arg; - } - - /* Set the parent in this arg and any args linked after it */ - - while (Arg) - { - Arg->Common.Parent = Op; - Arg = Arg->Common.Next; - - Op->Common.ArgListLength++; - } - - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiPsGetDepthNext - * - * PARAMETERS: Origin - Root of subtree to search - * Op - Last (previous) Op that was found - * - * RETURN: Next Op found in the search. - * - * DESCRIPTION: Get next op in tree (walking the tree in depth-first order) - * Return NULL when reaching "origin" or when walking up from root - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -AcpiPsGetDepthNext ( - ACPI_PARSE_OBJECT *Origin, - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Next = NULL; - ACPI_PARSE_OBJECT *Parent; - ACPI_PARSE_OBJECT *Arg; - - - ACPI_FUNCTION_ENTRY (); - - - if (!Op) - { - return (NULL); - } - - /* Look for an argument or child */ - - Next = AcpiPsGetArg (Op, 0); - if (Next) - { - ASL_CV_LABEL_FILENODE (Next); - return (Next); - } - - /* Look for a sibling */ - - Next = Op->Common.Next; - if (Next) - { - ASL_CV_LABEL_FILENODE (Next); - return (Next); - } - - /* Look for a sibling of parent */ - - Parent = Op->Common.Parent; - - while (Parent) - { - Arg = AcpiPsGetArg (Parent, 0); - while (Arg && (Arg != Origin) && (Arg != Op)) - { - - ASL_CV_LABEL_FILENODE (Arg); - Arg = Arg->Common.Next; - } - - if (Arg == Origin) - { - /* Reached parent of origin, end search */ - - return (NULL); - } - - if (Parent->Common.Next) - { - /* Found sibling of parent */ - - ASL_CV_LABEL_FILENODE (Parent->Common.Next); - return (Parent->Common.Next); - } - - Op = Parent; - Parent = Parent->Common.Parent; - } - - ASL_CV_LABEL_FILENODE (Next); - return (Next); -} - - -#ifdef ACPI_OBSOLETE_FUNCTIONS -/******************************************************************************* - * - * FUNCTION: AcpiPsGetChild - * - * PARAMETERS: Op - Get the child of this Op - * - * RETURN: Child Op, Null if none is found. - * - * DESCRIPTION: Get op's children or NULL if none - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -AcpiPsGetChild ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Child = NULL; - - - ACPI_FUNCTION_ENTRY (); - - - switch (Op->Common.AmlOpcode) - { - case AML_SCOPE_OP: - case AML_ELSE_OP: - case AML_DEVICE_OP: - case AML_THERMAL_ZONE_OP: - case AML_INT_METHODCALL_OP: - - Child = AcpiPsGetArg (Op, 0); - break; - - case AML_BUFFER_OP: - case AML_PACKAGE_OP: - case AML_VARIABLE_PACKAGE_OP: - case AML_METHOD_OP: - case AML_IF_OP: - case AML_WHILE_OP: - case AML_FIELD_OP: - - Child = AcpiPsGetArg (Op, 1); - break; - - case AML_POWER_RESOURCE_OP: - case AML_INDEX_FIELD_OP: - - Child = AcpiPsGetArg (Op, 2); - break; - - case AML_PROCESSOR_OP: - case AML_BANK_FIELD_OP: - - Child = AcpiPsGetArg (Op, 3); - break; - - default: - - /* All others have no children */ - - break; - } - - return (Child); -} -#endif diff --git a/drivers/acpica/psutils.c b/drivers/acpica/psutils.c deleted file mode 100644 index b040ef0..0000000 --- a/drivers/acpica/psutils.c +++ /dev/null @@ -1,402 +0,0 @@ -/****************************************************************************** - * - * Module Name: psutils - Parser miscellaneous utilities (Parser only) - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acparser.h" -#include "amlcode.h" -#include "acconvert.h" - -#define _COMPONENT ACPI_PARSER - ACPI_MODULE_NAME ("psutils") - - -/******************************************************************************* - * - * FUNCTION: AcpiPsCreateScopeOp - * - * PARAMETERS: None - * - * RETURN: A new Scope object, null on failure - * - * DESCRIPTION: Create a Scope and associated namepath op with the root name - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -AcpiPsCreateScopeOp ( - UINT8 *Aml) -{ - ACPI_PARSE_OBJECT *ScopeOp; - - - ScopeOp = AcpiPsAllocOp (AML_SCOPE_OP, Aml); - if (!ScopeOp) - { - return (NULL); - } - - ScopeOp->Named.Name = ACPI_ROOT_NAME; - return (ScopeOp); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiPsInitOp - * - * PARAMETERS: Op - A newly allocated Op object - * Opcode - Opcode to store in the Op - * - * RETURN: None - * - * DESCRIPTION: Initialize a parse (Op) object - * - ******************************************************************************/ - -void -AcpiPsInitOp ( - ACPI_PARSE_OBJECT *Op, - UINT16 Opcode) -{ - ACPI_FUNCTION_ENTRY (); - - - Op->Common.DescriptorType = ACPI_DESC_TYPE_PARSER; - Op->Common.AmlOpcode = Opcode; - - ACPI_DISASM_ONLY_MEMBERS (AcpiUtSafeStrncpy (Op->Common.AmlOpName, - (AcpiPsGetOpcodeInfo (Opcode))->Name, - sizeof (Op->Common.AmlOpName))); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiPsAllocOp - * - * PARAMETERS: Opcode - Opcode that will be stored in the new Op - * Aml - Address of the opcode - * - * RETURN: Pointer to the new Op, null on failure - * - * DESCRIPTION: Allocate an acpi_op, choose op type (and thus size) based on - * opcode. A cache of opcodes is available for the pure - * GENERIC_OP, since this is by far the most commonly used. - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT* -AcpiPsAllocOp ( - UINT16 Opcode, - UINT8 *Aml) -{ - ACPI_PARSE_OBJECT *Op; - const ACPI_OPCODE_INFO *OpInfo; - UINT8 Flags = ACPI_PARSEOP_GENERIC; - - - ACPI_FUNCTION_ENTRY (); - - - OpInfo = AcpiPsGetOpcodeInfo (Opcode); - - /* Determine type of ParseOp required */ - - if (OpInfo->Flags & AML_DEFER) - { - Flags = ACPI_PARSEOP_DEFERRED; - } - else if (OpInfo->Flags & AML_NAMED) - { - Flags = ACPI_PARSEOP_NAMED_OBJECT; - } - else if (Opcode == AML_INT_BYTELIST_OP) - { - Flags = ACPI_PARSEOP_BYTELIST; - } - - /* Allocate the minimum required size object */ - - if (Flags == ACPI_PARSEOP_GENERIC) - { - /* The generic op (default) is by far the most common (16 to 1) */ - - Op = AcpiOsAcquireObject (AcpiGbl_PsNodeCache); - } - else - { - /* Extended parseop */ - - Op = AcpiOsAcquireObject (AcpiGbl_PsNodeExtCache); - } - - /* Initialize the Op */ - - if (Op) - { - AcpiPsInitOp (Op, Opcode); - Op->Common.Aml = Aml; - Op->Common.Flags = Flags; - ASL_CV_CLEAR_OP_COMMENTS(Op); - - if (Opcode == AML_SCOPE_OP) - { - AcpiGbl_CurrentScope = Op; - } - - if (AcpiGbl_CaptureComments) - { - ASL_CV_TRANSFER_COMMENTS (Op); - } - } - - return (Op); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiPsFreeOp - * - * PARAMETERS: Op - Op to be freed - * - * RETURN: None. - * - * DESCRIPTION: Free an Op object. Either put it on the GENERIC_OP cache list - * or actually free it. - * - ******************************************************************************/ - -void -AcpiPsFreeOp ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_FUNCTION_NAME (PsFreeOp); - - - ASL_CV_CLEAR_OP_COMMENTS(Op); - if (Op->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP) - { - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, - "Free retval op: %p\n", Op)); - } - - if (Op->Common.Flags & ACPI_PARSEOP_GENERIC) - { - (void) AcpiOsReleaseObject (AcpiGbl_PsNodeCache, Op); - } - else - { - (void) AcpiOsReleaseObject (AcpiGbl_PsNodeExtCache, Op); - } -} - - -/******************************************************************************* - * - * FUNCTION: Utility functions - * - * DESCRIPTION: Low level character and object functions - * - ******************************************************************************/ - - -/* - * Is "c" a namestring lead character? - */ -BOOLEAN -AcpiPsIsLeadingChar ( - UINT32 c) -{ - return ((BOOLEAN) (c == '_' || (c >= 'A' && c <= 'Z'))); -} - - -/* - * Get op's name (4-byte name segment) or 0 if unnamed - */ -UINT32 -AcpiPsGetName ( - ACPI_PARSE_OBJECT *Op) -{ - - /* The "generic" object has no name associated with it */ - - if (Op->Common.Flags & ACPI_PARSEOP_GENERIC) - { - return (0); - } - - /* Only the "Extended" parse objects have a name */ - - return (Op->Named.Name); -} - - -/* - * Set op's name - */ -void -AcpiPsSetName ( - ACPI_PARSE_OBJECT *Op, - UINT32 name) -{ - - /* The "generic" object has no name associated with it */ - - if (Op->Common.Flags & ACPI_PARSEOP_GENERIC) - { - return; - } - - Op->Named.Name = name; -} diff --git a/drivers/acpica/pswalk.c b/drivers/acpica/pswalk.c deleted file mode 100644 index 093da84..0000000 --- a/drivers/acpica/pswalk.c +++ /dev/null @@ -1,254 +0,0 @@ -/****************************************************************************** - * - * Module Name: pswalk - Parser routines to walk parsed op tree(s) - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acparser.h" - -#define _COMPONENT ACPI_PARSER - ACPI_MODULE_NAME ("pswalk") - - -/******************************************************************************* - * - * FUNCTION: AcpiPsDeleteParseTree - * - * PARAMETERS: SubtreeRoot - Root of tree (or subtree) to delete - * - * RETURN: None - * - * DESCRIPTION: Delete a portion of or an entire parse tree. - * - ******************************************************************************/ - -#include "amlcode.h" - -void -AcpiPsDeleteParseTree ( - ACPI_PARSE_OBJECT *SubtreeRoot) -{ - ACPI_PARSE_OBJECT *Op = SubtreeRoot; - ACPI_PARSE_OBJECT *Next = NULL; - ACPI_PARSE_OBJECT *Parent = NULL; - UINT32 Level = 0; - - - ACPI_FUNCTION_TRACE_PTR (PsDeleteParseTree, SubtreeRoot); - - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE_TREES, - " root %p\n", SubtreeRoot)); - - /* Visit all nodes in the subtree */ - - while (Op) - { - if (Op != Parent) - { - /* This is the descending case */ - - if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_PARSE_TREES, _COMPONENT)) - { - /* This debug option will print the entire parse tree */ - - AcpiOsPrintf (" %*.s%s %p", (Level * 4), " ", - AcpiPsGetOpcodeName (Op->Common.AmlOpcode), Op); - - if (Op->Named.AmlOpcode == AML_INT_NAMEPATH_OP) - { - AcpiOsPrintf (" %4.4s", Op->Common.Value.String); - } - if (Op->Named.AmlOpcode == AML_STRING_OP) - { - AcpiOsPrintf (" %s", Op->Common.Value.String); - } - AcpiOsPrintf ("\n"); - } - - /* Look for an argument or child of the current op */ - - Next = AcpiPsGetArg (Op, 0); - if (Next) - { - /* Still going downward in tree (Op is not completed yet) */ - - Op = Next; - Level++; - continue; - } - } - - /* No more children, this Op is complete. */ - - Next = Op->Common.Next; - Parent = Op->Common.Parent; - - AcpiPsFreeOp (Op); - - /* If we are back to the starting point, the walk is complete. */ - - if (Op == SubtreeRoot) - { - return_VOID; - } - - if (Next) - { - Op = Next; - } - else - { - Level--; - Op = Parent; - } - } - - return_VOID; -} diff --git a/drivers/acpica/psxface.c b/drivers/acpica/psxface.c deleted file mode 100644 index 818be3a..0000000 --- a/drivers/acpica/psxface.c +++ /dev/null @@ -1,518 +0,0 @@ -/****************************************************************************** - * - * Module Name: psxface - Parser external interfaces - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acparser.h" -#include "acdispat.h" -#include "acinterp.h" -#include "actables.h" -#include "acnamesp.h" - - -#define _COMPONENT ACPI_PARSER - ACPI_MODULE_NAME ("psxface") - -/* Local Prototypes */ - -static void -AcpiPsUpdateParameterList ( - ACPI_EVALUATE_INFO *Info, - UINT16 Action); - - -/******************************************************************************* - * - * FUNCTION: AcpiDebugTrace - * - * PARAMETERS: MethodName - Valid ACPI name string - * DebugLevel - Optional level mask. 0 to use default - * DebugLayer - Optional layer mask. 0 to use default - * Flags - bit 1: one shot(1) or persistent(0) - * - * RETURN: Status - * - * DESCRIPTION: External interface to enable debug tracing during control - * method execution - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDebugTrace ( - const char *Name, - UINT32 DebugLevel, - UINT32 DebugLayer, - UINT32 Flags) -{ - ACPI_STATUS Status; - - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - AcpiGbl_TraceMethodName = Name; - AcpiGbl_TraceFlags = Flags; - AcpiGbl_TraceDbgLevel = DebugLevel; - AcpiGbl_TraceDbgLayer = DebugLayer; - Status = AE_OK; - - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiPsExecuteMethod - * - * PARAMETERS: Info - Method info block, contains: - * Node - Method Node to execute - * ObjDesc - Method object - * Parameters - List of parameters to pass to the method, - * terminated by NULL. Params itself may be - * NULL if no parameters are being passed. - * ReturnObject - Where to put method's return value (if - * any). If NULL, no value is returned. - * ParameterType - Type of Parameter list - * ReturnObject - Where to put method's return value (if - * any). If NULL, no value is returned. - * PassNumber - Parse or execute pass - * - * RETURN: Status - * - * DESCRIPTION: Execute a control method - * - ******************************************************************************/ - -ACPI_STATUS -AcpiPsExecuteMethod ( - ACPI_EVALUATE_INFO *Info) -{ - ACPI_STATUS Status; - ACPI_PARSE_OBJECT *Op; - ACPI_WALK_STATE *WalkState; - - - ACPI_FUNCTION_TRACE (PsExecuteMethod); - - - /* Quick validation of DSDT header */ - - AcpiTbCheckDsdtHeader (); - - /* Validate the Info and method Node */ - - if (!Info || !Info->Node) - { - return_ACPI_STATUS (AE_NULL_ENTRY); - } - - /* Init for new method, wait on concurrency semaphore */ - - Status = AcpiDsBeginMethodExecution (Info->Node, Info->ObjDesc, NULL); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* - * The caller "owns" the parameters, so give each one an extra reference - */ - AcpiPsUpdateParameterList (Info, REF_INCREMENT); - - /* - * Execute the method. Performs parse simultaneously - */ - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "**** Begin Method Parse/Execute [%4.4s] **** Node=%p Obj=%p\n", - Info->Node->Name.Ascii, Info->Node, Info->ObjDesc)); - - /* Create and init a Root Node */ - - Op = AcpiPsCreateScopeOp (Info->ObjDesc->Method.AmlStart); - if (!Op) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - /* Create and initialize a new walk state */ - - Info->PassNumber = ACPI_IMODE_EXECUTE; - WalkState = AcpiDsCreateWalkState ( - Info->ObjDesc->Method.OwnerId, NULL, NULL, NULL); - if (!WalkState) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - Status = AcpiDsInitAmlWalk (WalkState, Op, Info->Node, - Info->ObjDesc->Method.AmlStart, - Info->ObjDesc->Method.AmlLength, Info, Info->PassNumber); - if (ACPI_FAILURE (Status)) - { - AcpiDsDeleteWalkState (WalkState); - goto Cleanup; - } - - WalkState->MethodPathname = Info->FullPathname; - WalkState->MethodIsNested = FALSE; - - if (Info->ObjDesc->Method.InfoFlags & ACPI_METHOD_MODULE_LEVEL) - { - WalkState->ParseFlags |= ACPI_PARSE_MODULE_LEVEL; - } - - /* Invoke an internal method if necessary */ - - if (Info->ObjDesc->Method.InfoFlags & ACPI_METHOD_INTERNAL_ONLY) - { - Status = Info->ObjDesc->Method.Dispatch.Implementation (WalkState); - Info->ReturnObject = WalkState->ReturnDesc; - - /* Cleanup states */ - - AcpiDsScopeStackClear (WalkState); - AcpiPsCleanupScope (&WalkState->ParserState); - AcpiDsTerminateControlMethod (WalkState->MethodDesc, WalkState); - AcpiDsDeleteWalkState (WalkState); - goto Cleanup; - } - - /* - * Start method evaluation with an implicit return of zero. - * This is done for Windows compatibility. - */ - if (AcpiGbl_EnableInterpreterSlack) - { - WalkState->ImplicitReturnObj = - AcpiUtCreateIntegerObject ((UINT64) 0); - if (!WalkState->ImplicitReturnObj) - { - Status = AE_NO_MEMORY; - AcpiDsDeleteWalkState (WalkState); - goto Cleanup; - } - } - - /* Parse the AML */ - - Status = AcpiPsParseAml (WalkState); - - /* WalkState was deleted by ParseAml */ - -Cleanup: - AcpiPsDeleteParseTree (Op); - - /* Take away the extra reference that we gave the parameters above */ - - AcpiPsUpdateParameterList (Info, REF_DECREMENT); - - /* Exit now if error above */ - - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* - * If the method has returned an object, signal this to the caller with - * a control exception code - */ - if (Info->ReturnObject) - { - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Method returned ObjDesc=%p\n", - Info->ReturnObject)); - ACPI_DUMP_STACK_ENTRY (Info->ReturnObject); - - Status = AE_CTRL_RETURN_VALUE; - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiPsExecuteTable - * - * PARAMETERS: Info - Method info block, contains: - * Node - Node to where the is entered into the - * namespace - * ObjDesc - Pseudo method object describing the AML - * code of the entire table - * PassNumber - Parse or execute pass - * - * RETURN: Status - * - * DESCRIPTION: Execute a table - * - ******************************************************************************/ - -ACPI_STATUS -AcpiPsExecuteTable ( - ACPI_EVALUATE_INFO *Info) -{ - ACPI_STATUS Status; - ACPI_PARSE_OBJECT *Op = NULL; - ACPI_WALK_STATE *WalkState = NULL; - - - ACPI_FUNCTION_TRACE (PsExecuteTable); - - - /* Create and init a Root Node */ - - Op = AcpiPsCreateScopeOp (Info->ObjDesc->Method.AmlStart); - if (!Op) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - /* Create and initialize a new walk state */ - - WalkState = AcpiDsCreateWalkState ( - Info->ObjDesc->Method.OwnerId, NULL, NULL, NULL); - if (!WalkState) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - Status = AcpiDsInitAmlWalk (WalkState, Op, Info->Node, - Info->ObjDesc->Method.AmlStart, - Info->ObjDesc->Method.AmlLength, Info, Info->PassNumber); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - WalkState->MethodPathname = Info->FullPathname; - WalkState->MethodIsNested = FALSE; - - if (Info->ObjDesc->Method.InfoFlags & ACPI_METHOD_MODULE_LEVEL) - { - WalkState->ParseFlags |= ACPI_PARSE_MODULE_LEVEL; - } - - /* Info->Node is the default location to load the table */ - - if (Info->Node && Info->Node != AcpiGbl_RootNode) - { - Status = AcpiDsScopeStackPush ( - Info->Node, ACPI_TYPE_METHOD, WalkState); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - } - - /* - * Parse the AML, WalkState will be deleted by ParseAml - */ - AcpiExEnterInterpreter (); - Status = AcpiPsParseAml (WalkState); - AcpiExExitInterpreter (); - WalkState = NULL; - -Cleanup: - if (WalkState) - { - AcpiDsDeleteWalkState (WalkState); - } - if (Op) - { - AcpiPsDeleteParseTree (Op); - } - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiPsUpdateParameterList - * - * PARAMETERS: Info - See ACPI_EVALUATE_INFO - * (Used: ParameterType and Parameters) - * Action - Add or Remove reference - * - * RETURN: Status - * - * DESCRIPTION: Update reference count on all method parameter objects - * - ******************************************************************************/ - -static void -AcpiPsUpdateParameterList ( - ACPI_EVALUATE_INFO *Info, - UINT16 Action) -{ - UINT32 i; - - - if (Info->Parameters) - { - /* Update reference count for each parameter */ - - for (i = 0; Info->Parameters[i]; i++) - { - /* Ignore errors, just do them all */ - - (void) AcpiUtUpdateObjectReference ( - Info->Parameters[i], Action); - } - } -} diff --git a/drivers/acpica/rsaddr.c b/drivers/acpica/rsaddr.c deleted file mode 100644 index 8c3eb45..0000000 --- a/drivers/acpica/rsaddr.c +++ /dev/null @@ -1,519 +0,0 @@ -/******************************************************************************* - * - * Module Name: rsaddr - Address resource descriptors (16/32/64) - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acresrc.h" - -#define _COMPONENT ACPI_RESOURCES - ACPI_MODULE_NAME ("rsaddr") - - -/******************************************************************************* - * - * AcpiRsConvertAddress16 - All WORD (16-bit) address resources - * - ******************************************************************************/ - -ACPI_RSCONVERT_INFO AcpiRsConvertAddress16[5] = -{ - {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_ADDRESS16, - ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS16), - ACPI_RSC_TABLE_SIZE (AcpiRsConvertAddress16)}, - - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_ADDRESS16, - sizeof (AML_RESOURCE_ADDRESS16), - 0}, - - /* Resource Type, General Flags, and Type-Specific Flags */ - - {ACPI_RSC_ADDRESS, 0, 0, 0}, - - /* - * These fields are contiguous in both the source and destination: - * Address Granularity - * Address Range Minimum - * Address Range Maximum - * Address Translation Offset - * Address Length - */ - {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.Address16.Address.Granularity), - AML_OFFSET (Address16.Granularity), - 5}, - - /* Optional ResourceSource (Index and String) */ - - {ACPI_RSC_SOURCE, ACPI_RS_OFFSET (Data.Address16.ResourceSource), - 0, - sizeof (AML_RESOURCE_ADDRESS16)} -}; - - -/******************************************************************************* - * - * AcpiRsConvertAddress32 - All DWORD (32-bit) address resources - * - ******************************************************************************/ - -ACPI_RSCONVERT_INFO AcpiRsConvertAddress32[5] = -{ - {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_ADDRESS32, - ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS32), - ACPI_RSC_TABLE_SIZE (AcpiRsConvertAddress32)}, - - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_ADDRESS32, - sizeof (AML_RESOURCE_ADDRESS32), - 0}, - - /* Resource Type, General Flags, and Type-Specific Flags */ - - {ACPI_RSC_ADDRESS, 0, 0, 0}, - - /* - * These fields are contiguous in both the source and destination: - * Address Granularity - * Address Range Minimum - * Address Range Maximum - * Address Translation Offset - * Address Length - */ - {ACPI_RSC_MOVE32, ACPI_RS_OFFSET (Data.Address32.Address.Granularity), - AML_OFFSET (Address32.Granularity), - 5}, - - /* Optional ResourceSource (Index and String) */ - - {ACPI_RSC_SOURCE, ACPI_RS_OFFSET (Data.Address32.ResourceSource), - 0, - sizeof (AML_RESOURCE_ADDRESS32)} -}; - - -/******************************************************************************* - * - * AcpiRsConvertAddress64 - All QWORD (64-bit) address resources - * - ******************************************************************************/ - -ACPI_RSCONVERT_INFO AcpiRsConvertAddress64[5] = -{ - {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_ADDRESS64, - ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS64), - ACPI_RSC_TABLE_SIZE (AcpiRsConvertAddress64)}, - - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_ADDRESS64, - sizeof (AML_RESOURCE_ADDRESS64), - 0}, - - /* Resource Type, General Flags, and Type-Specific Flags */ - - {ACPI_RSC_ADDRESS, 0, 0, 0}, - - /* - * These fields are contiguous in both the source and destination: - * Address Granularity - * Address Range Minimum - * Address Range Maximum - * Address Translation Offset - * Address Length - */ - {ACPI_RSC_MOVE64, ACPI_RS_OFFSET (Data.Address64.Address.Granularity), - AML_OFFSET (Address64.Granularity), - 5}, - - /* Optional ResourceSource (Index and String) */ - - {ACPI_RSC_SOURCE, ACPI_RS_OFFSET (Data.Address64.ResourceSource), - 0, - sizeof (AML_RESOURCE_ADDRESS64)} -}; - - -/******************************************************************************* - * - * AcpiRsConvertExtAddress64 - All Extended (64-bit) address resources - * - ******************************************************************************/ - -ACPI_RSCONVERT_INFO AcpiRsConvertExtAddress64[5] = -{ - {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64, - ACPI_RS_SIZE (ACPI_RESOURCE_EXTENDED_ADDRESS64), - ACPI_RSC_TABLE_SIZE (AcpiRsConvertExtAddress64)}, - - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64, - sizeof (AML_RESOURCE_EXTENDED_ADDRESS64), - 0}, - - /* Resource Type, General Flags, and Type-Specific Flags */ - - {ACPI_RSC_ADDRESS, 0, 0, 0}, - - /* Revision ID */ - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.ExtAddress64.RevisionID), - AML_OFFSET (ExtAddress64.RevisionID), - 1}, - /* - * These fields are contiguous in both the source and destination: - * Address Granularity - * Address Range Minimum - * Address Range Maximum - * Address Translation Offset - * Address Length - * Type-Specific Attribute - */ - {ACPI_RSC_MOVE64, ACPI_RS_OFFSET (Data.ExtAddress64.Address.Granularity), - AML_OFFSET (ExtAddress64.Granularity), - 6} -}; - - -/******************************************************************************* - * - * AcpiRsConvertGeneralFlags - Flags common to all address descriptors - * - ******************************************************************************/ - -static ACPI_RSCONVERT_INFO AcpiRsConvertGeneralFlags[6] = -{ - {ACPI_RSC_FLAGINIT, 0, AML_OFFSET (Address.Flags), - ACPI_RSC_TABLE_SIZE (AcpiRsConvertGeneralFlags)}, - - /* Resource Type (Memory, Io, BusNumber, etc.) */ - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.Address.ResourceType), - AML_OFFSET (Address.ResourceType), - 1}, - - /* General Flags - Consume, Decode, MinFixed, MaxFixed */ - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Address.ProducerConsumer), - AML_OFFSET (Address.Flags), - 0}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Address.Decode), - AML_OFFSET (Address.Flags), - 1}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Address.MinAddressFixed), - AML_OFFSET (Address.Flags), - 2}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Address.MaxAddressFixed), - AML_OFFSET (Address.Flags), - 3} -}; - - -/******************************************************************************* - * - * AcpiRsConvertMemFlags - Flags common to Memory address descriptors - * - ******************************************************************************/ - -static ACPI_RSCONVERT_INFO AcpiRsConvertMemFlags[5] = -{ - {ACPI_RSC_FLAGINIT, 0, AML_OFFSET (Address.SpecificFlags), - ACPI_RSC_TABLE_SIZE (AcpiRsConvertMemFlags)}, - - /* Memory-specific flags */ - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Address.Info.Mem.WriteProtect), - AML_OFFSET (Address.SpecificFlags), - 0}, - - {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.Address.Info.Mem.Caching), - AML_OFFSET (Address.SpecificFlags), - 1}, - - {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.Address.Info.Mem.RangeType), - AML_OFFSET (Address.SpecificFlags), - 3}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Address.Info.Mem.Translation), - AML_OFFSET (Address.SpecificFlags), - 5} -}; - - -/******************************************************************************* - * - * AcpiRsConvertIoFlags - Flags common to I/O address descriptors - * - ******************************************************************************/ - -static ACPI_RSCONVERT_INFO AcpiRsConvertIoFlags[4] = -{ - {ACPI_RSC_FLAGINIT, 0, AML_OFFSET (Address.SpecificFlags), - ACPI_RSC_TABLE_SIZE (AcpiRsConvertIoFlags)}, - - /* I/O-specific flags */ - - {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.Address.Info.Io.RangeType), - AML_OFFSET (Address.SpecificFlags), - 0}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Address.Info.Io.Translation), - AML_OFFSET (Address.SpecificFlags), - 4}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Address.Info.Io.TranslationType), - AML_OFFSET (Address.SpecificFlags), - 5} -}; - - -/******************************************************************************* - * - * FUNCTION: AcpiRsGetAddressCommon - * - * PARAMETERS: Resource - Pointer to the internal resource struct - * Aml - Pointer to the AML resource descriptor - * - * RETURN: TRUE if the ResourceType field is OK, FALSE otherwise - * - * DESCRIPTION: Convert common flag fields from a raw AML resource descriptor - * to an internal resource descriptor - * - ******************************************************************************/ - -BOOLEAN -AcpiRsGetAddressCommon ( - ACPI_RESOURCE *Resource, - AML_RESOURCE *Aml) -{ - ACPI_FUNCTION_ENTRY(); - - /* Validate the Resource Type */ - - if ((Aml->Address.ResourceType > 2) && - (Aml->Address.ResourceType < 0xC0) && - (Aml->Address.ResourceType != 0x0A)) - { - return (FALSE); - } - - /* Get the Resource Type and General Flags */ - - (void) AcpiRsConvertAmlToResource ( - Resource, Aml, AcpiRsConvertGeneralFlags); - - /* Get the Type-Specific Flags (Memory and I/O descriptors only) */ - - if (Resource->Data.Address.ResourceType == ACPI_MEMORY_RANGE) - { - (void) AcpiRsConvertAmlToResource ( - Resource, Aml, AcpiRsConvertMemFlags); - } - else if (Resource->Data.Address.ResourceType == ACPI_IO_RANGE) - { - (void) AcpiRsConvertAmlToResource ( - Resource, Aml, AcpiRsConvertIoFlags); - } - else - { - /* Generic resource type, just grab the TypeSpecific byte */ - - Resource->Data.Address.Info.TypeSpecific = - Aml->Address.SpecificFlags; - } - - return (TRUE); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiRsSetAddressCommon - * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * Resource - Pointer to the internal resource struct - * - * RETURN: None - * - * DESCRIPTION: Convert common flag fields from a resource descriptor to an - * AML descriptor - * - ******************************************************************************/ - -void -AcpiRsSetAddressCommon ( - AML_RESOURCE *Aml, - ACPI_RESOURCE *Resource) -{ - ACPI_FUNCTION_ENTRY (); - - /* Set the Resource Type and General Flags */ - - (void) AcpiRsConvertResourceToAml ( - Resource, Aml, AcpiRsConvertGeneralFlags); - - /* Set the Type-Specific Flags (Memory and I/O descriptors only) */ - - if (Resource->Data.Address.ResourceType == ACPI_MEMORY_RANGE) - { - (void) AcpiRsConvertResourceToAml ( - Resource, Aml, AcpiRsConvertMemFlags); - } - else if (Resource->Data.Address.ResourceType == ACPI_IO_RANGE) - { - (void) AcpiRsConvertResourceToAml ( - Resource, Aml, AcpiRsConvertIoFlags); - } - else - { - /* Generic resource type, just copy the TypeSpecific byte */ - - Aml->Address.SpecificFlags = - Resource->Data.Address.Info.TypeSpecific; - } -} diff --git a/drivers/acpica/rscalc.c b/drivers/acpica/rscalc.c deleted file mode 100644 index 5818038..0000000 --- a/drivers/acpica/rscalc.c +++ /dev/null @@ -1,993 +0,0 @@ -/******************************************************************************* - * - * Module Name: rscalc - Calculate stream and list lengths - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acresrc.h" -#include "acnamesp.h" - - -#define _COMPONENT ACPI_RESOURCES - ACPI_MODULE_NAME ("rscalc") - - -/* Local prototypes */ - -static UINT8 -AcpiRsCountSetBits ( - UINT16 BitField); - -static ACPI_RS_LENGTH -AcpiRsStructOptionLength ( - ACPI_RESOURCE_SOURCE *ResourceSource); - -static UINT32 -AcpiRsStreamOptionLength ( - UINT32 ResourceLength, - UINT32 MinimumTotalLength); - - -/******************************************************************************* - * - * FUNCTION: AcpiRsCountSetBits - * - * PARAMETERS: BitField - Field in which to count bits - * - * RETURN: Number of bits set within the field - * - * DESCRIPTION: Count the number of bits set in a resource field. Used for - * (Short descriptor) interrupt and DMA lists. - * - ******************************************************************************/ - -static UINT8 -AcpiRsCountSetBits ( - UINT16 BitField) -{ - UINT8 BitsSet; - - - ACPI_FUNCTION_ENTRY (); - - - for (BitsSet = 0; BitField; BitsSet++) - { - /* Zero the least significant bit that is set */ - - BitField &= (UINT16) (BitField - 1); - } - - return (BitsSet); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiRsStructOptionLength - * - * PARAMETERS: ResourceSource - Pointer to optional descriptor field - * - * RETURN: Status - * - * DESCRIPTION: Common code to handle optional ResourceSourceIndex and - * ResourceSource fields in some Large descriptors. Used during - * list-to-stream conversion - * - ******************************************************************************/ - -static ACPI_RS_LENGTH -AcpiRsStructOptionLength ( - ACPI_RESOURCE_SOURCE *ResourceSource) -{ - ACPI_FUNCTION_ENTRY (); - - - /* - * If the ResourceSource string is valid, return the size of the string - * (StringLength includes the NULL terminator) plus the size of the - * ResourceSourceIndex (1). - */ - if (ResourceSource->StringPtr) - { - return ((ACPI_RS_LENGTH) (ResourceSource->StringLength + 1)); - } - - return (0); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiRsStreamOptionLength - * - * PARAMETERS: ResourceLength - Length from the resource header - * MinimumTotalLength - Minimum length of this resource, before - * any optional fields. Includes header size - * - * RETURN: Length of optional string (0 if no string present) - * - * DESCRIPTION: Common code to handle optional ResourceSourceIndex and - * ResourceSource fields in some Large descriptors. Used during - * stream-to-list conversion - * - ******************************************************************************/ - -static UINT32 -AcpiRsStreamOptionLength ( - UINT32 ResourceLength, - UINT32 MinimumAmlResourceLength) -{ - UINT32 StringLength = 0; - - - ACPI_FUNCTION_ENTRY (); - - - /* - * The ResourceSourceIndex and ResourceSource are optional elements of - * some Large-type resource descriptors. - */ - - /* - * If the length of the actual resource descriptor is greater than the - * ACPI spec-defined minimum length, it means that a ResourceSourceIndex - * exists and is followed by a (required) null terminated string. The - * string length (including the null terminator) is the resource length - * minus the minimum length, minus one byte for the ResourceSourceIndex - * itself. - */ - if (ResourceLength > MinimumAmlResourceLength) - { - /* Compute the length of the optional string */ - - StringLength = ResourceLength - MinimumAmlResourceLength - 1; - } - - /* - * Round the length up to a multiple of the native word in order to - * guarantee that the entire resource descriptor is native word aligned - */ - return ((UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (StringLength)); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiRsGetAmlLength - * - * PARAMETERS: Resource - Pointer to the resource linked list - * ResourceListSize - Size of the resource linked list - * SizeNeeded - Where the required size is returned - * - * RETURN: Status - * - * DESCRIPTION: Takes a linked list of internal resource descriptors and - * calculates the size buffer needed to hold the corresponding - * external resource byte stream. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiRsGetAmlLength ( - ACPI_RESOURCE *Resource, - ACPI_SIZE ResourceListSize, - ACPI_SIZE *SizeNeeded) -{ - ACPI_SIZE AmlSizeNeeded = 0; - ACPI_RESOURCE *ResourceEnd; - ACPI_RS_LENGTH TotalSize; - - - ACPI_FUNCTION_TRACE (RsGetAmlLength); - - - /* Traverse entire list of internal resource descriptors */ - - ResourceEnd = ACPI_ADD_PTR (ACPI_RESOURCE, Resource, ResourceListSize); - while (Resource < ResourceEnd) - { - /* Validate the descriptor type */ - - if (Resource->Type > ACPI_RESOURCE_TYPE_MAX) - { - return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); - } - - /* Sanity check the length. It must not be zero, or we loop forever */ - - if (!Resource->Length) - { - return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); - } - - /* Get the base size of the (external stream) resource descriptor */ - - TotalSize = AcpiGbl_AmlResourceSizes [Resource->Type]; - - /* - * Augment the base size for descriptors with optional and/or - * variable-length fields - */ - switch (Resource->Type) - { - case ACPI_RESOURCE_TYPE_IRQ: - - /* Length can be 3 or 2 */ - - if (Resource->Data.Irq.DescriptorLength == 2) - { - TotalSize--; - } - break; - - - case ACPI_RESOURCE_TYPE_START_DEPENDENT: - - /* Length can be 1 or 0 */ - - if (Resource->Data.Irq.DescriptorLength == 0) - { - TotalSize--; - } - break; - - - case ACPI_RESOURCE_TYPE_VENDOR: - /* - * Vendor Defined Resource: - * For a Vendor Specific resource, if the Length is between 1 and 7 - * it will be created as a Small Resource data type, otherwise it - * is a Large Resource data type. - */ - if (Resource->Data.Vendor.ByteLength > 7) - { - /* Base size of a Large resource descriptor */ - - TotalSize = sizeof (AML_RESOURCE_LARGE_HEADER); - } - - /* Add the size of the vendor-specific data */ - - TotalSize = (ACPI_RS_LENGTH) - (TotalSize + Resource->Data.Vendor.ByteLength); - break; - - - case ACPI_RESOURCE_TYPE_END_TAG: - /* - * End Tag: - * We are done -- return the accumulated total size. - */ - *SizeNeeded = AmlSizeNeeded + TotalSize; - - /* Normal exit */ - - return_ACPI_STATUS (AE_OK); - - - case ACPI_RESOURCE_TYPE_ADDRESS16: - /* - * 16-Bit Address Resource: - * Add the size of the optional ResourceSource info - */ - TotalSize = (ACPI_RS_LENGTH) (TotalSize + - AcpiRsStructOptionLength ( - &Resource->Data.Address16.ResourceSource)); - break; - - - case ACPI_RESOURCE_TYPE_ADDRESS32: - /* - * 32-Bit Address Resource: - * Add the size of the optional ResourceSource info - */ - TotalSize = (ACPI_RS_LENGTH) (TotalSize + - AcpiRsStructOptionLength ( - &Resource->Data.Address32.ResourceSource)); - break; - - - case ACPI_RESOURCE_TYPE_ADDRESS64: - /* - * 64-Bit Address Resource: - * Add the size of the optional ResourceSource info - */ - TotalSize = (ACPI_RS_LENGTH) (TotalSize + - AcpiRsStructOptionLength ( - &Resource->Data.Address64.ResourceSource)); - break; - - - case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: - /* - * Extended IRQ Resource: - * Add the size of each additional optional interrupt beyond the - * required 1 (4 bytes for each UINT32 interrupt number) - */ - TotalSize = (ACPI_RS_LENGTH) (TotalSize + - ((Resource->Data.ExtendedIrq.InterruptCount - 1) * 4) + - - /* Add the size of the optional ResourceSource info */ - - AcpiRsStructOptionLength ( - &Resource->Data.ExtendedIrq.ResourceSource)); - break; - - - case ACPI_RESOURCE_TYPE_GPIO: - - TotalSize = (ACPI_RS_LENGTH) (TotalSize + - (Resource->Data.Gpio.PinTableLength * 2) + - Resource->Data.Gpio.ResourceSource.StringLength + - Resource->Data.Gpio.VendorLength); - - break; - - case ACPI_RESOURCE_TYPE_PIN_FUNCTION: - - TotalSize = (ACPI_RS_LENGTH) (TotalSize + - (Resource->Data.PinFunction.PinTableLength * 2) + - Resource->Data.PinFunction.ResourceSource.StringLength + - Resource->Data.PinFunction.VendorLength); - - break; - - case ACPI_RESOURCE_TYPE_CLOCK_INPUT: - - TotalSize = (ACPI_RS_LENGTH) (TotalSize + - Resource->Data.ClockInput.ResourceSource.StringLength); - - break; - - - case ACPI_RESOURCE_TYPE_SERIAL_BUS: - - TotalSize = AcpiGbl_AmlResourceSerialBusSizes [ - Resource->Data.CommonSerialBus.Type]; - - TotalSize = (ACPI_RS_LENGTH) (TotalSize + - Resource->Data.I2cSerialBus.ResourceSource.StringLength + - Resource->Data.I2cSerialBus.VendorLength); - - break; - - case ACPI_RESOURCE_TYPE_PIN_CONFIG: - - TotalSize = (ACPI_RS_LENGTH) (TotalSize + - (Resource->Data.PinConfig.PinTableLength * 2) + - Resource->Data.PinConfig.ResourceSource.StringLength + - Resource->Data.PinConfig.VendorLength); - - break; - - case ACPI_RESOURCE_TYPE_PIN_GROUP: - - TotalSize = (ACPI_RS_LENGTH) (TotalSize + - (Resource->Data.PinGroup.PinTableLength * 2) + - Resource->Data.PinGroup.ResourceLabel.StringLength + - Resource->Data.PinGroup.VendorLength); - - break; - - case ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION: - - TotalSize = (ACPI_RS_LENGTH) (TotalSize + - Resource->Data.PinGroupFunction.ResourceSource.StringLength + - Resource->Data.PinGroupFunction.ResourceSourceLabel.StringLength + - Resource->Data.PinGroupFunction.VendorLength); - - break; - - case ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG: - - TotalSize = (ACPI_RS_LENGTH) (TotalSize + - Resource->Data.PinGroupConfig.ResourceSource.StringLength + - Resource->Data.PinGroupConfig.ResourceSourceLabel.StringLength + - Resource->Data.PinGroupConfig.VendorLength); - - break; - - default: - - break; - } - - /* Update the total */ - - AmlSizeNeeded += TotalSize; - - /* Point to the next object */ - - Resource = ACPI_ADD_PTR (ACPI_RESOURCE, Resource, Resource->Length); - } - - /* Did not find an EndTag resource descriptor */ - - return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiRsGetListLength - * - * PARAMETERS: AmlBuffer - Pointer to the resource byte stream - * AmlBufferLength - Size of AmlBuffer - * SizeNeeded - Where the size needed is returned - * - * RETURN: Status - * - * DESCRIPTION: Takes an external resource byte stream and calculates the size - * buffer needed to hold the corresponding internal resource - * descriptor linked list. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiRsGetListLength ( - UINT8 *AmlBuffer, - UINT32 AmlBufferLength, - ACPI_SIZE *SizeNeeded) -{ - ACPI_STATUS Status; - UINT8 *EndAml; - UINT8 *Buffer; - UINT32 BufferSize; - UINT16 Temp16; - UINT16 ResourceLength; - UINT32 ExtraStructBytes; - UINT8 ResourceIndex; - UINT8 MinimumAmlResourceLength; - AML_RESOURCE *AmlResource; - - - ACPI_FUNCTION_TRACE (RsGetListLength); - - - *SizeNeeded = ACPI_RS_SIZE_MIN; /* Minimum size is one EndTag */ - EndAml = AmlBuffer + AmlBufferLength; - - /* Walk the list of AML resource descriptors */ - - while (AmlBuffer < EndAml) - { - /* Validate the Resource Type and Resource Length */ - - Status = AcpiUtValidateResource (NULL, AmlBuffer, &ResourceIndex); - if (ACPI_FAILURE (Status)) - { - /* - * Exit on failure. Cannot continue because the descriptor length - * may be bogus also. - */ - return_ACPI_STATUS (Status); - } - - AmlResource = (void *) AmlBuffer; - - /* Get the resource length and base (minimum) AML size */ - - ResourceLength = AcpiUtGetResourceLength (AmlBuffer); - MinimumAmlResourceLength = AcpiGbl_ResourceAmlSizes[ResourceIndex]; - - /* - * Augment the size for descriptors with optional - * and/or variable length fields - */ - ExtraStructBytes = 0; - Buffer = AmlBuffer + AcpiUtGetResourceHeaderLength (AmlBuffer); - - switch (AcpiUtGetResourceType (AmlBuffer)) - { - case ACPI_RESOURCE_NAME_IRQ: - /* - * IRQ Resource: - * Get the number of bits set in the 16-bit IRQ mask - */ - ACPI_MOVE_16_TO_16 (&Temp16, Buffer); - ExtraStructBytes = AcpiRsCountSetBits (Temp16); - break; - - - case ACPI_RESOURCE_NAME_DMA: - /* - * DMA Resource: - * Get the number of bits set in the 8-bit DMA mask - */ - ExtraStructBytes = AcpiRsCountSetBits (*Buffer); - break; - - - case ACPI_RESOURCE_NAME_VENDOR_SMALL: - case ACPI_RESOURCE_NAME_VENDOR_LARGE: - /* - * Vendor Resource: - * Get the number of vendor data bytes - */ - ExtraStructBytes = ResourceLength; - - /* - * There is already one byte included in the minimum - * descriptor size. If there are extra struct bytes, - * subtract one from the count. - */ - if (ExtraStructBytes) - { - ExtraStructBytes--; - } - break; - - - case ACPI_RESOURCE_NAME_END_TAG: - /* - * End Tag: This is the normal exit - */ - return_ACPI_STATUS (AE_OK); - - - case ACPI_RESOURCE_NAME_ADDRESS32: - case ACPI_RESOURCE_NAME_ADDRESS16: - case ACPI_RESOURCE_NAME_ADDRESS64: - /* - * Address Resource: - * Add the size of the optional ResourceSource - */ - ExtraStructBytes = AcpiRsStreamOptionLength ( - ResourceLength, MinimumAmlResourceLength); - break; - - - case ACPI_RESOURCE_NAME_EXTENDED_IRQ: - /* - * Extended IRQ Resource: - * Using the InterruptTableLength, add 4 bytes for each additional - * interrupt. Note: at least one interrupt is required and is - * included in the minimum descriptor size (reason for the -1) - */ - ExtraStructBytes = (Buffer[1] - 1) * sizeof (UINT32); - - /* Add the size of the optional ResourceSource */ - - ExtraStructBytes += AcpiRsStreamOptionLength ( - ResourceLength - ExtraStructBytes, MinimumAmlResourceLength); - break; - - case ACPI_RESOURCE_NAME_GPIO: - - /* Vendor data is optional */ - - if (AmlResource->Gpio.VendorLength) - { - ExtraStructBytes += - AmlResource->Gpio.VendorOffset - - AmlResource->Gpio.PinTableOffset + - AmlResource->Gpio.VendorLength; - } - else - { - ExtraStructBytes += - AmlResource->LargeHeader.ResourceLength + - sizeof (AML_RESOURCE_LARGE_HEADER) - - AmlResource->Gpio.PinTableOffset; - } - break; - - case ACPI_RESOURCE_NAME_PIN_FUNCTION: - - /* Vendor data is optional */ - - if (AmlResource->PinFunction.VendorLength) - { - ExtraStructBytes += - AmlResource->PinFunction.VendorOffset - - AmlResource->PinFunction.PinTableOffset + - AmlResource->PinFunction.VendorLength; - } - else - { - ExtraStructBytes += - AmlResource->LargeHeader.ResourceLength + - sizeof (AML_RESOURCE_LARGE_HEADER) - - AmlResource->PinFunction.PinTableOffset; - } - break; - - case ACPI_RESOURCE_NAME_SERIAL_BUS: { - - MinimumAmlResourceLength = AcpiGbl_ResourceAmlSerialBusSizes[ - AmlResource->CommonSerialBus.Type]; - ExtraStructBytes += - AmlResource->CommonSerialBus.ResourceLength - - MinimumAmlResourceLength; - break; - } - - case ACPI_RESOURCE_NAME_PIN_CONFIG: - - /* Vendor data is optional */ - - if (AmlResource->PinConfig.VendorLength) - { - ExtraStructBytes += - AmlResource->PinConfig.VendorOffset - - AmlResource->PinConfig.PinTableOffset + - AmlResource->PinConfig.VendorLength; - } - else - { - ExtraStructBytes += - AmlResource->LargeHeader.ResourceLength + - sizeof (AML_RESOURCE_LARGE_HEADER) - - AmlResource->PinConfig.PinTableOffset; - } - break; - - case ACPI_RESOURCE_NAME_PIN_GROUP: - - ExtraStructBytes += - AmlResource->PinGroup.VendorOffset - - AmlResource->PinGroup.PinTableOffset + - AmlResource->PinGroup.VendorLength; - - break; - - case ACPI_RESOURCE_NAME_PIN_GROUP_FUNCTION: - - ExtraStructBytes += - AmlResource->PinGroupFunction.VendorOffset - - AmlResource->PinGroupFunction.ResSourceOffset + - AmlResource->PinGroupFunction.VendorLength; - - break; - - case ACPI_RESOURCE_NAME_PIN_GROUP_CONFIG: - - ExtraStructBytes += - AmlResource->PinGroupConfig.VendorOffset - - AmlResource->PinGroupConfig.ResSourceOffset + - AmlResource->PinGroupConfig.VendorLength; - - break; - - case ACPI_RESOURCE_NAME_CLOCK_INPUT: - ExtraStructBytes = AcpiRsStreamOptionLength ( - ResourceLength, MinimumAmlResourceLength); - - break; - - default: - - break; - } - - /* - * Update the required buffer size for the internal descriptor structs - * - * Important: Round the size up for the appropriate alignment. This - * is a requirement on IA64. - */ - if (AcpiUtGetResourceType (AmlBuffer) == - ACPI_RESOURCE_NAME_SERIAL_BUS) - { - BufferSize = AcpiGbl_ResourceStructSerialBusSizes[ - AmlResource->CommonSerialBus.Type] + ExtraStructBytes; - } - else - { - BufferSize = AcpiGbl_ResourceStructSizes[ResourceIndex] + - ExtraStructBytes; - } - - BufferSize = (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (BufferSize); - *SizeNeeded += BufferSize; - - ACPI_DEBUG_PRINT ((ACPI_DB_RESOURCES, - "Type %.2X, AmlLength %.2X InternalLength %.2X%8X\n", - AcpiUtGetResourceType (AmlBuffer), - AcpiUtGetDescriptorLength (AmlBuffer), ACPI_FORMAT_UINT64(*SizeNeeded))); - - /* - * Point to the next resource within the AML stream using the length - * contained in the resource descriptor header - */ - AmlBuffer += AcpiUtGetDescriptorLength (AmlBuffer); - } - - /* Did not find an EndTag resource descriptor */ - - return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiRsGetPciRoutingTableLength - * - * PARAMETERS: PackageObject - Pointer to the package object - * BufferSizeNeeded - UINT32 pointer of the size buffer - * needed to properly return the - * parsed data - * - * RETURN: Status - * - * DESCRIPTION: Given a package representing a PCI routing table, this - * calculates the size of the corresponding linked list of - * descriptions. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiRsGetPciRoutingTableLength ( - ACPI_OPERAND_OBJECT *PackageObject, - ACPI_SIZE *BufferSizeNeeded) -{ - UINT32 NumberOfElements; - ACPI_SIZE TempSizeNeeded = 0; - ACPI_OPERAND_OBJECT **TopObjectList; - UINT32 Index; - ACPI_OPERAND_OBJECT *PackageElement; - ACPI_OPERAND_OBJECT **SubObjectList; - BOOLEAN NameFound; - UINT32 TableIndex; - - - ACPI_FUNCTION_TRACE (RsGetPciRoutingTableLength); - - - NumberOfElements = PackageObject->Package.Count; - - /* - * Calculate the size of the return buffer. - * The base size is the number of elements * the sizes of the - * structures. Additional space for the strings is added below. - * The minus one is to subtract the size of the UINT8 Source[1] - * member because it is added below. - * - * But each PRT_ENTRY structure has a pointer to a string and - * the size of that string must be found. - */ - TopObjectList = PackageObject->Package.Elements; - - for (Index = 0; Index < NumberOfElements; Index++) - { - /* Dereference the subpackage */ - - PackageElement = *TopObjectList; - - /* We must have a valid Package object */ - - if (!PackageElement || - (PackageElement->Common.Type != ACPI_TYPE_PACKAGE)) - { - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - - /* - * The SubObjectList will now point to an array of the - * four IRQ elements: Address, Pin, Source and SourceIndex - */ - SubObjectList = PackageElement->Package.Elements; - - /* Scan the IrqTableElements for the Source Name String */ - - NameFound = FALSE; - - for (TableIndex = 0; - TableIndex < PackageElement->Package.Count && !NameFound; - TableIndex++) - { - if (*SubObjectList && /* Null object allowed */ - - ((ACPI_TYPE_STRING == - (*SubObjectList)->Common.Type) || - - ((ACPI_TYPE_LOCAL_REFERENCE == - (*SubObjectList)->Common.Type) && - - ((*SubObjectList)->Reference.Class == - ACPI_REFCLASS_NAME)))) - { - NameFound = TRUE; - } - else - { - /* Look at the next element */ - - SubObjectList++; - } - } - - TempSizeNeeded += (sizeof (ACPI_PCI_ROUTING_TABLE) - 4); - - /* Was a String type found? */ - - if (NameFound) - { - if ((*SubObjectList)->Common.Type == ACPI_TYPE_STRING) - { - /* - * The length String.Length field does not include the - * terminating NULL, add 1 - */ - TempSizeNeeded += ((ACPI_SIZE) - (*SubObjectList)->String.Length + 1); - } - else - { - TempSizeNeeded += AcpiNsGetPathnameLength ( - (*SubObjectList)->Reference.Node); - } - } - else - { - /* - * If no name was found, then this is a NULL, which is - * translated as a UINT32 zero. - */ - TempSizeNeeded += sizeof (UINT32); - } - - /* Round up the size since each element must be aligned */ - - TempSizeNeeded = ACPI_ROUND_UP_TO_64BIT (TempSizeNeeded); - - /* Point to the next ACPI_OPERAND_OBJECT */ - - TopObjectList++; - } - - /* - * Add an extra element to the end of the list, essentially a - * NULL terminator - */ - *BufferSizeNeeded = TempSizeNeeded + sizeof (ACPI_PCI_ROUTING_TABLE); - return_ACPI_STATUS (AE_OK); -} diff --git a/drivers/acpica/rscreate.c b/drivers/acpica/rscreate.c deleted file mode 100644 index ac2bf12..0000000 --- a/drivers/acpica/rscreate.c +++ /dev/null @@ -1,618 +0,0 @@ -/******************************************************************************* - * - * Module Name: rscreate - Create resource lists/tables - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acresrc.h" -#include "acnamesp.h" - -#define _COMPONENT ACPI_RESOURCES - ACPI_MODULE_NAME ("rscreate") - - -/******************************************************************************* - * - * FUNCTION: AcpiBufferToResource - * - * PARAMETERS: AmlBuffer - Pointer to the resource byte stream - * AmlBufferLength - Length of the AmlBuffer - * ResourcePtr - Where the converted resource is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert a raw AML buffer to a resource list - * - ******************************************************************************/ - -ACPI_STATUS -AcpiBufferToResource ( - UINT8 *AmlBuffer, - UINT16 AmlBufferLength, - ACPI_RESOURCE **ResourcePtr) -{ - ACPI_STATUS Status; - ACPI_SIZE ListSizeNeeded; - void *Resource; - void *CurrentResourcePtr; - - - ACPI_FUNCTION_TRACE (AcpiBufferToResource); - - - /* - * Note: we allow AE_AML_NO_RESOURCE_END_TAG, since an end tag - * is not required here. - */ - - /* Get the required length for the converted resource */ - - Status = AcpiRsGetListLength ( - AmlBuffer, AmlBufferLength, &ListSizeNeeded); - if (Status == AE_AML_NO_RESOURCE_END_TAG) - { - Status = AE_OK; - } - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Allocate a buffer for the converted resource */ - - Resource = ACPI_ALLOCATE_ZEROED (ListSizeNeeded); - CurrentResourcePtr = Resource; - if (!Resource) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Perform the AML-to-Resource conversion */ - - Status = AcpiUtWalkAmlResources (NULL, AmlBuffer, AmlBufferLength, - AcpiRsConvertAmlToResources, &CurrentResourcePtr); - if (Status == AE_AML_NO_RESOURCE_END_TAG) - { - Status = AE_OK; - } - if (ACPI_FAILURE (Status)) - { - ACPI_FREE (Resource); - } - else - { - *ResourcePtr = Resource; - } - - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiBufferToResource) - - -/******************************************************************************* - * - * FUNCTION: AcpiRsCreateResourceList - * - * PARAMETERS: AmlBuffer - Pointer to the resource byte stream - * OutputBuffer - Pointer to the user's buffer - * - * RETURN: Status: AE_OK if okay, else a valid ACPI_STATUS code - * If OutputBuffer is not large enough, OutputBufferLength - * indicates how large OutputBuffer should be, else it - * indicates how may UINT8 elements of OutputBuffer are valid. - * - * DESCRIPTION: Takes the byte stream returned from a _CRS, _PRS control method - * execution and parses the stream to create a linked list - * of device resources. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiRsCreateResourceList ( - ACPI_OPERAND_OBJECT *AmlBuffer, - ACPI_BUFFER *OutputBuffer) -{ - - ACPI_STATUS Status; - UINT8 *AmlStart; - ACPI_SIZE ListSizeNeeded = 0; - UINT32 AmlBufferLength; - void *Resource; - - - ACPI_FUNCTION_TRACE (RsCreateResourceList); - - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AmlBuffer = %p\n", - AmlBuffer)); - - /* Params already validated, so we don't re-validate here */ - - AmlBufferLength = AmlBuffer->Buffer.Length; - AmlStart = AmlBuffer->Buffer.Pointer; - - /* - * Pass the AmlBuffer into a module that can calculate - * the buffer size needed for the linked list - */ - Status = AcpiRsGetListLength (AmlStart, AmlBufferLength, - &ListSizeNeeded); - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Status=%X ListSizeNeeded=%X\n", - Status, (UINT32) ListSizeNeeded)); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Validate/Allocate/Clear caller buffer */ - - Status = AcpiUtInitializeBuffer (OutputBuffer, ListSizeNeeded); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Do the conversion */ - - Resource = OutputBuffer->Pointer; - Status = AcpiUtWalkAmlResources (NULL, AmlStart, AmlBufferLength, - AcpiRsConvertAmlToResources, &Resource); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer %p Length %X\n", - OutputBuffer->Pointer, (UINT32) OutputBuffer->Length)); - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiRsCreatePciRoutingTable - * - * PARAMETERS: PackageObject - Pointer to a package containing one - * of more ACPI_OPERAND_OBJECTs - * OutputBuffer - Pointer to the user's buffer - * - * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code. - * If the OutputBuffer is too small, the error will be - * AE_BUFFER_OVERFLOW and OutputBuffer->Length will point - * to the size buffer needed. - * - * DESCRIPTION: Takes the ACPI_OPERAND_OBJECT package and creates a - * linked list of PCI interrupt descriptions - * - * NOTE: It is the caller's responsibility to ensure that the start of the - * output buffer is aligned properly (if necessary). - * - ******************************************************************************/ - -ACPI_STATUS -AcpiRsCreatePciRoutingTable ( - ACPI_OPERAND_OBJECT *PackageObject, - ACPI_BUFFER *OutputBuffer) -{ - UINT8 *Buffer; - ACPI_OPERAND_OBJECT **TopObjectList; - ACPI_OPERAND_OBJECT **SubObjectList; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_SIZE BufferSizeNeeded = 0; - UINT32 NumberOfElements; - UINT32 Index; - ACPI_PCI_ROUTING_TABLE *UserPrt; - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - ACPI_BUFFER PathBuffer; - - - ACPI_FUNCTION_TRACE (RsCreatePciRoutingTable); - - - /* Params already validated, so we don't re-validate here */ - - /* Get the required buffer length */ - - Status = AcpiRsGetPciRoutingTableLength ( - PackageObject,&BufferSizeNeeded); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "BufferSizeNeeded = %X\n", - (UINT32) BufferSizeNeeded)); - - /* Validate/Allocate/Clear caller buffer */ - - Status = AcpiUtInitializeBuffer (OutputBuffer, BufferSizeNeeded); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* - * Loop through the ACPI_INTERNAL_OBJECTS - Each object should be a - * package that in turn contains an UINT64 Address, a UINT8 Pin, - * a Name, and a UINT8 SourceIndex. - */ - TopObjectList = PackageObject->Package.Elements; - NumberOfElements = PackageObject->Package.Count; - Buffer = OutputBuffer->Pointer; - UserPrt = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, Buffer); - - for (Index = 0; Index < NumberOfElements; Index++) - { - /* - * Point UserPrt past this current structure - * - * NOTE: On the first iteration, UserPrt->Length will - * be zero because we cleared the return buffer earlier - */ - Buffer += UserPrt->Length; - UserPrt = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, Buffer); - - /* - * Fill in the Length field with the information we have at this - * point. The minus four is to subtract the size of the UINT8 - * Source[4] member because it is added below. - */ - UserPrt->Length = (sizeof (ACPI_PCI_ROUTING_TABLE) - 4); - - /* Each subpackage must be of length 4 */ - - if ((*TopObjectList)->Package.Count != 4) - { - ACPI_ERROR ((AE_INFO, - "(PRT[%u]) Need package of length 4, found length %u", - Index, (*TopObjectList)->Package.Count)); - return_ACPI_STATUS (AE_AML_PACKAGE_LIMIT); - } - - /* - * Dereference the subpackage. - * The SubObjectList will now point to an array of the four IRQ - * elements: [Address, Pin, Source, SourceIndex] - */ - SubObjectList = (*TopObjectList)->Package.Elements; - - /* 1) First subobject: Dereference the PRT.Address */ - - ObjDesc = SubObjectList[0]; - if (!ObjDesc || ObjDesc->Common.Type != ACPI_TYPE_INTEGER) - { - ACPI_ERROR ((AE_INFO, - "(PRT[%u].Address) Need Integer, found %s", - Index, AcpiUtGetObjectTypeName (ObjDesc))); - return_ACPI_STATUS (AE_BAD_DATA); - } - - UserPrt->Address = ObjDesc->Integer.Value; - - /* 2) Second subobject: Dereference the PRT.Pin */ - - ObjDesc = SubObjectList[1]; - if (!ObjDesc || ObjDesc->Common.Type != ACPI_TYPE_INTEGER) - { - ACPI_ERROR ((AE_INFO, "(PRT[%u].Pin) Need Integer, found %s", - Index, AcpiUtGetObjectTypeName (ObjDesc))); - return_ACPI_STATUS (AE_BAD_DATA); - } - - UserPrt->Pin = (UINT32) ObjDesc->Integer.Value; - - /* - * 3) Third subobject: Dereference the PRT.SourceName - * The name may be unresolved (slack mode), so allow a null object - */ - ObjDesc = SubObjectList[2]; - if (ObjDesc) - { - switch (ObjDesc->Common.Type) - { - case ACPI_TYPE_LOCAL_REFERENCE: - - if (ObjDesc->Reference.Class != ACPI_REFCLASS_NAME) - { - ACPI_ERROR ((AE_INFO, - "(PRT[%u].Source) Need name, found Reference Class 0x%X", - Index, ObjDesc->Reference.Class)); - return_ACPI_STATUS (AE_BAD_DATA); - } - - Node = ObjDesc->Reference.Node; - - /* Use *remaining* length of the buffer as max for pathname */ - - PathBuffer.Length = OutputBuffer->Length - - (UINT32) ((UINT8 *) UserPrt->Source - - (UINT8 *) OutputBuffer->Pointer); - PathBuffer.Pointer = UserPrt->Source; - - Status = AcpiNsHandleToPathname ( - (ACPI_HANDLE) Node, &PathBuffer, FALSE); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* +1 to include null terminator */ - - UserPrt->Length += (UINT32) strlen (UserPrt->Source) + 1; - break; - - case ACPI_TYPE_STRING: - - strcpy (UserPrt->Source, ObjDesc->String.Pointer); - - /* - * Add to the Length field the length of the string - * (add 1 for terminator) - */ - UserPrt->Length += ObjDesc->String.Length + 1; - break; - - case ACPI_TYPE_INTEGER: - /* - * If this is a number, then the Source Name is NULL, since - * the entire buffer was zeroed out, we can leave this alone. - * - * Add to the Length field the length of the UINT32 NULL - */ - UserPrt->Length += sizeof (UINT32); - break; - - default: - - ACPI_ERROR ((AE_INFO, - "(PRT[%u].Source) Need Ref/String/Integer, found %s", - Index, AcpiUtGetObjectTypeName (ObjDesc))); - return_ACPI_STATUS (AE_BAD_DATA); - } - } - - /* Now align the current length */ - - UserPrt->Length = (UINT32) ACPI_ROUND_UP_TO_64BIT (UserPrt->Length); - - /* 4) Fourth subobject: Dereference the PRT.SourceIndex */ - - ObjDesc = SubObjectList[3]; - if (!ObjDesc || ObjDesc->Common.Type != ACPI_TYPE_INTEGER) - { - ACPI_ERROR ((AE_INFO, - "(PRT[%u].SourceIndex) Need Integer, found %s", - Index, AcpiUtGetObjectTypeName (ObjDesc))); - return_ACPI_STATUS (AE_BAD_DATA); - } - - UserPrt->SourceIndex = (UINT32) ObjDesc->Integer.Value; - - /* Point to the next ACPI_OPERAND_OBJECT in the top level package */ - - TopObjectList++; - } - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer %p Length %X\n", - OutputBuffer->Pointer, (UINT32) OutputBuffer->Length)); - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiRsCreateAmlResources - * - * PARAMETERS: ResourceList - Pointer to the resource list buffer - * OutputBuffer - Where the AML buffer is returned - * - * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code. - * If the OutputBuffer is too small, the error will be - * AE_BUFFER_OVERFLOW and OutputBuffer->Length will point - * to the size buffer needed. - * - * DESCRIPTION: Converts a list of device resources to an AML bytestream - * to be used as input for the _SRS control method. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiRsCreateAmlResources ( - ACPI_BUFFER *ResourceList, - ACPI_BUFFER *OutputBuffer) -{ - ACPI_STATUS Status; - ACPI_SIZE AmlSizeNeeded = 0; - - - ACPI_FUNCTION_TRACE (RsCreateAmlResources); - - - /* Params already validated, no need to re-validate here */ - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ResourceList Buffer = %p\n", - ResourceList->Pointer)); - - /* Get the buffer size needed for the AML byte stream */ - - Status = AcpiRsGetAmlLength ( - ResourceList->Pointer, ResourceList->Length, &AmlSizeNeeded); - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AmlSizeNeeded=%X, %s\n", - (UINT32) AmlSizeNeeded, AcpiFormatException (Status))); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Validate/Allocate/Clear caller buffer */ - - Status = AcpiUtInitializeBuffer (OutputBuffer, AmlSizeNeeded); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Do the conversion */ - - Status = AcpiRsConvertResourcesToAml (ResourceList->Pointer, - AmlSizeNeeded, OutputBuffer->Pointer); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer %p Length %X\n", - OutputBuffer->Pointer, (UINT32) OutputBuffer->Length)); - return_ACPI_STATUS (AE_OK); -} diff --git a/drivers/acpica/rsdump.c b/drivers/acpica/rsdump.c deleted file mode 100644 index 56933b9..0000000 --- a/drivers/acpica/rsdump.c +++ /dev/null @@ -1,833 +0,0 @@ -/******************************************************************************* - * - * Module Name: rsdump - AML debugger support for resource structures. - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acresrc.h" - -#define _COMPONENT ACPI_RESOURCES - ACPI_MODULE_NAME ("rsdump") - -/* - * All functions in this module are used by the AML Debugger only - */ - -/* Local prototypes */ - -static void -AcpiRsOutString ( - const char *Title, - const char *Value); - -static void -AcpiRsOutInteger8 ( - const char *Title, - UINT8 Value); - -static void -AcpiRsOutInteger16 ( - const char *Title, - UINT16 Value); - -static void -AcpiRsOutInteger32 ( - const char *Title, - UINT32 Value); - -static void -AcpiRsOutInteger64 ( - const char *Title, - UINT64 Value); - -static void -AcpiRsOutTitle ( - const char *Title); - -static void -AcpiRsDumpByteList ( - UINT16 Length, - UINT8 *Data); - -static void -AcpiRsDumpWordList ( - UINT16 Length, - UINT16 *Data); - -static void -AcpiRsDumpDwordList ( - UINT8 Length, - UINT32 *Data); - -static void -AcpiRsDumpShortByteList ( - UINT8 Length, - UINT8 *Data); - -static void -AcpiRsDumpResourceSource ( - ACPI_RESOURCE_SOURCE *ResourceSource); - -static void -AcpiRsDumpResourceLabel ( - char *Title, - ACPI_RESOURCE_LABEL *ResourceLabel); - -static void -AcpiRsDumpAddressCommon ( - ACPI_RESOURCE_DATA *Resource); - -static void -AcpiRsDumpDescriptor ( - void *Resource, - ACPI_RSDUMP_INFO *Table); - - -#ifdef ACPI_DEBUGGER -/******************************************************************************* - * - * FUNCTION: AcpiRsDumpResourceList - * - * PARAMETERS: ResourceList - Pointer to a resource descriptor list - * - * RETURN: None - * - * DESCRIPTION: Dispatches the structure to the correct dump routine. - * - ******************************************************************************/ - -void -AcpiRsDumpResourceList ( - ACPI_RESOURCE *ResourceList) -{ - UINT32 Count = 0; - UINT32 Type; - - - ACPI_FUNCTION_ENTRY (); - - - /* Check if debug output enabled */ - - if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_RESOURCES, _COMPONENT)) - { - return; - } - - /* Walk list and dump all resource descriptors (END_TAG terminates) */ - - do - { - AcpiOsPrintf ("\n[%02X] ", Count); - Count++; - - /* Validate Type before dispatch */ - - Type = ResourceList->Type; - if (Type > ACPI_RESOURCE_TYPE_MAX) - { - AcpiOsPrintf ( - "Invalid descriptor type (%X) in resource list\n", - ResourceList->Type); - return; - } - else if (!ResourceList->Type) - { - ACPI_ERROR ((AE_INFO, "Invalid Zero Resource Type")); - return; - } - - /* Sanity check the length. It must not be zero, or we loop forever */ - - if (!ResourceList->Length) - { - AcpiOsPrintf ( - "Invalid zero length descriptor in resource list\n"); - return; - } - - /* Dump the resource descriptor */ - - if (Type == ACPI_RESOURCE_TYPE_SERIAL_BUS) - { - AcpiRsDumpDescriptor (&ResourceList->Data, - AcpiGbl_DumpSerialBusDispatch[ - ResourceList->Data.CommonSerialBus.Type]); - } - else - { - AcpiRsDumpDescriptor (&ResourceList->Data, - AcpiGbl_DumpResourceDispatch[Type]); - } - - /* Point to the next resource structure */ - - ResourceList = ACPI_NEXT_RESOURCE (ResourceList); - - /* Exit when END_TAG descriptor is reached */ - - } while (Type != ACPI_RESOURCE_TYPE_END_TAG); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiRsDumpIrqList - * - * PARAMETERS: RouteTable - Pointer to the routing table to dump. - * - * RETURN: None - * - * DESCRIPTION: Print IRQ routing table - * - ******************************************************************************/ - -void -AcpiRsDumpIrqList ( - UINT8 *RouteTable) -{ - ACPI_PCI_ROUTING_TABLE *PrtElement; - UINT8 Count; - - - ACPI_FUNCTION_ENTRY (); - - - /* Check if debug output enabled */ - - if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_RESOURCES, _COMPONENT)) - { - return; - } - - PrtElement = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, RouteTable); - - /* Dump all table elements, Exit on zero length element */ - - for (Count = 0; PrtElement->Length; Count++) - { - AcpiOsPrintf ("\n[%02X] PCI IRQ Routing Table Package\n", Count); - AcpiRsDumpDescriptor (PrtElement, AcpiRsDumpPrt); - - PrtElement = ACPI_ADD_PTR (ACPI_PCI_ROUTING_TABLE, - PrtElement, PrtElement->Length); - } -} -#endif - -/******************************************************************************* - * - * FUNCTION: AcpiRsDumpDescriptor - * - * PARAMETERS: Resource - Buffer containing the resource - * Table - Table entry to decode the resource - * - * RETURN: None - * - * DESCRIPTION: Dump a resource descriptor based on a dump table entry. - * - ******************************************************************************/ - -static void -AcpiRsDumpDescriptor ( - void *Resource, - ACPI_RSDUMP_INFO *Table) -{ - UINT8 *Target = NULL; - UINT8 *PreviousTarget; - const char *Name; - UINT8 Count; - - - /* First table entry must contain the table length (# of table entries) */ - - Count = Table->Offset; - - while (Count) - { - PreviousTarget = Target; - Target = ACPI_ADD_PTR (UINT8, Resource, Table->Offset); - Name = Table->Name; - - switch (Table->Opcode) - { - case ACPI_RSD_TITLE: - /* - * Optional resource title - */ - if (Table->Name) - { - AcpiOsPrintf ("%s Resource\n", Name); - } - break; - - /* Strings */ - - case ACPI_RSD_LITERAL: - - AcpiRsOutString (Name, ACPI_CAST_PTR (char, Table->Pointer)); - break; - - case ACPI_RSD_STRING: - - AcpiRsOutString (Name, ACPI_CAST_PTR (char, Target)); - break; - - /* Data items, 8/16/32/64 bit */ - - case ACPI_RSD_UINT8: - - if (Table->Pointer) - { - AcpiRsOutString (Name, Table->Pointer [*Target]); - } - else - { - AcpiRsOutInteger8 (Name, ACPI_GET8 (Target)); - } - break; - - case ACPI_RSD_UINT16: - - AcpiRsOutInteger16 (Name, ACPI_GET16 (Target)); - break; - - case ACPI_RSD_UINT32: - - AcpiRsOutInteger32 (Name, ACPI_GET32 (Target)); - break; - - case ACPI_RSD_UINT64: - - AcpiRsOutInteger64 (Name, ACPI_GET64 (Target)); - break; - - /* Flags: 1-bit and 2-bit flags supported */ - - case ACPI_RSD_1BITFLAG: - - AcpiRsOutString (Name, Table->Pointer [*Target & 0x01]); - break; - - case ACPI_RSD_2BITFLAG: - - AcpiRsOutString (Name, Table->Pointer [*Target & 0x03]); - break; - - case ACPI_RSD_3BITFLAG: - - AcpiRsOutString (Name, Table->Pointer [*Target & 0x07]); - break; - - case ACPI_RSD_6BITFLAG: - - AcpiRsOutInteger8 (Name, (ACPI_GET8 (Target) & 0x3F)); - break; - - case ACPI_RSD_SHORTLIST: - /* - * Short byte list (single line output) for DMA and IRQ resources - * Note: The list length is obtained from the previous table entry - */ - if (PreviousTarget) - { - AcpiRsOutTitle (Name); - AcpiRsDumpShortByteList (*PreviousTarget, Target); - } - break; - - case ACPI_RSD_SHORTLISTX: - /* - * Short byte list (single line output) for GPIO vendor data - * Note: The list length is obtained from the previous table entry - */ - if (PreviousTarget) - { - AcpiRsOutTitle (Name); - AcpiRsDumpShortByteList (*PreviousTarget, - *(ACPI_CAST_INDIRECT_PTR (UINT8, Target))); - } - break; - - case ACPI_RSD_LONGLIST: - /* - * Long byte list for Vendor resource data - * Note: The list length is obtained from the previous table entry - */ - if (PreviousTarget) - { - AcpiRsDumpByteList (ACPI_GET16 (PreviousTarget), Target); - } - break; - - case ACPI_RSD_DWORDLIST: - /* - * Dword list for Extended Interrupt resources - * Note: The list length is obtained from the previous table entry - */ - if (PreviousTarget) - { - AcpiRsDumpDwordList (*PreviousTarget, - ACPI_CAST_PTR (UINT32, Target)); - } - break; - - case ACPI_RSD_WORDLIST: - /* - * Word list for GPIO Pin Table - * Note: The list length is obtained from the previous table entry - */ - if (PreviousTarget) - { - AcpiRsDumpWordList (*PreviousTarget, - *(ACPI_CAST_INDIRECT_PTR (UINT16, Target))); - } - break; - - case ACPI_RSD_ADDRESS: - /* - * Common flags for all Address resources - */ - AcpiRsDumpAddressCommon (ACPI_CAST_PTR ( - ACPI_RESOURCE_DATA, Target)); - break; - - case ACPI_RSD_SOURCE: - /* - * Optional ResourceSource for Address resources - */ - AcpiRsDumpResourceSource (ACPI_CAST_PTR ( - ACPI_RESOURCE_SOURCE, Target)); - break; - - case ACPI_RSD_LABEL: - /* - * ResourceLabel - */ - AcpiRsDumpResourceLabel ("Resource Label", ACPI_CAST_PTR ( - ACPI_RESOURCE_LABEL, Target)); - break; - - case ACPI_RSD_SOURCE_LABEL: - /* - * ResourceSourceLabel - */ - AcpiRsDumpResourceLabel ("Resource Source Label", ACPI_CAST_PTR ( - ACPI_RESOURCE_LABEL, Target)); - break; - - default: - - AcpiOsPrintf ("**** Invalid table opcode [%X] ****\n", - Table->Opcode); - return; - } - - Table++; - Count--; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiRsDumpResourceSource - * - * PARAMETERS: ResourceSource - Pointer to a Resource Source struct - * - * RETURN: None - * - * DESCRIPTION: Common routine for dumping the optional ResourceSource and the - * corresponding ResourceSourceIndex. - * - ******************************************************************************/ - -static void -AcpiRsDumpResourceSource ( - ACPI_RESOURCE_SOURCE *ResourceSource) -{ - ACPI_FUNCTION_ENTRY (); - - - if (ResourceSource->Index == 0xFF) - { - return; - } - - AcpiRsOutInteger8 ("Resource Source Index", - ResourceSource->Index); - - AcpiRsOutString ("Resource Source", - ResourceSource->StringPtr ? - ResourceSource->StringPtr : "[Not Specified]"); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiRsDumpResourceLabel - * - * PARAMETERS: Title - Title of the dumped resource field - * ResourceLabel - Pointer to a Resource Label struct - * - * RETURN: None - * - * DESCRIPTION: Common routine for dumping the ResourceLabel - * - ******************************************************************************/ - -static void -AcpiRsDumpResourceLabel ( - char *Title, - ACPI_RESOURCE_LABEL *ResourceLabel) -{ - ACPI_FUNCTION_ENTRY (); - - AcpiRsOutString (Title, - ResourceLabel->StringPtr ? - ResourceLabel->StringPtr : "[Not Specified]"); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiRsDumpAddressCommon - * - * PARAMETERS: Resource - Pointer to an internal resource descriptor - * - * RETURN: None - * - * DESCRIPTION: Dump the fields that are common to all Address resource - * descriptors - * - ******************************************************************************/ - -static void -AcpiRsDumpAddressCommon ( - ACPI_RESOURCE_DATA *Resource) -{ - ACPI_FUNCTION_ENTRY (); - - - /* Decode the type-specific flags */ - - switch (Resource->Address.ResourceType) - { - case ACPI_MEMORY_RANGE: - - AcpiRsDumpDescriptor (Resource, AcpiRsDumpMemoryFlags); - break; - - case ACPI_IO_RANGE: - - AcpiRsDumpDescriptor (Resource, AcpiRsDumpIoFlags); - break; - - case ACPI_BUS_NUMBER_RANGE: - - AcpiRsOutString ("Resource Type", "Bus Number Range"); - break; - - default: - - AcpiRsOutInteger8 ("Resource Type", - (UINT8) Resource->Address.ResourceType); - break; - } - - /* Decode the general flags */ - - AcpiRsDumpDescriptor (Resource, AcpiRsDumpGeneralFlags); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiRsOut* - * - * PARAMETERS: Title - Name of the resource field - * Value - Value of the resource field - * - * RETURN: None - * - * DESCRIPTION: Miscellaneous helper functions to consistently format the - * output of the resource dump routines - * - ******************************************************************************/ - -static void -AcpiRsOutString ( - const char *Title, - const char *Value) -{ - - AcpiOsPrintf ("%27s : %s", Title, Value); - if (!*Value) - { - AcpiOsPrintf ("[NULL NAMESTRING]"); - } - AcpiOsPrintf ("\n"); -} - -static void -AcpiRsOutInteger8 ( - const char *Title, - UINT8 Value) -{ - AcpiOsPrintf ("%27s : %2.2X\n", Title, Value); -} - -static void -AcpiRsOutInteger16 ( - const char *Title, - UINT16 Value) -{ - - AcpiOsPrintf ("%27s : %4.4X\n", Title, Value); -} - -static void -AcpiRsOutInteger32 ( - const char *Title, - UINT32 Value) -{ - - AcpiOsPrintf ("%27s : %8.8X\n", Title, Value); -} - -static void -AcpiRsOutInteger64 ( - const char *Title, - UINT64 Value) -{ - - AcpiOsPrintf ("%27s : %8.8X%8.8X\n", Title, - ACPI_FORMAT_UINT64 (Value)); -} - -static void -AcpiRsOutTitle ( - const char *Title) -{ - - AcpiOsPrintf ("%27s : ", Title); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiRsDump*List - * - * PARAMETERS: Length - Number of elements in the list - * Data - Start of the list - * - * RETURN: None - * - * DESCRIPTION: Miscellaneous functions to dump lists of raw data - * - ******************************************************************************/ - -static void -AcpiRsDumpByteList ( - UINT16 Length, - UINT8 *Data) -{ - UINT16 i; - - - for (i = 0; i < Length; i++) - { - AcpiOsPrintf ("%25s%2.2X : %2.2X\n", "Byte", i, Data[i]); - } -} - -static void -AcpiRsDumpShortByteList ( - UINT8 Length, - UINT8 *Data) -{ - UINT8 i; - - - for (i = 0; i < Length; i++) - { - AcpiOsPrintf ("%X ", Data[i]); - } - - AcpiOsPrintf ("\n"); -} - -static void -AcpiRsDumpDwordList ( - UINT8 Length, - UINT32 *Data) -{ - UINT8 i; - - - for (i = 0; i < Length; i++) - { - AcpiOsPrintf ("%25s%2.2X : %8.8X\n", "Dword", i, Data[i]); - } -} - -static void -AcpiRsDumpWordList ( - UINT16 Length, - UINT16 *Data) -{ - UINT16 i; - - - for (i = 0; i < Length; i++) - { - AcpiOsPrintf ("%25s%2.2X : %4.4X\n", "Word", i, Data[i]); - } -} diff --git a/drivers/acpica/rsdumpinfo.c b/drivers/acpica/rsdumpinfo.c deleted file mode 100644 index 9528d4c..0000000 --- a/drivers/acpica/rsdumpinfo.c +++ /dev/null @@ -1,562 +0,0 @@ -/******************************************************************************* - * - * Module Name: rsdumpinfo - Tables used to display resource descriptors. - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acresrc.h" - -#define _COMPONENT ACPI_RESOURCES - ACPI_MODULE_NAME ("rsdumpinfo") - - -#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUGGER) - - -#define ACPI_RSD_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_RESOURCE_DATA,f) -#define ACPI_PRT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_PCI_ROUTING_TABLE,f) -#define ACPI_RSD_TABLE_SIZE(name) (sizeof(name) / sizeof (ACPI_RSDUMP_INFO)) - - -/******************************************************************************* - * - * Resource Descriptor info tables - * - * Note: The first table entry must be a Title or Literal and must contain - * the table length (number of table entries) - * - ******************************************************************************/ - -ACPI_RSDUMP_INFO AcpiRsDumpIrq[7] = -{ - {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpIrq), "IRQ", NULL}, - {ACPI_RSD_UINT8 , ACPI_RSD_OFFSET (Irq.DescriptorLength), "Descriptor Length", NULL}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Triggering), "Triggering", AcpiGbl_HeDecode}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Polarity), "Polarity", AcpiGbl_LlDecode}, - {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Irq.Shareable), "Sharing", AcpiGbl_ShrDecode}, - {ACPI_RSD_UINT8 , ACPI_RSD_OFFSET (Irq.InterruptCount), "Interrupt Count", NULL}, - {ACPI_RSD_SHORTLIST,ACPI_RSD_OFFSET (Irq.Interrupts[0]), "Interrupt List", NULL} -}; - -ACPI_RSDUMP_INFO AcpiRsDumpDma[6] = -{ - {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpDma), "DMA", NULL}, - {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Dma.Type), "Speed", AcpiGbl_TypDecode}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Dma.BusMaster), "Mastering", AcpiGbl_BmDecode}, - {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Dma.Transfer), "Transfer Type", AcpiGbl_SizDecode}, - {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Dma.ChannelCount), "Channel Count", NULL}, - {ACPI_RSD_SHORTLIST,ACPI_RSD_OFFSET (Dma.Channels[0]), "Channel List", NULL} -}; - -ACPI_RSDUMP_INFO AcpiRsDumpStartDpf[4] = -{ - {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpStartDpf), "Start-Dependent-Functions",NULL}, - {ACPI_RSD_UINT8 , ACPI_RSD_OFFSET (StartDpf.DescriptorLength), "Descriptor Length", NULL}, - {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (StartDpf.CompatibilityPriority), "Compatibility Priority", AcpiGbl_ConfigDecode}, - {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (StartDpf.PerformanceRobustness), "Performance/Robustness", AcpiGbl_ConfigDecode} -}; - -ACPI_RSDUMP_INFO AcpiRsDumpEndDpf[1] = -{ - {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpEndDpf), "End-Dependent-Functions", NULL} -}; - -ACPI_RSDUMP_INFO AcpiRsDumpIo[6] = -{ - {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpIo), "I/O", NULL}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Io.IoDecode), "Address Decoding", AcpiGbl_IoDecode}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Io.Minimum), "Address Minimum", NULL}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Io.Maximum), "Address Maximum", NULL}, - {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Io.Alignment), "Alignment", NULL}, - {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Io.AddressLength), "Address Length", NULL} -}; - -ACPI_RSDUMP_INFO AcpiRsDumpFixedIo[3] = -{ - {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpFixedIo), "Fixed I/O", NULL}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (FixedIo.Address), "Address", NULL}, - {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (FixedIo.AddressLength), "Address Length", NULL} -}; - -ACPI_RSDUMP_INFO AcpiRsDumpVendor[3] = -{ - {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpVendor), "Vendor Specific", NULL}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Vendor.ByteLength), "Length", NULL}, - {ACPI_RSD_LONGLIST, ACPI_RSD_OFFSET (Vendor.ByteData[0]), "Vendor Data", NULL} -}; - -ACPI_RSDUMP_INFO AcpiRsDumpEndTag[1] = -{ - {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpEndTag), "EndTag", NULL} -}; - -ACPI_RSDUMP_INFO AcpiRsDumpMemory24[6] = -{ - {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpMemory24), "24-Bit Memory Range", NULL}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Memory24.WriteProtect), "Write Protect", AcpiGbl_RwDecode}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Memory24.Minimum), "Address Minimum", NULL}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Memory24.Maximum), "Address Maximum", NULL}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Memory24.Alignment), "Alignment", NULL}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Memory24.AddressLength), "Address Length", NULL} -}; - -ACPI_RSDUMP_INFO AcpiRsDumpMemory32[6] = -{ - {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpMemory32), "32-Bit Memory Range", NULL}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Memory32.WriteProtect), "Write Protect", AcpiGbl_RwDecode}, - {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Memory32.Minimum), "Address Minimum", NULL}, - {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Memory32.Maximum), "Address Maximum", NULL}, - {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Memory32.Alignment), "Alignment", NULL}, - {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Memory32.AddressLength), "Address Length", NULL} -}; - -ACPI_RSDUMP_INFO AcpiRsDumpFixedMemory32[4] = -{ - {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpFixedMemory32), "32-Bit Fixed Memory Range",NULL}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (FixedMemory32.WriteProtect), "Write Protect", AcpiGbl_RwDecode}, - {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (FixedMemory32.Address), "Address", NULL}, - {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (FixedMemory32.AddressLength), "Address Length", NULL} -}; - -ACPI_RSDUMP_INFO AcpiRsDumpAddress16[8] = -{ - {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpAddress16), "16-Bit WORD Address Space",NULL}, - {ACPI_RSD_ADDRESS, 0, NULL, NULL}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Address16.Address.Granularity), "Granularity", NULL}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Address16.Address.Minimum), "Address Minimum", NULL}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Address16.Address.Maximum), "Address Maximum", NULL}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Address16.Address.TranslationOffset), - "Translation Offset", NULL}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Address16.Address.AddressLength), "Address Length", NULL}, - {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (Address16.ResourceSource), NULL, NULL} -}; - -ACPI_RSDUMP_INFO AcpiRsDumpAddress32[8] = -{ - {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpAddress32), "32-Bit DWORD Address Space", NULL}, - {ACPI_RSD_ADDRESS, 0, NULL, NULL}, - {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Address32.Address.Granularity), "Granularity", NULL}, - {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Address32.Address.Minimum), "Address Minimum", NULL}, - {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Address32.Address.Maximum), "Address Maximum", NULL}, - {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Address32.Address.TranslationOffset), - "Translation Offset", NULL}, - {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Address32.Address.AddressLength), "Address Length", NULL}, - {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (Address32.ResourceSource), NULL, NULL} -}; - -ACPI_RSDUMP_INFO AcpiRsDumpAddress64[8] = -{ - {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpAddress64), "64-Bit QWORD Address Space", NULL}, - {ACPI_RSD_ADDRESS, 0, NULL, NULL}, - {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (Address64.Address.Granularity), "Granularity", NULL}, - {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (Address64.Address.Minimum), "Address Minimum", NULL}, - {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (Address64.Address.Maximum), "Address Maximum", NULL}, - {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (Address64.Address.TranslationOffset), - "Translation Offset", NULL}, - {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (Address64.Address.AddressLength), "Address Length", NULL}, - {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (Address64.ResourceSource), NULL, NULL} -}; - -ACPI_RSDUMP_INFO AcpiRsDumpExtAddress64[8] = -{ - {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpExtAddress64), "64-Bit Extended Address Space", NULL}, - {ACPI_RSD_ADDRESS, 0, NULL, NULL}, - {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.Address.Granularity), "Granularity", NULL}, - {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.Address.Minimum), "Address Minimum", NULL}, - {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.Address.Maximum), "Address Maximum", NULL}, - {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.Address.TranslationOffset), - "Translation Offset", NULL}, - {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.Address.AddressLength), - "Address Length", NULL}, - {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.TypeSpecific), "Type-Specific Attribute", NULL} -}; - -ACPI_RSDUMP_INFO AcpiRsDumpExtIrq[8] = -{ - {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpExtIrq), "Extended IRQ", NULL}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.ProducerConsumer), "Type", AcpiGbl_ConsumeDecode}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Triggering), "Triggering", AcpiGbl_HeDecode}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Polarity), "Polarity", AcpiGbl_LlDecode}, - {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Shareable), "Sharing", AcpiGbl_ShrDecode}, - {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (ExtendedIrq.ResourceSource), NULL, NULL}, - {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (ExtendedIrq.InterruptCount), "Interrupt Count", NULL}, - {ACPI_RSD_DWORDLIST,ACPI_RSD_OFFSET (ExtendedIrq.Interrupts[0]), "Interrupt List", NULL} -}; - -ACPI_RSDUMP_INFO AcpiRsDumpGenericReg[6] = -{ - {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpGenericReg), "Generic Register", NULL}, - {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (GenericReg.SpaceId), "Space ID", NULL}, - {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (GenericReg.BitWidth), "Bit Width", NULL}, - {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (GenericReg.BitOffset), "Bit Offset", NULL}, - {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (GenericReg.AccessSize), "Access Size", NULL}, - {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (GenericReg.Address), "Address", NULL} -}; - -ACPI_RSDUMP_INFO AcpiRsDumpGpio[16] = -{ - {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpGpio), "GPIO", NULL}, - {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Gpio.RevisionId), "RevisionId", NULL}, - {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Gpio.ConnectionType), "ConnectionType", AcpiGbl_CtDecode}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Gpio.ProducerConsumer), "ProducerConsumer", AcpiGbl_ConsumeDecode}, - {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Gpio.PinConfig), "PinConfig", AcpiGbl_PpcDecode}, - {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Gpio.Shareable), "Sharing", AcpiGbl_ShrDecode}, - {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Gpio.IoRestriction), "IoRestriction", AcpiGbl_IorDecode}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Gpio.Triggering), "Triggering", AcpiGbl_HeDecode}, - {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Gpio.Polarity), "Polarity", AcpiGbl_LlDecode}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Gpio.DriveStrength), "DriveStrength", NULL}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Gpio.DebounceTimeout), "DebounceTimeout", NULL}, - {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (Gpio.ResourceSource), "ResourceSource", NULL}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Gpio.PinTableLength), "PinTableLength", NULL}, - {ACPI_RSD_WORDLIST, ACPI_RSD_OFFSET (Gpio.PinTable), "PinTable", NULL}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Gpio.VendorLength), "VendorLength", NULL}, - {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (Gpio.VendorData), "VendorData", NULL}, -}; - -ACPI_RSDUMP_INFO AcpiRsDumpPinFunction[10] = -{ - {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpPinFunction), "PinFunction", NULL}, - {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (PinFunction.RevisionId), "RevisionId", NULL}, - {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (PinFunction.PinConfig), "PinConfig", AcpiGbl_PpcDecode}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (PinFunction.Shareable), "Sharing", AcpiGbl_ShrDecode}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (PinFunction.FunctionNumber), "FunctionNumber", NULL}, - {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (PinFunction.ResourceSource), "ResourceSource", NULL}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (PinFunction.PinTableLength), "PinTableLength", NULL}, - {ACPI_RSD_WORDLIST, ACPI_RSD_OFFSET (PinFunction.PinTable), "PinTable", NULL}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (PinFunction.VendorLength), "VendorLength", NULL}, - {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (PinFunction.VendorData), "VendorData", NULL}, -}; - -ACPI_RSDUMP_INFO AcpiRsDumpClockInput[7] = -{ - {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpClockInput), "ClockInput", NULL}, - {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (ClockInput.RevisionId), "RevisionId", NULL}, - {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (ClockInput.FrequencyNumerator), "FrequencyNumerator", NULL}, - {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (ClockInput.FrequencyDivisor), "FrequencyDivisor", NULL}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ClockInput.Scale), "Scale", AcpiGbl_ClockInputScale}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ClockInput.Mode), "Mode", AcpiGbl_ClockInputMode}, - {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (ClockInput.ResourceSource), "ResourceSource", NULL}, -}; - -ACPI_RSDUMP_INFO AcpiRsDumpPinConfig[11] = -{ - {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpPinConfig), "PinConfig", NULL}, - {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (PinConfig.RevisionId), "RevisionId", NULL}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (PinConfig.ProducerConsumer), "ProducerConsumer", AcpiGbl_ConsumeDecode}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (PinConfig.Shareable), "Sharing", AcpiGbl_ShrDecode}, - {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (PinConfig.PinConfigType), "PinConfigType", NULL}, - {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (PinConfig.PinConfigValue), "PinConfigValue", NULL}, - {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (PinConfig.ResourceSource), "ResourceSource", NULL}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (PinConfig.PinTableLength), "PinTableLength", NULL}, - {ACPI_RSD_WORDLIST, ACPI_RSD_OFFSET (PinConfig.PinTable), "PinTable", NULL}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (PinConfig.VendorLength), "VendorLength", NULL}, - {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (PinConfig.VendorData), "VendorData", NULL}, -}; - -ACPI_RSDUMP_INFO AcpiRsDumpPinGroup[8] = -{ - {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpPinGroup), "PinGroup", NULL}, - {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (PinGroup.RevisionId), "RevisionId", NULL}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (PinGroup.ProducerConsumer), "ProducerConsumer", AcpiGbl_ConsumeDecode}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (PinGroup.PinTableLength), "PinTableLength", NULL}, - {ACPI_RSD_WORDLIST, ACPI_RSD_OFFSET (PinGroup.PinTable), "PinTable", NULL}, - {ACPI_RSD_LABEL, ACPI_RSD_OFFSET (PinGroup.ResourceLabel), "ResourceLabel", NULL}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (PinGroup.VendorLength), "VendorLength", NULL}, - {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (PinGroup.VendorData), "VendorData", NULL}, -}; - -ACPI_RSDUMP_INFO AcpiRsDumpPinGroupFunction[9] = -{ - {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpPinGroupFunction), "PinGroupFunction", NULL}, - {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (PinGroupFunction.RevisionId), "RevisionId", NULL}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (PinGroupFunction.ProducerConsumer), "ProducerConsumer", AcpiGbl_ConsumeDecode}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (PinGroupFunction.Shareable), "Sharing", AcpiGbl_ShrDecode}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (PinGroupFunction.FunctionNumber), "FunctionNumber", NULL}, - {ACPI_RSD_SOURCE_LABEL, ACPI_RSD_OFFSET (PinGroupFunction.ResourceSourceLabel), "ResourceSourceLabel", NULL}, - {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (PinGroupFunction.ResourceSource), "ResourceSource", NULL}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (PinGroupFunction.VendorLength), "VendorLength", NULL}, - {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (PinGroupFunction.VendorData), "VendorData", NULL}, -}; - -ACPI_RSDUMP_INFO AcpiRsDumpPinGroupConfig[10] = -{ - {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpPinGroupConfig), "PinGroupConfig", NULL}, - {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (PinGroupConfig.RevisionId), "RevisionId", NULL}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (PinGroupConfig.ProducerConsumer), "ProducerConsumer", AcpiGbl_ConsumeDecode}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (PinGroupConfig.Shareable), "Sharing", AcpiGbl_ShrDecode}, - {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (PinGroupConfig.PinConfigType), "PinConfigType", NULL}, - {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (PinGroupConfig.PinConfigValue), "PinConfigValue", NULL}, - {ACPI_RSD_SOURCE_LABEL, ACPI_RSD_OFFSET (PinGroupConfig.ResourceSourceLabel), "ResourceSourceLabel", NULL}, - {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (PinGroupConfig.ResourceSource), "ResourceSource", NULL}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (PinGroupConfig.VendorLength), "VendorLength", NULL}, - {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (PinGroupConfig.VendorData), "VendorData", NULL}, -}; - -ACPI_RSDUMP_INFO AcpiRsDumpFixedDma[4] = -{ - {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpFixedDma), "FixedDma", NULL}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (FixedDma.RequestLines), "RequestLines", NULL}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (FixedDma.Channels), "Channels", NULL}, - {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (FixedDma.Width), "TransferWidth", AcpiGbl_DtsDecode}, -}; - -#define ACPI_RS_DUMP_COMMON_SERIAL_BUS \ - {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (CommonSerialBus.RevisionId), "RevisionId", NULL}, \ - {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (CommonSerialBus.Type), "Type", AcpiGbl_SbtDecode}, \ - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (CommonSerialBus.ProducerConsumer), "ProducerConsumer", AcpiGbl_ConsumeDecode}, \ - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (CommonSerialBus.SlaveMode), "SlaveMode", AcpiGbl_SmDecode}, \ - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (CommonSerialBus.ConnectionSharing),"ConnectionSharing", AcpiGbl_ShrDecode}, \ - {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (CommonSerialBus.TypeRevisionId), "TypeRevisionId", NULL}, \ - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (CommonSerialBus.TypeDataLength), "TypeDataLength", NULL}, \ - {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (CommonSerialBus.ResourceSource), "ResourceSource", NULL}, \ - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (CommonSerialBus.VendorLength), "VendorLength", NULL}, \ - {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (CommonSerialBus.VendorData), "VendorData", NULL}, - -ACPI_RSDUMP_INFO AcpiRsDumpCommonSerialBus[11] = -{ - {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpCommonSerialBus), "Common Serial Bus", NULL}, - ACPI_RS_DUMP_COMMON_SERIAL_BUS -}; - -ACPI_RSDUMP_INFO AcpiRsDumpCsi2SerialBus[11] = -{ - {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpCsi2SerialBus), "Camera Serial Bus", NULL}, - {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Csi2SerialBus.RevisionId), "RevisionId", NULL}, - {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Csi2SerialBus.Type), "Type", AcpiGbl_SbtDecode}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Csi2SerialBus.ProducerConsumer), "ProducerConsumer", AcpiGbl_ConsumeDecode}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Csi2SerialBus.SlaveMode), "SlaveMode", AcpiGbl_SmDecode}, - {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Csi2SerialBus.PhyType), "PhyType", AcpiGbl_PhyDecode}, - {ACPI_RSD_6BITFLAG, ACPI_RSD_OFFSET (Csi2SerialBus.LocalPortInstance), "LocalPortInstance", NULL}, - {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Csi2SerialBus.TypeRevisionId), "TypeRevisionId", NULL}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Csi2SerialBus.VendorLength), "VendorLength", NULL}, - {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (Csi2SerialBus.VendorData), "VendorData", NULL}, - {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (Csi2SerialBus.ResourceSource), "ResourceSource", NULL}, -}; - -ACPI_RSDUMP_INFO AcpiRsDumpI2cSerialBus[14] = -{ - {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpI2cSerialBus), "I2C Serial Bus", NULL}, - ACPI_RS_DUMP_COMMON_SERIAL_BUS - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (I2cSerialBus.AccessMode), "AccessMode", AcpiGbl_AmDecode}, - {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (I2cSerialBus.ConnectionSpeed), "ConnectionSpeed", NULL}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (I2cSerialBus.SlaveAddress), "SlaveAddress", NULL}, -}; - -ACPI_RSDUMP_INFO AcpiRsDumpSpiSerialBus[18] = -{ - {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpSpiSerialBus), "Spi Serial Bus", NULL}, - ACPI_RS_DUMP_COMMON_SERIAL_BUS - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (SpiSerialBus.WireMode), "WireMode", AcpiGbl_WmDecode}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (SpiSerialBus.DevicePolarity), "DevicePolarity", AcpiGbl_DpDecode}, - {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (SpiSerialBus.DataBitLength), "DataBitLength", NULL}, - {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (SpiSerialBus.ClockPhase), "ClockPhase", AcpiGbl_CphDecode}, - {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (SpiSerialBus.ClockPolarity), "ClockPolarity", AcpiGbl_CpoDecode}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (SpiSerialBus.DeviceSelection), "DeviceSelection", NULL}, - {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (SpiSerialBus.ConnectionSpeed), "ConnectionSpeed", NULL}, -}; - -ACPI_RSDUMP_INFO AcpiRsDumpUartSerialBus[20] = -{ - {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpUartSerialBus), "Uart Serial Bus", NULL}, - ACPI_RS_DUMP_COMMON_SERIAL_BUS - {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (UartSerialBus.FlowControl), "FlowControl", AcpiGbl_FcDecode}, - {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (UartSerialBus.StopBits), "StopBits", AcpiGbl_SbDecode}, - {ACPI_RSD_3BITFLAG, ACPI_RSD_OFFSET (UartSerialBus.DataBits), "DataBits", AcpiGbl_BpbDecode}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (UartSerialBus.Endian), "Endian", AcpiGbl_EdDecode}, - {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (UartSerialBus.Parity), "Parity", AcpiGbl_PtDecode}, - {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (UartSerialBus.LinesEnabled), "LinesEnabled", NULL}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (UartSerialBus.RxFifoSize), "RxFifoSize", NULL}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (UartSerialBus.TxFifoSize), "TxFifoSize", NULL}, - {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (UartSerialBus.DefaultBaudRate), "ConnectionSpeed", NULL}, -}; - -/* - * Tables used for common address descriptor flag fields - */ -ACPI_RSDUMP_INFO AcpiRsDumpGeneralFlags[5] = -{ - {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpGeneralFlags), NULL, NULL}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.ProducerConsumer), "Consumer/Producer", AcpiGbl_ConsumeDecode}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Decode), "Address Decode", AcpiGbl_DecDecode}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.MinAddressFixed), "Min Relocatability", AcpiGbl_MinDecode}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.MaxAddressFixed), "Max Relocatability", AcpiGbl_MaxDecode} -}; - -ACPI_RSDUMP_INFO AcpiRsDumpMemoryFlags[5] = -{ - {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE (AcpiRsDumpMemoryFlags), "Resource Type", (void *) "Memory Range"}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.WriteProtect), "Write Protect", AcpiGbl_RwDecode}, - {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.Caching), "Caching", AcpiGbl_MemDecode}, - {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.RangeType), "Range Type", AcpiGbl_MtpDecode}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.Translation), "Translation", AcpiGbl_TtpDecode} -}; - -ACPI_RSDUMP_INFO AcpiRsDumpIoFlags[4] = -{ - {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE (AcpiRsDumpIoFlags), "Resource Type", (void *) "I/O Range"}, - {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.RangeType), "Range Type", AcpiGbl_RngDecode}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.Translation), "Translation", AcpiGbl_TtpDecode}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.TranslationType), "Translation Type", AcpiGbl_TrsDecode} -}; - - -/* - * Table used to dump _PRT contents - */ -ACPI_RSDUMP_INFO AcpiRsDumpPrt[5] = -{ - {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpPrt), NULL, NULL}, - {ACPI_RSD_UINT64, ACPI_PRT_OFFSET (Address), "Address", NULL}, - {ACPI_RSD_UINT32, ACPI_PRT_OFFSET (Pin), "Pin", NULL}, - {ACPI_RSD_STRING, ACPI_PRT_OFFSET (Source[0]), "Source", NULL}, - {ACPI_RSD_UINT32, ACPI_PRT_OFFSET (SourceIndex), "Source Index", NULL} -}; - -#endif diff --git a/drivers/acpica/rsinfo.c b/drivers/acpica/rsinfo.c deleted file mode 100644 index f8d51c0..0000000 --- a/drivers/acpica/rsinfo.c +++ /dev/null @@ -1,404 +0,0 @@ -/******************************************************************************* - * - * Module Name: rsinfo - Dispatch and Info tables - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acresrc.h" - -#define _COMPONENT ACPI_RESOURCES - ACPI_MODULE_NAME ("rsinfo") - -/* - * Resource dispatch and information tables. Any new resource types (either - * Large or Small) must be reflected in each of these tables, so they are here - * in one place. - * - * The tables for Large descriptors are indexed by bits 6:0 of the AML - * descriptor type byte. The tables for Small descriptors are indexed by - * bits 6:3 of the descriptor byte. The tables for internal resource - * descriptors are indexed by the ACPI_RESOURCE_TYPE field. - */ - - -/* Dispatch table for resource-to-AML (Set Resource) conversion functions */ - -ACPI_RSCONVERT_INFO *AcpiGbl_SetResourceDispatch[] = -{ - AcpiRsSetIrq, /* 0x00, ACPI_RESOURCE_TYPE_IRQ */ - AcpiRsConvertDma, /* 0x01, ACPI_RESOURCE_TYPE_DMA */ - AcpiRsSetStartDpf, /* 0x02, ACPI_RESOURCE_TYPE_START_DEPENDENT */ - AcpiRsConvertEndDpf, /* 0x03, ACPI_RESOURCE_TYPE_END_DEPENDENT */ - AcpiRsConvertIo, /* 0x04, ACPI_RESOURCE_TYPE_IO */ - AcpiRsConvertFixedIo, /* 0x05, ACPI_RESOURCE_TYPE_FIXED_IO */ - AcpiRsSetVendor, /* 0x06, ACPI_RESOURCE_TYPE_VENDOR */ - AcpiRsConvertEndTag, /* 0x07, ACPI_RESOURCE_TYPE_END_TAG */ - AcpiRsConvertMemory24, /* 0x08, ACPI_RESOURCE_TYPE_MEMORY24 */ - AcpiRsConvertMemory32, /* 0x09, ACPI_RESOURCE_TYPE_MEMORY32 */ - AcpiRsConvertFixedMemory32, /* 0x0A, ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */ - AcpiRsConvertAddress16, /* 0x0B, ACPI_RESOURCE_TYPE_ADDRESS16 */ - AcpiRsConvertAddress32, /* 0x0C, ACPI_RESOURCE_TYPE_ADDRESS32 */ - AcpiRsConvertAddress64, /* 0x0D, ACPI_RESOURCE_TYPE_ADDRESS64 */ - AcpiRsConvertExtAddress64, /* 0x0E, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ - AcpiRsConvertExtIrq, /* 0x0F, ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ - AcpiRsConvertGenericReg, /* 0x10, ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ - AcpiRsConvertGpio, /* 0x11, ACPI_RESOURCE_TYPE_GPIO */ - AcpiRsConvertFixedDma, /* 0x12, ACPI_RESOURCE_TYPE_FIXED_DMA */ - NULL, /* 0x13, ACPI_RESOURCE_TYPE_SERIAL_BUS - Use subtype table below */ - AcpiRsConvertPinFunction, /* 0x14, ACPI_RESOURCE_TYPE_PIN_FUNCTION */ - AcpiRsConvertPinConfig, /* 0x15, ACPI_RESOURCE_TYPE_PIN_CONFIG */ - AcpiRsConvertPinGroup, /* 0x16, ACPI_RESOURCE_TYPE_PIN_GROUP */ - AcpiRsConvertPinGroupFunction, /* 0x17, ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION */ - AcpiRsConvertPinGroupConfig, /* 0x18, ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG */ - AcpiRsConvertClockInput, /* 0x19, ACPI_RESOURCE_TYPE_CLOCK_INPUT */ -}; - -/* Dispatch tables for AML-to-resource (Get Resource) conversion functions */ - -ACPI_RSCONVERT_INFO *AcpiGbl_GetResourceDispatch[] = -{ - /* Small descriptors */ - - NULL, /* 0x00, Reserved */ - NULL, /* 0x01, Reserved */ - NULL, /* 0x02, Reserved */ - NULL, /* 0x03, Reserved */ - AcpiRsGetIrq, /* 0x04, ACPI_RESOURCE_NAME_IRQ */ - AcpiRsConvertDma, /* 0x05, ACPI_RESOURCE_NAME_DMA */ - AcpiRsGetStartDpf, /* 0x06, ACPI_RESOURCE_NAME_START_DEPENDENT */ - AcpiRsConvertEndDpf, /* 0x07, ACPI_RESOURCE_NAME_END_DEPENDENT */ - AcpiRsConvertIo, /* 0x08, ACPI_RESOURCE_NAME_IO */ - AcpiRsConvertFixedIo, /* 0x09, ACPI_RESOURCE_NAME_FIXED_IO */ - AcpiRsConvertFixedDma, /* 0x0A, ACPI_RESOURCE_NAME_FIXED_DMA */ - NULL, /* 0x0B, Reserved */ - NULL, /* 0x0C, Reserved */ - NULL, /* 0x0D, Reserved */ - AcpiRsGetVendorSmall, /* 0x0E, ACPI_RESOURCE_NAME_VENDOR_SMALL */ - AcpiRsConvertEndTag, /* 0x0F, ACPI_RESOURCE_NAME_END_TAG */ - - /* Large descriptors */ - - NULL, /* 0x00, Reserved */ - AcpiRsConvertMemory24, /* 0x01, ACPI_RESOURCE_NAME_MEMORY24 */ - AcpiRsConvertGenericReg, /* 0x02, ACPI_RESOURCE_NAME_GENERIC_REGISTER */ - NULL, /* 0x03, Reserved */ - AcpiRsGetVendorLarge, /* 0x04, ACPI_RESOURCE_NAME_VENDOR_LARGE */ - AcpiRsConvertMemory32, /* 0x05, ACPI_RESOURCE_NAME_MEMORY32 */ - AcpiRsConvertFixedMemory32, /* 0x06, ACPI_RESOURCE_NAME_FIXED_MEMORY32 */ - AcpiRsConvertAddress32, /* 0x07, ACPI_RESOURCE_NAME_ADDRESS32 */ - AcpiRsConvertAddress16, /* 0x08, ACPI_RESOURCE_NAME_ADDRESS16 */ - AcpiRsConvertExtIrq, /* 0x09, ACPI_RESOURCE_NAME_EXTENDED_IRQ */ - AcpiRsConvertAddress64, /* 0x0A, ACPI_RESOURCE_NAME_ADDRESS64 */ - AcpiRsConvertExtAddress64, /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 */ - AcpiRsConvertGpio, /* 0x0C, ACPI_RESOURCE_NAME_GPIO */ - AcpiRsConvertPinFunction, /* 0x0D, ACPI_RESOURCE_NAME_PIN_FUNCTION */ - NULL, /* 0x0E, ACPI_RESOURCE_NAME_SERIAL_BUS - Use subtype table below */ - AcpiRsConvertPinConfig, /* 0x0F, ACPI_RESOURCE_NAME_PIN_CONFIG */ - AcpiRsConvertPinGroup, /* 0x10, ACPI_RESOURCE_NAME_PIN_GROUP */ - AcpiRsConvertPinGroupFunction, /* 0x11, ACPI_RESOURCE_NAME_PIN_GROUP_FUNCTION */ - AcpiRsConvertPinGroupConfig, /* 0x12, ACPI_RESOURCE_NAME_PIN_GROUP_CONFIG */ - AcpiRsConvertClockInput, /* 0x13, ACPI_RESOURCE_NAME_CLOCK_INPUT */ -}; - -/* Subtype table for SerialBus -- I2C, SPI, UART, and CSI2 */ - -ACPI_RSCONVERT_INFO *AcpiGbl_ConvertResourceSerialBusDispatch[] = -{ - NULL, - AcpiRsConvertI2cSerialBus, - AcpiRsConvertSpiSerialBus, - AcpiRsConvertUartSerialBus, - AcpiRsConvertCsi2SerialBus -}; - - -#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUGGER) - -/* Dispatch table for resource dump functions */ - -ACPI_RSDUMP_INFO *AcpiGbl_DumpResourceDispatch[] = -{ - AcpiRsDumpIrq, /* ACPI_RESOURCE_TYPE_IRQ */ - AcpiRsDumpDma, /* ACPI_RESOURCE_TYPE_DMA */ - AcpiRsDumpStartDpf, /* ACPI_RESOURCE_TYPE_START_DEPENDENT */ - AcpiRsDumpEndDpf, /* ACPI_RESOURCE_TYPE_END_DEPENDENT */ - AcpiRsDumpIo, /* ACPI_RESOURCE_TYPE_IO */ - AcpiRsDumpFixedIo, /* ACPI_RESOURCE_TYPE_FIXED_IO */ - AcpiRsDumpVendor, /* ACPI_RESOURCE_TYPE_VENDOR */ - AcpiRsDumpEndTag, /* ACPI_RESOURCE_TYPE_END_TAG */ - AcpiRsDumpMemory24, /* ACPI_RESOURCE_TYPE_MEMORY24 */ - AcpiRsDumpMemory32, /* ACPI_RESOURCE_TYPE_MEMORY32 */ - AcpiRsDumpFixedMemory32, /* ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */ - AcpiRsDumpAddress16, /* ACPI_RESOURCE_TYPE_ADDRESS16 */ - AcpiRsDumpAddress32, /* ACPI_RESOURCE_TYPE_ADDRESS32 */ - AcpiRsDumpAddress64, /* ACPI_RESOURCE_TYPE_ADDRESS64 */ - AcpiRsDumpExtAddress64, /* ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ - AcpiRsDumpExtIrq, /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ - AcpiRsDumpGenericReg, /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ - AcpiRsDumpGpio, /* ACPI_RESOURCE_TYPE_GPIO */ - AcpiRsDumpFixedDma, /* ACPI_RESOURCE_TYPE_FIXED_DMA */ - NULL, /* ACPI_RESOURCE_TYPE_SERIAL_BUS */ - AcpiRsDumpPinFunction, /* ACPI_RESOURCE_TYPE_PIN_FUNCTION */ - AcpiRsDumpPinConfig, /* ACPI_RESOURCE_TYPE_PIN_CONFIG */ - AcpiRsDumpPinGroup, /* ACPI_RESOURCE_TYPE_PIN_GROUP */ - AcpiRsDumpPinGroupFunction, /* ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION */ - AcpiRsDumpPinGroupConfig, /* ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG */ - AcpiRsDumpClockInput, /* ACPI_RESOURCE_TYPE_CLOCK_INPUT */ -}; - -ACPI_RSDUMP_INFO *AcpiGbl_DumpSerialBusDispatch[] = -{ - NULL, - AcpiRsDumpI2cSerialBus, /* AML_RESOURCE_I2C_BUS_TYPE */ - AcpiRsDumpSpiSerialBus, /* AML_RESOURCE_SPI_BUS_TYPE */ - AcpiRsDumpUartSerialBus, /* AML_RESOURCE_UART_BUS_TYPE */ - AcpiRsDumpCsi2SerialBus, /* AML_RESOURCE_CSI2_BUS_TYPE */ -}; -#endif - - -/* - * Base sizes for external AML resource descriptors, indexed by internal type. - * Includes size of the descriptor header (1 byte for small descriptors, - * 3 bytes for large descriptors) - */ -const UINT8 AcpiGbl_AmlResourceSizes[] = -{ - sizeof (AML_RESOURCE_IRQ), /* ACPI_RESOURCE_TYPE_IRQ (optional Byte 3 always created) */ - sizeof (AML_RESOURCE_DMA), /* ACPI_RESOURCE_TYPE_DMA */ - sizeof (AML_RESOURCE_START_DEPENDENT), /* ACPI_RESOURCE_TYPE_START_DEPENDENT (optional Byte 1 always created) */ - sizeof (AML_RESOURCE_END_DEPENDENT), /* ACPI_RESOURCE_TYPE_END_DEPENDENT */ - sizeof (AML_RESOURCE_IO), /* ACPI_RESOURCE_TYPE_IO */ - sizeof (AML_RESOURCE_FIXED_IO), /* ACPI_RESOURCE_TYPE_FIXED_IO */ - sizeof (AML_RESOURCE_VENDOR_SMALL), /* ACPI_RESOURCE_TYPE_VENDOR */ - sizeof (AML_RESOURCE_END_TAG), /* ACPI_RESOURCE_TYPE_END_TAG */ - sizeof (AML_RESOURCE_MEMORY24), /* ACPI_RESOURCE_TYPE_MEMORY24 */ - sizeof (AML_RESOURCE_MEMORY32), /* ACPI_RESOURCE_TYPE_MEMORY32 */ - sizeof (AML_RESOURCE_FIXED_MEMORY32), /* ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */ - sizeof (AML_RESOURCE_ADDRESS16), /* ACPI_RESOURCE_TYPE_ADDRESS16 */ - sizeof (AML_RESOURCE_ADDRESS32), /* ACPI_RESOURCE_TYPE_ADDRESS32 */ - sizeof (AML_RESOURCE_ADDRESS64), /* ACPI_RESOURCE_TYPE_ADDRESS64 */ - sizeof (AML_RESOURCE_EXTENDED_ADDRESS64),/*ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ - sizeof (AML_RESOURCE_EXTENDED_IRQ), /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ - sizeof (AML_RESOURCE_GENERIC_REGISTER), /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ - sizeof (AML_RESOURCE_GPIO), /* ACPI_RESOURCE_TYPE_GPIO */ - sizeof (AML_RESOURCE_FIXED_DMA), /* ACPI_RESOURCE_TYPE_FIXED_DMA */ - sizeof (AML_RESOURCE_COMMON_SERIALBUS), /* ACPI_RESOURCE_TYPE_SERIAL_BUS */ - sizeof (AML_RESOURCE_PIN_FUNCTION), /* ACPI_RESOURCE_TYPE_PIN_FUNCTION */ - sizeof (AML_RESOURCE_PIN_CONFIG), /* ACPI_RESOURCE_TYPE_PIN_CONFIG */ - sizeof (AML_RESOURCE_PIN_GROUP), /* ACPI_RESOURCE_TYPE_PIN_GROUP */ - sizeof (AML_RESOURCE_PIN_GROUP_FUNCTION), /* ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION */ - sizeof (AML_RESOURCE_PIN_GROUP_CONFIG), /* ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG */ - sizeof (AML_RESOURCE_CLOCK_INPUT), /* ACPI_RESOURCE_TYPE_CLOCK_INPUT */ -}; - - -const UINT8 AcpiGbl_ResourceStructSizes[] = -{ - /* Small descriptors */ - - 0, - 0, - 0, - 0, - ACPI_RS_SIZE (ACPI_RESOURCE_IRQ), - ACPI_RS_SIZE (ACPI_RESOURCE_DMA), - ACPI_RS_SIZE (ACPI_RESOURCE_START_DEPENDENT), - ACPI_RS_SIZE_MIN, - ACPI_RS_SIZE (ACPI_RESOURCE_IO), - ACPI_RS_SIZE (ACPI_RESOURCE_FIXED_IO), - ACPI_RS_SIZE (ACPI_RESOURCE_FIXED_DMA), - 0, - 0, - 0, - ACPI_RS_SIZE (ACPI_RESOURCE_VENDOR), - ACPI_RS_SIZE_MIN, - - /* Large descriptors */ - - 0, - ACPI_RS_SIZE (ACPI_RESOURCE_MEMORY24), - ACPI_RS_SIZE (ACPI_RESOURCE_GENERIC_REGISTER), - 0, - ACPI_RS_SIZE (ACPI_RESOURCE_VENDOR), - ACPI_RS_SIZE (ACPI_RESOURCE_MEMORY32), - ACPI_RS_SIZE (ACPI_RESOURCE_FIXED_MEMORY32), - ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS32), - ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS16), - ACPI_RS_SIZE (ACPI_RESOURCE_EXTENDED_IRQ), - ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS64), - ACPI_RS_SIZE (ACPI_RESOURCE_EXTENDED_ADDRESS64), - ACPI_RS_SIZE (ACPI_RESOURCE_GPIO), - ACPI_RS_SIZE (ACPI_RESOURCE_PIN_FUNCTION), - ACPI_RS_SIZE (ACPI_RESOURCE_COMMON_SERIALBUS), - ACPI_RS_SIZE (ACPI_RESOURCE_PIN_CONFIG), - ACPI_RS_SIZE (ACPI_RESOURCE_PIN_GROUP), - ACPI_RS_SIZE (ACPI_RESOURCE_PIN_GROUP_FUNCTION), - ACPI_RS_SIZE (ACPI_RESOURCE_PIN_GROUP_CONFIG), - ACPI_RS_SIZE (ACPI_RESOURCE_CLOCK_INPUT), -}; - -const UINT8 AcpiGbl_AmlResourceSerialBusSizes[] = -{ - 0, - sizeof (AML_RESOURCE_I2C_SERIALBUS), - sizeof (AML_RESOURCE_SPI_SERIALBUS), - sizeof (AML_RESOURCE_UART_SERIALBUS), - sizeof (AML_RESOURCE_CSI2_SERIALBUS), -}; - -const UINT8 AcpiGbl_ResourceStructSerialBusSizes[] = -{ - 0, - ACPI_RS_SIZE (ACPI_RESOURCE_I2C_SERIALBUS), - ACPI_RS_SIZE (ACPI_RESOURCE_SPI_SERIALBUS), - ACPI_RS_SIZE (ACPI_RESOURCE_UART_SERIALBUS), - ACPI_RS_SIZE (ACPI_RESOURCE_CSI2_SERIALBUS), -}; diff --git a/drivers/acpica/rsio.c b/drivers/acpica/rsio.c deleted file mode 100644 index cfb078e..0000000 --- a/drivers/acpica/rsio.c +++ /dev/null @@ -1,408 +0,0 @@ -/******************************************************************************* - * - * Module Name: rsio - IO and DMA resource descriptors - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acresrc.h" - -#define _COMPONENT ACPI_RESOURCES - ACPI_MODULE_NAME ("rsio") - - -/******************************************************************************* - * - * AcpiRsConvertIo - * - ******************************************************************************/ - -ACPI_RSCONVERT_INFO AcpiRsConvertIo[5] = -{ - {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_IO, - ACPI_RS_SIZE (ACPI_RESOURCE_IO), - ACPI_RSC_TABLE_SIZE (AcpiRsConvertIo)}, - - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_IO, - sizeof (AML_RESOURCE_IO), - 0}, - - /* Decode flag */ - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Io.IoDecode), - AML_OFFSET (Io.Flags), - 0}, - /* - * These fields are contiguous in both the source and destination: - * Address Alignment - * Length - * Minimum Base Address - * Maximum Base Address - */ - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.Io.Alignment), - AML_OFFSET (Io.Alignment), - 2}, - - {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.Io.Minimum), - AML_OFFSET (Io.Minimum), - 2} -}; - - -/******************************************************************************* - * - * AcpiRsConvertFixedIo - * - ******************************************************************************/ - -ACPI_RSCONVERT_INFO AcpiRsConvertFixedIo[4] = -{ - {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_FIXED_IO, - ACPI_RS_SIZE (ACPI_RESOURCE_FIXED_IO), - ACPI_RSC_TABLE_SIZE (AcpiRsConvertFixedIo)}, - - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_FIXED_IO, - sizeof (AML_RESOURCE_FIXED_IO), - 0}, - /* - * These fields are contiguous in both the source and destination: - * Base Address - * Length - */ - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.FixedIo.AddressLength), - AML_OFFSET (FixedIo.AddressLength), - 1}, - - {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.FixedIo.Address), - AML_OFFSET (FixedIo.Address), - 1} -}; - - -/******************************************************************************* - * - * AcpiRsConvertGenericReg - * - ******************************************************************************/ - -ACPI_RSCONVERT_INFO AcpiRsConvertGenericReg[4] = -{ - {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_GENERIC_REGISTER, - ACPI_RS_SIZE (ACPI_RESOURCE_GENERIC_REGISTER), - ACPI_RSC_TABLE_SIZE (AcpiRsConvertGenericReg)}, - - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_GENERIC_REGISTER, - sizeof (AML_RESOURCE_GENERIC_REGISTER), - 0}, - /* - * These fields are contiguous in both the source and destination: - * Address Space ID - * Register Bit Width - * Register Bit Offset - * Access Size - */ - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.GenericReg.SpaceId), - AML_OFFSET (GenericReg.AddressSpaceId), - 4}, - - /* Get the Register Address */ - - {ACPI_RSC_MOVE64, ACPI_RS_OFFSET (Data.GenericReg.Address), - AML_OFFSET (GenericReg.Address), - 1} -}; - - -/******************************************************************************* - * - * AcpiRsConvertEndDpf - * - ******************************************************************************/ - -ACPI_RSCONVERT_INFO AcpiRsConvertEndDpf[2] = -{ - {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_END_DEPENDENT, - ACPI_RS_SIZE_MIN, - ACPI_RSC_TABLE_SIZE (AcpiRsConvertEndDpf)}, - - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_END_DEPENDENT, - sizeof (AML_RESOURCE_END_DEPENDENT), - 0} -}; - - -/******************************************************************************* - * - * AcpiRsConvertEndTag - * - ******************************************************************************/ - -ACPI_RSCONVERT_INFO AcpiRsConvertEndTag[2] = -{ - {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_END_TAG, - ACPI_RS_SIZE_MIN, - ACPI_RSC_TABLE_SIZE (AcpiRsConvertEndTag)}, - - /* - * Note: The checksum field is set to zero, meaning that the resource - * data is treated as if the checksum operation succeeded. - * (ACPI Spec 1.0b Section 6.4.2.8) - */ - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_END_TAG, - sizeof (AML_RESOURCE_END_TAG), - 0} -}; - - -/******************************************************************************* - * - * AcpiRsGetStartDpf - * - ******************************************************************************/ - -ACPI_RSCONVERT_INFO AcpiRsGetStartDpf[6] = -{ - {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_START_DEPENDENT, - ACPI_RS_SIZE (ACPI_RESOURCE_START_DEPENDENT), - ACPI_RSC_TABLE_SIZE (AcpiRsGetStartDpf)}, - - /* Defaults for Compatibility and Performance priorities */ - - {ACPI_RSC_SET8, ACPI_RS_OFFSET (Data.StartDpf.CompatibilityPriority), - ACPI_ACCEPTABLE_CONFIGURATION, - 2}, - - /* Get the descriptor length (0 or 1 for Start Dpf descriptor) */ - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.StartDpf.DescriptorLength), - AML_OFFSET (StartDpf.DescriptorType), - 0}, - - /* All done if there is no flag byte present in the descriptor */ - - {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_AML_LENGTH, 0, 1}, - - /* Flag byte is present, get the flags */ - - {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.StartDpf.CompatibilityPriority), - AML_OFFSET (StartDpf.Flags), - 0}, - - {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.StartDpf.PerformanceRobustness), - AML_OFFSET (StartDpf.Flags), - 2} -}; - - -/******************************************************************************* - * - * AcpiRsSetStartDpf - * - ******************************************************************************/ - -ACPI_RSCONVERT_INFO AcpiRsSetStartDpf[10] = -{ - /* Start with a default descriptor of length 1 */ - - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_START_DEPENDENT, - sizeof (AML_RESOURCE_START_DEPENDENT), - ACPI_RSC_TABLE_SIZE (AcpiRsSetStartDpf)}, - - /* Set the default flag values */ - - {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.StartDpf.CompatibilityPriority), - AML_OFFSET (StartDpf.Flags), - 0}, - - {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.StartDpf.PerformanceRobustness), - AML_OFFSET (StartDpf.Flags), - 2}, - /* - * All done if the output descriptor length is required to be 1 - * (i.e., optimization to 0 bytes cannot be attempted) - */ - {ACPI_RSC_EXIT_EQ, ACPI_RSC_COMPARE_VALUE, - ACPI_RS_OFFSET(Data.StartDpf.DescriptorLength), - 1}, - - /* Set length to 0 bytes (no flags byte) */ - - {ACPI_RSC_LENGTH, 0, 0, sizeof (AML_RESOURCE_START_DEPENDENT_NOPRIO)}, - - /* - * All done if the output descriptor length is required to be 0. - * - * TBD: Perhaps we should check for error if input flags are not - * compatible with a 0-byte descriptor. - */ - {ACPI_RSC_EXIT_EQ, ACPI_RSC_COMPARE_VALUE, - ACPI_RS_OFFSET(Data.StartDpf.DescriptorLength), - 0}, - - /* Reset length to 1 byte (descriptor with flags byte) */ - - {ACPI_RSC_LENGTH, 0, 0, sizeof (AML_RESOURCE_START_DEPENDENT)}, - - - /* - * All done if flags byte is necessary -- if either priority value - * is not ACPI_ACCEPTABLE_CONFIGURATION - */ - {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE, - ACPI_RS_OFFSET (Data.StartDpf.CompatibilityPriority), - ACPI_ACCEPTABLE_CONFIGURATION}, - - {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE, - ACPI_RS_OFFSET (Data.StartDpf.PerformanceRobustness), - ACPI_ACCEPTABLE_CONFIGURATION}, - - /* Flag byte is not necessary */ - - {ACPI_RSC_LENGTH, 0, 0, sizeof (AML_RESOURCE_START_DEPENDENT_NOPRIO)} -}; diff --git a/drivers/acpica/rsirq.c b/drivers/acpica/rsirq.c deleted file mode 100644 index ddf9647..0000000 --- a/drivers/acpica/rsirq.c +++ /dev/null @@ -1,426 +0,0 @@ -/******************************************************************************* - * - * Module Name: rsirq - IRQ resource descriptors - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acresrc.h" - -#define _COMPONENT ACPI_RESOURCES - ACPI_MODULE_NAME ("rsirq") - - -/******************************************************************************* - * - * AcpiRsGetIrq - * - ******************************************************************************/ - -ACPI_RSCONVERT_INFO AcpiRsGetIrq[9] = -{ - {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_IRQ, - ACPI_RS_SIZE (ACPI_RESOURCE_IRQ), - ACPI_RSC_TABLE_SIZE (AcpiRsGetIrq)}, - - /* Get the IRQ mask (bytes 1:2) */ - - {ACPI_RSC_BITMASK16,ACPI_RS_OFFSET (Data.Irq.Interrupts[0]), - AML_OFFSET (Irq.IrqMask), - ACPI_RS_OFFSET (Data.Irq.InterruptCount)}, - - /* Set default flags (others are zero) */ - - {ACPI_RSC_SET8, ACPI_RS_OFFSET (Data.Irq.Triggering), - ACPI_EDGE_SENSITIVE, - 1}, - - /* Get the descriptor length (2 or 3 for IRQ descriptor) */ - - {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.Irq.DescriptorLength), - AML_OFFSET (Irq.DescriptorType), - 0}, - - /* All done if no flag byte present in descriptor */ - - {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_AML_LENGTH, 0, 3}, - - /* Get flags: Triggering[0], Polarity[3], Sharing[4], Wake[5] */ - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.Triggering), - AML_OFFSET (Irq.Flags), - 0}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.Polarity), - AML_OFFSET (Irq.Flags), - 3}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.Shareable), - AML_OFFSET (Irq.Flags), - 4}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.WakeCapable), - AML_OFFSET (Irq.Flags), - 5} -}; - - -/******************************************************************************* - * - * AcpiRsSetIrq - * - ******************************************************************************/ - -ACPI_RSCONVERT_INFO AcpiRsSetIrq[14] = -{ - /* Start with a default descriptor of length 3 */ - - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_IRQ, - sizeof (AML_RESOURCE_IRQ), - ACPI_RSC_TABLE_SIZE (AcpiRsSetIrq)}, - - /* Convert interrupt list to 16-bit IRQ bitmask */ - - {ACPI_RSC_BITMASK16,ACPI_RS_OFFSET (Data.Irq.Interrupts[0]), - AML_OFFSET (Irq.IrqMask), - ACPI_RS_OFFSET (Data.Irq.InterruptCount)}, - - /* Set flags: Triggering[0], Polarity[3], Sharing[4], Wake[5] */ - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.Triggering), - AML_OFFSET (Irq.Flags), - 0}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.Polarity), - AML_OFFSET (Irq.Flags), - 3}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.Shareable), - AML_OFFSET (Irq.Flags), - 4}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.WakeCapable), - AML_OFFSET (Irq.Flags), - 5}, - - /* - * All done if the output descriptor length is required to be 3 - * (i.e., optimization to 2 bytes cannot be attempted) - */ - {ACPI_RSC_EXIT_EQ, ACPI_RSC_COMPARE_VALUE, - ACPI_RS_OFFSET(Data.Irq.DescriptorLength), - 3}, - - /* Set length to 2 bytes (no flags byte) */ - - {ACPI_RSC_LENGTH, 0, 0, sizeof (AML_RESOURCE_IRQ_NOFLAGS)}, - - /* - * All done if the output descriptor length is required to be 2. - * - * TBD: Perhaps we should check for error if input flags are not - * compatible with a 2-byte descriptor. - */ - {ACPI_RSC_EXIT_EQ, ACPI_RSC_COMPARE_VALUE, - ACPI_RS_OFFSET(Data.Irq.DescriptorLength), - 2}, - - /* Reset length to 3 bytes (descriptor with flags byte) */ - - {ACPI_RSC_LENGTH, 0, 0, sizeof (AML_RESOURCE_IRQ)}, - - /* - * Check if the flags byte is necessary. Not needed if the flags are: - * ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_HIGH, ACPI_EXCLUSIVE - */ - {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE, - ACPI_RS_OFFSET (Data.Irq.Triggering), - ACPI_EDGE_SENSITIVE}, - - {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE, - ACPI_RS_OFFSET (Data.Irq.Polarity), - ACPI_ACTIVE_HIGH}, - - {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE, - ACPI_RS_OFFSET (Data.Irq.Shareable), - ACPI_EXCLUSIVE}, - - /* We can optimize to a 2-byte IrqNoFlags() descriptor */ - - {ACPI_RSC_LENGTH, 0, 0, sizeof (AML_RESOURCE_IRQ_NOFLAGS)} -}; - - -/******************************************************************************* - * - * AcpiRsConvertExtIrq - * - ******************************************************************************/ - -ACPI_RSCONVERT_INFO AcpiRsConvertExtIrq[10] = -{ - {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_EXTENDED_IRQ, - ACPI_RS_SIZE (ACPI_RESOURCE_EXTENDED_IRQ), - ACPI_RSC_TABLE_SIZE (AcpiRsConvertExtIrq)}, - - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_EXTENDED_IRQ, - sizeof (AML_RESOURCE_EXTENDED_IRQ), - 0}, - - /* - * Flags: Producer/Consumer[0], Triggering[1], Polarity[2], - * Sharing[3], Wake[4] - */ - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.ExtendedIrq.ProducerConsumer), - AML_OFFSET (ExtendedIrq.Flags), - 0}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.ExtendedIrq.Triggering), - AML_OFFSET (ExtendedIrq.Flags), - 1}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.ExtendedIrq.Polarity), - AML_OFFSET (ExtendedIrq.Flags), - 2}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.ExtendedIrq.Shareable), - AML_OFFSET (ExtendedIrq.Flags), - 3}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.ExtendedIrq.WakeCapable), - AML_OFFSET (ExtendedIrq.Flags), - 4}, - - /* IRQ Table length (Byte4) */ - - {ACPI_RSC_COUNT, ACPI_RS_OFFSET (Data.ExtendedIrq.InterruptCount), - AML_OFFSET (ExtendedIrq.InterruptCount), - sizeof (UINT32)}, - - /* Copy every IRQ in the table, each is 32 bits */ - - {ACPI_RSC_MOVE32, ACPI_RS_OFFSET (Data.ExtendedIrq.Interrupts[0]), - AML_OFFSET (ExtendedIrq.Interrupts[0]), - 0}, - - /* Optional ResourceSource (Index and String) */ - - {ACPI_RSC_SOURCEX, ACPI_RS_OFFSET (Data.ExtendedIrq.ResourceSource), - ACPI_RS_OFFSET (Data.ExtendedIrq.Interrupts[0]), - sizeof (AML_RESOURCE_EXTENDED_IRQ)} -}; - - -/******************************************************************************* - * - * AcpiRsConvertDma - * - ******************************************************************************/ - -ACPI_RSCONVERT_INFO AcpiRsConvertDma[6] = -{ - {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_DMA, - ACPI_RS_SIZE (ACPI_RESOURCE_DMA), - ACPI_RSC_TABLE_SIZE (AcpiRsConvertDma)}, - - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_DMA, - sizeof (AML_RESOURCE_DMA), - 0}, - - /* Flags: transfer preference, bus mastering, channel speed */ - - {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.Dma.Transfer), - AML_OFFSET (Dma.Flags), - 0}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Dma.BusMaster), - AML_OFFSET (Dma.Flags), - 2}, - - {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.Dma.Type), - AML_OFFSET (Dma.Flags), - 5}, - - /* DMA channel mask bits */ - - {ACPI_RSC_BITMASK, ACPI_RS_OFFSET (Data.Dma.Channels[0]), - AML_OFFSET (Dma.DmaChannelMask), - ACPI_RS_OFFSET (Data.Dma.ChannelCount)} -}; - - -/******************************************************************************* - * - * AcpiRsConvertFixedDma - * - ******************************************************************************/ - -ACPI_RSCONVERT_INFO AcpiRsConvertFixedDma[4] = -{ - {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_FIXED_DMA, - ACPI_RS_SIZE (ACPI_RESOURCE_FIXED_DMA), - ACPI_RSC_TABLE_SIZE (AcpiRsConvertFixedDma)}, - - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_FIXED_DMA, - sizeof (AML_RESOURCE_FIXED_DMA), - 0}, - - /* - * These fields are contiguous in both the source and destination: - * RequestLines - * Channels - */ - {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.FixedDma.RequestLines), - AML_OFFSET (FixedDma.RequestLines), - 2}, - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.FixedDma.Width), - AML_OFFSET (FixedDma.Width), - 1}, -}; diff --git a/drivers/acpica/rslist.c b/drivers/acpica/rslist.c deleted file mode 100644 index 779f962..0000000 --- a/drivers/acpica/rslist.c +++ /dev/null @@ -1,396 +0,0 @@ -/******************************************************************************* - * - * Module Name: rslist - Linked list utilities - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acresrc.h" - -#define _COMPONENT ACPI_RESOURCES - ACPI_MODULE_NAME ("rslist") - - -/******************************************************************************* - * - * FUNCTION: AcpiRsConvertAmlToResources - * - * PARAMETERS: ACPI_WALK_AML_CALLBACK - * ResourcePtr - Pointer to the buffer that will - * contain the output structures - * - * RETURN: Status - * - * DESCRIPTION: Convert an AML resource to an internal representation of the - * resource that is aligned and easier to access. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiRsConvertAmlToResources ( - UINT8 *Aml, - UINT32 Length, - UINT32 Offset, - UINT8 ResourceIndex, - void **Context) -{ - ACPI_RESOURCE **ResourcePtr = ACPI_CAST_INDIRECT_PTR ( - ACPI_RESOURCE, Context); - ACPI_RESOURCE *Resource; - AML_RESOURCE *AmlResource; - ACPI_RSCONVERT_INFO *ConversionTable; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (RsConvertAmlToResources); - - - /* - * Check that the input buffer and all subsequent pointers into it - * are aligned on a native word boundary. Most important on IA64 - */ - Resource = *ResourcePtr; - if (ACPI_IS_MISALIGNED (Resource)) - { - ACPI_WARNING ((AE_INFO, - "Misaligned resource pointer %p", Resource)); - } - - /* Get the appropriate conversion info table */ - - AmlResource = ACPI_CAST_PTR (AML_RESOURCE, Aml); - - if (AcpiUtGetResourceType (Aml) == - ACPI_RESOURCE_NAME_SERIAL_BUS) - { - if (AmlResource->CommonSerialBus.Type > - AML_RESOURCE_MAX_SERIALBUSTYPE) - { - ConversionTable = NULL; - } - else - { - /* This is an I2C, SPI, UART, or CSI2 SerialBus descriptor */ - - ConversionTable = AcpiGbl_ConvertResourceSerialBusDispatch [ - AmlResource->CommonSerialBus.Type]; - } - } - else - { - ConversionTable = AcpiGbl_GetResourceDispatch[ResourceIndex]; - } - - if (!ConversionTable) - { - ACPI_ERROR ((AE_INFO, - "Invalid/unsupported resource descriptor: Type 0x%2.2X", - ResourceIndex)); - return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); - } - - /* Convert the AML byte stream resource to a local resource struct */ - - Status = AcpiRsConvertAmlToResource ( - Resource, AmlResource, ConversionTable); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Could not convert AML resource (Type 0x%X)", *Aml)); - return_ACPI_STATUS (Status); - } - - if (!Resource->Length) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Zero-length resource returned from RsConvertAmlToResource")); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_RESOURCES, - "Type %.2X, AmlLength %.2X InternalLength %.2X\n", - AcpiUtGetResourceType (Aml), Length, - Resource->Length)); - - /* Point to the next structure in the output buffer */ - - *ResourcePtr = ACPI_NEXT_RESOURCE (Resource); - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiRsConvertResourcesToAml - * - * PARAMETERS: Resource - Pointer to the resource linked list - * AmlSizeNeeded - Calculated size of the byte stream - * needed from calling AcpiRsGetAmlLength() - * The size of the OutputBuffer is - * guaranteed to be >= AmlSizeNeeded - * OutputBuffer - Pointer to the buffer that will - * contain the byte stream - * - * RETURN: Status - * - * DESCRIPTION: Takes the resource linked list and parses it, creating a - * byte stream of resources in the caller's output buffer - * - ******************************************************************************/ - -ACPI_STATUS -AcpiRsConvertResourcesToAml ( - ACPI_RESOURCE *Resource, - ACPI_SIZE AmlSizeNeeded, - UINT8 *OutputBuffer) -{ - UINT8 *Aml = OutputBuffer; - UINT8 *EndAml = OutputBuffer + AmlSizeNeeded; - ACPI_RSCONVERT_INFO *ConversionTable; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (RsConvertResourcesToAml); - - - /* Walk the resource descriptor list, convert each descriptor */ - - while (Aml < EndAml) - { - /* Validate the (internal) Resource Type */ - - if (Resource->Type > ACPI_RESOURCE_TYPE_MAX) - { - ACPI_ERROR ((AE_INFO, - "Invalid descriptor type (0x%X) in resource list", - Resource->Type)); - return_ACPI_STATUS (AE_BAD_DATA); - } - - /* Sanity check the length. It must not be zero, or we loop forever */ - - if (!Resource->Length) - { - ACPI_ERROR ((AE_INFO, - "Invalid zero length descriptor in resource list\n")); - return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); - } - - /* Perform the conversion */ - - if (Resource->Type == ACPI_RESOURCE_TYPE_SERIAL_BUS) - { - if (Resource->Data.CommonSerialBus.Type > - AML_RESOURCE_MAX_SERIALBUSTYPE) - { - ConversionTable = NULL; - } - else - { - /* This is an I2C, SPI, UART or CSI2 SerialBus descriptor */ - - ConversionTable = AcpiGbl_ConvertResourceSerialBusDispatch[ - Resource->Data.CommonSerialBus.Type]; - } - } - else - { - ConversionTable = AcpiGbl_SetResourceDispatch[Resource->Type]; - } - - if (!ConversionTable) - { - ACPI_ERROR ((AE_INFO, - "Invalid/unsupported resource descriptor: Type 0x%2.2X", - Resource->Type)); - return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); - } - - Status = AcpiRsConvertResourceToAml (Resource, - ACPI_CAST_PTR (AML_RESOURCE, Aml), ConversionTable); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Could not convert resource (type 0x%X) to AML", - Resource->Type)); - return_ACPI_STATUS (Status); - } - - /* Perform final sanity check on the new AML resource descriptor */ - - Status = AcpiUtValidateResource ( - NULL, ACPI_CAST_PTR (AML_RESOURCE, Aml), NULL); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Check for end-of-list, normal exit */ - - if (Resource->Type == ACPI_RESOURCE_TYPE_END_TAG) - { - /* An End Tag indicates the end of the input Resource Template */ - - return_ACPI_STATUS (AE_OK); - } - - /* - * Extract the total length of the new descriptor and set the - * Aml to point to the next (output) resource descriptor - */ - Aml += AcpiUtGetDescriptorLength (Aml); - - /* Point to the next input resource descriptor */ - - Resource = ACPI_NEXT_RESOURCE (Resource); - } - - /* Completed buffer, but did not find an EndTag resource descriptor */ - - return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG); -} diff --git a/drivers/acpica/rsmemory.c b/drivers/acpica/rsmemory.c deleted file mode 100644 index d44dffa..0000000 --- a/drivers/acpica/rsmemory.c +++ /dev/null @@ -1,355 +0,0 @@ -/******************************************************************************* - * - * Module Name: rsmem24 - Memory resource descriptors - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acresrc.h" - -#define _COMPONENT ACPI_RESOURCES - ACPI_MODULE_NAME ("rsmemory") - - -/******************************************************************************* - * - * AcpiRsConvertMemory24 - * - ******************************************************************************/ - -ACPI_RSCONVERT_INFO AcpiRsConvertMemory24[4] = -{ - {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_MEMORY24, - ACPI_RS_SIZE (ACPI_RESOURCE_MEMORY24), - ACPI_RSC_TABLE_SIZE (AcpiRsConvertMemory24)}, - - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_MEMORY24, - sizeof (AML_RESOURCE_MEMORY24), - 0}, - - /* Read/Write bit */ - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Memory24.WriteProtect), - AML_OFFSET (Memory24.Flags), - 0}, - /* - * These fields are contiguous in both the source and destination: - * Minimum Base Address - * Maximum Base Address - * Address Base Alignment - * Range Length - */ - {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.Memory24.Minimum), - AML_OFFSET (Memory24.Minimum), - 4} -}; - - -/******************************************************************************* - * - * AcpiRsConvertMemory32 - * - ******************************************************************************/ - -ACPI_RSCONVERT_INFO AcpiRsConvertMemory32[4] = -{ - {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_MEMORY32, - ACPI_RS_SIZE (ACPI_RESOURCE_MEMORY32), - ACPI_RSC_TABLE_SIZE (AcpiRsConvertMemory32)}, - - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_MEMORY32, - sizeof (AML_RESOURCE_MEMORY32), - 0}, - - /* Read/Write bit */ - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Memory32.WriteProtect), - AML_OFFSET (Memory32.Flags), - 0}, - /* - * These fields are contiguous in both the source and destination: - * Minimum Base Address - * Maximum Base Address - * Address Base Alignment - * Range Length - */ - {ACPI_RSC_MOVE32, ACPI_RS_OFFSET (Data.Memory32.Minimum), - AML_OFFSET (Memory32.Minimum), - 4} -}; - - -/******************************************************************************* - * - * AcpiRsConvertFixedMemory32 - * - ******************************************************************************/ - -ACPI_RSCONVERT_INFO AcpiRsConvertFixedMemory32[4] = -{ - {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_FIXED_MEMORY32, - ACPI_RS_SIZE (ACPI_RESOURCE_FIXED_MEMORY32), - ACPI_RSC_TABLE_SIZE (AcpiRsConvertFixedMemory32)}, - - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_FIXED_MEMORY32, - sizeof (AML_RESOURCE_FIXED_MEMORY32), - 0}, - - /* Read/Write bit */ - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.FixedMemory32.WriteProtect), - AML_OFFSET (FixedMemory32.Flags), - 0}, - /* - * These fields are contiguous in both the source and destination: - * Base Address - * Range Length - */ - {ACPI_RSC_MOVE32, ACPI_RS_OFFSET (Data.FixedMemory32.Address), - AML_OFFSET (FixedMemory32.Address), - 2} -}; - - -/******************************************************************************* - * - * AcpiRsGetVendorSmall - * - ******************************************************************************/ - -ACPI_RSCONVERT_INFO AcpiRsGetVendorSmall[3] = -{ - {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_VENDOR, - ACPI_RS_SIZE (ACPI_RESOURCE_VENDOR), - ACPI_RSC_TABLE_SIZE (AcpiRsGetVendorSmall)}, - - /* Length of the vendor data (byte count) */ - - {ACPI_RSC_COUNT16, ACPI_RS_OFFSET (Data.Vendor.ByteLength), - 0, - sizeof (UINT8)}, - - /* Vendor data */ - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.Vendor.ByteData[0]), - sizeof (AML_RESOURCE_SMALL_HEADER), - 0} -}; - - -/******************************************************************************* - * - * AcpiRsGetVendorLarge - * - ******************************************************************************/ - -ACPI_RSCONVERT_INFO AcpiRsGetVendorLarge[3] = -{ - {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_VENDOR, - ACPI_RS_SIZE (ACPI_RESOURCE_VENDOR), - ACPI_RSC_TABLE_SIZE (AcpiRsGetVendorLarge)}, - - /* Length of the vendor data (byte count) */ - - {ACPI_RSC_COUNT16, ACPI_RS_OFFSET (Data.Vendor.ByteLength), - 0, - sizeof (UINT8)}, - - /* Vendor data */ - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.Vendor.ByteData[0]), - sizeof (AML_RESOURCE_LARGE_HEADER), - 0} -}; - - -/******************************************************************************* - * - * AcpiRsSetVendor - * - ******************************************************************************/ - -ACPI_RSCONVERT_INFO AcpiRsSetVendor[7] = -{ - /* Default is a small vendor descriptor */ - - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_VENDOR_SMALL, - sizeof (AML_RESOURCE_SMALL_HEADER), - ACPI_RSC_TABLE_SIZE (AcpiRsSetVendor)}, - - /* Get the length and copy the data */ - - {ACPI_RSC_COUNT16, ACPI_RS_OFFSET (Data.Vendor.ByteLength), - 0, - 0}, - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.Vendor.ByteData[0]), - sizeof (AML_RESOURCE_SMALL_HEADER), - 0}, - - /* - * All done if the Vendor byte length is 7 or less, meaning that it will - * fit within a small descriptor - */ - {ACPI_RSC_EXIT_LE, 0, 0, 7}, - - /* Must create a large vendor descriptor */ - - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_VENDOR_LARGE, - sizeof (AML_RESOURCE_LARGE_HEADER), - 0}, - - {ACPI_RSC_COUNT16, ACPI_RS_OFFSET (Data.Vendor.ByteLength), - 0, - 0}, - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.Vendor.ByteData[0]), - sizeof (AML_RESOURCE_LARGE_HEADER), - 0} -}; diff --git a/drivers/acpica/rsmisc.c b/drivers/acpica/rsmisc.c deleted file mode 100644 index fa256ed..0000000 --- a/drivers/acpica/rsmisc.c +++ /dev/null @@ -1,943 +0,0 @@ -/******************************************************************************* - * - * Module Name: rsmisc - Miscellaneous resource descriptors - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acresrc.h" - -#define _COMPONENT ACPI_RESOURCES - ACPI_MODULE_NAME ("rsmisc") - - -#define INIT_RESOURCE_TYPE(i) i->ResourceOffset -#define INIT_RESOURCE_LENGTH(i) i->AmlOffset -#define INIT_TABLE_LENGTH(i) i->Value - -#define COMPARE_OPCODE(i) i->ResourceOffset -#define COMPARE_TARGET(i) i->AmlOffset -#define COMPARE_VALUE(i) i->Value - - -/******************************************************************************* - * - * FUNCTION: AcpiRsConvertAmlToResource - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Aml - Where the AML descriptor is returned - * Info - Pointer to appropriate conversion table - * - * RETURN: Status - * - * DESCRIPTION: Convert an external AML resource descriptor to the corresponding - * internal resource descriptor - * - ******************************************************************************/ - -ACPI_STATUS -AcpiRsConvertAmlToResource ( - ACPI_RESOURCE *Resource, - AML_RESOURCE *Aml, - ACPI_RSCONVERT_INFO *Info) -{ - ACPI_RS_LENGTH AmlResourceLength; - void *Source; - void *Destination; - char *Target; - UINT8 Count; - UINT8 FlagsMode = FALSE; - UINT16 ItemCount = 0; - UINT16 Temp16 = 0; - - - ACPI_FUNCTION_TRACE (RsConvertAmlToResource); - - - if (!Info) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - if (((ACPI_SIZE) Resource) & 0x3) - { - /* Each internal resource struct is expected to be 32-bit aligned */ - - ACPI_WARNING ((AE_INFO, - "Misaligned resource pointer (get): %p Type 0x%2.2X Length %u", - Resource, Resource->Type, Resource->Length)); - } - - /* Extract the resource Length field (does not include header length) */ - - AmlResourceLength = AcpiUtGetResourceLength (Aml); - - /* - * First table entry must be ACPI_RSC_INITxxx and must contain the - * table length (# of table entries) - */ - Count = INIT_TABLE_LENGTH (Info); - while (Count) - { - Target = NULL; - - /* - * Source is the external AML byte stream buffer, - * destination is the internal resource descriptor - */ - Source = ACPI_ADD_PTR (void, Aml, Info->AmlOffset); - Destination = ACPI_ADD_PTR (void, Resource, Info->ResourceOffset); - - switch (Info->Opcode) - { - case ACPI_RSC_INITGET: - /* - * Get the resource type and the initial (minimum) length - */ - memset (Resource, 0, INIT_RESOURCE_LENGTH (Info)); - Resource->Type = INIT_RESOURCE_TYPE (Info); - Resource->Length = INIT_RESOURCE_LENGTH (Info); - break; - - case ACPI_RSC_INITSET: - break; - - case ACPI_RSC_FLAGINIT: - - FlagsMode = TRUE; - break; - - case ACPI_RSC_1BITFLAG: - /* - * Mask and shift the flag bit - */ - ACPI_SET8 (Destination, - ((ACPI_GET8 (Source) >> Info->Value) & 0x01)); - break; - - case ACPI_RSC_2BITFLAG: - /* - * Mask and shift the flag bits - */ - ACPI_SET8 (Destination, - ((ACPI_GET8 (Source) >> Info->Value) & 0x03)); - break; - - case ACPI_RSC_3BITFLAG: - /* - * Mask and shift the flag bits - */ - ACPI_SET8 (Destination, - ((ACPI_GET8 (Source) >> Info->Value) & 0x07)); - break; - - case ACPI_RSC_6BITFLAG: - /* - * Mask and shift the flag bits - */ - ACPI_SET8 (Destination, - ((ACPI_GET8 (Source) >> Info->Value) & 0x3F)); - break; - - case ACPI_RSC_COUNT: - - ItemCount = ACPI_GET8 (Source); - ACPI_SET8 (Destination, ItemCount); - - Resource->Length = Resource->Length + - (Info->Value * (ItemCount - 1)); - break; - - case ACPI_RSC_COUNT16: - - ItemCount = AmlResourceLength; - ACPI_SET16 (Destination, ItemCount); - - Resource->Length = Resource->Length + - (Info->Value * (ItemCount - 1)); - break; - - case ACPI_RSC_COUNT_GPIO_PIN: - - Target = ACPI_ADD_PTR (void, Aml, Info->Value); - ItemCount = ACPI_GET16 (Target) - ACPI_GET16 (Source); - - Resource->Length = Resource->Length + ItemCount; - ItemCount = ItemCount / 2; - ACPI_SET16 (Destination, ItemCount); - break; - - case ACPI_RSC_COUNT_GPIO_VEN: - - ItemCount = ACPI_GET8 (Source); - ACPI_SET8 (Destination, ItemCount); - - Resource->Length = Resource->Length + (Info->Value * ItemCount); - break; - - case ACPI_RSC_COUNT_GPIO_RES: - /* - * Vendor data is optional (length/offset may both be zero) - * Examine vendor data length field first - */ - Target = ACPI_ADD_PTR (void, Aml, (Info->Value + 2)); - if (ACPI_GET16 (Target)) - { - /* Use vendor offset to get resource source length */ - - Target = ACPI_ADD_PTR (void, Aml, Info->Value); - ItemCount = ACPI_GET16 (Target) - ACPI_GET16 (Source); - } - else - { - /* No vendor data to worry about */ - - ItemCount = Aml->LargeHeader.ResourceLength + - sizeof (AML_RESOURCE_LARGE_HEADER) - - ACPI_GET16 (Source); - } - - Resource->Length = Resource->Length + ItemCount; - ACPI_SET16 (Destination, ItemCount); - break; - - case ACPI_RSC_COUNT_SERIAL_VEN: - - ACPI_MOVE_16_TO_16(&Temp16, Source); - ItemCount = Temp16 - Info->Value; - - Resource->Length = Resource->Length + ItemCount; - ACPI_SET16 (Destination, ItemCount); - break; - - case ACPI_RSC_COUNT_SERIAL_RES: - - ACPI_MOVE_16_TO_16(&Temp16, Source); - ItemCount = (AmlResourceLength + - sizeof (AML_RESOURCE_LARGE_HEADER)) - - Temp16 - Info->Value; - - Resource->Length = Resource->Length + ItemCount; - ACPI_SET16 (Destination, ItemCount); - break; - - case ACPI_RSC_LENGTH: - - Resource->Length = Resource->Length + Info->Value; - break; - - case ACPI_RSC_MOVE8: - case ACPI_RSC_MOVE16: - case ACPI_RSC_MOVE32: - case ACPI_RSC_MOVE64: - /* - * Raw data move. Use the Info value field unless ItemCount has - * been previously initialized via a COUNT opcode - */ - if (Info->Value) - { - ItemCount = Info->Value; - } - AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode); - break; - - case ACPI_RSC_MOVE_GPIO_PIN: - - /* Generate and set the PIN data pointer */ - - Target = (char *) ACPI_ADD_PTR (void, Resource, - (Resource->Length - ItemCount * 2)); - *(UINT16 **) Destination = ACPI_CAST_PTR (UINT16, Target); - - /* Copy the PIN data */ - - Source = ACPI_ADD_PTR (void, Aml, ACPI_GET16 (Source)); - AcpiRsMoveData (Target, Source, ItemCount, Info->Opcode); - break; - - case ACPI_RSC_MOVE_GPIO_RES: - - /* Generate and set the ResourceSource string pointer */ - - Target = (char *) ACPI_ADD_PTR (void, Resource, - (Resource->Length - ItemCount)); - *(UINT8 **) Destination = ACPI_CAST_PTR (UINT8, Target); - - /* Copy the ResourceSource string */ - - Source = ACPI_ADD_PTR (void, Aml, ACPI_GET16 (Source)); - AcpiRsMoveData (Target, Source, ItemCount, Info->Opcode); - break; - - case ACPI_RSC_MOVE_SERIAL_VEN: - - /* Generate and set the Vendor Data pointer */ - - Target = (char *) ACPI_ADD_PTR (void, Resource, - (Resource->Length - ItemCount)); - *(UINT8 **) Destination = ACPI_CAST_PTR (UINT8, Target); - - /* Copy the Vendor Data */ - - Source = ACPI_ADD_PTR (void, Aml, Info->Value); - AcpiRsMoveData (Target, Source, ItemCount, Info->Opcode); - break; - - case ACPI_RSC_MOVE_SERIAL_RES: - - /* Generate and set the ResourceSource string pointer */ - - Target = (char *) ACPI_ADD_PTR (void, Resource, - (Resource->Length - ItemCount)); - *(UINT8 **) Destination = ACPI_CAST_PTR (UINT8, Target); - - /* Copy the ResourceSource string */ - - ACPI_MOVE_16_TO_16 (&Temp16, Source); - Source = ACPI_ADD_PTR ( - void, Aml, (Temp16 + Info->Value)); - AcpiRsMoveData (Target, Source, ItemCount, Info->Opcode); - break; - - case ACPI_RSC_SET8: - - memset (Destination, Info->AmlOffset, Info->Value); - break; - - case ACPI_RSC_DATA8: - - Target = ACPI_ADD_PTR (char, Resource, Info->Value); - memcpy (Destination, Source, ACPI_GET16 (Target)); - break; - - case ACPI_RSC_ADDRESS: - /* - * Common handler for address descriptor flags - */ - if (!AcpiRsGetAddressCommon (Resource, Aml)) - { - return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); - } - break; - - case ACPI_RSC_SOURCE: - /* - * Optional ResourceSource (Index and String) - */ - Resource->Length += - AcpiRsGetResourceSource (AmlResourceLength, Info->Value, - Destination, Aml, NULL); - break; - - case ACPI_RSC_SOURCEX: - /* - * Optional ResourceSource (Index and String). This is the more - * complicated case used by the Interrupt() macro - */ - Target = ACPI_ADD_PTR (char, Resource, - Info->AmlOffset + (ItemCount * 4)); - - Resource->Length += - AcpiRsGetResourceSource (AmlResourceLength, (ACPI_RS_LENGTH) - (((ItemCount - 1) * sizeof (UINT32)) + Info->Value), - Destination, Aml, Target); - break; - - case ACPI_RSC_BITMASK: - /* - * 8-bit encoded bitmask (DMA macro) - */ - ItemCount = AcpiRsDecodeBitmask (ACPI_GET8 (Source), Destination); - if (ItemCount) - { - Resource->Length += (ItemCount - 1); - } - - Target = ACPI_ADD_PTR (char, Resource, Info->Value); - ACPI_SET8 (Target, ItemCount); - break; - - case ACPI_RSC_BITMASK16: - /* - * 16-bit encoded bitmask (IRQ macro) - */ - ACPI_MOVE_16_TO_16 (&Temp16, Source); - - ItemCount = AcpiRsDecodeBitmask (Temp16, Destination); - if (ItemCount) - { - Resource->Length += (ItemCount - 1); - } - - Target = ACPI_ADD_PTR (char, Resource, Info->Value); - ACPI_SET8 (Target, ItemCount); - break; - - case ACPI_RSC_EXIT_NE: - /* - * Control - Exit conversion if not equal - */ - switch (Info->ResourceOffset) - { - case ACPI_RSC_COMPARE_AML_LENGTH: - - if (AmlResourceLength != Info->Value) - { - goto Exit; - } - break; - - case ACPI_RSC_COMPARE_VALUE: - - if (ACPI_GET8 (Source) != Info->Value) - { - goto Exit; - } - break; - - default: - - ACPI_ERROR ((AE_INFO, "Invalid conversion sub-opcode")); - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - break; - - default: - - ACPI_ERROR ((AE_INFO, "Invalid conversion opcode")); - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - Count--; - Info++; - } - -Exit: - if (!FlagsMode) - { - /* Round the resource struct length up to the next boundary (32 or 64) */ - - Resource->Length = (UINT32) - ACPI_ROUND_UP_TO_NATIVE_WORD (Resource->Length); - } - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiRsConvertResourceToAml - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Aml - Where the AML descriptor is returned - * Info - Pointer to appropriate conversion table - * - * RETURN: Status - * - * DESCRIPTION: Convert an internal resource descriptor to the corresponding - * external AML resource descriptor. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiRsConvertResourceToAml ( - ACPI_RESOURCE *Resource, - AML_RESOURCE *Aml, - ACPI_RSCONVERT_INFO *Info) -{ - void *Source = NULL; - void *Destination; - char *Target; - ACPI_RSDESC_SIZE AmlLength = 0; - UINT8 Count; - UINT16 Temp16 = 0; - UINT16 ItemCount = 0; - - - ACPI_FUNCTION_TRACE (RsConvertResourceToAml); - - - if (!Info) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* - * First table entry must be ACPI_RSC_INITxxx and must contain the - * table length (# of table entries) - */ - Count = INIT_TABLE_LENGTH (Info); - - while (Count) - { - /* - * Source is the internal resource descriptor, - * destination is the external AML byte stream buffer - */ - Source = ACPI_ADD_PTR (void, Resource, Info->ResourceOffset); - Destination = ACPI_ADD_PTR (void, Aml, Info->AmlOffset); - - switch (Info->Opcode) - { - case ACPI_RSC_INITSET: - - memset (Aml, 0, INIT_RESOURCE_LENGTH (Info)); - AmlLength = INIT_RESOURCE_LENGTH (Info); - AcpiRsSetResourceHeader ( - INIT_RESOURCE_TYPE (Info), AmlLength, Aml); - break; - - case ACPI_RSC_INITGET: - break; - - case ACPI_RSC_FLAGINIT: - /* - * Clear the flag byte - */ - ACPI_SET8 (Destination, 0); - break; - - case ACPI_RSC_1BITFLAG: - /* - * Mask and shift the flag bit - */ - ACPI_SET_BIT (*ACPI_CAST8 (Destination), (UINT8) - ((ACPI_GET8 (Source) & 0x01) << Info->Value)); - break; - - case ACPI_RSC_2BITFLAG: - /* - * Mask and shift the flag bits - */ - ACPI_SET_BIT (*ACPI_CAST8 (Destination), (UINT8) - ((ACPI_GET8 (Source) & 0x03) << Info->Value)); - break; - - case ACPI_RSC_3BITFLAG: - /* - * Mask and shift the flag bits - */ - ACPI_SET_BIT (*ACPI_CAST8 (Destination), (UINT8) - ((ACPI_GET8 (Source) & 0x07) << Info->Value)); - break; - - case ACPI_RSC_6BITFLAG: - /* - * Mask and shift the flag bits - */ - ACPI_SET_BIT (*ACPI_CAST8 (Destination), (UINT8) - ((ACPI_GET8 (Source) & 0x3F) << Info->Value)); - break; - - case ACPI_RSC_COUNT: - - ItemCount = ACPI_GET8 (Source); - ACPI_SET8 (Destination, ItemCount); - - AmlLength = (UINT16) - (AmlLength + (Info->Value * (ItemCount - 1))); - break; - - case ACPI_RSC_COUNT16: - - ItemCount = ACPI_GET16 (Source); - AmlLength = (UINT16) (AmlLength + ItemCount); - AcpiRsSetResourceLength (AmlLength, Aml); - break; - - case ACPI_RSC_COUNT_GPIO_PIN: - - ItemCount = ACPI_GET16 (Source); - ACPI_SET16 (Destination, AmlLength); - - AmlLength = (UINT16) (AmlLength + ItemCount * 2); - Target = ACPI_ADD_PTR (void, Aml, Info->Value); - ACPI_SET16 (Target, AmlLength); - AcpiRsSetResourceLength (AmlLength, Aml); - break; - - case ACPI_RSC_COUNT_GPIO_VEN: - - ItemCount = ACPI_GET16 (Source); - ACPI_SET16 (Destination, ItemCount); - - AmlLength = (UINT16) ( - AmlLength + (Info->Value * ItemCount)); - AcpiRsSetResourceLength (AmlLength, Aml); - break; - - case ACPI_RSC_COUNT_GPIO_RES: - - /* Set resource source string length */ - - ItemCount = ACPI_GET16 (Source); - ACPI_SET16 (Destination, AmlLength); - - /* Compute offset for the Vendor Data */ - - AmlLength = (UINT16) (AmlLength + ItemCount); - Target = ACPI_ADD_PTR (void, Aml, Info->Value); - - /* Set vendor offset only if there is vendor data */ - - ACPI_SET16 (Target, AmlLength); - - AcpiRsSetResourceLength (AmlLength, Aml); - break; - - case ACPI_RSC_COUNT_SERIAL_VEN: - - ItemCount = ACPI_GET16 (Source); - ACPI_SET16 (Destination, ItemCount + Info->Value); - AmlLength = (UINT16) (AmlLength + ItemCount); - AcpiRsSetResourceLength (AmlLength, Aml); - break; - - case ACPI_RSC_COUNT_SERIAL_RES: - - ItemCount = ACPI_GET16 (Source); - AmlLength = (UINT16) (AmlLength + ItemCount); - AcpiRsSetResourceLength (AmlLength, Aml); - break; - - case ACPI_RSC_LENGTH: - - AcpiRsSetResourceLength (Info->Value, Aml); - break; - - case ACPI_RSC_MOVE8: - case ACPI_RSC_MOVE16: - case ACPI_RSC_MOVE32: - case ACPI_RSC_MOVE64: - - if (Info->Value) - { - ItemCount = Info->Value; - } - AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode); - break; - - case ACPI_RSC_MOVE_GPIO_PIN: - - Destination = (char *) ACPI_ADD_PTR (void, Aml, - ACPI_GET16 (Destination)); - Source = * (UINT16 **) Source; - AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode); - break; - - case ACPI_RSC_MOVE_GPIO_RES: - - /* Used for both ResourceSource string and VendorData */ - - Destination = (char *) ACPI_ADD_PTR (void, Aml, - ACPI_GET16 (Destination)); - Source = * (UINT8 **) Source; - AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode); - break; - - case ACPI_RSC_MOVE_SERIAL_VEN: - - Destination = (char *) ACPI_ADD_PTR (void, Aml, - (AmlLength - ItemCount)); - Source = * (UINT8 **) Source; - AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode); - break; - - case ACPI_RSC_MOVE_SERIAL_RES: - - Destination = (char *) ACPI_ADD_PTR (void, Aml, - (AmlLength - ItemCount)); - Source = * (UINT8 **) Source; - AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode); - break; - - case ACPI_RSC_ADDRESS: - - /* Set the Resource Type, General Flags, and Type-Specific Flags */ - - AcpiRsSetAddressCommon (Aml, Resource); - break; - - case ACPI_RSC_SOURCEX: - /* - * Optional ResourceSource (Index and String) - */ - AmlLength = AcpiRsSetResourceSource ( - Aml, (ACPI_RS_LENGTH) AmlLength, Source); - AcpiRsSetResourceLength (AmlLength, Aml); - break; - - case ACPI_RSC_SOURCE: - /* - * Optional ResourceSource (Index and String). This is the more - * complicated case used by the Interrupt() macro - */ - AmlLength = AcpiRsSetResourceSource (Aml, Info->Value, Source); - AcpiRsSetResourceLength (AmlLength, Aml); - break; - - case ACPI_RSC_BITMASK: - /* - * 8-bit encoded bitmask (DMA macro) - */ - ACPI_SET8 (Destination, - AcpiRsEncodeBitmask (Source, - *ACPI_ADD_PTR (UINT8, Resource, Info->Value))); - break; - - case ACPI_RSC_BITMASK16: - /* - * 16-bit encoded bitmask (IRQ macro) - */ - Temp16 = AcpiRsEncodeBitmask ( - Source, *ACPI_ADD_PTR (UINT8, Resource, Info->Value)); - ACPI_MOVE_16_TO_16 (Destination, &Temp16); - break; - - case ACPI_RSC_EXIT_LE: - /* - * Control - Exit conversion if less than or equal - */ - if (ItemCount <= Info->Value) - { - goto Exit; - } - break; - - case ACPI_RSC_EXIT_NE: - /* - * Control - Exit conversion if not equal - */ - switch (COMPARE_OPCODE (Info)) - { - case ACPI_RSC_COMPARE_VALUE: - - if (*ACPI_ADD_PTR (UINT8, Resource, - COMPARE_TARGET (Info)) != COMPARE_VALUE (Info)) - { - goto Exit; - } - break; - - default: - - ACPI_ERROR ((AE_INFO, "Invalid conversion sub-opcode")); - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - break; - - case ACPI_RSC_EXIT_EQ: - /* - * Control - Exit conversion if equal - */ - if (*ACPI_ADD_PTR (UINT8, Resource, - COMPARE_TARGET (Info)) == COMPARE_VALUE (Info)) - { - goto Exit; - } - break; - - default: - - ACPI_ERROR ((AE_INFO, "Invalid conversion opcode")); - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - Count--; - Info++; - } - -Exit: - return_ACPI_STATUS (AE_OK); -} - - -#if 0 -/* Previous resource validations */ - - if (Aml->ExtAddress64.RevisionID != - AML_RESOURCE_EXTENDED_ADDRESS_REVISION) - { - return_ACPI_STATUS (AE_SUPPORT); - } - - if (Resource->Data.StartDpf.PerformanceRobustness >= 3) - { - return_ACPI_STATUS (AE_AML_BAD_RESOURCE_VALUE); - } - - if (((Aml->Irq.Flags & 0x09) == 0x00) || - ((Aml->Irq.Flags & 0x09) == 0x09)) - { - /* - * Only [ActiveHigh, EdgeSensitive] or [ActiveLow, LevelSensitive] - * polarity/trigger interrupts are allowed (ACPI spec, section - * "IRQ Format"), so 0x00 and 0x09 are illegal. - */ - ACPI_ERROR ((AE_INFO, - "Invalid interrupt polarity/trigger in resource list, 0x%X", - Aml->Irq.Flags)); - return_ACPI_STATUS (AE_BAD_DATA); - } - - Resource->Data.ExtendedIrq.InterruptCount = Temp8; - if (Temp8 < 1) - { - /* Must have at least one IRQ */ - - return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); - } - - if (Resource->Data.Dma.Transfer == 0x03) - { - ACPI_ERROR ((AE_INFO, - "Invalid DMA.Transfer preference (3)")); - return_ACPI_STATUS (AE_BAD_DATA); - } -#endif diff --git a/drivers/acpica/rsserial.c b/drivers/acpica/rsserial.c deleted file mode 100644 index add2630..0000000 --- a/drivers/acpica/rsserial.c +++ /dev/null @@ -1,1008 +0,0 @@ -/******************************************************************************* - * - * Module Name: rsserial - GPIO/SerialBus resource descriptors - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acresrc.h" - -#define _COMPONENT ACPI_RESOURCES - ACPI_MODULE_NAME ("rsserial") - - -/******************************************************************************* - * - * AcpiRsConvertGpio - * - ******************************************************************************/ - -ACPI_RSCONVERT_INFO AcpiRsConvertGpio[18] = -{ - {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_GPIO, - ACPI_RS_SIZE (ACPI_RESOURCE_GPIO), - ACPI_RSC_TABLE_SIZE (AcpiRsConvertGpio)}, - - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_GPIO, - sizeof (AML_RESOURCE_GPIO), - 0}, - - /* - * These fields are contiguous in both the source and destination: - * RevisionId - * ConnectionType - */ - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.Gpio.RevisionId), - AML_OFFSET (Gpio.RevisionId), - 2}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Gpio.ProducerConsumer), - AML_OFFSET (Gpio.Flags), - 0}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Gpio.Shareable), - AML_OFFSET (Gpio.IntFlags), - 3}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Gpio.WakeCapable), - AML_OFFSET (Gpio.IntFlags), - 4}, - - {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.Gpio.IoRestriction), - AML_OFFSET (Gpio.IntFlags), - 0}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Gpio.Triggering), - AML_OFFSET (Gpio.IntFlags), - 0}, - - {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.Gpio.Polarity), - AML_OFFSET (Gpio.IntFlags), - 1}, - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.Gpio.PinConfig), - AML_OFFSET (Gpio.PinConfig), - 1}, - - /* - * These fields are contiguous in both the source and destination: - * DriveStrength - * DebounceTimeout - */ - {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.Gpio.DriveStrength), - AML_OFFSET (Gpio.DriveStrength), - 2}, - - /* Pin Table */ - - {ACPI_RSC_COUNT_GPIO_PIN, ACPI_RS_OFFSET (Data.Gpio.PinTableLength), - AML_OFFSET (Gpio.PinTableOffset), - AML_OFFSET (Gpio.ResSourceOffset)}, - - {ACPI_RSC_MOVE_GPIO_PIN, ACPI_RS_OFFSET (Data.Gpio.PinTable), - AML_OFFSET (Gpio.PinTableOffset), - 0}, - - /* Resource Source */ - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.Gpio.ResourceSource.Index), - AML_OFFSET (Gpio.ResSourceIndex), - 1}, - - {ACPI_RSC_COUNT_GPIO_RES, ACPI_RS_OFFSET (Data.Gpio.ResourceSource.StringLength), - AML_OFFSET (Gpio.ResSourceOffset), - AML_OFFSET (Gpio.VendorOffset)}, - - {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.Gpio.ResourceSource.StringPtr), - AML_OFFSET (Gpio.ResSourceOffset), - 0}, - - /* Vendor Data */ - - {ACPI_RSC_COUNT_GPIO_VEN, ACPI_RS_OFFSET (Data.Gpio.VendorLength), - AML_OFFSET (Gpio.VendorLength), - 1}, - - {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.Gpio.VendorData), - AML_OFFSET (Gpio.VendorOffset), - 0}, -}; - -/******************************************************************************* - * - * AcpiRsConvertClockInput - * - ******************************************************************************/ - -ACPI_RSCONVERT_INFO AcpiRsConvertClockInput[8] = -{ - {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_CLOCK_INPUT, - ACPI_RS_SIZE (ACPI_RESOURCE_CLOCK_INPUT), - ACPI_RSC_TABLE_SIZE (AcpiRsConvertClockInput)}, - - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_CLOCK_INPUT, - sizeof (AML_RESOURCE_CLOCK_INPUT), - 0}, - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.ClockInput.RevisionId), - AML_OFFSET (ClockInput.RevisionId), - 1}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.ClockInput.Mode), - AML_OFFSET (ClockInput.Flags), - 0}, - - {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.ClockInput.Scale), - AML_OFFSET (ClockInput.Flags), - 1}, - - {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.ClockInput.FrequencyDivisor), - AML_OFFSET (ClockInput.FrequencyDivisor), - 2}, - - {ACPI_RSC_MOVE32, ACPI_RS_OFFSET (Data.ClockInput.FrequencyNumerator), - AML_OFFSET (ClockInput.FrequencyNumerator), - 4}, - - /* Resource Source */ - {ACPI_RSC_SOURCE, ACPI_RS_OFFSET (Data.ClockInput.ResourceSource), - 0, - sizeof(AML_RESOURCE_CLOCK_INPUT)}, - -}; - - -/******************************************************************************* - * - * AcpiRsConvertPinfunction - * - ******************************************************************************/ - -ACPI_RSCONVERT_INFO AcpiRsConvertPinFunction[13] = -{ - {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_PIN_FUNCTION, - ACPI_RS_SIZE (ACPI_RESOURCE_PIN_FUNCTION), - ACPI_RSC_TABLE_SIZE (AcpiRsConvertPinFunction)}, - - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_PIN_FUNCTION, - sizeof (AML_RESOURCE_PIN_FUNCTION), - 0}, - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.PinFunction.RevisionId), - AML_OFFSET (PinFunction.RevisionId), - 1}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.PinFunction.Shareable), - AML_OFFSET (PinFunction.Flags), - 0}, - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.PinFunction.PinConfig), - AML_OFFSET (PinFunction.PinConfig), - 1}, - - {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.PinFunction.FunctionNumber), - AML_OFFSET (PinFunction.FunctionNumber), - 2}, - - /* Pin Table */ - - /* - * It is OK to use GPIO operations here because none of them refer GPIO - * structures directly but instead use offsets given here. - */ - - {ACPI_RSC_COUNT_GPIO_PIN, ACPI_RS_OFFSET (Data.PinFunction.PinTableLength), - AML_OFFSET (PinFunction.PinTableOffset), - AML_OFFSET (PinFunction.ResSourceOffset)}, - - {ACPI_RSC_MOVE_GPIO_PIN, ACPI_RS_OFFSET (Data.PinFunction.PinTable), - AML_OFFSET (PinFunction.PinTableOffset), - 0}, - - /* Resource Source */ - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.PinFunction.ResourceSource.Index), - AML_OFFSET (PinFunction.ResSourceIndex), - 1}, - - {ACPI_RSC_COUNT_GPIO_RES, ACPI_RS_OFFSET (Data.PinFunction.ResourceSource.StringLength), - AML_OFFSET (PinFunction.ResSourceOffset), - AML_OFFSET (PinFunction.VendorOffset)}, - - {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.PinFunction.ResourceSource.StringPtr), - AML_OFFSET (PinFunction.ResSourceOffset), - 0}, - - /* Vendor Data */ - - {ACPI_RSC_COUNT_GPIO_VEN, ACPI_RS_OFFSET (Data.PinFunction.VendorLength), - AML_OFFSET (PinFunction.VendorLength), - 1}, - - {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.PinFunction.VendorData), - AML_OFFSET (PinFunction.VendorOffset), - 0}, -}; - - -/******************************************************************************* - * - * AcpiRsConvertCsi2SerialBus - * - ******************************************************************************/ - -ACPI_RSCONVERT_INFO AcpiRsConvertCsi2SerialBus[14] = -{ - {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS, - ACPI_RS_SIZE (ACPI_RESOURCE_CSI2_SERIALBUS), - ACPI_RSC_TABLE_SIZE (AcpiRsConvertCsi2SerialBus)}, - - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_SERIAL_BUS, - sizeof (AML_RESOURCE_CSI2_SERIALBUS), - 0}, - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.RevisionId), - AML_OFFSET (CommonSerialBus.RevisionId), - 1}, - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.Csi2SerialBus.Type), - AML_OFFSET (Csi2SerialBus.Type), - 1}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Csi2SerialBus.ProducerConsumer), - AML_OFFSET (Csi2SerialBus.Flags), - 1}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Csi2SerialBus.SlaveMode), - AML_OFFSET (Csi2SerialBus.Flags), - 0}, - - {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.Csi2SerialBus.PhyType), - AML_OFFSET (Csi2SerialBus.TypeSpecificFlags), - 0}, - - {ACPI_RSC_6BITFLAG, ACPI_RS_OFFSET (Data.Csi2SerialBus.LocalPortInstance), - AML_OFFSET (Csi2SerialBus.TypeSpecificFlags), - 2}, - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.Csi2SerialBus.TypeRevisionId), - AML_OFFSET (Csi2SerialBus.TypeRevisionId), - 1}, - - /* Vendor data */ - - {ACPI_RSC_COUNT_SERIAL_VEN, ACPI_RS_OFFSET (Data.Csi2SerialBus.VendorLength), - AML_OFFSET (Csi2SerialBus.TypeDataLength), - AML_RESOURCE_CSI2_MIN_DATA_LEN}, - - {ACPI_RSC_MOVE_SERIAL_VEN, ACPI_RS_OFFSET (Data.Csi2SerialBus.VendorData), - 0, - sizeof (AML_RESOURCE_CSI2_SERIALBUS)}, - - /* Resource Source */ - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.Csi2SerialBus.ResourceSource.Index), - AML_OFFSET (Csi2SerialBus.ResSourceIndex), - 1}, - - {ACPI_RSC_COUNT_SERIAL_RES, ACPI_RS_OFFSET (Data.Csi2SerialBus.ResourceSource.StringLength), - AML_OFFSET (Csi2SerialBus.TypeDataLength), - sizeof (AML_RESOURCE_CSI2_SERIALBUS)}, - - {ACPI_RSC_MOVE_SERIAL_RES, ACPI_RS_OFFSET (Data.Csi2SerialBus.ResourceSource.StringPtr), - AML_OFFSET (Csi2SerialBus.TypeDataLength), - sizeof (AML_RESOURCE_CSI2_SERIALBUS)}, -}; - - -/******************************************************************************* - * - * AcpiRsConvertI2cSerialBus - * - ******************************************************************************/ - -ACPI_RSCONVERT_INFO AcpiRsConvertI2cSerialBus[17] = -{ - {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS, - ACPI_RS_SIZE (ACPI_RESOURCE_I2C_SERIALBUS), - ACPI_RSC_TABLE_SIZE (AcpiRsConvertI2cSerialBus)}, - - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_SERIAL_BUS, - sizeof (AML_RESOURCE_I2C_SERIALBUS), - 0}, - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.RevisionId), - AML_OFFSET (CommonSerialBus.RevisionId), - 1}, - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.Type), - AML_OFFSET (CommonSerialBus.Type), - 1}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.CommonSerialBus.SlaveMode), - AML_OFFSET (CommonSerialBus.Flags), - 0}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.CommonSerialBus.ProducerConsumer), - AML_OFFSET (CommonSerialBus.Flags), - 1}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.CommonSerialBus.ConnectionSharing), - AML_OFFSET (CommonSerialBus.Flags), - 2}, - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.TypeRevisionId), - AML_OFFSET (CommonSerialBus.TypeRevisionId), - 1}, - - {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.CommonSerialBus.TypeDataLength), - AML_OFFSET (CommonSerialBus.TypeDataLength), - 1}, - - /* Vendor data */ - - {ACPI_RSC_COUNT_SERIAL_VEN, ACPI_RS_OFFSET (Data.CommonSerialBus.VendorLength), - AML_OFFSET (CommonSerialBus.TypeDataLength), - AML_RESOURCE_I2C_MIN_DATA_LEN}, - - {ACPI_RSC_MOVE_SERIAL_VEN, ACPI_RS_OFFSET (Data.CommonSerialBus.VendorData), - 0, - sizeof (AML_RESOURCE_I2C_SERIALBUS)}, - - /* Resource Source */ - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.ResourceSource.Index), - AML_OFFSET (CommonSerialBus.ResSourceIndex), - 1}, - - {ACPI_RSC_COUNT_SERIAL_RES, ACPI_RS_OFFSET (Data.CommonSerialBus.ResourceSource.StringLength), - AML_OFFSET (CommonSerialBus.TypeDataLength), - sizeof (AML_RESOURCE_COMMON_SERIALBUS)}, - - {ACPI_RSC_MOVE_SERIAL_RES, ACPI_RS_OFFSET (Data.CommonSerialBus.ResourceSource.StringPtr), - AML_OFFSET (CommonSerialBus.TypeDataLength), - sizeof (AML_RESOURCE_COMMON_SERIALBUS)}, - - /* I2C bus type specific */ - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.I2cSerialBus.AccessMode), - AML_OFFSET (I2cSerialBus.TypeSpecificFlags), - 0}, - - {ACPI_RSC_MOVE32, ACPI_RS_OFFSET (Data.I2cSerialBus.ConnectionSpeed), - AML_OFFSET (I2cSerialBus.ConnectionSpeed), - 1}, - - {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.I2cSerialBus.SlaveAddress), - AML_OFFSET (I2cSerialBus.SlaveAddress), - 1}, -}; - - -/******************************************************************************* - * - * AcpiRsConvertSpiSerialBus - * - ******************************************************************************/ - -ACPI_RSCONVERT_INFO AcpiRsConvertSpiSerialBus[21] = -{ - {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS, - ACPI_RS_SIZE (ACPI_RESOURCE_SPI_SERIALBUS), - ACPI_RSC_TABLE_SIZE (AcpiRsConvertSpiSerialBus)}, - - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_SERIAL_BUS, - sizeof (AML_RESOURCE_SPI_SERIALBUS), - 0}, - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.RevisionId), - AML_OFFSET (CommonSerialBus.RevisionId), - 1}, - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.Type), - AML_OFFSET (CommonSerialBus.Type), - 1}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.CommonSerialBus.SlaveMode), - AML_OFFSET (CommonSerialBus.Flags), - 0}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.CommonSerialBus.ProducerConsumer), - AML_OFFSET (CommonSerialBus.Flags), - 1}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.CommonSerialBus.ConnectionSharing), - AML_OFFSET (CommonSerialBus.Flags), - 2}, - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.TypeRevisionId), - AML_OFFSET (CommonSerialBus.TypeRevisionId), - 1}, - - {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.CommonSerialBus.TypeDataLength), - AML_OFFSET (CommonSerialBus.TypeDataLength), - 1}, - - /* Vendor data */ - - {ACPI_RSC_COUNT_SERIAL_VEN, ACPI_RS_OFFSET (Data.CommonSerialBus.VendorLength), - AML_OFFSET (CommonSerialBus.TypeDataLength), - AML_RESOURCE_SPI_MIN_DATA_LEN}, - - {ACPI_RSC_MOVE_SERIAL_VEN, ACPI_RS_OFFSET (Data.CommonSerialBus.VendorData), - 0, - sizeof (AML_RESOURCE_SPI_SERIALBUS)}, - - /* Resource Source */ - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.ResourceSource.Index), - AML_OFFSET (CommonSerialBus.ResSourceIndex), - 1}, - - {ACPI_RSC_COUNT_SERIAL_RES, ACPI_RS_OFFSET (Data.CommonSerialBus.ResourceSource.StringLength), - AML_OFFSET (CommonSerialBus.TypeDataLength), - sizeof (AML_RESOURCE_COMMON_SERIALBUS)}, - - {ACPI_RSC_MOVE_SERIAL_RES, ACPI_RS_OFFSET (Data.CommonSerialBus.ResourceSource.StringPtr), - AML_OFFSET (CommonSerialBus.TypeDataLength), - sizeof (AML_RESOURCE_COMMON_SERIALBUS)}, - - /* Spi bus type specific */ - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.SpiSerialBus.WireMode), - AML_OFFSET (SpiSerialBus.TypeSpecificFlags), - 0}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.SpiSerialBus.DevicePolarity), - AML_OFFSET (SpiSerialBus.TypeSpecificFlags), - 1}, - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.SpiSerialBus.DataBitLength), - AML_OFFSET (SpiSerialBus.DataBitLength), - 1}, - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.SpiSerialBus.ClockPhase), - AML_OFFSET (SpiSerialBus.ClockPhase), - 1}, - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.SpiSerialBus.ClockPolarity), - AML_OFFSET (SpiSerialBus.ClockPolarity), - 1}, - - {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.SpiSerialBus.DeviceSelection), - AML_OFFSET (SpiSerialBus.DeviceSelection), - 1}, - - {ACPI_RSC_MOVE32, ACPI_RS_OFFSET (Data.SpiSerialBus.ConnectionSpeed), - AML_OFFSET (SpiSerialBus.ConnectionSpeed), - 1}, -}; - - -/******************************************************************************* - * - * AcpiRsConvertUartSerialBus - * - ******************************************************************************/ - -ACPI_RSCONVERT_INFO AcpiRsConvertUartSerialBus[23] = -{ - {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS, - ACPI_RS_SIZE (ACPI_RESOURCE_UART_SERIALBUS), - ACPI_RSC_TABLE_SIZE (AcpiRsConvertUartSerialBus)}, - - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_SERIAL_BUS, - sizeof (AML_RESOURCE_UART_SERIALBUS), - 0}, - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.RevisionId), - AML_OFFSET (CommonSerialBus.RevisionId), - 1}, - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.Type), - AML_OFFSET (CommonSerialBus.Type), - 1}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.CommonSerialBus.SlaveMode), - AML_OFFSET (CommonSerialBus.Flags), - 0}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.CommonSerialBus.ProducerConsumer), - AML_OFFSET (CommonSerialBus.Flags), - 1}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.CommonSerialBus.ConnectionSharing), - AML_OFFSET (CommonSerialBus.Flags), - 2}, - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.TypeRevisionId), - AML_OFFSET (CommonSerialBus.TypeRevisionId), - 1}, - - {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.CommonSerialBus.TypeDataLength), - AML_OFFSET (CommonSerialBus.TypeDataLength), - 1}, - - /* Vendor data */ - - {ACPI_RSC_COUNT_SERIAL_VEN, ACPI_RS_OFFSET (Data.CommonSerialBus.VendorLength), - AML_OFFSET (CommonSerialBus.TypeDataLength), - AML_RESOURCE_UART_MIN_DATA_LEN}, - - {ACPI_RSC_MOVE_SERIAL_VEN, ACPI_RS_OFFSET (Data.CommonSerialBus.VendorData), - 0, - sizeof (AML_RESOURCE_UART_SERIALBUS)}, - - /* Resource Source */ - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.ResourceSource.Index), - AML_OFFSET (CommonSerialBus.ResSourceIndex), - 1}, - - {ACPI_RSC_COUNT_SERIAL_RES, ACPI_RS_OFFSET (Data.CommonSerialBus.ResourceSource.StringLength), - AML_OFFSET (CommonSerialBus.TypeDataLength), - sizeof (AML_RESOURCE_COMMON_SERIALBUS)}, - - {ACPI_RSC_MOVE_SERIAL_RES, ACPI_RS_OFFSET (Data.CommonSerialBus.ResourceSource.StringPtr), - AML_OFFSET (CommonSerialBus.TypeDataLength), - sizeof (AML_RESOURCE_COMMON_SERIALBUS)}, - - /* Uart bus type specific */ - - {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.UartSerialBus.FlowControl), - AML_OFFSET (UartSerialBus.TypeSpecificFlags), - 0}, - - {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.UartSerialBus.StopBits), - AML_OFFSET (UartSerialBus.TypeSpecificFlags), - 2}, - - {ACPI_RSC_3BITFLAG, ACPI_RS_OFFSET (Data.UartSerialBus.DataBits), - AML_OFFSET (UartSerialBus.TypeSpecificFlags), - 4}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.UartSerialBus.Endian), - AML_OFFSET (UartSerialBus.TypeSpecificFlags), - 7}, - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.UartSerialBus.Parity), - AML_OFFSET (UartSerialBus.Parity), - 1}, - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.UartSerialBus.LinesEnabled), - AML_OFFSET (UartSerialBus.LinesEnabled), - 1}, - - {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.UartSerialBus.RxFifoSize), - AML_OFFSET (UartSerialBus.RxFifoSize), - 1}, - - {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.UartSerialBus.TxFifoSize), - AML_OFFSET (UartSerialBus.TxFifoSize), - 1}, - - {ACPI_RSC_MOVE32, ACPI_RS_OFFSET (Data.UartSerialBus.DefaultBaudRate), - AML_OFFSET (UartSerialBus.DefaultBaudRate), - 1}, -}; - - -/******************************************************************************* - * - * AcpiRsConvertPinConfig - * - ******************************************************************************/ - -ACPI_RSCONVERT_INFO AcpiRsConvertPinConfig[14] = -{ - {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_PIN_CONFIG, - ACPI_RS_SIZE (ACPI_RESOURCE_PIN_CONFIG), - ACPI_RSC_TABLE_SIZE (AcpiRsConvertPinConfig)}, - - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_PIN_CONFIG, - sizeof (AML_RESOURCE_PIN_CONFIG), - 0}, - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.PinConfig.RevisionId), - AML_OFFSET (PinConfig.RevisionId), - 1}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.PinConfig.Shareable), - AML_OFFSET (PinConfig.Flags), - 0}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.PinConfig.ProducerConsumer), - AML_OFFSET (PinConfig.Flags), - 1}, - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.PinConfig.PinConfigType), - AML_OFFSET (PinConfig.PinConfigType), - 1}, - - {ACPI_RSC_MOVE32, ACPI_RS_OFFSET (Data.PinConfig.PinConfigValue), - AML_OFFSET (PinConfig.PinConfigValue), - 1}, - - /* Pin Table */ - - /* - * It is OK to use GPIO operations here because none of them refer GPIO - * structures directly but instead use offsets given here. - */ - - {ACPI_RSC_COUNT_GPIO_PIN, ACPI_RS_OFFSET (Data.PinConfig.PinTableLength), - AML_OFFSET (PinConfig.PinTableOffset), - AML_OFFSET (PinConfig.ResSourceOffset)}, - - {ACPI_RSC_MOVE_GPIO_PIN, ACPI_RS_OFFSET (Data.PinConfig.PinTable), - AML_OFFSET (PinConfig.PinTableOffset), - 0}, - - /* Resource Source */ - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.PinConfig.ResourceSource.Index), - AML_OFFSET (PinConfig.ResSourceIndex), - 1}, - - {ACPI_RSC_COUNT_GPIO_RES, ACPI_RS_OFFSET (Data.PinConfig.ResourceSource.StringLength), - AML_OFFSET (PinConfig.ResSourceOffset), - AML_OFFSET (PinConfig.VendorOffset)}, - - {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.PinConfig.ResourceSource.StringPtr), - AML_OFFSET (PinConfig.ResSourceOffset), - 0}, - - /* Vendor Data */ - - {ACPI_RSC_COUNT_GPIO_VEN, ACPI_RS_OFFSET (Data.PinConfig.VendorLength), - AML_OFFSET (PinConfig.VendorLength), - 1}, - - {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.PinConfig.VendorData), - AML_OFFSET (PinConfig.VendorOffset), - 0}, -}; - -/******************************************************************************* - * - * AcpiRsConvertPinGroup - * - ******************************************************************************/ - -ACPI_RSCONVERT_INFO AcpiRsConvertPinGroup[10] = -{ - {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_PIN_GROUP, - ACPI_RS_SIZE (ACPI_RESOURCE_PIN_GROUP), - ACPI_RSC_TABLE_SIZE (AcpiRsConvertPinGroup)}, - - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_PIN_GROUP, - sizeof (AML_RESOURCE_PIN_GROUP), - 0}, - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.PinGroup.RevisionId), - AML_OFFSET (PinGroup.RevisionId), - 1}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.PinGroup.ProducerConsumer), - AML_OFFSET (PinGroup.Flags), - 0}, - - /* Pin Table */ - - /* - * It is OK to use GPIO operations here because none of them refer GPIO - * structures directly but instead use offsets given here. - */ - - {ACPI_RSC_COUNT_GPIO_PIN, ACPI_RS_OFFSET (Data.PinGroup.PinTableLength), - AML_OFFSET (PinGroup.PinTableOffset), - AML_OFFSET (PinGroup.LabelOffset)}, - - {ACPI_RSC_MOVE_GPIO_PIN, ACPI_RS_OFFSET (Data.PinGroup.PinTable), - AML_OFFSET (PinGroup.PinTableOffset), - 0}, - - /* Resource Label */ - - {ACPI_RSC_COUNT_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroup.ResourceLabel.StringLength), - AML_OFFSET (PinGroup.LabelOffset), - AML_OFFSET (PinGroup.VendorOffset)}, - - {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroup.ResourceLabel.StringPtr), - AML_OFFSET (PinGroup.LabelOffset), - 0}, - - /* Vendor Data */ - - {ACPI_RSC_COUNT_GPIO_VEN, ACPI_RS_OFFSET (Data.PinGroup.VendorLength), - AML_OFFSET (PinGroup.VendorLength), - 1}, - - {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroup.VendorData), - AML_OFFSET (PinGroup.VendorOffset), - 0}, -}; - -/******************************************************************************* - * - * AcpiRsConvertPinGroupFunction - * - ******************************************************************************/ - -ACPI_RSCONVERT_INFO AcpiRsConvertPinGroupFunction[13] = -{ - {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION, - ACPI_RS_SIZE (ACPI_RESOURCE_PIN_GROUP_FUNCTION), - ACPI_RSC_TABLE_SIZE (AcpiRsConvertPinGroupFunction)}, - - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_PIN_GROUP_FUNCTION, - sizeof (AML_RESOURCE_PIN_GROUP_FUNCTION), - 0}, - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.PinGroupFunction.RevisionId), - AML_OFFSET (PinGroupFunction.RevisionId), - 1}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.PinGroupFunction.Shareable), - AML_OFFSET (PinGroupFunction.Flags), - 0}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.PinGroupFunction.ProducerConsumer), - AML_OFFSET (PinGroupFunction.Flags), - 1}, - - {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.PinGroupFunction.FunctionNumber), - AML_OFFSET (PinGroupFunction.FunctionNumber), - 1}, - - /* Resource Source */ - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.PinGroupFunction.ResourceSource.Index), - AML_OFFSET (PinGroupFunction.ResSourceIndex), - 1}, - - {ACPI_RSC_COUNT_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroupFunction.ResourceSource.StringLength), - AML_OFFSET (PinGroupFunction.ResSourceOffset), - AML_OFFSET (PinGroupFunction.ResSourceLabelOffset)}, - - {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroupFunction.ResourceSource.StringPtr), - AML_OFFSET (PinGroupFunction.ResSourceOffset), - 0}, - - /* Resource Source Label */ - - {ACPI_RSC_COUNT_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroupFunction.ResourceSourceLabel.StringLength), - AML_OFFSET (PinGroupFunction.ResSourceLabelOffset), - AML_OFFSET (PinGroupFunction.VendorOffset)}, - - {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroupFunction.ResourceSourceLabel.StringPtr), - AML_OFFSET (PinGroupFunction.ResSourceLabelOffset), - 0}, - - /* Vendor Data */ - - {ACPI_RSC_COUNT_GPIO_VEN, ACPI_RS_OFFSET (Data.PinGroupFunction.VendorLength), - AML_OFFSET (PinGroupFunction.VendorLength), - 1}, - - {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroupFunction.VendorData), - AML_OFFSET (PinGroupFunction.VendorOffset), - 0}, -}; - -/******************************************************************************* - * - * AcpiRsConvertPinGroupConfig - * - ******************************************************************************/ - -ACPI_RSCONVERT_INFO AcpiRsConvertPinGroupConfig[14] = -{ - {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG, - ACPI_RS_SIZE (ACPI_RESOURCE_PIN_GROUP_CONFIG), - ACPI_RSC_TABLE_SIZE (AcpiRsConvertPinGroupConfig)}, - - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_PIN_GROUP_CONFIG, - sizeof (AML_RESOURCE_PIN_GROUP_CONFIG), - 0}, - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.PinGroupConfig.RevisionId), - AML_OFFSET (PinGroupConfig.RevisionId), - 1}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.PinGroupConfig.Shareable), - AML_OFFSET (PinGroupConfig.Flags), - 0}, - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.PinGroupConfig.ProducerConsumer), - AML_OFFSET (PinGroupConfig.Flags), - 1}, - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.PinGroupConfig.PinConfigType), - AML_OFFSET (PinGroupConfig.PinConfigType), - 1}, - - {ACPI_RSC_MOVE32, ACPI_RS_OFFSET (Data.PinGroupConfig.PinConfigValue), - AML_OFFSET (PinGroupConfig.PinConfigValue), - 1}, - - /* Resource Source */ - - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.PinGroupConfig.ResourceSource.Index), - AML_OFFSET (PinGroupConfig.ResSourceIndex), - 1}, - - {ACPI_RSC_COUNT_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroupConfig.ResourceSource.StringLength), - AML_OFFSET (PinGroupConfig.ResSourceOffset), - AML_OFFSET (PinGroupConfig.ResSourceLabelOffset)}, - - {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroupConfig.ResourceSource.StringPtr), - AML_OFFSET (PinGroupConfig.ResSourceOffset), - 0}, - - /* Resource Source Label */ - - {ACPI_RSC_COUNT_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroupConfig.ResourceSourceLabel.StringLength), - AML_OFFSET (PinGroupConfig.ResSourceLabelOffset), - AML_OFFSET (PinGroupConfig.VendorOffset)}, - - {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroupConfig.ResourceSourceLabel.StringPtr), - AML_OFFSET (PinGroupConfig.ResSourceLabelOffset), - 0}, - - /* Vendor Data */ - - {ACPI_RSC_COUNT_GPIO_VEN, ACPI_RS_OFFSET (Data.PinGroupConfig.VendorLength), - AML_OFFSET (PinGroupConfig.VendorLength), - 1}, - - {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroupConfig.VendorData), - AML_OFFSET (PinGroupConfig.VendorOffset), - 0}, -}; diff --git a/drivers/acpica/rsutils.c b/drivers/acpica/rsutils.c deleted file mode 100644 index 0faac38..0000000 --- a/drivers/acpica/rsutils.c +++ /dev/null @@ -1,978 +0,0 @@ -/******************************************************************************* - * - * Module Name: rsutils - Utilities for the resource manager - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" -#include "acresrc.h" - - -#define _COMPONENT ACPI_RESOURCES - ACPI_MODULE_NAME ("rsutils") - - -/******************************************************************************* - * - * FUNCTION: AcpiRsDecodeBitmask - * - * PARAMETERS: Mask - Bitmask to decode - * List - Where the converted list is returned - * - * RETURN: Count of bits set (length of list) - * - * DESCRIPTION: Convert a bit mask into a list of values - * - ******************************************************************************/ - -UINT8 -AcpiRsDecodeBitmask ( - UINT16 Mask, - UINT8 *List) -{ - UINT8 i; - UINT8 BitCount; - - - ACPI_FUNCTION_ENTRY (); - - - /* Decode the mask bits */ - - for (i = 0, BitCount = 0; Mask; i++) - { - if (Mask & 0x0001) - { - List[BitCount] = i; - BitCount++; - } - - Mask >>= 1; - } - - return (BitCount); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiRsEncodeBitmask - * - * PARAMETERS: List - List of values to encode - * Count - Length of list - * - * RETURN: Encoded bitmask - * - * DESCRIPTION: Convert a list of values to an encoded bitmask - * - ******************************************************************************/ - -UINT16 -AcpiRsEncodeBitmask ( - UINT8 *List, - UINT8 Count) -{ - UINT32 i; - UINT16 Mask; - - - ACPI_FUNCTION_ENTRY (); - - - /* Encode the list into a single bitmask */ - - for (i = 0, Mask = 0; i < Count; i++) - { - Mask |= (0x1 << List[i]); - } - - return (Mask); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiRsMoveData - * - * PARAMETERS: Destination - Pointer to the destination descriptor - * Source - Pointer to the source descriptor - * ItemCount - How many items to move - * MoveType - Byte width - * - * RETURN: None - * - * DESCRIPTION: Move multiple data items from one descriptor to another. Handles - * alignment issues and endian issues if necessary, as configured - * via the ACPI_MOVE_* macros. (This is why a memcpy is not used) - * - ******************************************************************************/ - -void -AcpiRsMoveData ( - void *Destination, - void *Source, - UINT16 ItemCount, - UINT8 MoveType) -{ - UINT32 i; - - - ACPI_FUNCTION_ENTRY (); - - - /* One move per item */ - - for (i = 0; i < ItemCount; i++) - { - switch (MoveType) - { - /* - * For the 8-bit case, we can perform the move all at once - * since there are no alignment or endian issues - */ - case ACPI_RSC_MOVE8: - case ACPI_RSC_MOVE_GPIO_RES: - case ACPI_RSC_MOVE_SERIAL_VEN: - case ACPI_RSC_MOVE_SERIAL_RES: - - memcpy (Destination, Source, ItemCount); - return; - - /* - * 16-, 32-, and 64-bit cases must use the move macros that perform - * endian conversion and/or accommodate hardware that cannot perform - * misaligned memory transfers - */ - case ACPI_RSC_MOVE16: - case ACPI_RSC_MOVE_GPIO_PIN: - - ACPI_MOVE_16_TO_16 ( - &ACPI_CAST_PTR (UINT16, Destination)[i], - &ACPI_CAST_PTR (UINT16, Source)[i]); - break; - - case ACPI_RSC_MOVE32: - - ACPI_MOVE_32_TO_32 ( - &ACPI_CAST_PTR (UINT32, Destination)[i], - &ACPI_CAST_PTR (UINT32, Source)[i]); - break; - - case ACPI_RSC_MOVE64: - - ACPI_MOVE_64_TO_64 ( - &ACPI_CAST_PTR (UINT64, Destination)[i], - &ACPI_CAST_PTR (UINT64, Source)[i]); - break; - - default: - - return; - } - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiRsSetResourceLength - * - * PARAMETERS: TotalLength - Length of the AML descriptor, including - * the header and length fields. - * Aml - Pointer to the raw AML descriptor - * - * RETURN: None - * - * DESCRIPTION: Set the ResourceLength field of an AML - * resource descriptor, both Large and Small descriptors are - * supported automatically. Note: Descriptor Type field must - * be valid. - * - ******************************************************************************/ - -void -AcpiRsSetResourceLength ( - ACPI_RSDESC_SIZE TotalLength, - AML_RESOURCE *Aml) -{ - ACPI_RS_LENGTH ResourceLength; - - - ACPI_FUNCTION_ENTRY (); - - - /* Length is the total descriptor length minus the header length */ - - ResourceLength = (ACPI_RS_LENGTH) - (TotalLength - AcpiUtGetResourceHeaderLength (Aml)); - - /* Length is stored differently for large and small descriptors */ - - if (Aml->SmallHeader.DescriptorType & ACPI_RESOURCE_NAME_LARGE) - { - /* Large descriptor -- bytes 1-2 contain the 16-bit length */ - - ACPI_MOVE_16_TO_16 ( - &Aml->LargeHeader.ResourceLength, &ResourceLength); - } - else - { - /* - * Small descriptor -- bits 2:0 of byte 0 contain the length - * Clear any existing length, preserving descriptor type bits - */ - Aml->SmallHeader.DescriptorType = (UINT8) - ((Aml->SmallHeader.DescriptorType & - ~ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK) - | ResourceLength); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiRsSetResourceHeader - * - * PARAMETERS: DescriptorType - Byte to be inserted as the type - * TotalLength - Length of the AML descriptor, including - * the header and length fields. - * Aml - Pointer to the raw AML descriptor - * - * RETURN: None - * - * DESCRIPTION: Set the DescriptorType and ResourceLength fields of an AML - * resource descriptor, both Large and Small descriptors are - * supported automatically - * - ******************************************************************************/ - -void -AcpiRsSetResourceHeader ( - UINT8 DescriptorType, - ACPI_RSDESC_SIZE TotalLength, - AML_RESOURCE *Aml) -{ - ACPI_FUNCTION_ENTRY (); - - - /* Set the Resource Type */ - - Aml->SmallHeader.DescriptorType = DescriptorType; - - /* Set the Resource Length */ - - AcpiRsSetResourceLength (TotalLength, Aml); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiRsStrcpy - * - * PARAMETERS: Destination - Pointer to the destination string - * Source - Pointer to the source string - * - * RETURN: String length, including NULL terminator - * - * DESCRIPTION: Local string copy that returns the string length, saving a - * strcpy followed by a strlen. - * - ******************************************************************************/ - -static UINT16 -AcpiRsStrcpy ( - char *Destination, - char *Source) -{ - UINT16 i; - - - ACPI_FUNCTION_ENTRY (); - - - for (i = 0; Source[i]; i++) - { - Destination[i] = Source[i]; - } - - Destination[i] = 0; - - /* Return string length including the NULL terminator */ - - return ((UINT16) (i + 1)); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiRsGetResourceSource - * - * PARAMETERS: ResourceLength - Length field of the descriptor - * MinimumLength - Minimum length of the descriptor (minus - * any optional fields) - * ResourceSource - Where the ResourceSource is returned - * Aml - Pointer to the raw AML descriptor - * StringPtr - (optional) where to store the actual - * ResourceSource string - * - * RETURN: Length of the string plus NULL terminator, rounded up to native - * word boundary - * - * DESCRIPTION: Copy the optional ResourceSource data from a raw AML descriptor - * to an internal resource descriptor - * - ******************************************************************************/ - -ACPI_RS_LENGTH -AcpiRsGetResourceSource ( - ACPI_RS_LENGTH ResourceLength, - ACPI_RS_LENGTH MinimumLength, - ACPI_RESOURCE_SOURCE *ResourceSource, - AML_RESOURCE *Aml, - char *StringPtr) -{ - ACPI_RSDESC_SIZE TotalLength; - UINT8 *AmlResourceSource; - - - ACPI_FUNCTION_ENTRY (); - - - TotalLength = ResourceLength + sizeof (AML_RESOURCE_LARGE_HEADER); - AmlResourceSource = ACPI_ADD_PTR (UINT8, Aml, MinimumLength); - - /* - * ResourceSource is present if the length of the descriptor is longer - * than the minimum length. - * - * Note: Some resource descriptors will have an additional null, so - * we add 1 to the minimum length. - */ - if (TotalLength > (ACPI_RSDESC_SIZE) (MinimumLength + 1)) - { - /* Get the ResourceSourceIndex */ - - ResourceSource->Index = AmlResourceSource[0]; - - ResourceSource->StringPtr = StringPtr; - if (!StringPtr) - { - /* - * String destination pointer is not specified; Set the String - * pointer to the end of the current ResourceSource structure. - */ - ResourceSource->StringPtr = ACPI_ADD_PTR ( - char, ResourceSource, sizeof (ACPI_RESOURCE_SOURCE)); - } - - /* - * In order for the Resource length to be a multiple of the native - * word, calculate the length of the string (+1 for NULL terminator) - * and expand to the next word multiple. - * - * Zero the entire area of the buffer. - */ - TotalLength = (UINT32) strlen ( - ACPI_CAST_PTR (char, &AmlResourceSource[1])) + 1; - - TotalLength = (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (TotalLength); - - memset (ResourceSource->StringPtr, 0, TotalLength); - - /* Copy the ResourceSource string to the destination */ - - ResourceSource->StringLength = AcpiRsStrcpy ( - ResourceSource->StringPtr, - ACPI_CAST_PTR (char, &AmlResourceSource[1])); - - return ((ACPI_RS_LENGTH) TotalLength); - } - - /* ResourceSource is not present */ - - ResourceSource->Index = 0; - ResourceSource->StringLength = 0; - ResourceSource->StringPtr = NULL; - return (0); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiRsSetResourceSource - * - * PARAMETERS: Aml - Pointer to the raw AML descriptor - * MinimumLength - Minimum length of the descriptor (minus - * any optional fields) - * ResourceSource - Internal ResourceSource - - * - * RETURN: Total length of the AML descriptor - * - * DESCRIPTION: Convert an optional ResourceSource from internal format to a - * raw AML resource descriptor - * - ******************************************************************************/ - -ACPI_RSDESC_SIZE -AcpiRsSetResourceSource ( - AML_RESOURCE *Aml, - ACPI_RS_LENGTH MinimumLength, - ACPI_RESOURCE_SOURCE *ResourceSource) -{ - UINT8 *AmlResourceSource; - ACPI_RSDESC_SIZE DescriptorLength; - - - ACPI_FUNCTION_ENTRY (); - - - DescriptorLength = MinimumLength; - - /* Non-zero string length indicates presence of a ResourceSource */ - - if (ResourceSource->StringLength) - { - /* Point to the end of the AML descriptor */ - - AmlResourceSource = ACPI_ADD_PTR (UINT8, Aml, MinimumLength); - - /* Copy the ResourceSourceIndex */ - - AmlResourceSource[0] = (UINT8) ResourceSource->Index; - - /* Copy the ResourceSource string */ - - strcpy (ACPI_CAST_PTR (char, &AmlResourceSource[1]), - ResourceSource->StringPtr); - - /* - * Add the length of the string (+ 1 for null terminator) to the - * final descriptor length - */ - DescriptorLength += ((ACPI_RSDESC_SIZE) - ResourceSource->StringLength + 1); - } - - /* Return the new total length of the AML descriptor */ - - return (DescriptorLength); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiRsGetPrtMethodData - * - * PARAMETERS: Node - Device node - * RetBuffer - Pointer to a buffer structure for the - * results - * - * RETURN: Status - * - * DESCRIPTION: This function is called to get the _PRT value of an object - * contained in an object specified by the handle passed in - * - * If the function fails an appropriate status will be returned - * and the contents of the callers buffer is undefined. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiRsGetPrtMethodData ( - ACPI_NAMESPACE_NODE *Node, - ACPI_BUFFER *RetBuffer) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (RsGetPrtMethodData); - - - /* Parameters guaranteed valid by caller */ - - /* Execute the method, no parameters */ - - Status = AcpiUtEvaluateObject ( - Node, METHOD_NAME__PRT, ACPI_BTYPE_PACKAGE, &ObjDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* - * Create a resource linked list from the byte stream buffer that comes - * back from the _CRS method execution. - */ - Status = AcpiRsCreatePciRoutingTable (ObjDesc, RetBuffer); - - /* On exit, we must delete the object returned by EvaluateObject */ - - AcpiUtRemoveReference (ObjDesc); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiRsGetCrsMethodData - * - * PARAMETERS: Node - Device node - * RetBuffer - Pointer to a buffer structure for the - * results - * - * RETURN: Status - * - * DESCRIPTION: This function is called to get the _CRS value of an object - * contained in an object specified by the handle passed in - * - * If the function fails an appropriate status will be returned - * and the contents of the callers buffer is undefined. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiRsGetCrsMethodData ( - ACPI_NAMESPACE_NODE *Node, - ACPI_BUFFER *RetBuffer) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (RsGetCrsMethodData); - - - /* Parameters guaranteed valid by caller */ - - /* Execute the method, no parameters */ - - Status = AcpiUtEvaluateObject ( - Node, METHOD_NAME__CRS, ACPI_BTYPE_BUFFER, &ObjDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* - * Make the call to create a resource linked list from the - * byte stream buffer that comes back from the _CRS method - * execution. - */ - Status = AcpiRsCreateResourceList (ObjDesc, RetBuffer); - - /* On exit, we must delete the object returned by evaluateObject */ - - AcpiUtRemoveReference (ObjDesc); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiRsGetPrsMethodData - * - * PARAMETERS: Node - Device node - * RetBuffer - Pointer to a buffer structure for the - * results - * - * RETURN: Status - * - * DESCRIPTION: This function is called to get the _PRS value of an object - * contained in an object specified by the handle passed in - * - * If the function fails an appropriate status will be returned - * and the contents of the callers buffer is undefined. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiRsGetPrsMethodData ( - ACPI_NAMESPACE_NODE *Node, - ACPI_BUFFER *RetBuffer) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (RsGetPrsMethodData); - - - /* Parameters guaranteed valid by caller */ - - /* Execute the method, no parameters */ - - Status = AcpiUtEvaluateObject ( - Node, METHOD_NAME__PRS, ACPI_BTYPE_BUFFER, &ObjDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* - * Make the call to create a resource linked list from the - * byte stream buffer that comes back from the _CRS method - * execution. - */ - Status = AcpiRsCreateResourceList (ObjDesc, RetBuffer); - - /* On exit, we must delete the object returned by evaluateObject */ - - AcpiUtRemoveReference (ObjDesc); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiRsGetAeiMethodData - * - * PARAMETERS: Node - Device node - * RetBuffer - Pointer to a buffer structure for the - * results - * - * RETURN: Status - * - * DESCRIPTION: This function is called to get the _AEI value of an object - * contained in an object specified by the handle passed in - * - * If the function fails an appropriate status will be returned - * and the contents of the callers buffer is undefined. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiRsGetAeiMethodData ( - ACPI_NAMESPACE_NODE *Node, - ACPI_BUFFER *RetBuffer) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (RsGetAeiMethodData); - - - /* Parameters guaranteed valid by caller */ - - /* Execute the method, no parameters */ - - Status = AcpiUtEvaluateObject ( - Node, METHOD_NAME__AEI, ACPI_BTYPE_BUFFER, &ObjDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* - * Make the call to create a resource linked list from the - * byte stream buffer that comes back from the _CRS method - * execution. - */ - Status = AcpiRsCreateResourceList (ObjDesc, RetBuffer); - - /* On exit, we must delete the object returned by evaluateObject */ - - AcpiUtRemoveReference (ObjDesc); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiRsGetMethodData - * - * PARAMETERS: Handle - Handle to the containing object - * Path - Path to method, relative to Handle - * RetBuffer - Pointer to a buffer structure for the - * results - * - * RETURN: Status - * - * DESCRIPTION: This function is called to get the _CRS or _PRS value of an - * object contained in an object specified by the handle passed in - * - * If the function fails an appropriate status will be returned - * and the contents of the callers buffer is undefined. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiRsGetMethodData ( - ACPI_HANDLE Handle, - const char *Path, - ACPI_BUFFER *RetBuffer) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (RsGetMethodData); - - - /* Parameters guaranteed valid by caller */ - - /* Execute the method, no parameters */ - - Status = AcpiUtEvaluateObject ( - ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Handle), - Path, ACPI_BTYPE_BUFFER, &ObjDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* - * Make the call to create a resource linked list from the - * byte stream buffer that comes back from the method - * execution. - */ - Status = AcpiRsCreateResourceList (ObjDesc, RetBuffer); - - /* On exit, we must delete the object returned by EvaluateObject */ - - AcpiUtRemoveReference (ObjDesc); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiRsSetSrsMethodData - * - * PARAMETERS: Node - Device node - * InBuffer - Pointer to a buffer structure of the - * parameter - * - * RETURN: Status - * - * DESCRIPTION: This function is called to set the _SRS of an object contained - * in an object specified by the handle passed in - * - * If the function fails an appropriate status will be returned - * and the contents of the callers buffer is undefined. - * - * Note: Parameters guaranteed valid by caller - * - ******************************************************************************/ - -ACPI_STATUS -AcpiRsSetSrsMethodData ( - ACPI_NAMESPACE_NODE *Node, - ACPI_BUFFER *InBuffer) -{ - ACPI_EVALUATE_INFO *Info; - ACPI_OPERAND_OBJECT *Args[2]; - ACPI_STATUS Status; - ACPI_BUFFER Buffer; - - - ACPI_FUNCTION_TRACE (RsSetSrsMethodData); - - - /* Allocate and initialize the evaluation information block */ - - Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO)); - if (!Info) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - Info->PrefixNode = Node; - Info->RelativePathname = METHOD_NAME__SRS; - Info->Parameters = Args; - Info->Flags = ACPI_IGNORE_RETURN_VALUE; - - /* - * The InBuffer parameter will point to a linked list of - * resource parameters. It needs to be formatted into a - * byte stream to be sent in as an input parameter to _SRS - * - * Convert the linked list into a byte stream - */ - Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiRsCreateAmlResources (InBuffer, &Buffer); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - /* Create and initialize the method parameter object */ - - Args[0] = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER); - if (!Args[0]) - { - /* - * Must free the buffer allocated above (otherwise it is freed - * later) - */ - ACPI_FREE (Buffer.Pointer); - Status = AE_NO_MEMORY; - goto Cleanup; - } - - Args[0]->Buffer.Length = (UINT32) Buffer.Length; - Args[0]->Buffer.Pointer = Buffer.Pointer; - Args[0]->Common.Flags = AOPOBJ_DATA_VALID; - Args[1] = NULL; - - /* Execute the method, no return value is expected */ - - Status = AcpiNsEvaluate (Info); - - /* Clean up and return the status from AcpiNsEvaluate */ - - AcpiUtRemoveReference (Args[0]); - -Cleanup: - ACPI_FREE (Info); - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/rsxface.c b/drivers/acpica/rsxface.c deleted file mode 100644 index ad9783b..0000000 --- a/drivers/acpica/rsxface.c +++ /dev/null @@ -1,852 +0,0 @@ -/******************************************************************************* - * - * Module Name: rsxface - Public interfaces to the resource manager - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#define EXPORT_ACPI_INTERFACES - -#include "acpi.h" -#include "accommon.h" -#include "acresrc.h" -#include "acnamesp.h" - -#define _COMPONENT ACPI_RESOURCES - ACPI_MODULE_NAME ("rsxface") - -/* Local macros for 16,32-bit to 64-bit conversion */ - -#define ACPI_COPY_FIELD(Out, In, Field) ((Out)->Field = (In)->Field) -#define ACPI_COPY_ADDRESS(Out, In) \ - ACPI_COPY_FIELD(Out, In, ResourceType); \ - ACPI_COPY_FIELD(Out, In, ProducerConsumer); \ - ACPI_COPY_FIELD(Out, In, Decode); \ - ACPI_COPY_FIELD(Out, In, MinAddressFixed); \ - ACPI_COPY_FIELD(Out, In, MaxAddressFixed); \ - ACPI_COPY_FIELD(Out, In, Info); \ - ACPI_COPY_FIELD(Out, In, Address.Granularity); \ - ACPI_COPY_FIELD(Out, In, Address.Minimum); \ - ACPI_COPY_FIELD(Out, In, Address.Maximum); \ - ACPI_COPY_FIELD(Out, In, Address.TranslationOffset); \ - ACPI_COPY_FIELD(Out, In, Address.AddressLength); \ - ACPI_COPY_FIELD(Out, In, ResourceSource); - - -/* Local prototypes */ - -static ACPI_STATUS -AcpiRsMatchVendorResource ( - ACPI_RESOURCE *Resource, - void *Context); - -static ACPI_STATUS -AcpiRsValidateParameters ( - ACPI_HANDLE DeviceHandle, - ACPI_BUFFER *Buffer, - ACPI_NAMESPACE_NODE **ReturnNode); - - -/******************************************************************************* - * - * FUNCTION: AcpiRsValidateParameters - * - * PARAMETERS: DeviceHandle - Handle to a device - * Buffer - Pointer to a data buffer - * ReturnNode - Pointer to where the device node is returned - * - * RETURN: Status - * - * DESCRIPTION: Common parameter validation for resource interfaces - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiRsValidateParameters ( - ACPI_HANDLE DeviceHandle, - ACPI_BUFFER *Buffer, - ACPI_NAMESPACE_NODE **ReturnNode) -{ - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node; - - - ACPI_FUNCTION_TRACE (RsValidateParameters); - - - /* - * Must have a valid handle to an ACPI device - */ - if (!DeviceHandle) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - Node = AcpiNsValidateHandle (DeviceHandle); - if (!Node) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - if (Node->Type != ACPI_TYPE_DEVICE) - { - return_ACPI_STATUS (AE_TYPE); - } - - /* - * Validate the user buffer object - * - * if there is a non-zero buffer length we also need a valid pointer in - * the buffer. If it's a zero buffer length, we'll be returning the - * needed buffer size (later), so keep going. - */ - Status = AcpiUtValidateBuffer (Buffer); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - *ReturnNode = Node; - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiGetIrqRoutingTable - * - * PARAMETERS: DeviceHandle - Handle to the Bus device we are querying - * RetBuffer - Pointer to a buffer to receive the - * current resources for the device - * - * RETURN: Status - * - * DESCRIPTION: This function is called to get the IRQ routing table for a - * specific bus. The caller must first acquire a handle for the - * desired bus. The routine table is placed in the buffer pointed - * to by the RetBuffer variable parameter. - * - * If the function fails an appropriate status will be returned - * and the value of RetBuffer is undefined. - * - * This function attempts to execute the _PRT method contained in - * the object indicated by the passed DeviceHandle. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiGetIrqRoutingTable ( - ACPI_HANDLE DeviceHandle, - ACPI_BUFFER *RetBuffer) -{ - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node; - - - ACPI_FUNCTION_TRACE (AcpiGetIrqRoutingTable); - - - /* Validate parameters then dispatch to internal routine */ - - Status = AcpiRsValidateParameters (DeviceHandle, RetBuffer, &Node); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Status = AcpiRsGetPrtMethodData (Node, RetBuffer); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiGetIrqRoutingTable) - - -/******************************************************************************* - * - * FUNCTION: AcpiGetCurrentResources - * - * PARAMETERS: DeviceHandle - Handle to the device object for the - * device we are querying - * RetBuffer - Pointer to a buffer to receive the - * current resources for the device - * - * RETURN: Status - * - * DESCRIPTION: This function is called to get the current resources for a - * specific device. The caller must first acquire a handle for - * the desired device. The resource data is placed in the buffer - * pointed to by the RetBuffer variable parameter. - * - * If the function fails an appropriate status will be returned - * and the value of RetBuffer is undefined. - * - * This function attempts to execute the _CRS method contained in - * the object indicated by the passed DeviceHandle. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiGetCurrentResources ( - ACPI_HANDLE DeviceHandle, - ACPI_BUFFER *RetBuffer) -{ - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node; - - - ACPI_FUNCTION_TRACE (AcpiGetCurrentResources); - - - /* Validate parameters then dispatch to internal routine */ - - Status = AcpiRsValidateParameters (DeviceHandle, RetBuffer, &Node); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Status = AcpiRsGetCrsMethodData (Node, RetBuffer); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiGetCurrentResources) - - -/******************************************************************************* - * - * FUNCTION: AcpiGetPossibleResources - * - * PARAMETERS: DeviceHandle - Handle to the device object for the - * device we are querying - * RetBuffer - Pointer to a buffer to receive the - * resources for the device - * - * RETURN: Status - * - * DESCRIPTION: This function is called to get a list of the possible resources - * for a specific device. The caller must first acquire a handle - * for the desired device. The resource data is placed in the - * buffer pointed to by the RetBuffer variable. - * - * If the function fails an appropriate status will be returned - * and the value of RetBuffer is undefined. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiGetPossibleResources ( - ACPI_HANDLE DeviceHandle, - ACPI_BUFFER *RetBuffer) -{ - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node; - - - ACPI_FUNCTION_TRACE (AcpiGetPossibleResources); - - - /* Validate parameters then dispatch to internal routine */ - - Status = AcpiRsValidateParameters (DeviceHandle, RetBuffer, &Node); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Status = AcpiRsGetPrsMethodData (Node, RetBuffer); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiGetPossibleResources) - - -/******************************************************************************* - * - * FUNCTION: AcpiSetCurrentResources - * - * PARAMETERS: DeviceHandle - Handle to the device object for the - * device we are setting resources - * InBuffer - Pointer to a buffer containing the - * resources to be set for the device - * - * RETURN: Status - * - * DESCRIPTION: This function is called to set the current resources for a - * specific device. The caller must first acquire a handle for - * the desired device. The resource data is passed to the routine - * the buffer pointed to by the InBuffer variable. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiSetCurrentResources ( - ACPI_HANDLE DeviceHandle, - ACPI_BUFFER *InBuffer) -{ - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node; - - - ACPI_FUNCTION_TRACE (AcpiSetCurrentResources); - - - /* Validate the buffer, don't allow zero length */ - - if ((!InBuffer) || - (!InBuffer->Pointer) || - (!InBuffer->Length)) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* Validate parameters then dispatch to internal routine */ - - Status = AcpiRsValidateParameters (DeviceHandle, InBuffer, &Node); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Status = AcpiRsSetSrsMethodData (Node, InBuffer); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiSetCurrentResources) - - -/******************************************************************************* - * - * FUNCTION: AcpiGetEventResources - * - * PARAMETERS: DeviceHandle - Handle to the device object for the - * device we are getting resources - * InBuffer - Pointer to a buffer containing the - * resources to be set for the device - * - * RETURN: Status - * - * DESCRIPTION: This function is called to get the event resources for a - * specific device. The caller must first acquire a handle for - * the desired device. The resource data is passed to the routine - * the buffer pointed to by the InBuffer variable. Uses the - * _AEI method. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiGetEventResources ( - ACPI_HANDLE DeviceHandle, - ACPI_BUFFER *RetBuffer) -{ - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node; - - - ACPI_FUNCTION_TRACE (AcpiGetEventResources); - - - /* Validate parameters then dispatch to internal routine */ - - Status = AcpiRsValidateParameters (DeviceHandle, RetBuffer, &Node); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Status = AcpiRsGetAeiMethodData (Node, RetBuffer); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiGetEventResources) - - -/****************************************************************************** - * - * FUNCTION: AcpiResourceToAddress64 - * - * PARAMETERS: Resource - Pointer to a resource - * Out - Pointer to the users's return buffer - * (a struct acpi_resource_address64) - * - * RETURN: Status - * - * DESCRIPTION: If the resource is an address16, address32, or address64, - * copy it to the address64 return buffer. This saves the - * caller from having to duplicate code for different-sized - * addresses. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiResourceToAddress64 ( - ACPI_RESOURCE *Resource, - ACPI_RESOURCE_ADDRESS64 *Out) -{ - ACPI_RESOURCE_ADDRESS16 *Address16; - ACPI_RESOURCE_ADDRESS32 *Address32; - - - if (!Resource || !Out) - { - return (AE_BAD_PARAMETER); - } - - /* Convert 16 or 32 address descriptor to 64 */ - - switch (Resource->Type) - { - case ACPI_RESOURCE_TYPE_ADDRESS16: - - Address16 = ACPI_CAST_PTR ( - ACPI_RESOURCE_ADDRESS16, &Resource->Data); - ACPI_COPY_ADDRESS (Out, Address16); - break; - - case ACPI_RESOURCE_TYPE_ADDRESS32: - - Address32 = ACPI_CAST_PTR ( - ACPI_RESOURCE_ADDRESS32, &Resource->Data); - ACPI_COPY_ADDRESS (Out, Address32); - break; - - case ACPI_RESOURCE_TYPE_ADDRESS64: - - /* Simple copy for 64 bit source */ - - memcpy (Out, &Resource->Data, sizeof (ACPI_RESOURCE_ADDRESS64)); - break; - - default: - - return (AE_BAD_PARAMETER); - } - - return (AE_OK); -} - -ACPI_EXPORT_SYMBOL (AcpiResourceToAddress64) - - -/******************************************************************************* - * - * FUNCTION: AcpiGetVendorResource - * - * PARAMETERS: DeviceHandle - Handle for the parent device object - * Name - Method name for the parent resource - * (METHOD_NAME__CRS or METHOD_NAME__PRS) - * Uuid - Pointer to the UUID to be matched. - * includes both subtype and 16-byte UUID - * RetBuffer - Where the vendor resource is returned - * - * RETURN: Status - * - * DESCRIPTION: Walk a resource template for the specified device to find a - * vendor-defined resource that matches the supplied UUID and - * UUID subtype. Returns a ACPI_RESOURCE of type Vendor. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiGetVendorResource ( - ACPI_HANDLE DeviceHandle, - char *Name, - ACPI_VENDOR_UUID *Uuid, - ACPI_BUFFER *RetBuffer) -{ - ACPI_VENDOR_WALK_INFO Info; - ACPI_STATUS Status; - - - /* Other parameters are validated by AcpiWalkResources */ - - if (!Uuid || !RetBuffer) - { - return (AE_BAD_PARAMETER); - } - - Info.Uuid = Uuid; - Info.Buffer = RetBuffer; - Info.Status = AE_NOT_EXIST; - - /* Walk the _CRS or _PRS resource list for this device */ - - Status = AcpiWalkResources ( - DeviceHandle, Name, AcpiRsMatchVendorResource, &Info); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - return (Info.Status); -} - -ACPI_EXPORT_SYMBOL (AcpiGetVendorResource) - - -/******************************************************************************* - * - * FUNCTION: AcpiRsMatchVendorResource - * - * PARAMETERS: ACPI_WALK_RESOURCE_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Match a vendor resource via the ACPI 3.0 UUID - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiRsMatchVendorResource ( - ACPI_RESOURCE *Resource, - void *Context) -{ - ACPI_VENDOR_WALK_INFO *Info = Context; - ACPI_RESOURCE_VENDOR_TYPED *Vendor; - ACPI_BUFFER *Buffer; - ACPI_STATUS Status; - - - /* Ignore all descriptors except Vendor */ - - if (Resource->Type != ACPI_RESOURCE_TYPE_VENDOR) - { - return (AE_OK); - } - - Vendor = &Resource->Data.VendorTyped; - - /* - * For a valid match, these conditions must hold: - * - * 1) Length of descriptor data must be at least as long as a UUID struct - * 2) The UUID subtypes must match - * 3) The UUID data must match - */ - if ((Vendor->ByteLength < (ACPI_UUID_LENGTH + 1)) || - (Vendor->UuidSubtype != Info->Uuid->Subtype) || - (memcmp (Vendor->Uuid, Info->Uuid->Data, ACPI_UUID_LENGTH))) - { - return (AE_OK); - } - - /* Validate/Allocate/Clear caller buffer */ - - Buffer = Info->Buffer; - Status = AcpiUtInitializeBuffer (Buffer, Resource->Length); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Found the correct resource, copy and return it */ - - memcpy (Buffer->Pointer, Resource, Resource->Length); - Buffer->Length = Resource->Length; - - /* Found the desired descriptor, terminate resource walk */ - - Info->Status = AE_OK; - return (AE_CTRL_TERMINATE); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiWalkResourceBuffer - * - * PARAMETERS: Buffer - Formatted buffer returned by one of the - * various Get*Resource functions - * UserFunction - Called for each resource - * Context - Passed to UserFunction - * - * RETURN: Status - * - * DESCRIPTION: Walks the input resource template. The UserFunction is called - * once for each resource in the list. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiWalkResourceBuffer ( - ACPI_BUFFER *Buffer, - ACPI_WALK_RESOURCE_CALLBACK UserFunction, - void *Context) -{ - ACPI_STATUS Status = AE_OK; - ACPI_RESOURCE *Resource; - ACPI_RESOURCE *ResourceEnd; - - - ACPI_FUNCTION_TRACE (AcpiWalkResourceBuffer); - - - /* Parameter validation */ - - if (!Buffer || !Buffer->Pointer || !UserFunction) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* Buffer contains the resource list and length */ - - Resource = ACPI_CAST_PTR (ACPI_RESOURCE, Buffer->Pointer); - ResourceEnd = ACPI_ADD_PTR ( - ACPI_RESOURCE, Buffer->Pointer, Buffer->Length); - - /* Walk the resource list until the EndTag is found (or buffer end) */ - - while (Resource < ResourceEnd) - { - /* Sanity check the resource type */ - - if (Resource->Type > ACPI_RESOURCE_TYPE_MAX) - { - Status = AE_AML_INVALID_RESOURCE_TYPE; - break; - } - - /* Sanity check the length. It must not be zero, or we loop forever */ - - if (!Resource->Length) - { - return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); - } - - /* Invoke the user function, abort on any error returned */ - - Status = UserFunction (Resource, Context); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_CTRL_TERMINATE) - { - /* This is an OK termination by the user function */ - - Status = AE_OK; - } - break; - } - - /* EndTag indicates end-of-list */ - - if (Resource->Type == ACPI_RESOURCE_TYPE_END_TAG) - { - break; - } - - /* Get the next resource descriptor */ - - Resource = ACPI_NEXT_RESOURCE (Resource); - } - - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiWalkResourceBuffer) - - -/******************************************************************************* - * - * FUNCTION: AcpiWalkResources - * - * PARAMETERS: DeviceHandle - Handle to the device object for the - * device we are querying - * Name - Method name of the resources we want. - * (METHOD_NAME__CRS, METHOD_NAME__PRS, or - * METHOD_NAME__AEI or METHOD_NAME__DMA) - * UserFunction - Called for each resource - * Context - Passed to UserFunction - * - * RETURN: Status - * - * DESCRIPTION: Retrieves the current or possible resource list for the - * specified device. The UserFunction is called once for - * each resource in the list. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiWalkResources ( - ACPI_HANDLE DeviceHandle, - char *Name, - ACPI_WALK_RESOURCE_CALLBACK UserFunction, - void *Context) -{ - ACPI_STATUS Status; - ACPI_BUFFER Buffer; - - - ACPI_FUNCTION_TRACE (AcpiWalkResources); - - - /* Parameter validation */ - - if (!DeviceHandle || !UserFunction || !Name || - (!ACPI_COMPARE_NAMESEG (Name, METHOD_NAME__CRS) && - !ACPI_COMPARE_NAMESEG (Name, METHOD_NAME__PRS) && - !ACPI_COMPARE_NAMESEG (Name, METHOD_NAME__AEI) && - !ACPI_COMPARE_NAMESEG (Name, METHOD_NAME__DMA))) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* Get the _CRS/_PRS/_AEI/_DMA resource list */ - - Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiRsGetMethodData (DeviceHandle, Name, &Buffer); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Walk the resource list and cleanup */ - - Status = AcpiWalkResourceBuffer (&Buffer, UserFunction, Context); - ACPI_FREE (Buffer.Pointer); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiWalkResources) diff --git a/drivers/acpica/tbdata.c b/drivers/acpica/tbdata.c deleted file mode 100644 index b371f3e..0000000 --- a/drivers/acpica/tbdata.c +++ /dev/null @@ -1,1378 +0,0 @@ -/****************************************************************************** - * - * Module Name: tbdata - Table manager data structure functions - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" -#include "actables.h" -#include "acevents.h" - -#define _COMPONENT ACPI_TABLES - ACPI_MODULE_NAME ("tbdata") - -/* Local prototypes */ - -static ACPI_STATUS -AcpiTbCheckDuplication ( - ACPI_TABLE_DESC *TableDesc, - UINT32 *TableIndex); - -static BOOLEAN -AcpiTbCompareTables ( - ACPI_TABLE_DESC *TableDesc, - UINT32 TableIndex); - - -/******************************************************************************* - * - * FUNCTION: AcpiTbCompareTables - * - * PARAMETERS: TableDesc - Table 1 descriptor to be compared - * TableIndex - Index of table 2 to be compared - * - * RETURN: TRUE if both tables are identical. - * - * DESCRIPTION: This function compares a table with another table that has - * already been installed in the root table list. - * - ******************************************************************************/ - -static BOOLEAN -AcpiTbCompareTables ( - ACPI_TABLE_DESC *TableDesc, - UINT32 TableIndex) -{ - ACPI_STATUS Status = AE_OK; - BOOLEAN IsIdentical; - ACPI_TABLE_HEADER *Table; - UINT32 TableLength; - UINT8 TableFlags; - - - Status = AcpiTbAcquireTable (&AcpiGbl_RootTableList.Tables[TableIndex], - &Table, &TableLength, &TableFlags); - if (ACPI_FAILURE (Status)) - { - return (FALSE); - } - - /* - * Check for a table match on the entire table length, - * not just the header. - */ - IsIdentical = (BOOLEAN)((TableDesc->Length != TableLength || - memcmp (TableDesc->Pointer, Table, TableLength)) ? - FALSE : TRUE); - - /* Release the acquired table */ - - AcpiTbReleaseTable (Table, TableLength, TableFlags); - return (IsIdentical); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbInitTableDescriptor - * - * PARAMETERS: TableDesc - Table descriptor - * Address - Physical address of the table - * Flags - Allocation flags of the table - * Table - Pointer to the table - * - * RETURN: None - * - * DESCRIPTION: Initialize a new table descriptor - * - ******************************************************************************/ - -void -AcpiTbInitTableDescriptor ( - ACPI_TABLE_DESC *TableDesc, - ACPI_PHYSICAL_ADDRESS Address, - UINT8 Flags, - ACPI_TABLE_HEADER *Table) -{ - - /* - * Initialize the table descriptor. Set the pointer to NULL for external - * tables, since the table is not fully mapped at this time. - */ - memset (TableDesc, 0, sizeof (ACPI_TABLE_DESC)); - TableDesc->Address = Address; - TableDesc->Length = Table->Length; - TableDesc->Flags = Flags; - ACPI_MOVE_32_TO_32 (TableDesc->Signature.Ascii, Table->Signature); - - switch (TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK) - { - case ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL: - case ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL: - - TableDesc->Pointer = Table; - break; - - case ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL: - default: - - break; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbAcquireTable - * - * PARAMETERS: TableDesc - Table descriptor - * TablePtr - Where table is returned - * TableLength - Where table length is returned - * TableFlags - Where table allocation flags are returned - * - * RETURN: Status - * - * DESCRIPTION: Acquire an ACPI table. It can be used for tables not - * maintained in the AcpiGbl_RootTableList. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiTbAcquireTable ( - ACPI_TABLE_DESC *TableDesc, - ACPI_TABLE_HEADER **TablePtr, - UINT32 *TableLength, - UINT8 *TableFlags) -{ - ACPI_TABLE_HEADER *Table = NULL; - - - switch (TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK) - { - case ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL: - - Table = AcpiOsMapMemory (TableDesc->Address, TableDesc->Length); - break; - - case ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL: - case ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL: - - Table = TableDesc->Pointer; - break; - - default: - - break; - } - - /* Table is not valid yet */ - - if (!Table) - { - return (AE_NO_MEMORY); - } - - /* Fill the return values */ - - *TablePtr = Table; - *TableLength = TableDesc->Length; - *TableFlags = TableDesc->Flags; - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbReleaseTable - * - * PARAMETERS: Table - Pointer for the table - * TableLength - Length for the table - * TableFlags - Allocation flags for the table - * - * RETURN: None - * - * DESCRIPTION: Release a table. The inverse of AcpiTbAcquireTable(). - * - ******************************************************************************/ - -void -AcpiTbReleaseTable ( - ACPI_TABLE_HEADER *Table, - UINT32 TableLength, - UINT8 TableFlags) -{ - - switch (TableFlags & ACPI_TABLE_ORIGIN_MASK) - { - case ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL: - - AcpiOsUnmapMemory (Table, TableLength); - break; - - case ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL: - case ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL: - default: - - break; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbAcquireTempTable - * - * PARAMETERS: TableDesc - Table descriptor to be acquired - * Address - Address of the table - * Flags - Allocation flags of the table - * Table - Pointer to the table (required for virtual - * origins, optional for physical) - * - * RETURN: Status - * - * DESCRIPTION: This function validates the table header to obtain the length - * of a table and fills the table descriptor to make its state as - * "INSTALLED". Such a table descriptor is only used for verified - * installation. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiTbAcquireTempTable ( - ACPI_TABLE_DESC *TableDesc, - ACPI_PHYSICAL_ADDRESS Address, - UINT8 Flags, - ACPI_TABLE_HEADER *Table) -{ - BOOLEAN MappedTable = FALSE; - - - switch (Flags & ACPI_TABLE_ORIGIN_MASK) - { - case ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL: - - /* Get the length of the full table from the header */ - - if (!Table) - { - Table = AcpiOsMapMemory (Address, sizeof (ACPI_TABLE_HEADER)); - if (!Table) - { - return (AE_NO_MEMORY); - } - - MappedTable = TRUE; - } - - break; - - case ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL: - case ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL: - - if (!Table) - { - return (AE_BAD_PARAMETER); - } - - break; - - default: - - /* Table is not valid yet */ - - return (AE_NO_MEMORY); - } - - AcpiTbInitTableDescriptor (TableDesc, Address, Flags, Table); - if (MappedTable) - { - AcpiOsUnmapMemory (Table, sizeof (ACPI_TABLE_HEADER)); - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbReleaseTempTable - * - * PARAMETERS: TableDesc - Table descriptor to be released - * - * RETURN: Status - * - * DESCRIPTION: The inverse of AcpiTbAcquireTempTable(). - * - *****************************************************************************/ - -void -AcpiTbReleaseTempTable ( - ACPI_TABLE_DESC *TableDesc) -{ - - /* - * Note that the .Address is maintained by the callers of - * AcpiTbAcquireTempTable(), thus do not invoke AcpiTbUninstallTable() - * where .Address will be freed. - */ - AcpiTbInvalidateTable (TableDesc); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiTbValidateTable - * - * PARAMETERS: TableDesc - Table descriptor - * - * RETURN: Status - * - * DESCRIPTION: This function is called to validate the table, the returned - * table descriptor is in "VALIDATED" state. - * - *****************************************************************************/ - -ACPI_STATUS -AcpiTbValidateTable ( - ACPI_TABLE_DESC *TableDesc) -{ - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE (TbValidateTable); - - - /* Validate the table if necessary */ - - if (!TableDesc->Pointer) - { - Status = AcpiTbAcquireTable (TableDesc, &TableDesc->Pointer, - &TableDesc->Length, &TableDesc->Flags); - if (!TableDesc->Pointer) - { - Status = AE_NO_MEMORY; - } - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbInvalidateTable - * - * PARAMETERS: TableDesc - Table descriptor - * - * RETURN: None - * - * DESCRIPTION: Invalidate one internal ACPI table, this is the inverse of - * AcpiTbValidateTable(). - * - ******************************************************************************/ - -void -AcpiTbInvalidateTable ( - ACPI_TABLE_DESC *TableDesc) -{ - - ACPI_FUNCTION_TRACE (TbInvalidateTable); - - - /* Table must be validated */ - - if (!TableDesc->Pointer) - { - return_VOID; - } - - AcpiTbReleaseTable (TableDesc->Pointer, TableDesc->Length, - TableDesc->Flags); - - switch (TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK) - { - case ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL: - - TableDesc->Pointer = NULL; - break; - - case ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL: - case ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL: - default: - - break; - } - - return_VOID; -} - - -/****************************************************************************** - * - * FUNCTION: AcpiTbValidateTempTable - * - * PARAMETERS: TableDesc - Table descriptor - * - * RETURN: Status - * - * DESCRIPTION: This function is called to validate the table, the returned - * table descriptor is in "VALIDATED" state. - * - *****************************************************************************/ - -ACPI_STATUS -AcpiTbValidateTempTable ( - ACPI_TABLE_DESC *TableDesc) -{ - - if (!TableDesc->Pointer && !AcpiGbl_EnableTableValidation) - { - /* - * Only validates the header of the table. - * Note that Length contains the size of the mapping after invoking - * this work around, this value is required by - * AcpiTbReleaseTempTable(). - * We can do this because in AcpiInitTableDescriptor(), the Length - * field of the installed descriptor is filled with the actual - * table length obtaining from the table header. - */ - TableDesc->Length = sizeof (ACPI_TABLE_HEADER); - } - - return (AcpiTbValidateTable (TableDesc)); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbCheckDuplication - * - * PARAMETERS: TableDesc - Table descriptor - * TableIndex - Where the table index is returned - * - * RETURN: Status - * - * DESCRIPTION: Avoid installing duplicated tables. However table override and - * user aided dynamic table load is allowed, thus comparing the - * address of the table is not sufficient, and checking the entire - * table content is required. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiTbCheckDuplication ( - ACPI_TABLE_DESC *TableDesc, - UINT32 *TableIndex) -{ - UINT32 i; - - - ACPI_FUNCTION_TRACE (TbCheckDuplication); - - - /* Check if table is already registered */ - - for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i) - { - /* Do not compare with unverified tables */ - - if (!(AcpiGbl_RootTableList.Tables[i].Flags & ACPI_TABLE_IS_VERIFIED)) - { - continue; - } - - /* - * Check for a table match on the entire table length, - * not just the header. - */ - if (!AcpiTbCompareTables (TableDesc, i)) - { - continue; - } - - /* - * Note: the current mechanism does not unregister a table if it is - * dynamically unloaded. The related namespace entries are deleted, - * but the table remains in the root table list. - * - * The assumption here is that the number of different tables that - * will be loaded is actually small, and there is minimal overhead - * in just keeping the table in case it is needed again. - * - * If this assumption changes in the future (perhaps on large - * machines with many table load/unload operations), tables will - * need to be unregistered when they are unloaded, and slots in the - * root table list should be reused when empty. - */ - if (AcpiGbl_RootTableList.Tables[i].Flags & - ACPI_TABLE_IS_LOADED) - { - /* Table is still loaded, this is an error */ - - return_ACPI_STATUS (AE_ALREADY_EXISTS); - } - else - { - *TableIndex = i; - return_ACPI_STATUS (AE_CTRL_TERMINATE); - } - } - - /* Indicate no duplication to the caller */ - - return_ACPI_STATUS (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiTbVerifyTempTable - * - * PARAMETERS: TableDesc - Table descriptor - * Signature - Table signature to verify - * TableIndex - Where the table index is returned - * - * RETURN: Status - * - * DESCRIPTION: This function is called to validate and verify the table, the - * returned table descriptor is in "VALIDATED" state. - * Note that 'TableIndex' is required to be set to !NULL to - * enable duplication check. - * - *****************************************************************************/ - -ACPI_STATUS -AcpiTbVerifyTempTable ( - ACPI_TABLE_DESC *TableDesc, - char *Signature, - UINT32 *TableIndex) -{ - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE (TbVerifyTempTable); - - - /* Validate the table */ - - Status = AcpiTbValidateTempTable (TableDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* If a particular signature is expected (DSDT/FACS), it must match */ - - if (Signature && - !ACPI_COMPARE_NAMESEG (&TableDesc->Signature, Signature)) - { - ACPI_BIOS_ERROR ((AE_INFO, - "Invalid signature 0x%X for ACPI table, expected [%s]", - TableDesc->Signature.Integer, Signature)); - Status = AE_BAD_SIGNATURE; - goto InvalidateAndExit; - } - - if (AcpiGbl_EnableTableValidation) - { - /* Verify the checksum */ - - Status = AcpiUtVerifyChecksum (TableDesc->Pointer, TableDesc->Length); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, AE_NO_MEMORY, - "%4.4s 0x%8.8X%8.8X" - " Attempted table install failed", - AcpiUtValidNameseg (TableDesc->Signature.Ascii) ? - TableDesc->Signature.Ascii : "????", - ACPI_FORMAT_UINT64 (TableDesc->Address))); - - goto InvalidateAndExit; - } - - /* Avoid duplications */ - - if (TableIndex) - { - Status = AcpiTbCheckDuplication (TableDesc, TableIndex); - if (ACPI_FAILURE (Status)) - { - if (Status != AE_CTRL_TERMINATE) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "%4.4s 0x%8.8X%8.8X" - " Table is already loaded", - AcpiUtValidNameseg (TableDesc->Signature.Ascii) ? - TableDesc->Signature.Ascii : "????", - ACPI_FORMAT_UINT64 (TableDesc->Address))); - } - - goto InvalidateAndExit; - } - } - - TableDesc->Flags |= ACPI_TABLE_IS_VERIFIED; - } - - return_ACPI_STATUS (Status); - -InvalidateAndExit: - AcpiTbInvalidateTable (TableDesc); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbResizeRootTableList - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Expand the size of global table array - * - ******************************************************************************/ - -ACPI_STATUS -AcpiTbResizeRootTableList ( - void) -{ - ACPI_TABLE_DESC *Tables; - UINT32 TableCount; - UINT32 CurrentTableCount, MaxTableCount; - UINT32 i; - - - ACPI_FUNCTION_TRACE (TbResizeRootTableList); - - - /* AllowResize flag is a parameter to AcpiInitializeTables */ - - if (!(AcpiGbl_RootTableList.Flags & ACPI_ROOT_ALLOW_RESIZE)) - { - ACPI_ERROR ((AE_INFO, "Resize of Root Table Array is not allowed")); - return_ACPI_STATUS (AE_SUPPORT); - } - - /* Increase the Table Array size */ - - if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED) - { - TableCount = AcpiGbl_RootTableList.MaxTableCount; - } - else - { - TableCount = AcpiGbl_RootTableList.CurrentTableCount; - } - - MaxTableCount = TableCount + ACPI_ROOT_TABLE_SIZE_INCREMENT; - Tables = ACPI_ALLOCATE_ZEROED ( - ((ACPI_SIZE) MaxTableCount) * sizeof (ACPI_TABLE_DESC)); - if (!Tables) - { - ACPI_ERROR ((AE_INFO, "Could not allocate new root table array")); - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Copy and free the previous table array */ - - CurrentTableCount = 0; - if (AcpiGbl_RootTableList.Tables) - { - for (i = 0; i < TableCount; i++) - { - if (AcpiGbl_RootTableList.Tables[i].Address) - { - memcpy (Tables + CurrentTableCount, - AcpiGbl_RootTableList.Tables + i, - sizeof (ACPI_TABLE_DESC)); - CurrentTableCount++; - } - } - - if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED) - { - ACPI_FREE (AcpiGbl_RootTableList.Tables); - } - } - - AcpiGbl_RootTableList.Tables = Tables; - AcpiGbl_RootTableList.MaxTableCount = MaxTableCount; - AcpiGbl_RootTableList.CurrentTableCount = CurrentTableCount; - AcpiGbl_RootTableList.Flags |= ACPI_ROOT_ORIGIN_ALLOCATED; - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbGetNextTableDescriptor - * - * PARAMETERS: TableIndex - Where table index is returned - * TableDesc - Where table descriptor is returned - * - * RETURN: Status and table index/descriptor. - * - * DESCRIPTION: Allocate a new ACPI table entry to the global table list - * - ******************************************************************************/ - -ACPI_STATUS -AcpiTbGetNextTableDescriptor ( - UINT32 *TableIndex, - ACPI_TABLE_DESC **TableDesc) -{ - ACPI_STATUS Status; - UINT32 i; - - - /* Ensure that there is room for the table in the Root Table List */ - - if (AcpiGbl_RootTableList.CurrentTableCount >= - AcpiGbl_RootTableList.MaxTableCount) - { - Status = AcpiTbResizeRootTableList(); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - - i = AcpiGbl_RootTableList.CurrentTableCount; - AcpiGbl_RootTableList.CurrentTableCount++; - - if (TableIndex) - { - *TableIndex = i; - } - if (TableDesc) - { - *TableDesc = &AcpiGbl_RootTableList.Tables[i]; - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbTerminate - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Delete all internal ACPI tables - * - ******************************************************************************/ - -void -AcpiTbTerminate ( - void) -{ - UINT32 i; - - - ACPI_FUNCTION_TRACE (TbTerminate); - - - (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); - - /* Delete the individual tables */ - - for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++) - { - AcpiTbUninstallTable (&AcpiGbl_RootTableList.Tables[i]); - } - - /* - * Delete the root table array if allocated locally. Array cannot be - * mapped, so we don't need to check for that flag. - */ - if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED) - { - ACPI_FREE (AcpiGbl_RootTableList.Tables); - } - - AcpiGbl_RootTableList.Tables = NULL; - AcpiGbl_RootTableList.Flags = 0; - AcpiGbl_RootTableList.CurrentTableCount = 0; - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ACPI Tables freed\n")); - - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbDeleteNamespaceByOwner - * - * PARAMETERS: TableIndex - Table index - * - * RETURN: Status - * - * DESCRIPTION: Delete all namespace objects created when this table was loaded. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiTbDeleteNamespaceByOwner ( - UINT32 TableIndex) -{ - ACPI_OWNER_ID OwnerId; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (TbDeleteNamespaceByOwner); - - - Status = AcpiUtAcquireMutex (ACPI_MTX_TABLES); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - if (TableIndex >= AcpiGbl_RootTableList.CurrentTableCount) - { - /* The table index does not exist */ - - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); - return_ACPI_STATUS (AE_NOT_EXIST); - } - - /* Get the owner ID for this table, used to delete namespace nodes */ - - OwnerId = AcpiGbl_RootTableList.Tables[TableIndex].OwnerId; - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); - - /* - * Need to acquire the namespace writer lock to prevent interference - * with any concurrent namespace walks. The interpreter must be - * released during the deletion since the acquisition of the deletion - * lock may block, and also since the execution of a namespace walk - * must be allowed to use the interpreter. - */ - Status = AcpiUtAcquireWriteLock (&AcpiGbl_NamespaceRwLock); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - AcpiNsDeleteNamespaceByOwner (OwnerId); - AcpiUtReleaseWriteLock (&AcpiGbl_NamespaceRwLock); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbAllocateOwnerId - * - * PARAMETERS: TableIndex - Table index - * - * RETURN: Status - * - * DESCRIPTION: Allocates OwnerId in TableDesc - * - ******************************************************************************/ - -ACPI_STATUS -AcpiTbAllocateOwnerId ( - UINT32 TableIndex) -{ - ACPI_STATUS Status = AE_BAD_PARAMETER; - - - ACPI_FUNCTION_TRACE (TbAllocateOwnerId); - - - (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); - if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount) - { - Status = AcpiUtAllocateOwnerId ( - &(AcpiGbl_RootTableList.Tables[TableIndex].OwnerId)); - } - - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbReleaseOwnerId - * - * PARAMETERS: TableIndex - Table index - * - * RETURN: Status - * - * DESCRIPTION: Releases OwnerId in TableDesc - * - ******************************************************************************/ - -ACPI_STATUS -AcpiTbReleaseOwnerId ( - UINT32 TableIndex) -{ - ACPI_STATUS Status = AE_BAD_PARAMETER; - - - ACPI_FUNCTION_TRACE (TbReleaseOwnerId); - - - (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); - if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount) - { - AcpiUtReleaseOwnerId ( - &(AcpiGbl_RootTableList.Tables[TableIndex].OwnerId)); - Status = AE_OK; - } - - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbGetOwnerId - * - * PARAMETERS: TableIndex - Table index - * OwnerId - Where the table OwnerId is returned - * - * RETURN: Status - * - * DESCRIPTION: returns OwnerId for the ACPI table - * - ******************************************************************************/ - -ACPI_STATUS -AcpiTbGetOwnerId ( - UINT32 TableIndex, - ACPI_OWNER_ID *OwnerId) -{ - ACPI_STATUS Status = AE_BAD_PARAMETER; - - - ACPI_FUNCTION_TRACE (TbGetOwnerId); - - - (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); - if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount) - { - *OwnerId = AcpiGbl_RootTableList.Tables[TableIndex].OwnerId; - Status = AE_OK; - } - - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbIsTableLoaded - * - * PARAMETERS: TableIndex - Index into the root table - * - * RETURN: Table Loaded Flag - * - ******************************************************************************/ - -BOOLEAN -AcpiTbIsTableLoaded ( - UINT32 TableIndex) -{ - BOOLEAN IsLoaded = FALSE; - - - (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); - if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount) - { - IsLoaded = (BOOLEAN) - (AcpiGbl_RootTableList.Tables[TableIndex].Flags & - ACPI_TABLE_IS_LOADED); - } - - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); - return (IsLoaded); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbSetTableLoadedFlag - * - * PARAMETERS: TableIndex - Table index - * IsLoaded - TRUE if table is loaded, FALSE otherwise - * - * RETURN: None - * - * DESCRIPTION: Sets the table loaded flag to either TRUE or FALSE. - * - ******************************************************************************/ - -void -AcpiTbSetTableLoadedFlag ( - UINT32 TableIndex, - BOOLEAN IsLoaded) -{ - - (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); - if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount) - { - if (IsLoaded) - { - AcpiGbl_RootTableList.Tables[TableIndex].Flags |= - ACPI_TABLE_IS_LOADED; - } - else - { - AcpiGbl_RootTableList.Tables[TableIndex].Flags &= - ~ACPI_TABLE_IS_LOADED; - } - } - - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbLoadTable - * - * PARAMETERS: TableIndex - Table index - * ParentNode - Where table index is returned - * - * RETURN: Status - * - * DESCRIPTION: Load an ACPI table - * - ******************************************************************************/ - -ACPI_STATUS -AcpiTbLoadTable ( - UINT32 TableIndex, - ACPI_NAMESPACE_NODE *ParentNode) -{ - ACPI_TABLE_HEADER *Table; - ACPI_STATUS Status; - ACPI_OWNER_ID OwnerId; - - - ACPI_FUNCTION_TRACE (TbLoadTable); - - - /* - * Note: Now table is "INSTALLED", it must be validated before - * using. - */ - Status = AcpiGetTableByIndex (TableIndex, &Table); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Status = AcpiNsLoadTable (TableIndex, ParentNode); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* - * Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The host is - * responsible for discovering any new wake GPEs by running _PRW methods - * that may have been loaded by this table. - */ - Status = AcpiTbGetOwnerId (TableIndex, &OwnerId); - if (ACPI_SUCCESS (Status)) - { - AcpiEvUpdateGpes (OwnerId); - } - - /* Invoke table handler */ - - AcpiTbNotifyTable (ACPI_TABLE_EVENT_LOAD, Table); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbInstallAndLoadTable - * - * PARAMETERS: Address - Physical address of the table - * Flags - Allocation flags of the table - * Table - Pointer to the table (required for - * virtual origins, optional for - * physical) - * Override - Whether override should be performed - * TableIndex - Where table index is returned - * - * RETURN: Status - * - * DESCRIPTION: Install and load an ACPI table - * - ******************************************************************************/ - -ACPI_STATUS -AcpiTbInstallAndLoadTable ( - ACPI_PHYSICAL_ADDRESS Address, - UINT8 Flags, - ACPI_TABLE_HEADER *Table, - BOOLEAN Override, - UINT32 *TableIndex) -{ - ACPI_STATUS Status; - UINT32 i; - - - ACPI_FUNCTION_TRACE (TbInstallAndLoadTable); - - - /* Install the table and load it into the namespace */ - - Status = AcpiTbInstallStandardTable (Address, Flags, Table, TRUE, - Override, &i); - if (ACPI_FAILURE (Status)) - { - goto Exit; - } - - Status = AcpiTbLoadTable (i, AcpiGbl_RootNode); - -Exit: - *TableIndex = i; - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbUnloadTable - * - * PARAMETERS: TableIndex - Table index - * - * RETURN: Status - * - * DESCRIPTION: Unload an ACPI table - * - ******************************************************************************/ - -ACPI_STATUS -AcpiTbUnloadTable ( - UINT32 TableIndex) -{ - ACPI_STATUS Status = AE_OK; - ACPI_TABLE_HEADER *Table; - - - ACPI_FUNCTION_TRACE (TbUnloadTable); - - - /* Ensure the table is still loaded */ - - if (!AcpiTbIsTableLoaded (TableIndex)) - { - return_ACPI_STATUS (AE_NOT_EXIST); - } - - /* Invoke table handler */ - - Status = AcpiGetTableByIndex (TableIndex, &Table); - if (ACPI_SUCCESS (Status)) - { - AcpiTbNotifyTable (ACPI_TABLE_EVENT_UNLOAD, Table); - } - - /* Delete the portion of the namespace owned by this table */ - - Status = AcpiTbDeleteNamespaceByOwner (TableIndex); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - (void) AcpiTbReleaseOwnerId (TableIndex); - AcpiTbSetTableLoadedFlag (TableIndex, FALSE); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbNotifyTable - * - * PARAMETERS: Event - Table event - * Table - Validated table pointer - * - * RETURN: None - * - * DESCRIPTION: Notify a table event to the users. - * - ******************************************************************************/ - -void -AcpiTbNotifyTable ( - UINT32 Event, - void *Table) -{ - /* Invoke table handler if present */ - - if (AcpiGbl_TableHandler) - { - (void) AcpiGbl_TableHandler (Event, Table, - AcpiGbl_TableHandlerContext); - } -} diff --git a/drivers/acpica/tbfadt.c b/drivers/acpica/tbfadt.c deleted file mode 100644 index 002b692..0000000 --- a/drivers/acpica/tbfadt.c +++ /dev/null @@ -1,893 +0,0 @@ -/****************************************************************************** - * - * Module Name: tbfadt - FADT table utilities - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "actables.h" - -#define _COMPONENT ACPI_TABLES - ACPI_MODULE_NAME ("tbfadt") - -/* Local prototypes */ - -static void -AcpiTbInitGenericAddress ( - ACPI_GENERIC_ADDRESS *GenericAddress, - UINT8 SpaceId, - UINT8 ByteWidth, - UINT64 Address, - const char *RegisterName, - UINT8 Flags); - -static void -AcpiTbConvertFadt ( - void); - -static void -AcpiTbSetupFadtRegisters ( - void); - -static UINT64 -AcpiTbSelectAddress ( - char *RegisterName, - UINT32 Address32, - UINT64 Address64); - - -/* Table for conversion of FADT to common internal format and FADT validation */ - -typedef struct acpi_fadt_info -{ - const char *Name; - UINT16 Address64; - UINT16 Address32; - UINT16 Length; - UINT8 DefaultLength; - UINT8 Flags; - -} ACPI_FADT_INFO; - -#define ACPI_FADT_OPTIONAL 0 -#define ACPI_FADT_REQUIRED 1 -#define ACPI_FADT_SEPARATE_LENGTH 2 -#define ACPI_FADT_GPE_REGISTER 4 - -static ACPI_FADT_INFO FadtInfoTable[] = -{ - {"Pm1aEventBlock", - ACPI_FADT_OFFSET (XPm1aEventBlock), - ACPI_FADT_OFFSET (Pm1aEventBlock), - ACPI_FADT_OFFSET (Pm1EventLength), - ACPI_PM1_REGISTER_WIDTH * 2, /* Enable + Status register */ - ACPI_FADT_REQUIRED}, - - {"Pm1bEventBlock", - ACPI_FADT_OFFSET (XPm1bEventBlock), - ACPI_FADT_OFFSET (Pm1bEventBlock), - ACPI_FADT_OFFSET (Pm1EventLength), - ACPI_PM1_REGISTER_WIDTH * 2, /* Enable + Status register */ - ACPI_FADT_OPTIONAL}, - - {"Pm1aControlBlock", - ACPI_FADT_OFFSET (XPm1aControlBlock), - ACPI_FADT_OFFSET (Pm1aControlBlock), - ACPI_FADT_OFFSET (Pm1ControlLength), - ACPI_PM1_REGISTER_WIDTH, - ACPI_FADT_REQUIRED}, - - {"Pm1bControlBlock", - ACPI_FADT_OFFSET (XPm1bControlBlock), - ACPI_FADT_OFFSET (Pm1bControlBlock), - ACPI_FADT_OFFSET (Pm1ControlLength), - ACPI_PM1_REGISTER_WIDTH, - ACPI_FADT_OPTIONAL}, - - {"Pm2ControlBlock", - ACPI_FADT_OFFSET (XPm2ControlBlock), - ACPI_FADT_OFFSET (Pm2ControlBlock), - ACPI_FADT_OFFSET (Pm2ControlLength), - ACPI_PM2_REGISTER_WIDTH, - ACPI_FADT_SEPARATE_LENGTH}, - - {"PmTimerBlock", - ACPI_FADT_OFFSET (XPmTimerBlock), - ACPI_FADT_OFFSET (PmTimerBlock), - ACPI_FADT_OFFSET (PmTimerLength), - ACPI_PM_TIMER_WIDTH, - ACPI_FADT_SEPARATE_LENGTH}, /* ACPI 5.0A: Timer is optional */ - - {"Gpe0Block", - ACPI_FADT_OFFSET (XGpe0Block), - ACPI_FADT_OFFSET (Gpe0Block), - ACPI_FADT_OFFSET (Gpe0BlockLength), - 0, - ACPI_FADT_SEPARATE_LENGTH | ACPI_FADT_GPE_REGISTER}, - - {"Gpe1Block", - ACPI_FADT_OFFSET (XGpe1Block), - ACPI_FADT_OFFSET (Gpe1Block), - ACPI_FADT_OFFSET (Gpe1BlockLength), - 0, - ACPI_FADT_SEPARATE_LENGTH | ACPI_FADT_GPE_REGISTER} -}; - -#define ACPI_FADT_INFO_ENTRIES \ - (sizeof (FadtInfoTable) / sizeof (ACPI_FADT_INFO)) - - -/* Table used to split Event Blocks into separate status/enable registers */ - -typedef struct acpi_fadt_pm_info -{ - ACPI_GENERIC_ADDRESS *Target; - UINT16 Source; - UINT8 RegisterNum; - -} ACPI_FADT_PM_INFO; - -static ACPI_FADT_PM_INFO FadtPmInfoTable[] = -{ - {&AcpiGbl_XPm1aStatus, - ACPI_FADT_OFFSET (XPm1aEventBlock), - 0}, - - {&AcpiGbl_XPm1aEnable, - ACPI_FADT_OFFSET (XPm1aEventBlock), - 1}, - - {&AcpiGbl_XPm1bStatus, - ACPI_FADT_OFFSET (XPm1bEventBlock), - 0}, - - {&AcpiGbl_XPm1bEnable, - ACPI_FADT_OFFSET (XPm1bEventBlock), - 1} -}; - -#define ACPI_FADT_PM_INFO_ENTRIES \ - (sizeof (FadtPmInfoTable) / sizeof (ACPI_FADT_PM_INFO)) - - -/******************************************************************************* - * - * FUNCTION: AcpiTbInitGenericAddress - * - * PARAMETERS: GenericAddress - GAS struct to be initialized - * SpaceId - ACPI Space ID for this register - * ByteWidth - Width of this register - * Address - Address of the register - * RegisterName - ASCII name of the ACPI register - * - * RETURN: None - * - * DESCRIPTION: Initialize a Generic Address Structure (GAS) - * See the ACPI specification for a full description and - * definition of this structure. - * - ******************************************************************************/ - -static void -AcpiTbInitGenericAddress ( - ACPI_GENERIC_ADDRESS *GenericAddress, - UINT8 SpaceId, - UINT8 ByteWidth, - UINT64 Address, - const char *RegisterName, - UINT8 Flags) -{ - UINT8 BitWidth; - - - /* - * Bit width field in the GAS is only one byte long, 255 max. - * Check for BitWidth overflow in GAS. - */ - BitWidth = (UINT8) (ByteWidth * 8); - if (ByteWidth > 31) /* (31*8)=248, (32*8)=256 */ - { - /* - * No error for GPE blocks, because we do not use the BitWidth - * for GPEs, the legacy length (ByteWidth) is used instead to - * allow for a large number of GPEs. - */ - if (!(Flags & ACPI_FADT_GPE_REGISTER)) - { - ACPI_ERROR ((AE_INFO, - "%s - 32-bit FADT register is too long (%u bytes, %u bits) " - "to convert to GAS struct - 255 bits max, truncating", - RegisterName, ByteWidth, (ByteWidth * 8))); - } - - BitWidth = 255; - } - - /* - * The 64-bit Address field is non-aligned in the byte packed - * GAS struct. - */ - ACPI_MOVE_64_TO_64 (&GenericAddress->Address, &Address); - - /* All other fields are byte-wide */ - - GenericAddress->SpaceId = SpaceId; - GenericAddress->BitWidth = BitWidth; - GenericAddress->BitOffset = 0; - GenericAddress->AccessWidth = 0; /* Access width ANY */ -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbSelectAddress - * - * PARAMETERS: RegisterName - ASCII name of the ACPI register - * Address32 - 32-bit address of the register - * Address64 - 64-bit address of the register - * - * RETURN: The resolved 64-bit address - * - * DESCRIPTION: Select between 32-bit and 64-bit versions of addresses within - * the FADT. Used for the FACS and DSDT addresses. - * - * NOTES: - * - * Check for FACS and DSDT address mismatches. An address mismatch between - * the 32-bit and 64-bit address fields (FIRMWARE_CTRL/X_FIRMWARE_CTRL and - * DSDT/X_DSDT) could be a corrupted address field or it might indicate - * the presence of two FACS or two DSDT tables. - * - * November 2013: - * By default, as per the ACPICA specification, a valid 64-bit address is - * used regardless of the value of the 32-bit address. However, this - * behavior can be overridden via the AcpiGbl_Use32BitFadtAddresses flag. - * - ******************************************************************************/ - -static UINT64 -AcpiTbSelectAddress ( - char *RegisterName, - UINT32 Address32, - UINT64 Address64) -{ - - if (!Address64) - { - /* 64-bit address is zero, use 32-bit address */ - - return ((UINT64) Address32); - } - - if (Address32 && - (Address64 != (UINT64) Address32)) - { - /* Address mismatch between 32-bit and 64-bit versions */ - - ACPI_BIOS_WARNING ((AE_INFO, - "32/64X %s address mismatch in FADT: " - "0x%8.8X/0x%8.8X%8.8X, using %u-bit address", - RegisterName, Address32, ACPI_FORMAT_UINT64 (Address64), - AcpiGbl_Use32BitFadtAddresses ? 32 : 64)); - - /* 32-bit address override */ - - if (AcpiGbl_Use32BitFadtAddresses) - { - return ((UINT64) Address32); - } - } - - /* Default is to use the 64-bit address */ - - return (Address64); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbParseFadt - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Initialize the FADT, DSDT and FACS tables - * (FADT contains the addresses of the DSDT and FACS) - * - ******************************************************************************/ - -void -AcpiTbParseFadt ( - void) -{ - UINT32 Length; - ACPI_TABLE_HEADER *Table; - ACPI_TABLE_DESC *FadtDesc; - ACPI_STATUS Status; - - - /* - * The FADT has multiple versions with different lengths, - * and it contains pointers to both the DSDT and FACS tables. - * - * Get a local copy of the FADT and convert it to a common format - * Map entire FADT, assumed to be smaller than one page. - */ - FadtDesc = &AcpiGbl_RootTableList.Tables[AcpiGbl_FadtIndex]; - Status = AcpiTbGetTable (FadtDesc, &Table); - if (ACPI_FAILURE (Status)) - { - return; - } - Length = FadtDesc->Length; - - /* - * Validate the FADT checksum before we copy the table. Ignore - * checksum error as we want to try to get the DSDT and FACS. - */ - (void) AcpiUtVerifyChecksum (Table, Length); - - /* Create a local copy of the FADT in common ACPI 2.0+ format */ - - AcpiTbCreateLocalFadt (Table, Length); - - /* All done with the real FADT, unmap it */ - - AcpiTbPutTable (FadtDesc); - - /* Obtain the DSDT and FACS tables via their addresses within the FADT */ - - AcpiTbInstallStandardTable ( - (ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XDsdt, - ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, NULL, FALSE, TRUE, - &AcpiGbl_DsdtIndex); - - if (AcpiGbl_FADT.Facs) - { - AcpiTbInstallStandardTable ( - (ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.Facs, - ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, NULL, FALSE, TRUE, - &AcpiGbl_FacsIndex); - } - if (AcpiGbl_FADT.XFacs) - { - AcpiTbInstallStandardTable ( - (ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XFacs, - ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, NULL, FALSE, TRUE, - &AcpiGbl_XFacsIndex); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbCreateLocalFadt - * - * PARAMETERS: Table - Pointer to BIOS FADT - * Length - Length of the table - * - * RETURN: None - * - * DESCRIPTION: Get a local copy of the FADT and convert it to a common format. - * Performs validation on some important FADT fields. - * - * NOTE: We create a local copy of the FADT regardless of the version. - * - ******************************************************************************/ - -void -AcpiTbCreateLocalFadt ( - ACPI_TABLE_HEADER *Table, - UINT32 Length) -{ - - /* - * Check if the FADT is larger than the largest table that we expect - * (typically the current ACPI specification version). If so, truncate - * the table, and issue a warning. - */ - if (Length > sizeof (ACPI_TABLE_FADT)) - { - ACPI_BIOS_WARNING ((AE_INFO, - "FADT (revision %u) is longer than %s length, " - "truncating length %u to %u", - Table->Revision, ACPI_FADT_CONFORMANCE, Length, - (UINT32) sizeof (ACPI_TABLE_FADT))); - } - - /* Clear the entire local FADT */ - - memset (&AcpiGbl_FADT, 0, sizeof (ACPI_TABLE_FADT)); - - /* Copy the original FADT, up to sizeof (ACPI_TABLE_FADT) */ - - memcpy (&AcpiGbl_FADT, Table, - ACPI_MIN (Length, sizeof (ACPI_TABLE_FADT))); - - /* Take a copy of the Hardware Reduced flag */ - - AcpiGbl_ReducedHardware = FALSE; - if (AcpiGbl_FADT.Flags & ACPI_FADT_HW_REDUCED) - { - AcpiGbl_ReducedHardware = TRUE; - } - - /* Convert the local copy of the FADT to the common internal format */ - - AcpiTbConvertFadt (); - - /* Initialize the global ACPI register structures */ - - AcpiTbSetupFadtRegisters (); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbConvertFadt - * - * PARAMETERS: None - AcpiGbl_FADT is used. - * - * RETURN: None - * - * DESCRIPTION: Converts all versions of the FADT to a common internal format. - * Expand 32-bit addresses to 64-bit as necessary. Also validate - * important fields within the FADT. - * - * NOTE: AcpiGbl_FADT must be of size (ACPI_TABLE_FADT), and must - * contain a copy of the actual BIOS-provided FADT. - * - * Notes on 64-bit register addresses: - * - * After this FADT conversion, later ACPICA code will only use the 64-bit "X" - * fields of the FADT for all ACPI register addresses. - * - * The 64-bit X fields are optional extensions to the original 32-bit FADT - * V1.0 fields. Even if they are present in the FADT, they are optional and - * are unused if the BIOS sets them to zero. Therefore, we must copy/expand - * 32-bit V1.0 fields to the 64-bit X fields if the 64-bit X field is originally - * zero. - * - * For ACPI 1.0 FADTs (that contain no 64-bit addresses), all 32-bit address - * fields are expanded to the corresponding 64-bit X fields in the internal - * common FADT. - * - * For ACPI 2.0+ FADTs, all valid (non-zero) 32-bit address fields are expanded - * to the corresponding 64-bit X fields, if the 64-bit field is originally - * zero. Adhering to the ACPI specification, we completely ignore the 32-bit - * field if the 64-bit field is valid, regardless of whether the host OS is - * 32-bit or 64-bit. - * - * Possible additional checks: - * (AcpiGbl_FADT.Pm1EventLength >= 4) - * (AcpiGbl_FADT.Pm1ControlLength >= 2) - * (AcpiGbl_FADT.PmTimerLength >= 4) - * Gpe block lengths must be multiple of 2 - * - ******************************************************************************/ - -static void -AcpiTbConvertFadt ( - void) -{ - const char *Name; - ACPI_GENERIC_ADDRESS *Address64; - UINT32 Address32; - UINT8 Length; - UINT8 Flags; - UINT32 i; - - - /* - * For ACPI 1.0 FADTs (revision 1 or 2), ensure that reserved fields which - * should be zero are indeed zero. This will workaround BIOSs that - * inadvertently place values in these fields. - * - * The ACPI 1.0 reserved fields that will be zeroed are the bytes located - * at offset 45, 55, 95, and the word located at offset 109, 110. - * - * Note: The FADT revision value is unreliable. Only the length can be - * trusted. - */ - if (AcpiGbl_FADT.Header.Length <= ACPI_FADT_V2_SIZE) - { - AcpiGbl_FADT.PreferredProfile = 0; - AcpiGbl_FADT.PstateControl = 0; - AcpiGbl_FADT.CstControl = 0; - AcpiGbl_FADT.BootFlags = 0; - } - - /* - * Now we can update the local FADT length to the length of the - * current FADT version as defined by the ACPI specification. - * Thus, we will have a common FADT internally. - */ - AcpiGbl_FADT.Header.Length = sizeof (ACPI_TABLE_FADT); - - /* - * Expand the 32-bit DSDT addresses to 64-bit as necessary. - * Later ACPICA code will always use the X 64-bit field. - */ - AcpiGbl_FADT.XDsdt = AcpiTbSelectAddress ("DSDT", - AcpiGbl_FADT.Dsdt, AcpiGbl_FADT.XDsdt); - - /* If Hardware Reduced flag is set, we are all done */ - - if (AcpiGbl_ReducedHardware) - { - return; - } - - /* Examine all of the 64-bit extended address fields (X fields) */ - - for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) - { - /* - * Get the 32-bit and 64-bit addresses, as well as the register - * length and register name. - */ - Address32 = *ACPI_ADD_PTR (UINT32, - &AcpiGbl_FADT, FadtInfoTable[i].Address32); - - Address64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS, - &AcpiGbl_FADT, FadtInfoTable[i].Address64); - - Length = *ACPI_ADD_PTR (UINT8, - &AcpiGbl_FADT, FadtInfoTable[i].Length); - - Name = FadtInfoTable[i].Name; - Flags = FadtInfoTable[i].Flags; - - /* - * Expand the ACPI 1.0 32-bit addresses to the ACPI 2.0 64-bit "X" - * generic address structures as necessary. Later code will always use - * the 64-bit address structures. - * - * November 2013: - * Now always use the 64-bit address if it is valid (non-zero), in - * accordance with the ACPI specification which states that a 64-bit - * address supersedes the 32-bit version. This behavior can be - * overridden by the AcpiGbl_Use32BitFadtAddresses flag. - * - * During 64-bit address construction and verification, - * these cases are handled: - * - * Address32 zero, Address64 [don't care] - Use Address64 - * - * No override: if AcpiGbl_Use32BitFadtAddresses is FALSE, and: - * Address32 non-zero, Address64 zero - Copy/use Address32 - * Address32 non-zero == Address64 non-zero - Use Address64 - * Address32 non-zero != Address64 non-zero - Warning, use Address64 - * - * Override: if AcpiGbl_Use32BitFadtAddresses is TRUE, and: - * Address32 non-zero, Address64 zero - Copy/use Address32 - * Address32 non-zero == Address64 non-zero - Copy/use Address32 - * Address32 non-zero != Address64 non-zero - Warning, copy/use Address32 - * - * Note: SpaceId is always I/O for 32-bit legacy address fields - */ - if (Address32) - { - if (Address64->Address) - { - if (Address64->Address != (UINT64) Address32) - { - /* Address mismatch */ - - ACPI_BIOS_WARNING ((AE_INFO, - "32/64X address mismatch in FADT/%s: " - "0x%8.8X/0x%8.8X%8.8X, using %u-bit address", - Name, Address32, - ACPI_FORMAT_UINT64 (Address64->Address), - AcpiGbl_Use32BitFadtAddresses ? 32 : 64)); - } - - /* - * For each extended field, check for length mismatch - * between the legacy length field and the corresponding - * 64-bit X length field. - * Note: If the legacy length field is > 0xFF bits, ignore - * this check. (GPE registers can be larger than the - * 64-bit GAS structure can accommodate, 0xFF bits). - */ - if ((ACPI_MUL_8 (Length) <= ACPI_UINT8_MAX) && - (Address64->BitWidth != ACPI_MUL_8 (Length))) - { - ACPI_BIOS_WARNING ((AE_INFO, - "32/64X length mismatch in FADT/%s: %u/%u", - Name, ACPI_MUL_8 (Length), Address64->BitWidth)); - } - } - - /* - * Hardware register access code always uses the 64-bit fields. - * So if the 64-bit field is zero or is to be overridden, - * initialize it with the 32-bit fields. - * Note that when the 32-bit address favor is specified, the - * 64-bit fields are always re-initialized so that - * AccessSize/BitWidth/BitOffset fields can be correctly - * configured to the values to trigger a 32-bit compatible - * access mode in the hardware register access code. - */ - if (!Address64->Address || AcpiGbl_Use32BitFadtAddresses) - { - AcpiTbInitGenericAddress (Address64, - ACPI_ADR_SPACE_SYSTEM_IO, Length, - (UINT64) Address32, Name, Flags); - } - } - - if (FadtInfoTable[i].Flags & ACPI_FADT_REQUIRED) - { - /* - * Field is required (PM1aEvent, PM1aControl). - * Both the address and length must be non-zero. - */ - if (!Address64->Address || !Length) - { - ACPI_BIOS_ERROR ((AE_INFO, - "Required FADT field %s has zero address and/or length: " - "0x%8.8X%8.8X/0x%X", - Name, ACPI_FORMAT_UINT64 (Address64->Address), Length)); - } - } - else if (FadtInfoTable[i].Flags & ACPI_FADT_SEPARATE_LENGTH) - { - /* - * Field is optional (PM2Control, GPE0, GPE1) AND has its own - * length field. If present, both the address and length must - * be valid. - */ - if ((Address64->Address && !Length) || - (!Address64->Address && Length)) - { - ACPI_BIOS_WARNING ((AE_INFO, - "Optional FADT field %s has valid %s but zero %s: " - "0x%8.8X%8.8X/0x%X", Name, - (Length ? "Length" : "Address"), - (Length ? "Address": "Length"), - ACPI_FORMAT_UINT64 (Address64->Address), Length)); - } - } - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbSetupFadtRegisters - * - * PARAMETERS: None, uses AcpiGbl_FADT. - * - * RETURN: None - * - * DESCRIPTION: Initialize global ACPI PM1 register definitions. Optionally, - * force FADT register definitions to their default lengths. - * - ******************************************************************************/ - -static void -AcpiTbSetupFadtRegisters ( - void) -{ - ACPI_GENERIC_ADDRESS *Target64; - ACPI_GENERIC_ADDRESS *Source64; - UINT8 Pm1RegisterByteWidth; - UINT32 i; - - - /* - * Optionally check all register lengths against the default values and - * update them if they are incorrect. - */ - if (AcpiGbl_UseDefaultRegisterWidths) - { - for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) - { - Target64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS, &AcpiGbl_FADT, - FadtInfoTable[i].Address64); - - /* - * If a valid register (Address != 0) and the (DefaultLength > 0) - * (Not a GPE register), then check the width against the default. - */ - if ((Target64->Address) && - (FadtInfoTable[i].DefaultLength > 0) && - (FadtInfoTable[i].DefaultLength != Target64->BitWidth)) - { - ACPI_BIOS_WARNING ((AE_INFO, - "Invalid length for FADT/%s: %u, using default %u", - FadtInfoTable[i].Name, Target64->BitWidth, - FadtInfoTable[i].DefaultLength)); - - /* Incorrect size, set width to the default */ - - Target64->BitWidth = FadtInfoTable[i].DefaultLength; - } - } - } - - /* - * Get the length of the individual PM1 registers (enable and status). - * Each register is defined to be (event block length / 2). Extra divide - * by 8 converts bits to bytes. - */ - Pm1RegisterByteWidth = (UINT8) - ACPI_DIV_16 (AcpiGbl_FADT.XPm1aEventBlock.BitWidth); - - /* - * Calculate separate GAS structs for the PM1x (A/B) Status and Enable - * registers. These addresses do not appear (directly) in the FADT, so it - * is useful to pre-calculate them from the PM1 Event Block definitions. - * - * The PM event blocks are split into two register blocks, first is the - * PM Status Register block, followed immediately by the PM Enable - * Register block. Each is of length (Pm1EventLength/2) - * - * Note: The PM1A event block is required by the ACPI specification. - * However, the PM1B event block is optional and is rarely, if ever, - * used. - */ - - for (i = 0; i < ACPI_FADT_PM_INFO_ENTRIES; i++) - { - Source64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS, &AcpiGbl_FADT, - FadtPmInfoTable[i].Source); - - if (Source64->Address) - { - AcpiTbInitGenericAddress (FadtPmInfoTable[i].Target, - Source64->SpaceId, Pm1RegisterByteWidth, - Source64->Address + - (FadtPmInfoTable[i].RegisterNum * Pm1RegisterByteWidth), - "PmRegisters", 0); - } - } -} diff --git a/drivers/acpica/tbfind.c b/drivers/acpica/tbfind.c deleted file mode 100644 index 6c88e1e..0000000 --- a/drivers/acpica/tbfind.c +++ /dev/null @@ -1,268 +0,0 @@ -/****************************************************************************** - * - * Module Name: tbfind - find table - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "actables.h" - -#define _COMPONENT ACPI_TABLES - ACPI_MODULE_NAME ("tbfind") - - -/******************************************************************************* - * - * FUNCTION: AcpiTbFindTable - * - * PARAMETERS: Signature - String with ACPI table signature - * OemId - String with the table OEM ID - * OemTableId - String with the OEM Table ID - * TableIndex - Where the table index is returned - * - * RETURN: Status and table index - * - * DESCRIPTION: Find an ACPI table (in the RSDT/XSDT) that matches the - * Signature, OEM ID and OEM Table ID. Returns an index that can - * be used to get the table header or entire table. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiTbFindTable ( - char *Signature, - char *OemId, - char *OemTableId, - UINT32 *TableIndex) -{ - ACPI_STATUS Status = AE_OK; - ACPI_TABLE_HEADER Header; - UINT32 i; - - - ACPI_FUNCTION_TRACE (TbFindTable); - - - /* Validate the input table signature */ - - if (!AcpiUtValidNameseg (Signature)) - { - return_ACPI_STATUS (AE_BAD_SIGNATURE); - } - - /* Don't allow the OEM strings to be too long */ - - if ((strlen (OemId) > ACPI_OEM_ID_SIZE) || - (strlen (OemTableId) > ACPI_OEM_TABLE_ID_SIZE)) - { - return_ACPI_STATUS (AE_AML_STRING_LIMIT); - } - - /* Normalize the input strings */ - - memset (&Header, 0, sizeof (ACPI_TABLE_HEADER)); - ACPI_COPY_NAMESEG (Header.Signature, Signature); - memcpy (Header.OemId, OemId, ACPI_OEM_ID_SIZE); - memcpy (Header.OemTableId, OemTableId, ACPI_OEM_TABLE_ID_SIZE); - - /* Search for the table */ - - (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); - for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i) - { - if (memcmp (&(AcpiGbl_RootTableList.Tables[i].Signature), - Header.Signature, ACPI_NAMESEG_SIZE)) - { - /* Not the requested table */ - - continue; - } - - /* Table with matching signature has been found */ - - if (!AcpiGbl_RootTableList.Tables[i].Pointer) - { - /* Table is not currently mapped, map it */ - - Status = AcpiTbValidateTable (&AcpiGbl_RootTableList.Tables[i]); - if (ACPI_FAILURE (Status)) - { - goto UnlockAndExit; - } - - if (!AcpiGbl_RootTableList.Tables[i].Pointer) - { - continue; - } - } - - /* Check for table match on all IDs */ - - if (!memcmp (AcpiGbl_RootTableList.Tables[i].Pointer->Signature, - Header.Signature, ACPI_NAMESEG_SIZE) && - (!OemId[0] || - !memcmp (AcpiGbl_RootTableList.Tables[i].Pointer->OemId, - Header.OemId, ACPI_OEM_ID_SIZE)) && - (!OemTableId[0] || - !memcmp (AcpiGbl_RootTableList.Tables[i].Pointer->OemTableId, - Header.OemTableId, ACPI_OEM_TABLE_ID_SIZE))) - { - *TableIndex = i; - - ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Found table [%4.4s]\n", - Header.Signature)); - goto UnlockAndExit; - } - } - Status = AE_NOT_FOUND; - -UnlockAndExit: - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/tbinstal.c b/drivers/acpica/tbinstal.c deleted file mode 100644 index bd60617..0000000 --- a/drivers/acpica/tbinstal.c +++ /dev/null @@ -1,469 +0,0 @@ -/****************************************************************************** - * - * Module Name: tbinstal - ACPI table installation and removal - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "actables.h" - -#define _COMPONENT ACPI_TABLES - ACPI_MODULE_NAME ("tbinstal") - - -/******************************************************************************* - * - * FUNCTION: AcpiTbInstallTableWithOverride - * - * PARAMETERS: NewTableDesc - New table descriptor to install - * Override - Whether override should be performed - * TableIndex - Where the table index is returned - * - * RETURN: None - * - * DESCRIPTION: Install an ACPI table into the global data structure. The - * table override mechanism is called to allow the host - * OS to replace any table before it is installed in the root - * table array. - * - ******************************************************************************/ - -void -AcpiTbInstallTableWithOverride ( - ACPI_TABLE_DESC *NewTableDesc, - BOOLEAN Override, - UINT32 *TableIndex) -{ - UINT32 i; - ACPI_STATUS Status; - - - Status = AcpiTbGetNextTableDescriptor (&i, NULL); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* - * ACPI Table Override: - * - * Before we install the table, let the host OS override it with a new - * one if desired. Any table within the RSDT/XSDT can be replaced, - * including the DSDT which is pointed to by the FADT. - */ - if (Override) - { - AcpiTbOverrideTable (NewTableDesc); - } - - AcpiTbInitTableDescriptor (&AcpiGbl_RootTableList.Tables[i], - NewTableDesc->Address, NewTableDesc->Flags, NewTableDesc->Pointer); - - AcpiTbPrintTableHeader (NewTableDesc->Address, NewTableDesc->Pointer); - - /* This synchronizes AcpiGbl_DsdtIndex */ - - *TableIndex = i; - - /* Set the global integer width (based upon revision of the DSDT) */ - - if (i == AcpiGbl_DsdtIndex) - { - AcpiUtSetIntegerWidth (NewTableDesc->Pointer->Revision); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbInstallStandardTable - * - * PARAMETERS: Address - Address of the table (might be a virtual - * address depending on the TableFlags) - * Flags - Flags for the table - * Table - Pointer to the table (required for virtual - * origins, optional for physical) - * Reload - Whether reload should be performed - * Override - Whether override should be performed - * TableIndex - Where the table index is returned - * - * RETURN: Status - * - * DESCRIPTION: This function is called to verify and install an ACPI table. - * When this function is called by "Load" or "LoadTable" opcodes, - * or by AcpiLoadTable() API, the "Reload" parameter is set. - * After successfully returning from this function, table is - * "INSTALLED" but not "VALIDATED". - * - ******************************************************************************/ - -ACPI_STATUS -AcpiTbInstallStandardTable ( - ACPI_PHYSICAL_ADDRESS Address, - UINT8 Flags, - ACPI_TABLE_HEADER *Table, - BOOLEAN Reload, - BOOLEAN Override, - UINT32 *TableIndex) -{ - UINT32 i; - ACPI_STATUS Status = AE_OK; - ACPI_TABLE_DESC NewTableDesc; - - - ACPI_FUNCTION_TRACE (TbInstallStandardTable); - - - /* Acquire a temporary table descriptor for validation */ - - Status = AcpiTbAcquireTempTable (&NewTableDesc, Address, Flags, Table); - if (ACPI_FAILURE (Status)) - { - ACPI_ERROR ((AE_INFO, - "Could not acquire table length at %8.8X%8.8X", - ACPI_FORMAT_UINT64 (Address))); - return_ACPI_STATUS (Status); - } - - /* - * Optionally do not load any SSDTs from the RSDT/XSDT. This can - * be useful for debugging ACPI problems on some machines. - */ - if (!Reload && - AcpiGbl_DisableSsdtTableInstall && - ACPI_COMPARE_NAMESEG (&NewTableDesc.Signature, ACPI_SIG_SSDT)) - { - ACPI_INFO (( - "Ignoring installation of %4.4s at %8.8X%8.8X", - NewTableDesc.Signature.Ascii, ACPI_FORMAT_UINT64 (Address))); - goto ReleaseAndExit; - } - - /* Acquire the table lock */ - - (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); - - /* Validate and verify a table before installation */ - - Status = AcpiTbVerifyTempTable (&NewTableDesc, NULL, &i); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_CTRL_TERMINATE) - { - /* - * Table was unloaded, allow it to be reloaded. - * As we are going to return AE_OK to the caller, we should - * take the responsibility of freeing the input descriptor. - * Refill the input descriptor to ensure - * AcpiTbInstallTableWithOverride() can be called again to - * indicate the re-installation. - */ - AcpiTbUninstallTable (&NewTableDesc); - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); - *TableIndex = i; - return_ACPI_STATUS (AE_OK); - } - goto UnlockAndExit; - } - - /* Add the table to the global root table list */ - - AcpiTbInstallTableWithOverride (&NewTableDesc, Override, TableIndex); - - /* Invoke table handler */ - - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); - AcpiTbNotifyTable (ACPI_TABLE_EVENT_INSTALL, NewTableDesc.Pointer); - (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); - -UnlockAndExit: - - /* Release the table lock */ - - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); - -ReleaseAndExit: - - /* Release the temporary table descriptor */ - - AcpiTbReleaseTempTable (&NewTableDesc); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbOverrideTable - * - * PARAMETERS: OldTableDesc - Validated table descriptor to be - * overridden - * - * RETURN: None - * - * DESCRIPTION: Attempt table override by calling the OSL override functions. - * Note: If the table is overridden, then the entire new table - * is acquired and returned by this function. - * Before/after invocation, the table descriptor is in a state - * that is "VALIDATED". - * - ******************************************************************************/ - -void -AcpiTbOverrideTable ( - ACPI_TABLE_DESC *OldTableDesc) -{ - ACPI_STATUS Status; - ACPI_TABLE_DESC NewTableDesc; - ACPI_TABLE_HEADER *Table; - ACPI_PHYSICAL_ADDRESS Address; - UINT32 Length; - ACPI_ERROR_ONLY (char *OverrideType); - - - /* (1) Attempt logical override (returns a logical address) */ - - Status = AcpiOsTableOverride (OldTableDesc->Pointer, &Table); - if (ACPI_SUCCESS (Status) && Table) - { - AcpiTbAcquireTempTable (&NewTableDesc, ACPI_PTR_TO_PHYSADDR (Table), - ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL, Table); - ACPI_ERROR_ONLY (OverrideType = "Logical"); - goto FinishOverride; - } - - /* (2) Attempt physical override (returns a physical address) */ - - Status = AcpiOsPhysicalTableOverride (OldTableDesc->Pointer, - &Address, &Length); - if (ACPI_SUCCESS (Status) && Address && Length) - { - AcpiTbAcquireTempTable (&NewTableDesc, Address, - ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, NULL); - ACPI_ERROR_ONLY (OverrideType = "Physical"); - goto FinishOverride; - } - - return; /* There was no override */ - - -FinishOverride: - - /* - * Validate and verify a table before overriding, no nested table - * duplication check as it's too complicated and unnecessary. - */ - Status = AcpiTbVerifyTempTable (&NewTableDesc, NULL, NULL); - if (ACPI_FAILURE (Status)) - { - return; - } - - ACPI_INFO (("%4.4s 0x%8.8X%8.8X" - " %s table override, new table: 0x%8.8X%8.8X", - OldTableDesc->Signature.Ascii, - ACPI_FORMAT_UINT64 (OldTableDesc->Address), - OverrideType, ACPI_FORMAT_UINT64 (NewTableDesc.Address))); - - /* We can now uninstall the original table */ - - AcpiTbUninstallTable (OldTableDesc); - - /* - * Replace the original table descriptor and keep its state as - * "VALIDATED". - */ - AcpiTbInitTableDescriptor (OldTableDesc, NewTableDesc.Address, - NewTableDesc.Flags, NewTableDesc.Pointer); - AcpiTbValidateTempTable (OldTableDesc); - - /* Release the temporary table descriptor */ - - AcpiTbReleaseTempTable (&NewTableDesc); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbUninstallTable - * - * PARAMETERS: TableDesc - Table descriptor - * - * RETURN: None - * - * DESCRIPTION: Delete one internal ACPI table - * - ******************************************************************************/ - -void -AcpiTbUninstallTable ( - ACPI_TABLE_DESC *TableDesc) -{ - - ACPI_FUNCTION_TRACE (TbUninstallTable); - - - /* Table must be installed */ - - if (!TableDesc->Address) - { - return_VOID; - } - - AcpiTbInvalidateTable (TableDesc); - - if ((TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK) == - ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL) - { - ACPI_FREE (TableDesc->Pointer); - TableDesc->Pointer = NULL; - } - - TableDesc->Address = ACPI_PTR_TO_PHYSADDR (NULL); - return_VOID; -} diff --git a/drivers/acpica/tbprint.c b/drivers/acpica/tbprint.c deleted file mode 100644 index 72dab8d..0000000 --- a/drivers/acpica/tbprint.c +++ /dev/null @@ -1,309 +0,0 @@ -/****************************************************************************** - * - * Module Name: tbprint - Table output utilities - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "actables.h" -#include "acdisasm.h" -#include "acutils.h" - -#define _COMPONENT ACPI_TABLES - ACPI_MODULE_NAME ("tbprint") - - -/* Local prototypes */ - -static void -AcpiTbFixString ( - char *String, - ACPI_SIZE Length); - -static void -AcpiTbCleanupTableHeader ( - ACPI_TABLE_HEADER *OutHeader, - ACPI_TABLE_HEADER *Header); - - -/******************************************************************************* - * - * FUNCTION: AcpiTbFixString - * - * PARAMETERS: String - String to be repaired - * Length - Maximum length - * - * RETURN: None - * - * DESCRIPTION: Replace every non-printable or non-ascii byte in the string - * with a question mark '?'. - * - ******************************************************************************/ - -static void -AcpiTbFixString ( - char *String, - ACPI_SIZE Length) -{ - - while (Length && *String) - { - if (!isprint ((int) (UINT8) *String)) - { - *String = '?'; - } - - String++; - Length--; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbCleanupTableHeader - * - * PARAMETERS: OutHeader - Where the cleaned header is returned - * Header - Input ACPI table header - * - * RETURN: Returns the cleaned header in OutHeader - * - * DESCRIPTION: Copy the table header and ensure that all "string" fields in - * the header consist of printable characters. - * - ******************************************************************************/ - -static void -AcpiTbCleanupTableHeader ( - ACPI_TABLE_HEADER *OutHeader, - ACPI_TABLE_HEADER *Header) -{ - - memcpy (OutHeader, Header, sizeof (ACPI_TABLE_HEADER)); - - AcpiTbFixString (OutHeader->Signature, ACPI_NAMESEG_SIZE); - AcpiTbFixString (OutHeader->OemId, ACPI_OEM_ID_SIZE); - AcpiTbFixString (OutHeader->OemTableId, ACPI_OEM_TABLE_ID_SIZE); - AcpiTbFixString (OutHeader->AslCompilerId, ACPI_NAMESEG_SIZE); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbPrintTableHeader - * - * PARAMETERS: Address - Table physical address - * Header - Table header - * - * RETURN: None - * - * DESCRIPTION: Print an ACPI table header. Special cases for FACS and RSDP. - * - ******************************************************************************/ - -void -AcpiTbPrintTableHeader ( - ACPI_PHYSICAL_ADDRESS Address, - ACPI_TABLE_HEADER *Header) -{ - ACPI_TABLE_HEADER LocalHeader; - -#pragma GCC diagnostic push -#if defined(__GNUC__) && __GNUC__ >= 11 -#pragma GCC diagnostic ignored "-Wstringop-overread" -#endif - - if (ACPI_COMPARE_NAMESEG (Header->Signature, ACPI_SIG_FACS)) - { - /* FACS only has signature and length fields */ - - ACPI_INFO (("%-4.4s 0x%8.8X%8.8X %06X", - Header->Signature, ACPI_FORMAT_UINT64 (Address), - Header->Length)); - } - else if (ACPI_VALIDATE_RSDP_SIG (ACPI_CAST_PTR (ACPI_TABLE_RSDP, - Header)->Signature)) - { - /* RSDP has no common fields */ - - memcpy (LocalHeader.OemId, ACPI_CAST_PTR (ACPI_TABLE_RSDP, - Header)->OemId, ACPI_OEM_ID_SIZE); - AcpiTbFixString (LocalHeader.OemId, ACPI_OEM_ID_SIZE); - - ACPI_INFO (("RSDP 0x%8.8X%8.8X %06X (v%.2d %-6.6s)", - ACPI_FORMAT_UINT64 (Address), - (ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Revision > 0) ? - ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Length : 20, - ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Revision, - LocalHeader.OemId)); - } - else if (AcpiGbl_CDAT && !AcpiUtValidNameseg (Header->Signature)) - { - /* CDAT does not use the common ACPI table header */ - - ACPI_INFO (("%-4.4s 0x%8.8X%8.8X %06X", - ACPI_SIG_CDAT, ACPI_FORMAT_UINT64 (Address), - ACPI_CAST_PTR (ACPI_TABLE_CDAT, Header)->Length)); - } - else - { - /* Standard ACPI table with full common header */ - - AcpiTbCleanupTableHeader (&LocalHeader, Header); - - ACPI_INFO (( - "%-4.4s 0x%8.8X%8.8X" - " %06X (v%.2d %-6.6s %-8.8s %08X %-4.4s %08X)", - LocalHeader.Signature, ACPI_FORMAT_UINT64 (Address), - LocalHeader.Length, LocalHeader.Revision, LocalHeader.OemId, - LocalHeader.OemTableId, LocalHeader.OemRevision, - LocalHeader.AslCompilerId, LocalHeader.AslCompilerRevision)); - } -#pragma GCC diagnostic pop -} diff --git a/drivers/acpica/tbutils.c b/drivers/acpica/tbutils.c deleted file mode 100644 index 2aeb296..0000000 --- a/drivers/acpica/tbutils.c +++ /dev/null @@ -1,621 +0,0 @@ -/****************************************************************************** - * - * Module Name: tbutils - ACPI Table utilities - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "actables.h" - -#define _COMPONENT ACPI_TABLES - ACPI_MODULE_NAME ("tbutils") - - -/* Local prototypes */ - -static ACPI_PHYSICAL_ADDRESS -AcpiTbGetRootTableEntry ( - UINT8 *TableEntry, - UINT32 TableEntrySize); - - -/******************************************************************************* - * - * FUNCTION: AcpiTbInitializeFacs - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Create a permanent mapping for the FADT and save it in a global - * for accessing the Global Lock and Firmware Waking Vector - * - ******************************************************************************/ - -ACPI_STATUS -AcpiTbInitializeFacs ( - void) -{ - ACPI_TABLE_FACS *Facs; - - if (AcpiGbl_FADT.XFacs && - (!AcpiGbl_FADT.Facs || !AcpiGbl_Use32BitFacsAddresses)) - { - (void) AcpiGetTableByIndex (AcpiGbl_XFacsIndex, - ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Facs)); - AcpiGbl_FACS = Facs; - } - else if (AcpiGbl_FADT.Facs) - { - (void) AcpiGetTableByIndex (AcpiGbl_FacsIndex, - ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Facs)); - AcpiGbl_FACS = Facs; - } - - /* If there is no FACS, just continue. There was already an error msg */ - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbCheckDsdtHeader - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Quick compare to check validity of the DSDT. This will detect - * if the DSDT has been replaced from outside the OS and/or if - * the DSDT header has been corrupted. - * - ******************************************************************************/ - -void -AcpiTbCheckDsdtHeader ( - void) -{ - - /* Compare original length and checksum to current values */ - - if (AcpiGbl_OriginalDsdtHeader.Length != AcpiGbl_DSDT->Length || - AcpiGbl_OriginalDsdtHeader.Checksum != AcpiGbl_DSDT->Checksum) - { - ACPI_BIOS_ERROR ((AE_INFO, - "The DSDT has been corrupted or replaced - " - "old, new headers below")); - - AcpiTbPrintTableHeader (0, &AcpiGbl_OriginalDsdtHeader); - AcpiTbPrintTableHeader (0, AcpiGbl_DSDT); - - /* Disable further error messages */ - - AcpiGbl_OriginalDsdtHeader.Length = AcpiGbl_DSDT->Length; - AcpiGbl_OriginalDsdtHeader.Checksum = AcpiGbl_DSDT->Checksum; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbCopyDsdt - * - * PARAMETERS: TableIndex - Index of installed table to copy - * - * RETURN: The copied DSDT - * - * DESCRIPTION: Implements a subsystem option to copy the DSDT to local memory. - * Some very bad BIOSs are known to either corrupt the DSDT or - * install a new, bad DSDT. This copy works around the problem. - * - ******************************************************************************/ - -ACPI_TABLE_HEADER * -AcpiTbCopyDsdt ( - UINT32 TableIndex) -{ - ACPI_TABLE_HEADER *NewTable; - ACPI_TABLE_DESC *TableDesc; - - - TableDesc = &AcpiGbl_RootTableList.Tables[TableIndex]; - - NewTable = ACPI_ALLOCATE (TableDesc->Length); - if (!NewTable) - { - ACPI_ERROR ((AE_INFO, "Could not copy DSDT of length 0x%X", - TableDesc->Length)); - return (NULL); - } - - memcpy (NewTable, TableDesc->Pointer, TableDesc->Length); - AcpiTbUninstallTable (TableDesc); - - AcpiTbInitTableDescriptor ( - &AcpiGbl_RootTableList.Tables[AcpiGbl_DsdtIndex], - ACPI_PTR_TO_PHYSADDR (NewTable), - ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL, NewTable); - - ACPI_INFO (( - "Forced DSDT copy: length 0x%05X copied locally, original unmapped", - NewTable->Length)); - - return (NewTable); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbGetRootTableEntry - * - * PARAMETERS: TableEntry - Pointer to the RSDT/XSDT table entry - * TableEntrySize - sizeof 32 or 64 (RSDT or XSDT) - * - * RETURN: Physical address extracted from the root table - * - * DESCRIPTION: Get one root table entry. Handles 32-bit and 64-bit cases on - * both 32-bit and 64-bit platforms - * - * NOTE: ACPI_PHYSICAL_ADDRESS is 32-bit on 32-bit platforms, 64-bit on - * 64-bit platforms. - * - ******************************************************************************/ - -static ACPI_PHYSICAL_ADDRESS -AcpiTbGetRootTableEntry ( - UINT8 *TableEntry, - UINT32 TableEntrySize) -{ - UINT32 Address32; - UINT64 Address64; - - - /* - * Get the table physical address (32-bit for RSDT, 64-bit for XSDT): - * Note: Addresses are 32-bit aligned (not 64) in both RSDT and XSDT - */ - if (TableEntrySize == ACPI_RSDT_ENTRY_SIZE) - { - /* - * 32-bit platform, RSDT: Return 32-bit table entry - * 64-bit platform, RSDT: Expand 32-bit to 64-bit and return - */ - ACPI_MOVE_32_TO_32(&Address32, TableEntry); - return Address32; - } - else - { - /* - * 32-bit platform, XSDT: Truncate 64-bit to 32-bit and return - * 64-bit platform, XSDT: Move (unaligned) 64-bit to local, - * return 64-bit - */ - ACPI_MOVE_64_TO_64 (&Address64, TableEntry); - -#if ACPI_MACHINE_WIDTH == 32 - if (Address64 > ACPI_UINT32_MAX) - { - /* Will truncate 64-bit address to 32 bits, issue warning */ - - ACPI_BIOS_WARNING ((AE_INFO, - "64-bit Physical Address in XSDT is too large (0x%8.8X%8.8X)," - " truncating", - ACPI_FORMAT_UINT64 (Address64))); - } -#endif - return ((ACPI_PHYSICAL_ADDRESS) (Address64)); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbParseRootTable - * - * PARAMETERS: RsdpAddress - Pointer to the RSDP - * - * RETURN: Status - * - * DESCRIPTION: This function is called to parse the Root System Description - * Table (RSDT or XSDT) - * - * NOTE: Tables are mapped (not copied) for efficiency. The FACS must - * be mapped and cannot be copied because it contains the actual - * memory location of the ACPI Global Lock. - * - ******************************************************************************/ - -ACPI_STATUS ACPI_INIT_FUNCTION -AcpiTbParseRootTable ( - ACPI_PHYSICAL_ADDRESS RsdpAddress) -{ - ACPI_TABLE_RSDP *Rsdp; - UINT32 TableEntrySize; - UINT32 i; - UINT32 TableCount; - ACPI_TABLE_HEADER *Table; - ACPI_PHYSICAL_ADDRESS Address; - UINT32 Length; - UINT8 *TableEntry; - ACPI_STATUS Status; - UINT32 TableIndex; - - - ACPI_FUNCTION_TRACE (TbParseRootTable); - - - /* Map the entire RSDP and extract the address of the RSDT or XSDT */ - - Rsdp = AcpiOsMapMemory (RsdpAddress, sizeof (ACPI_TABLE_RSDP)); - if (!Rsdp) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - AcpiTbPrintTableHeader (RsdpAddress, - ACPI_CAST_PTR (ACPI_TABLE_HEADER, Rsdp)); - - /* Use XSDT if present and not overridden. Otherwise, use RSDT */ - - if ((Rsdp->Revision > 1) && - Rsdp->XsdtPhysicalAddress && - !AcpiGbl_DoNotUseXsdt) - { - /* - * RSDP contains an XSDT (64-bit physical addresses). We must use - * the XSDT if the revision is > 1 and the XSDT pointer is present, - * as per the ACPI specification. - */ - Address = (ACPI_PHYSICAL_ADDRESS) Rsdp->XsdtPhysicalAddress; - TableEntrySize = ACPI_XSDT_ENTRY_SIZE; - } - else - { - /* Root table is an RSDT (32-bit physical addresses) */ - - Address = (ACPI_PHYSICAL_ADDRESS) Rsdp->RsdtPhysicalAddress; - TableEntrySize = ACPI_RSDT_ENTRY_SIZE; - } - - /* - * It is not possible to map more than one entry in some environments, - * so unmap the RSDP here before mapping other tables - */ - AcpiOsUnmapMemory (Rsdp, sizeof (ACPI_TABLE_RSDP)); - - /* Map the RSDT/XSDT table header to get the full table length */ - - Table = AcpiOsMapMemory (Address, sizeof (ACPI_TABLE_HEADER)); - if (!Table) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - AcpiTbPrintTableHeader (Address, Table); - - /* - * Validate length of the table, and map entire table. - * Minimum length table must contain at least one entry. - */ - Length = Table->Length; - AcpiOsUnmapMemory (Table, sizeof (ACPI_TABLE_HEADER)); - - if (Length < (sizeof (ACPI_TABLE_HEADER) + TableEntrySize)) - { - ACPI_BIOS_ERROR ((AE_INFO, - "Invalid table length 0x%X in RSDT/XSDT", Length)); - return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); - } - - Table = AcpiOsMapMemory (Address, Length); - if (!Table) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Validate the root table checksum */ - - Status = AcpiUtVerifyChecksum (Table, Length); - if (ACPI_FAILURE (Status)) - { - AcpiOsUnmapMemory (Table, Length); - return_ACPI_STATUS (Status); - } - - /* Get the number of entries and pointer to first entry */ - - TableCount = (UINT32) ((Table->Length - sizeof (ACPI_TABLE_HEADER)) / - TableEntrySize); - TableEntry = ACPI_ADD_PTR (UINT8, Table, sizeof (ACPI_TABLE_HEADER)); - - /* Initialize the root table array from the RSDT/XSDT */ - - for (i = 0; i < TableCount; i++) - { - /* Get the table physical address (32-bit for RSDT, 64-bit for XSDT) */ - - Address = AcpiTbGetRootTableEntry (TableEntry, TableEntrySize); - - /* Skip NULL entries in RSDT/XSDT */ - - if (!Address) - { - goto NextTable; - } - - Status = AcpiTbInstallStandardTable (Address, - ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, NULL, FALSE, TRUE, - &TableIndex); - - if (ACPI_SUCCESS (Status) && - ACPI_COMPARE_NAMESEG ( - &AcpiGbl_RootTableList.Tables[TableIndex].Signature, - ACPI_SIG_FADT)) - { - AcpiGbl_FadtIndex = TableIndex; - AcpiTbParseFadt (); - } - -NextTable: - - TableEntry += TableEntrySize; - } - - AcpiOsUnmapMemory (Table, Length); - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbGetTable - * - * PARAMETERS: TableDesc - Table descriptor - * OutTable - Where the pointer to the table is returned - * - * RETURN: Status and pointer to the requested table - * - * DESCRIPTION: Increase a reference to a table descriptor and return the - * validated table pointer. - * If the table descriptor is an entry of the root table list, - * this API must be invoked with ACPI_MTX_TABLES acquired. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiTbGetTable ( - ACPI_TABLE_DESC *TableDesc, - ACPI_TABLE_HEADER **OutTable) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiTbGetTable); - - - if (TableDesc->ValidationCount == 0) - { - /* Table need to be "VALIDATED" */ - - Status = AcpiTbValidateTable (TableDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - if (TableDesc->ValidationCount < ACPI_MAX_TABLE_VALIDATIONS) - { - TableDesc->ValidationCount++; - - /* - * Detect ValidationCount overflows to ensure that the warning - * message will only be printed once. - */ - if (TableDesc->ValidationCount >= ACPI_MAX_TABLE_VALIDATIONS) - { - ACPI_WARNING((AE_INFO, - "Table %p, Validation count overflows\n", TableDesc)); - } - } - - *OutTable = TableDesc->Pointer; - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbPutTable - * - * PARAMETERS: TableDesc - Table descriptor - * - * RETURN: None - * - * DESCRIPTION: Decrease a reference to a table descriptor and release the - * validated table pointer if no references. - * If the table descriptor is an entry of the root table list, - * this API must be invoked with ACPI_MTX_TABLES acquired. - * - ******************************************************************************/ - -void -AcpiTbPutTable ( - ACPI_TABLE_DESC *TableDesc) -{ - - ACPI_FUNCTION_TRACE (AcpiTbPutTable); - - - if (TableDesc->ValidationCount < ACPI_MAX_TABLE_VALIDATIONS) - { - TableDesc->ValidationCount--; - - /* - * Detect ValidationCount underflows to ensure that the warning - * message will only be printed once. - */ - if (TableDesc->ValidationCount >= ACPI_MAX_TABLE_VALIDATIONS) - { - ACPI_WARNING ((AE_INFO, - "Table %p, Validation count underflows\n", TableDesc)); - return_VOID; - } - } - - if (TableDesc->ValidationCount == 0) - { - /* Table need to be "INVALIDATED" */ - - AcpiTbInvalidateTable (TableDesc); - } - - return_VOID; -} diff --git a/drivers/acpica/tbxface.c b/drivers/acpica/tbxface.c deleted file mode 100644 index 783567c..0000000 --- a/drivers/acpica/tbxface.c +++ /dev/null @@ -1,747 +0,0 @@ -/****************************************************************************** - * - * Module Name: tbxface - ACPI table-oriented external interfaces - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#define EXPORT_ACPI_INTERFACES - -#include "acpi.h" -#include "accommon.h" -#include "actables.h" - -#define _COMPONENT ACPI_TABLES - ACPI_MODULE_NAME ("tbxface") - - -/******************************************************************************* - * - * FUNCTION: AcpiAllocateRootTable - * - * PARAMETERS: InitialTableCount - Size of InitialTableArray, in number of - * ACPI_TABLE_DESC structures - * - * RETURN: Status - * - * DESCRIPTION: Allocate a root table array. Used by iASL compiler and - * AcpiInitializeTables. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiAllocateRootTable ( - UINT32 InitialTableCount) -{ - - AcpiGbl_RootTableList.MaxTableCount = InitialTableCount; - AcpiGbl_RootTableList.Flags = ACPI_ROOT_ALLOW_RESIZE; - - return (AcpiTbResizeRootTableList ()); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiInitializeTables - * - * PARAMETERS: InitialTableArray - Pointer to an array of pre-allocated - * ACPI_TABLE_DESC structures. If NULL, the - * array is dynamically allocated. - * InitialTableCount - Size of InitialTableArray, in number of - * ACPI_TABLE_DESC structures - * AllowResize - Flag to tell Table Manager if resize of - * pre-allocated array is allowed. Ignored - * if InitialTableArray is NULL. - * - * RETURN: Status - * - * DESCRIPTION: Initialize the table manager, get the RSDP and RSDT/XSDT. - * - * NOTE: Allows static allocation of the initial table array in order - * to avoid the use of dynamic memory in confined environments - * such as the kernel boot sequence where it may not be available. - * - * If the host OS memory managers are initialized, use NULL for - * InitialTableArray, and the table will be dynamically allocated. - * - ******************************************************************************/ - -ACPI_STATUS ACPI_INIT_FUNCTION -AcpiInitializeTables ( - ACPI_TABLE_DESC *InitialTableArray, - UINT32 InitialTableCount, - BOOLEAN AllowResize) -{ - ACPI_PHYSICAL_ADDRESS RsdpAddress; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiInitializeTables); - - - /* - * Setup the Root Table Array and allocate the table array - * if requested - */ - if (!InitialTableArray) - { - Status = AcpiAllocateRootTable (InitialTableCount); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - else - { - /* Root Table Array has been statically allocated by the host */ - - memset (InitialTableArray, 0, - (ACPI_SIZE) InitialTableCount * sizeof (ACPI_TABLE_DESC)); - - AcpiGbl_RootTableList.Tables = InitialTableArray; - AcpiGbl_RootTableList.MaxTableCount = InitialTableCount; - AcpiGbl_RootTableList.Flags = ACPI_ROOT_ORIGIN_UNKNOWN; - if (AllowResize) - { - AcpiGbl_RootTableList.Flags |= ACPI_ROOT_ALLOW_RESIZE; - } - } - - /* Get the address of the RSDP */ - - RsdpAddress = AcpiOsGetRootPointer (); - if (!RsdpAddress) - { - return_ACPI_STATUS (AE_NOT_FOUND); - } - - /* - * Get the root table (RSDT or XSDT) and extract all entries to the local - * Root Table Array. This array contains the information of the RSDT/XSDT - * in a common, more usable format. - */ - Status = AcpiTbParseRootTable (RsdpAddress); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL_INIT (AcpiInitializeTables) - - -/******************************************************************************* - * - * FUNCTION: AcpiReallocateRootTable - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Reallocate Root Table List into dynamic memory. Copies the - * root list from the previously provided scratch area. Should - * be called once dynamic memory allocation is available in the - * kernel. - * - ******************************************************************************/ - -ACPI_STATUS ACPI_INIT_FUNCTION -AcpiReallocateRootTable ( - void) -{ - ACPI_STATUS Status; - ACPI_TABLE_DESC *TableDesc; - UINT32 i, j; - - - ACPI_FUNCTION_TRACE (AcpiReallocateRootTable); - - - /* - * If there are tables unverified, it is required to reallocate the - * root table list to clean up invalid table entries. Otherwise only - * reallocate the root table list if the host provided a static buffer - * for the table array in the call to AcpiInitializeTables(). - */ - if ((AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED) && - AcpiGbl_EnableTableValidation) - { - return_ACPI_STATUS (AE_SUPPORT); - } - - (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); - - /* - * Ensure OS early boot logic, which is required by some hosts. If the - * table state is reported to be wrong, developers should fix the - * issue by invoking AcpiPutTable() for the reported table during the - * early stage. - */ - for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i) - { - TableDesc = &AcpiGbl_RootTableList.Tables[i]; - if (TableDesc->Pointer) - { - ACPI_ERROR ((AE_INFO, - "Table [%4.4s] is not invalidated during early boot stage", - TableDesc->Signature.Ascii)); - } - } - - if (!AcpiGbl_EnableTableValidation) - { - /* - * Now it's safe to do full table validation. We can do deferred - * table initialization here once the flag is set. - */ - AcpiGbl_EnableTableValidation = TRUE; - for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i) - { - TableDesc = &AcpiGbl_RootTableList.Tables[i]; - if (!(TableDesc->Flags & ACPI_TABLE_IS_VERIFIED)) - { - Status = AcpiTbVerifyTempTable (TableDesc, NULL, &j); - if (ACPI_FAILURE (Status)) - { - AcpiTbUninstallTable (TableDesc); - } - } - } - } - - AcpiGbl_RootTableList.Flags |= ACPI_ROOT_ALLOW_RESIZE; - Status = AcpiTbResizeRootTableList (); - AcpiGbl_RootTableList.Flags |= ACPI_ROOT_ORIGIN_ALLOCATED; - - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL_INIT (AcpiReallocateRootTable) - - -/******************************************************************************* - * - * FUNCTION: AcpiGetTableHeader - * - * PARAMETERS: Signature - ACPI signature of needed table - * Instance - Which instance (for SSDTs) - * OutTableHeader - The pointer to the where the table header - * is returned - * - * RETURN: Status and a copy of the table header - * - * DESCRIPTION: Finds and returns an ACPI table header. Caller provides the - * memory where a copy of the header is to be returned - * (fixed length). - * - ******************************************************************************/ - -ACPI_STATUS -AcpiGetTableHeader ( - char *Signature, - UINT32 Instance, - ACPI_TABLE_HEADER *OutTableHeader) -{ - UINT32 i; - UINT32 j; - ACPI_TABLE_HEADER *Header; - - - /* Parameter validation */ - - if (!Signature || !OutTableHeader) - { - return (AE_BAD_PARAMETER); - } - - /* Walk the root table list */ - - for (i = 0, j = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++) - { - if (!ACPI_COMPARE_NAMESEG ( - &(AcpiGbl_RootTableList.Tables[i].Signature), Signature)) - { - continue; - } - - if (++j < Instance) - { - continue; - } - - if (!AcpiGbl_RootTableList.Tables[i].Pointer) - { - if ((AcpiGbl_RootTableList.Tables[i].Flags & - ACPI_TABLE_ORIGIN_MASK) == - ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL) - { - Header = AcpiOsMapMemory ( - AcpiGbl_RootTableList.Tables[i].Address, - sizeof (ACPI_TABLE_HEADER)); - if (!Header) - { - return (AE_NO_MEMORY); - } - - memcpy (OutTableHeader, Header, sizeof (ACPI_TABLE_HEADER)); - AcpiOsUnmapMemory (Header, sizeof (ACPI_TABLE_HEADER)); - } - else - { - return (AE_NOT_FOUND); - } - } - else - { - memcpy (OutTableHeader, - AcpiGbl_RootTableList.Tables[i].Pointer, - sizeof (ACPI_TABLE_HEADER)); - } - - return (AE_OK); - } - - return (AE_NOT_FOUND); -} - -ACPI_EXPORT_SYMBOL (AcpiGetTableHeader) - - -/******************************************************************************* - * - * FUNCTION: AcpiGetTable - * - * PARAMETERS: Signature - ACPI signature of needed table - * Instance - Which instance (for SSDTs) - * OutTable - Where the pointer to the table is returned - * - * RETURN: Status and pointer to the requested table - * - * DESCRIPTION: Finds and verifies an ACPI table. Table must be in the - * RSDT/XSDT. - * Note that an early stage AcpiGetTable() call must be paired - * with an early stage AcpiPutTable() call. otherwise the table - * pointer mapped by the early stage mapping implementation may be - * erroneously unmapped by the late stage unmapping implementation - * in an AcpiPutTable() invoked during the late stage. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiGetTable ( - char *Signature, - UINT32 Instance, - ACPI_TABLE_HEADER **OutTable) -{ - UINT32 i; - UINT32 j; - ACPI_STATUS Status = AE_NOT_FOUND; - ACPI_TABLE_DESC *TableDesc; - - - /* Parameter validation */ - - if (!Signature || !OutTable) - { - return (AE_BAD_PARAMETER); - } - - /* - * Note that the following line is required by some OSPMs, they only - * check if the returned table is NULL instead of the returned status - * to determined if this function is succeeded. - */ - *OutTable = NULL; - - (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); - - /* Walk the root table list */ - - for (i = 0, j = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++) - { - TableDesc = &AcpiGbl_RootTableList.Tables[i]; - - if (!ACPI_COMPARE_NAMESEG (&TableDesc->Signature, Signature)) - { - continue; - } - - if (++j < Instance) - { - continue; - } - - Status = AcpiTbGetTable (TableDesc, OutTable); - break; - } - - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); - return (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiGetTable) - - -/******************************************************************************* - * - * FUNCTION: AcpiPutTable - * - * PARAMETERS: Table - The pointer to the table - * - * RETURN: None - * - * DESCRIPTION: Release a table returned by AcpiGetTable() and its clones. - * Note that it is not safe if this function was invoked after an - * uninstallation happened to the original table descriptor. - * Currently there is no OSPMs' requirement to handle such - * situations. - * - ******************************************************************************/ - -void -AcpiPutTable ( - ACPI_TABLE_HEADER *Table) -{ - UINT32 i; - ACPI_TABLE_DESC *TableDesc; - - - ACPI_FUNCTION_TRACE (AcpiPutTable); - - - if (!Table) - { - return_VOID; - } - - (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); - - /* Walk the root table list */ - - for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++) - { - TableDesc = &AcpiGbl_RootTableList.Tables[i]; - - if (TableDesc->Pointer != Table) - { - continue; - } - - AcpiTbPutTable (TableDesc); - break; - } - - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); - return_VOID; -} - -ACPI_EXPORT_SYMBOL (AcpiPutTable) - - -/******************************************************************************* - * - * FUNCTION: AcpiGetTableByIndex - * - * PARAMETERS: TableIndex - Table index - * OutTable - Where the pointer to the table is returned - * - * RETURN: Status and pointer to the requested table - * - * DESCRIPTION: Obtain a table by an index into the global table list. Used - * internally also. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiGetTableByIndex ( - UINT32 TableIndex, - ACPI_TABLE_HEADER **OutTable) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiGetTableByIndex); - - - /* Parameter validation */ - - if (!OutTable) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* - * Note that the following line is required by some OSPMs, they only - * check if the returned table is NULL instead of the returned status - * to determined if this function is succeeded. - */ - *OutTable = NULL; - - (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); - - /* Validate index */ - - if (TableIndex >= AcpiGbl_RootTableList.CurrentTableCount) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - Status = AcpiTbGetTable ( - &AcpiGbl_RootTableList.Tables[TableIndex], OutTable); - -UnlockAndExit: - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiGetTableByIndex) - - -/******************************************************************************* - * - * FUNCTION: AcpiInstallTableHandler - * - * PARAMETERS: Handler - Table event handler - * Context - Value passed to the handler on each event - * - * RETURN: Status - * - * DESCRIPTION: Install a global table event handler. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiInstallTableHandler ( - ACPI_TABLE_HANDLER Handler, - void *Context) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiInstallTableHandler); - - - if (!Handler) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Don't allow more than one handler */ - - if (AcpiGbl_TableHandler) - { - Status = AE_ALREADY_EXISTS; - goto Cleanup; - } - - /* Install the handler */ - - AcpiGbl_TableHandler = Handler; - AcpiGbl_TableHandlerContext = Context; - -Cleanup: - (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiInstallTableHandler) - - -/******************************************************************************* - * - * FUNCTION: AcpiRemoveTableHandler - * - * PARAMETERS: Handler - Table event handler that was installed - * previously. - * - * RETURN: Status - * - * DESCRIPTION: Remove a table event handler - * - ******************************************************************************/ - -ACPI_STATUS -AcpiRemoveTableHandler ( - ACPI_TABLE_HANDLER Handler) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiRemoveTableHandler); - - - Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Make sure that the installed handler is the same */ - - if (!Handler || - Handler != AcpiGbl_TableHandler) - { - Status = AE_BAD_PARAMETER; - goto Cleanup; - } - - /* Remove the handler */ - - AcpiGbl_TableHandler = NULL; - -Cleanup: - (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiRemoveTableHandler) diff --git a/drivers/acpica/tbxfload.c b/drivers/acpica/tbxfload.c deleted file mode 100644 index 8a61d50..0000000 --- a/drivers/acpica/tbxfload.c +++ /dev/null @@ -1,652 +0,0 @@ -/****************************************************************************** - * - * Module Name: tbxfload - Table load/unload external interfaces - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#define EXPORT_ACPI_INTERFACES - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" -#include "actables.h" -#include "acevents.h" - -#define _COMPONENT ACPI_TABLES - ACPI_MODULE_NAME ("tbxfload") - - -/******************************************************************************* - * - * FUNCTION: AcpiLoadTables - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Load the ACPI tables from the RSDT/XSDT - * - ******************************************************************************/ - -ACPI_STATUS ACPI_INIT_FUNCTION -AcpiLoadTables ( - void) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiLoadTables); - - - /* - * Install the default operation region handlers. These are the - * handlers that are defined by the ACPI specification to be - * "always accessible" -- namely, SystemMemory, SystemIO, and - * PCI_Config. This also means that no _REG methods need to be - * run for these address spaces. We need to have these handlers - * installed before any AML code can be executed, especially any - * module-level code (11/2015). - * Note that we allow OSPMs to install their own region handlers - * between AcpiInitializeSubsystem() and AcpiLoadTables() to use - * their customized default region handlers. - */ - Status = AcpiEvInstallRegionHandlers (); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, "During Region initialization")); - return_ACPI_STATUS (Status); - } - - /* Load the namespace from the tables */ - - Status = AcpiTbLoadNamespace (); - - /* Don't let single failures abort the load */ - - if (Status == AE_CTRL_TERMINATE) - { - Status = AE_OK; - } - - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "While loading namespace from ACPI tables")); - } - - /* - * Initialize the objects in the namespace that remain uninitialized. - * This runs the executable AML that may be part of the declaration of - * these name objects: - * OperationRegions, BufferFields, Buffers, and Packages. - * - */ - Status = AcpiNsInitializeObjects (); - if (ACPI_SUCCESS (Status)) - { - AcpiGbl_NamespaceInitialized = TRUE; - } - - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL_INIT (AcpiLoadTables) - - -/******************************************************************************* - * - * FUNCTION: AcpiTbLoadNamespace - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Load the namespace from the DSDT and all SSDTs/PSDTs found in - * the RSDT/XSDT. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiTbLoadNamespace ( - void) -{ - ACPI_STATUS Status; - UINT32 i; - ACPI_TABLE_HEADER *NewDsdt; - ACPI_TABLE_DESC *Table; - UINT32 TablesLoaded = 0; - UINT32 TablesFailed = 0; - - - ACPI_FUNCTION_TRACE (TbLoadNamespace); - - - (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); - - /* - * Load the namespace. The DSDT is required, but any SSDT and - * PSDT tables are optional. Verify the DSDT. - */ - Table = &AcpiGbl_RootTableList.Tables[AcpiGbl_DsdtIndex]; - - if (!AcpiGbl_RootTableList.CurrentTableCount || - !ACPI_COMPARE_NAMESEG (Table->Signature.Ascii, ACPI_SIG_DSDT) || - ACPI_FAILURE (AcpiTbValidateTable (Table))) - { - Status = AE_NO_ACPI_TABLES; - goto UnlockAndExit; - } - - /* - * Save the DSDT pointer for simple access. This is the mapped memory - * address. We must take care here because the address of the .Tables - * array can change dynamically as tables are loaded at run-time. Note: - * .Pointer field is not validated until after call to AcpiTbValidateTable. - */ - AcpiGbl_DSDT = Table->Pointer; - - /* - * Optionally copy the entire DSDT to local memory (instead of simply - * mapping it.) There are some BIOSs that corrupt or replace the original - * DSDT, creating the need for this option. Default is FALSE, do not copy - * the DSDT. - */ - if (AcpiGbl_CopyDsdtLocally) - { - NewDsdt = AcpiTbCopyDsdt (AcpiGbl_DsdtIndex); - if (NewDsdt) - { - AcpiGbl_DSDT = NewDsdt; - } - } - - /* - * Save the original DSDT header for detection of table corruption - * and/or replacement of the DSDT from outside the OS. - */ - memcpy (&AcpiGbl_OriginalDsdtHeader, AcpiGbl_DSDT, - sizeof (ACPI_TABLE_HEADER)); - - /* Load and parse tables */ - - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); - Status = AcpiNsLoadTable (AcpiGbl_DsdtIndex, AcpiGbl_RootNode); - (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, "[DSDT] table load failed")); - TablesFailed++; - } - else - { - TablesLoaded++; - } - - /* Load any SSDT or PSDT tables. Note: Loop leaves tables locked */ - - for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i) - { - Table = &AcpiGbl_RootTableList.Tables[i]; - - if (!Table->Address || - (!ACPI_COMPARE_NAMESEG (Table->Signature.Ascii, ACPI_SIG_SSDT) && - !ACPI_COMPARE_NAMESEG (Table->Signature.Ascii, ACPI_SIG_PSDT) && - !ACPI_COMPARE_NAMESEG (Table->Signature.Ascii, ACPI_SIG_OSDT)) || - ACPI_FAILURE (AcpiTbValidateTable (Table))) - { - continue; - } - - /* Ignore errors while loading tables, get as many as possible */ - - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); - Status = AcpiNsLoadTable (i, AcpiGbl_RootNode); - (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, "(%4.4s:%8.8s) while loading table", - Table->Signature.Ascii, Table->Pointer->OemTableId)); - - TablesFailed++; - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - "Table [%4.4s:%8.8s] (id FF) - Table namespace load failed\n\n", - Table->Signature.Ascii, Table->Pointer->OemTableId)); - } - else - { - TablesLoaded++; - } - } - - if (!TablesFailed) - { - ACPI_INFO (( - "%u ACPI AML tables successfully acquired and loaded", - TablesLoaded)); - } - else - { - ACPI_ERROR ((AE_INFO, - "%u table load failures, %u successful", - TablesFailed, TablesLoaded)); - - /* Indicate at least one failure */ - - Status = AE_CTRL_TERMINATE; - } - -#ifdef ACPI_APPLICATION - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "\n")); -#endif - - -UnlockAndExit: - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiInstallTable - * - * PARAMETERS: Table - Pointer to the ACPI table to be installed. - * - * RETURN: Status - * - * DESCRIPTION: Dynamically install an ACPI table. - * Note: This function should only be invoked after - * AcpiInitializeTables() and before AcpiLoadTables(). - * - ******************************************************************************/ - -ACPI_STATUS ACPI_INIT_FUNCTION -AcpiInstallTable ( - ACPI_TABLE_HEADER *Table) -{ - ACPI_STATUS Status; - UINT32 TableIndex; - - - ACPI_FUNCTION_TRACE (AcpiInstallTable); - - - Status = AcpiTbInstallStandardTable (ACPI_PTR_TO_PHYSADDR (Table), - ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL, Table, FALSE, FALSE, &TableIndex); - - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL_INIT (AcpiInstallTable) - - -/******************************************************************************* - * - * FUNCTION: AcpiInstallPhysicalTable - * - * PARAMETERS: Address - Address of the ACPI table to be installed. - * - * RETURN: Status - * - * DESCRIPTION: Dynamically install an ACPI table. - * Note: This function should only be invoked after - * AcpiInitializeTables() and before AcpiLoadTables(). - * - ******************************************************************************/ - -ACPI_STATUS ACPI_INIT_FUNCTION -AcpiInstallPhysicalTable ( - ACPI_PHYSICAL_ADDRESS Address) -{ - ACPI_STATUS Status; - UINT32 TableIndex; - - - ACPI_FUNCTION_TRACE (AcpiInstallPhysicalTable); - - - Status = AcpiTbInstallStandardTable (Address, - ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, NULL, FALSE, FALSE, &TableIndex); - - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL_INIT (AcpiInstallPhysicalTable) - - -/******************************************************************************* - * - * FUNCTION: AcpiLoadTable - * - * PARAMETERS: Table - Pointer to a buffer containing the ACPI - * table to be loaded. - * TableIdx - Pointer to a UINT32 for storing the table - * index, might be NULL - * - * RETURN: Status - * - * DESCRIPTION: Dynamically load an ACPI table from the caller's buffer. Must - * be a valid ACPI table with a valid ACPI table header. - * Note1: Mainly intended to support hotplug addition of SSDTs. - * Note2: Does not copy the incoming table. User is responsible - * to ensure that the table is not deleted or unmapped. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiLoadTable ( - ACPI_TABLE_HEADER *Table, - UINT32 *TableIdx) -{ - ACPI_STATUS Status; - UINT32 TableIndex; - - - ACPI_FUNCTION_TRACE (AcpiLoadTable); - - - /* Parameter validation */ - - if (!Table) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* Install the table and load it into the namespace */ - - ACPI_INFO (("Host-directed Dynamic ACPI Table Load:")); - Status = AcpiTbInstallAndLoadTable (ACPI_PTR_TO_PHYSADDR (Table), - ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL, Table, FALSE, &TableIndex); - if (TableIdx) - { - *TableIdx = TableIndex; - } - - if (ACPI_SUCCESS (Status)) - { - /* Complete the initialization/resolution of new objects */ - - AcpiNsInitializeObjects (); - } - - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiLoadTable) - - -/******************************************************************************* - * - * FUNCTION: AcpiUnloadParentTable - * - * PARAMETERS: Object - Handle to any namespace object owned by - * the table to be unloaded - * - * RETURN: Status - * - * DESCRIPTION: Via any namespace object within an SSDT or OEMx table, unloads - * the table and deletes all namespace objects associated with - * that table. Unloading of the DSDT is not allowed. - * Note: Mainly intended to support hotplug removal of SSDTs. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUnloadParentTable ( - ACPI_HANDLE Object) -{ - ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Object); - ACPI_STATUS Status = AE_NOT_EXIST; - ACPI_OWNER_ID OwnerId; - UINT32 i; - - - ACPI_FUNCTION_TRACE (AcpiUnloadParentTable); - - - /* Parameter validation */ - - if (!Object) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* - * The node OwnerId is currently the same as the parent table ID. - * However, this could change in the future. - */ - OwnerId = Node->OwnerId; - if (!OwnerId) - { - /* OwnerId==0 means DSDT is the owner. DSDT cannot be unloaded */ - - return_ACPI_STATUS (AE_TYPE); - } - - /* Must acquire the table lock during this operation */ - - Status = AcpiUtAcquireMutex (ACPI_MTX_TABLES); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Find the table in the global table list */ - - for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++) - { - if (OwnerId != AcpiGbl_RootTableList.Tables[i].OwnerId) - { - continue; - } - - /* - * Allow unload of SSDT and OEMx tables only. Do not allow unload - * of the DSDT. No other types of tables should get here, since - * only these types can contain AML and thus are the only types - * that can create namespace objects. - */ - if (ACPI_COMPARE_NAMESEG ( - AcpiGbl_RootTableList.Tables[i].Signature.Ascii, - ACPI_SIG_DSDT)) - { - Status = AE_TYPE; - break; - } - - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); - Status = AcpiTbUnloadTable (i); - (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); - break; - } - - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiUnloadParentTable) - - -/******************************************************************************* - * - * FUNCTION: AcpiUnloadTable - * - * PARAMETERS: TableIndex - Index as returned by AcpiLoadTable - * - * RETURN: Status - * - * DESCRIPTION: Via the TableIndex representing an SSDT or OEMx table, unloads - * the table and deletes all namespace objects associated with - * that table. Unloading of the DSDT is not allowed. - * Note: Mainly intended to support hotplug removal of SSDTs. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUnloadTable ( - UINT32 TableIndex) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiUnloadTable); - - - if (TableIndex == 1) - { - /* TableIndex==1 means DSDT is the owner. DSDT cannot be unloaded */ - - return_ACPI_STATUS (AE_TYPE); - } - - Status = AcpiTbUnloadTable (TableIndex); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiUnloadTable) diff --git a/drivers/acpica/tbxfroot.c b/drivers/acpica/tbxfroot.c deleted file mode 100644 index 63cf27e..0000000 --- a/drivers/acpica/tbxfroot.c +++ /dev/null @@ -1,445 +0,0 @@ -/****************************************************************************** - * - * Module Name: tbxfroot - Find the root ACPI table (RSDT) - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "actables.h" - - -#define _COMPONENT ACPI_TABLES - ACPI_MODULE_NAME ("tbxfroot") - - -/******************************************************************************* - * - * FUNCTION: AcpiTbGetRsdpLength - * - * PARAMETERS: Rsdp - Pointer to RSDP - * - * RETURN: Table length - * - * DESCRIPTION: Get the length of the RSDP - * - ******************************************************************************/ - -UINT32 -AcpiTbGetRsdpLength ( - ACPI_TABLE_RSDP *Rsdp) -{ - - if (!ACPI_VALIDATE_RSDP_SIG (Rsdp->Signature)) - { - /* BAD Signature */ - - return (0); - } - - /* "Length" field is available if table version >= 2 */ - - if (Rsdp->Revision >= 2) - { - return (Rsdp->Length); - } - else - { - return (ACPI_RSDP_CHECKSUM_LENGTH); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbValidateRsdp - * - * PARAMETERS: Rsdp - Pointer to unvalidated RSDP - * - * RETURN: Status - * - * DESCRIPTION: Validate the RSDP (ptr) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiTbValidateRsdp ( - ACPI_TABLE_RSDP *Rsdp) -{ - - /* - * The signature and checksum must both be correct - * - * Note: Sometimes there exists more than one RSDP in memory; the valid - * RSDP has a valid checksum, all others have an invalid checksum. - */ - if (!ACPI_VALIDATE_RSDP_SIG (Rsdp->Signature)) - { - /* Nope, BAD Signature */ - - return (AE_BAD_SIGNATURE); - } - - /* Check the standard checksum */ - - if (AcpiUtChecksum ((UINT8 *) Rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) - { - return (AE_BAD_CHECKSUM); - } - - /* Check extended checksum if table version >= 2 */ - - if ((Rsdp->Revision >= 2) && - (AcpiUtChecksum ((UINT8 *) Rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0)) - { - return (AE_BAD_CHECKSUM); - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiFindRootPointer - * - * PARAMETERS: TableAddress - Where the table pointer is returned - * - * RETURN: Status, RSDP physical address - * - * DESCRIPTION: Search lower 1Mbyte of memory for the root system descriptor - * pointer structure. If it is found, set *RSDP to point to it. - * - * NOTE1: The RSDP must be either in the first 1K of the Extended - * BIOS Data Area or between E0000 and FFFFF (From ACPI Spec.) - * Only a 32-bit physical address is necessary. - * - * NOTE2: This function is always available, regardless of the - * initialization state of the rest of ACPI. - * - ******************************************************************************/ - -ACPI_STATUS ACPI_INIT_FUNCTION -AcpiFindRootPointer ( - ACPI_PHYSICAL_ADDRESS *TableAddress) -{ - UINT8 *TablePtr; - UINT8 *MemRover; - UINT32 PhysicalAddress; - UINT32 EbdaWindowSize; - - - ACPI_FUNCTION_TRACE (AcpiFindRootPointer); - - - /* 1a) Get the location of the Extended BIOS Data Area (EBDA) */ - - TablePtr = AcpiOsMapMemory ( - (ACPI_PHYSICAL_ADDRESS) ACPI_EBDA_PTR_LOCATION, - ACPI_EBDA_PTR_LENGTH); - if (!TablePtr) - { - ACPI_ERROR ((AE_INFO, - "Could not map memory at 0x%8.8X for length %u", - ACPI_EBDA_PTR_LOCATION, ACPI_EBDA_PTR_LENGTH)); - - return_ACPI_STATUS (AE_NO_MEMORY); - } - - ACPI_MOVE_16_TO_32 (&PhysicalAddress, TablePtr); - - /* Convert segment part to physical address */ - - PhysicalAddress <<= 4; - AcpiOsUnmapMemory (TablePtr, ACPI_EBDA_PTR_LENGTH); - - /* EBDA present? */ - - /* - * Check that the EBDA pointer from memory is sane and does not point - * above valid low memory - */ - if (PhysicalAddress > 0x400 && - PhysicalAddress < 0xA0000) - { - /* - * Calculate the scan window size - * The EBDA is not guaranteed to be larger than a KiB and in case - * that it is smaller, the scanning function would leave the low - * memory and continue to the VGA range. - */ - EbdaWindowSize = ACPI_MIN(ACPI_EBDA_WINDOW_SIZE, - 0xA0000 - PhysicalAddress); - - /* - * 1b) Search EBDA paragraphs - */ - TablePtr = AcpiOsMapMemory ( - (ACPI_PHYSICAL_ADDRESS) PhysicalAddress, - EbdaWindowSize); - if (!TablePtr) - { - ACPI_ERROR ((AE_INFO, - "Could not map memory at 0x%8.8X for length %u", - PhysicalAddress, EbdaWindowSize)); - - return_ACPI_STATUS (AE_NO_MEMORY); - } - - MemRover = AcpiTbScanMemoryForRsdp ( - TablePtr, EbdaWindowSize); - AcpiOsUnmapMemory (TablePtr, EbdaWindowSize); - - if (MemRover) - { - /* Return the physical address */ - - PhysicalAddress += - (UINT32) ACPI_PTR_DIFF (MemRover, TablePtr); - - *TableAddress = (ACPI_PHYSICAL_ADDRESS) PhysicalAddress; - return_ACPI_STATUS (AE_OK); - } - } - - /* - * 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh - */ - TablePtr = AcpiOsMapMemory ( - (ACPI_PHYSICAL_ADDRESS) ACPI_HI_RSDP_WINDOW_BASE, - ACPI_HI_RSDP_WINDOW_SIZE); - - if (!TablePtr) - { - ACPI_ERROR ((AE_INFO, - "Could not map memory at 0x%8.8X for length %u", - ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE)); - - return_ACPI_STATUS (AE_NO_MEMORY); - } - - MemRover = AcpiTbScanMemoryForRsdp ( - TablePtr, ACPI_HI_RSDP_WINDOW_SIZE); - AcpiOsUnmapMemory (TablePtr, ACPI_HI_RSDP_WINDOW_SIZE); - - if (MemRover) - { - /* Return the physical address */ - - PhysicalAddress = (UINT32) - (ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF (MemRover, TablePtr)); - - *TableAddress = (ACPI_PHYSICAL_ADDRESS) PhysicalAddress; - return_ACPI_STATUS (AE_OK); - } - - /* A valid RSDP was not found */ - - ACPI_BIOS_ERROR ((AE_INFO, "A valid RSDP was not found")); - return_ACPI_STATUS (AE_NOT_FOUND); -} - -ACPI_EXPORT_SYMBOL_INIT (AcpiFindRootPointer) - - -/******************************************************************************* - * - * FUNCTION: AcpiTbScanMemoryForRsdp - * - * PARAMETERS: StartAddress - Starting pointer for search - * Length - Maximum length to search - * - * RETURN: Pointer to the RSDP if found, otherwise NULL. - * - * DESCRIPTION: Search a block of memory for the RSDP signature - * - ******************************************************************************/ - -UINT8 * -AcpiTbScanMemoryForRsdp ( - UINT8 *StartAddress, - UINT32 Length) -{ - ACPI_STATUS Status; - UINT8 *MemRover; - UINT8 *EndAddress; - - - ACPI_FUNCTION_TRACE (TbScanMemoryForRsdp); - - - EndAddress = StartAddress + Length; - - /* Search from given start address for the requested length */ - - for (MemRover = StartAddress; MemRover < EndAddress; - MemRover += ACPI_RSDP_SCAN_STEP) - { - /* The RSDP signature and checksum must both be correct */ - - Status = AcpiTbValidateRsdp ( - ACPI_CAST_PTR (ACPI_TABLE_RSDP, MemRover)); - if (ACPI_SUCCESS (Status)) - { - /* Sig and checksum valid, we have found a real RSDP */ - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "RSDP located at physical address %p\n", MemRover)); - return_PTR (MemRover); - } - - /* No sig match or bad checksum, keep searching */ - } - - /* Searched entire block, no RSDP was found */ - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Searched entire block from %p, valid RSDP was not found\n", - StartAddress)); - return_PTR (NULL); -} diff --git a/drivers/acpica/utaddress.c b/drivers/acpica/utaddress.c deleted file mode 100644 index 6d1b9aa..0000000 --- a/drivers/acpica/utaddress.c +++ /dev/null @@ -1,423 +0,0 @@ -/****************************************************************************** - * - * Module Name: utaddress - OpRegion address range check - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" - - -#define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utaddress") - - -/******************************************************************************* - * - * FUNCTION: AcpiUtAddAddressRange - * - * PARAMETERS: SpaceId - Address space ID - * Address - OpRegion start address - * Length - OpRegion length - * RegionNode - OpRegion namespace node - * - * RETURN: Status - * - * DESCRIPTION: Add the Operation Region address range to the global list. - * The only supported Space IDs are Memory and I/O. Called when - * the OpRegion address/length operands are fully evaluated. - * - * MUTEX: Locks the namespace - * - * NOTE: Because this interface is only called when an OpRegion argument - * list is evaluated, there cannot be any duplicate RegionNodes. - * Duplicate Address/Length values are allowed, however, so that multiple - * address conflicts can be detected. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtAddAddressRange ( - ACPI_ADR_SPACE_TYPE SpaceId, - ACPI_PHYSICAL_ADDRESS Address, - UINT32 Length, - ACPI_NAMESPACE_NODE *RegionNode) -{ - ACPI_ADDRESS_RANGE *RangeInfo; - - - ACPI_FUNCTION_TRACE (UtAddAddressRange); - - - if ((SpaceId != ACPI_ADR_SPACE_SYSTEM_MEMORY) && - (SpaceId != ACPI_ADR_SPACE_SYSTEM_IO)) - { - return_ACPI_STATUS (AE_OK); - } - - /* Allocate/init a new info block, add it to the appropriate list */ - - RangeInfo = ACPI_ALLOCATE (sizeof (ACPI_ADDRESS_RANGE)); - if (!RangeInfo) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - RangeInfo->StartAddress = Address; - RangeInfo->EndAddress = (Address + Length - 1); - RangeInfo->RegionNode = RegionNode; - - RangeInfo->Next = AcpiGbl_AddressRangeList[SpaceId]; - AcpiGbl_AddressRangeList[SpaceId] = RangeInfo; - - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "\nAdded [%4.4s] address range: 0x%8.8X%8.8X-0x%8.8X%8.8X\n", - AcpiUtGetNodeName (RangeInfo->RegionNode), - ACPI_FORMAT_UINT64 (Address), - ACPI_FORMAT_UINT64 (RangeInfo->EndAddress))); - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtRemoveAddressRange - * - * PARAMETERS: SpaceId - Address space ID - * RegionNode - OpRegion namespace node - * - * RETURN: None - * - * DESCRIPTION: Remove the Operation Region from the global list. The only - * supported Space IDs are Memory and I/O. Called when an - * OpRegion is deleted. - * - * MUTEX: Assumes the namespace is locked - * - ******************************************************************************/ - -void -AcpiUtRemoveAddressRange ( - ACPI_ADR_SPACE_TYPE SpaceId, - ACPI_NAMESPACE_NODE *RegionNode) -{ - ACPI_ADDRESS_RANGE *RangeInfo; - ACPI_ADDRESS_RANGE *Prev; - - - ACPI_FUNCTION_TRACE (UtRemoveAddressRange); - - - if ((SpaceId != ACPI_ADR_SPACE_SYSTEM_MEMORY) && - (SpaceId != ACPI_ADR_SPACE_SYSTEM_IO)) - { - return_VOID; - } - - /* Get the appropriate list head and check the list */ - - RangeInfo = Prev = AcpiGbl_AddressRangeList[SpaceId]; - while (RangeInfo) - { - if (RangeInfo->RegionNode == RegionNode) - { - if (RangeInfo == Prev) /* Found at list head */ - { - AcpiGbl_AddressRangeList[SpaceId] = RangeInfo->Next; - } - else - { - Prev->Next = RangeInfo->Next; - } - - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "\nRemoved [%4.4s] address range: 0x%8.8X%8.8X-0x%8.8X%8.8X\n", - AcpiUtGetNodeName (RangeInfo->RegionNode), - ACPI_FORMAT_UINT64 (RangeInfo->StartAddress), - ACPI_FORMAT_UINT64 (RangeInfo->EndAddress))); - - ACPI_FREE (RangeInfo); - return_VOID; - } - - Prev = RangeInfo; - RangeInfo = RangeInfo->Next; - } - - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtCheckAddressRange - * - * PARAMETERS: SpaceId - Address space ID - * Address - Start address - * Length - Length of address range - * Warn - TRUE if warning on overlap desired - * - * RETURN: Count of the number of conflicts detected. Zero is always - * returned for Space IDs other than Memory or I/O. - * - * DESCRIPTION: Check if the input address range overlaps any of the - * ASL operation region address ranges. The only supported - * Space IDs are Memory and I/O. - * - * MUTEX: Assumes the namespace is locked. - * - ******************************************************************************/ - -UINT32 -AcpiUtCheckAddressRange ( - ACPI_ADR_SPACE_TYPE SpaceId, - ACPI_PHYSICAL_ADDRESS Address, - UINT32 Length, - BOOLEAN Warn) -{ - ACPI_ADDRESS_RANGE *RangeInfo; - ACPI_PHYSICAL_ADDRESS EndAddress; - char *Pathname; - UINT32 OverlapCount = 0; - - - ACPI_FUNCTION_TRACE (UtCheckAddressRange); - - - if ((SpaceId != ACPI_ADR_SPACE_SYSTEM_MEMORY) && - (SpaceId != ACPI_ADR_SPACE_SYSTEM_IO)) - { - return_UINT32 (0); - } - - RangeInfo = AcpiGbl_AddressRangeList[SpaceId]; - EndAddress = Address + Length - 1; - - /* Check entire list for all possible conflicts */ - - while (RangeInfo) - { - /* - * Check if the requested address/length overlaps this - * address range. There are four cases to consider: - * - * 1) Input address/length is contained completely in the - * address range - * 2) Input address/length overlaps range at the range start - * 3) Input address/length overlaps range at the range end - * 4) Input address/length completely encompasses the range - */ - if ((Address <= RangeInfo->EndAddress) && - (EndAddress >= RangeInfo->StartAddress)) - { - /* Found an address range overlap */ - - OverlapCount++; - if (Warn) /* Optional warning message */ - { - Pathname = AcpiNsGetNormalizedPathname (RangeInfo->RegionNode, TRUE); - - ACPI_WARNING ((AE_INFO, - "%s range 0x%8.8X%8.8X-0x%8.8X%8.8X conflicts with OpRegion 0x%8.8X%8.8X-0x%8.8X%8.8X (%s)", - AcpiUtGetRegionName (SpaceId), - ACPI_FORMAT_UINT64 (Address), - ACPI_FORMAT_UINT64 (EndAddress), - ACPI_FORMAT_UINT64 (RangeInfo->StartAddress), - ACPI_FORMAT_UINT64 (RangeInfo->EndAddress), - Pathname)); - ACPI_FREE (Pathname); - } - } - - RangeInfo = RangeInfo->Next; - } - - return_UINT32 (OverlapCount); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtDeleteAddressLists - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Delete all global address range lists (called during - * subsystem shutdown). - * - ******************************************************************************/ - -void -AcpiUtDeleteAddressLists ( - void) -{ - ACPI_ADDRESS_RANGE *Next; - ACPI_ADDRESS_RANGE *RangeInfo; - int i; - - - /* Delete all elements in all address range lists */ - - for (i = 0; i < ACPI_ADDRESS_RANGE_MAX; i++) - { - Next = AcpiGbl_AddressRangeList[i]; - - while (Next) - { - RangeInfo = Next; - Next = RangeInfo->Next; - ACPI_FREE (RangeInfo); - } - - AcpiGbl_AddressRangeList[i] = NULL; - } -} diff --git a/drivers/acpica/utalloc.c b/drivers/acpica/utalloc.c deleted file mode 100644 index ae3c6a9..0000000 --- a/drivers/acpica/utalloc.c +++ /dev/null @@ -1,517 +0,0 @@ -/****************************************************************************** - * - * Module Name: utalloc - local memory allocation routines - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acdebug.h" - -#define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utalloc") - - -#if !defined (USE_NATIVE_ALLOCATE_ZEROED) -/******************************************************************************* - * - * FUNCTION: AcpiOsAllocateZeroed - * - * PARAMETERS: Size - Size of the allocation - * - * RETURN: Address of the allocated memory on success, NULL on failure. - * - * DESCRIPTION: Subsystem equivalent of calloc. Allocate and zero memory. - * This is the default implementation. Can be overridden via the - * USE_NATIVE_ALLOCATE_ZEROED flag. - * - ******************************************************************************/ - -void * -AcpiOsAllocateZeroed ( - ACPI_SIZE Size) -{ - void *Allocation; - - - ACPI_FUNCTION_ENTRY (); - - - Allocation = AcpiOsAllocate (Size); - if (Allocation) - { - /* Clear the memory block */ - - memset (Allocation, 0, Size); - } - - return (Allocation); -} - -#endif /* !USE_NATIVE_ALLOCATE_ZEROED */ - - -/******************************************************************************* - * - * FUNCTION: AcpiUtCreateCaches - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Create all local caches - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtCreateCaches ( - void) -{ - ACPI_STATUS Status; - - - /* Object Caches, for frequently used objects */ - - Status = AcpiOsCreateCache ("Acpi-Namespace", sizeof (ACPI_NAMESPACE_NODE), - ACPI_MAX_NAMESPACE_CACHE_DEPTH, &AcpiGbl_NamespaceCache); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - Status = AcpiOsCreateCache ("Acpi-State", sizeof (ACPI_GENERIC_STATE), - ACPI_MAX_STATE_CACHE_DEPTH, &AcpiGbl_StateCache); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - Status = AcpiOsCreateCache ("Acpi-Parse", sizeof (ACPI_PARSE_OBJ_COMMON), - ACPI_MAX_PARSE_CACHE_DEPTH, &AcpiGbl_PsNodeCache); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - Status = AcpiOsCreateCache ("Acpi-ParseExt", sizeof (ACPI_PARSE_OBJ_NAMED), - ACPI_MAX_EXTPARSE_CACHE_DEPTH, &AcpiGbl_PsNodeExtCache); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - Status = AcpiOsCreateCache ("Acpi-Operand", sizeof (ACPI_OPERAND_OBJECT), - ACPI_MAX_OBJECT_CACHE_DEPTH, &AcpiGbl_OperandCache); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - -#ifdef ACPI_ASL_COMPILER - /* - * For use with the ASL-/ASL+ option. This cache keeps track of regular - * 0xA9 0x01 comments. - */ - Status = AcpiOsCreateCache ("Acpi-Comment", sizeof (ACPI_COMMENT_NODE), - ACPI_MAX_COMMENT_CACHE_DEPTH, &AcpiGbl_RegCommentCache); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* - * This cache keeps track of the starting addresses of where the comments - * lie. This helps prevent duplication of comments. - */ - Status = AcpiOsCreateCache ("Acpi-Comment-Addr", sizeof (ACPI_COMMENT_ADDR_NODE), - ACPI_MAX_COMMENT_CACHE_DEPTH, &AcpiGbl_CommentAddrCache); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* - * This cache will be used for nodes that represent files. - */ - Status = AcpiOsCreateCache ("Acpi-File", sizeof (ACPI_FILE_NODE), - ACPI_MAX_COMMENT_CACHE_DEPTH, &AcpiGbl_FileCache); - if (ACPI_FAILURE (Status)) - { - return (Status); - } -#endif - - -#ifdef ACPI_DBG_TRACK_ALLOCATIONS - - /* Memory allocation lists */ - - Status = AcpiUtCreateList ("Acpi-Global", 0, - &AcpiGbl_GlobalList); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - Status = AcpiUtCreateList ("Acpi-Namespace", sizeof (ACPI_NAMESPACE_NODE), - &AcpiGbl_NsNodeList); - if (ACPI_FAILURE (Status)) - { - return (Status); - } -#endif - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtDeleteCaches - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Purge and delete all local caches - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtDeleteCaches ( - void) -{ -#ifdef ACPI_DBG_TRACK_ALLOCATIONS - char Buffer[7]; - - - if (AcpiGbl_DisplayFinalMemStats) - { - strcpy (Buffer, "MEMORY"); - (void) AcpiDbDisplayStatistics (Buffer); - } -#endif - - (void) AcpiOsDeleteCache (AcpiGbl_NamespaceCache); - AcpiGbl_NamespaceCache = NULL; - - (void) AcpiOsDeleteCache (AcpiGbl_StateCache); - AcpiGbl_StateCache = NULL; - - (void) AcpiOsDeleteCache (AcpiGbl_OperandCache); - AcpiGbl_OperandCache = NULL; - - (void) AcpiOsDeleteCache (AcpiGbl_PsNodeCache); - AcpiGbl_PsNodeCache = NULL; - - (void) AcpiOsDeleteCache (AcpiGbl_PsNodeExtCache); - AcpiGbl_PsNodeExtCache = NULL; - -#ifdef ACPI_ASL_COMPILER - (void) AcpiOsDeleteCache (AcpiGbl_RegCommentCache); - AcpiGbl_RegCommentCache = NULL; - - (void) AcpiOsDeleteCache (AcpiGbl_CommentAddrCache); - AcpiGbl_CommentAddrCache = NULL; - - (void) AcpiOsDeleteCache (AcpiGbl_FileCache); - AcpiGbl_FileCache = NULL; -#endif - -#ifdef ACPI_DBG_TRACK_ALLOCATIONS - - /* Debug only - display leftover memory allocation, if any */ - - AcpiUtDumpAllocations (ACPI_UINT32_MAX, NULL); - - /* Free memory lists */ - - AcpiOsFree (AcpiGbl_GlobalList); - AcpiGbl_GlobalList = NULL; - - AcpiOsFree (AcpiGbl_NsNodeList); - AcpiGbl_NsNodeList = NULL; -#endif - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtValidateBuffer - * - * PARAMETERS: Buffer - Buffer descriptor to be validated - * - * RETURN: Status - * - * DESCRIPTION: Perform parameter validation checks on an ACPI_BUFFER - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtValidateBuffer ( - ACPI_BUFFER *Buffer) -{ - - /* Obviously, the structure pointer must be valid */ - - if (!Buffer) - { - return (AE_BAD_PARAMETER); - } - - /* Special semantics for the length */ - - if ((Buffer->Length == ACPI_NO_BUFFER) || - (Buffer->Length == ACPI_ALLOCATE_BUFFER) || - (Buffer->Length == ACPI_ALLOCATE_LOCAL_BUFFER)) - { - return (AE_OK); - } - - /* Length is valid, the buffer pointer must be also */ - - if (!Buffer->Pointer) - { - return (AE_BAD_PARAMETER); - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtInitializeBuffer - * - * PARAMETERS: Buffer - Buffer to be validated - * RequiredLength - Length needed - * - * RETURN: Status - * - * DESCRIPTION: Validate that the buffer is of the required length or - * allocate a new buffer. Returned buffer is always zeroed. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtInitializeBuffer ( - ACPI_BUFFER *Buffer, - ACPI_SIZE RequiredLength) -{ - ACPI_SIZE InputBufferLength; - - - /* Parameter validation */ - - if (!Buffer || !RequiredLength) - { - return (AE_BAD_PARAMETER); - } - - /* - * Buffer->Length is used as both an input and output parameter. Get the - * input actual length and set the output required buffer length. - */ - InputBufferLength = Buffer->Length; - Buffer->Length = RequiredLength; - - /* - * The input buffer length contains the actual buffer length, or the type - * of buffer to be allocated by this routine. - */ - switch (InputBufferLength) - { - case ACPI_NO_BUFFER: - - /* Return the exception (and the required buffer length) */ - - return (AE_BUFFER_OVERFLOW); - - case ACPI_ALLOCATE_BUFFER: - /* - * Allocate a new buffer. We directectly call AcpiOsAllocate here to - * purposefully bypass the (optionally enabled) internal allocation - * tracking mechanism since we only want to track internal - * allocations. Note: The caller should use AcpiOsFree to free this - * buffer created via ACPI_ALLOCATE_BUFFER. - */ - Buffer->Pointer = AcpiOsAllocate (RequiredLength); - break; - - case ACPI_ALLOCATE_LOCAL_BUFFER: - - /* Allocate a new buffer with local interface to allow tracking */ - - Buffer->Pointer = ACPI_ALLOCATE (RequiredLength); - break; - - default: - - /* Existing buffer: Validate the size of the buffer */ - - if (InputBufferLength < RequiredLength) - { - return (AE_BUFFER_OVERFLOW); - } - break; - } - - /* Validate allocation from above or input buffer pointer */ - - if (!Buffer->Pointer) - { - return (AE_NO_MEMORY); - } - - /* Have a valid buffer, clear it */ - - memset (Buffer->Pointer, 0, RequiredLength); - return (AE_OK); -} diff --git a/drivers/acpica/utascii.c b/drivers/acpica/utascii.c deleted file mode 100644 index 05918b1..0000000 --- a/drivers/acpica/utascii.c +++ /dev/null @@ -1,269 +0,0 @@ -/****************************************************************************** - * - * Module Name: utascii - Utility ascii functions - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" - - -/******************************************************************************* - * - * FUNCTION: AcpiUtValidNameseg - * - * PARAMETERS: Name - The name or table signature to be examined. - * Four characters, does not have to be a - * NULL terminated string. - * - * RETURN: TRUE if signature is has 4 valid ACPI characters - * - * DESCRIPTION: Validate an ACPI table signature. - * - ******************************************************************************/ - -BOOLEAN -AcpiUtValidNameseg ( - char *Name) -{ - UINT32 i; - - - /* Validate each character in the signature */ - - for (i = 0; i < ACPI_NAMESEG_SIZE; i++) - { - if (!AcpiUtValidNameChar (Name[i], i)) - { - return (FALSE); - } - } - - return (TRUE); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtValidNameChar - * - * PARAMETERS: Char - The character to be examined - * Position - Byte position (0-3) - * - * RETURN: TRUE if the character is valid, FALSE otherwise - * - * DESCRIPTION: Check for a valid ACPI character. Must be one of: - * 1) Upper case alpha - * 2) numeric - * 3) underscore - * - * We allow a '!' as the last character because of the ASF! table - * - ******************************************************************************/ - -BOOLEAN -AcpiUtValidNameChar ( - char Character, - UINT32 Position) -{ - - if (!((Character >= 'A' && Character <= 'Z') || - (Character >= '0' && Character <= '9') || - (Character == '_'))) - { - /* Allow a '!' in the last position */ - - if (Character == '!' && Position == 3) - { - return (TRUE); - } - - return (FALSE); - } - - return (TRUE); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtCheckAndRepairAscii - * - * PARAMETERS: Name - Ascii string - * Count - Number of characters to check - * - * RETURN: None - * - * DESCRIPTION: Ensure that the requested number of characters are printable - * Ascii characters. Sets non-printable and null chars to . - * - ******************************************************************************/ - -void -AcpiUtCheckAndRepairAscii ( - UINT8 *Name, - char *RepairedName, - UINT32 Count) -{ - UINT32 i; - - - for (i = 0; i < Count; i++) - { - RepairedName[i] = (char) Name[i]; - - if (!Name[i]) - { - return; - } - if (!isprint (Name[i])) - { - RepairedName[i] = ' '; - } - } -} diff --git a/drivers/acpica/utbuffer.c b/drivers/acpica/utbuffer.c deleted file mode 100644 index b08d260..0000000 --- a/drivers/acpica/utbuffer.c +++ /dev/null @@ -1,478 +0,0 @@ -/****************************************************************************** - * - * Module Name: utbuffer - Buffer dump routines - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" - -#define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utbuffer") - - -/******************************************************************************* - * - * FUNCTION: AcpiUtDumpBuffer - * - * PARAMETERS: Buffer - Buffer to dump - * Count - Amount to dump, in bytes - * Display - BYTE, WORD, DWORD, or QWORD display: - * DB_BYTE_DISPLAY - * DB_WORD_DISPLAY - * DB_DWORD_DISPLAY - * DB_QWORD_DISPLAY - * BaseOffset - Beginning buffer offset (display only) - * - * RETURN: None - * - * DESCRIPTION: Generic dump buffer in both hex and ascii. - * - ******************************************************************************/ - -void -AcpiUtDumpBuffer ( - UINT8 *Buffer, - UINT32 Count, - UINT32 Display, - UINT32 BaseOffset) -{ - UINT32 i = 0; - UINT32 j; - UINT32 Temp32; - UINT8 BufChar; - UINT32 DisplayDataOnly = Display & DB_DISPLAY_DATA_ONLY; - - - Display &= ~DB_DISPLAY_DATA_ONLY; - if (!Buffer) - { - AcpiOsPrintf ("Null Buffer Pointer in DumpBuffer!\n"); - return; - } - - if ((Count < 4) || (Count & 0x01)) - { - Display = DB_BYTE_DISPLAY; - } - - /* Nasty little dump buffer routine! */ - - while (i < Count) - { - /* Print current offset */ - - if (!DisplayDataOnly) - { - AcpiOsPrintf ("%8.4X: ", (BaseOffset + i)); - } - - /* Print 16 hex chars */ - - for (j = 0; j < 16;) - { - if (i + j >= Count) - { - /* Dump fill spaces */ - - AcpiOsPrintf ("%*s", ((Display * 2) + 1), " "); - j += Display; - continue; - } - - switch (Display) - { - case DB_BYTE_DISPLAY: - default: /* Default is BYTE display */ - - AcpiOsPrintf ("%02X ", Buffer[(ACPI_SIZE) i + j]); - break; - - case DB_WORD_DISPLAY: - - ACPI_MOVE_16_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]); - AcpiOsPrintf ("%04X ", Temp32); - break; - - case DB_DWORD_DISPLAY: - - ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]); - AcpiOsPrintf ("%08X ", Temp32); - break; - - case DB_QWORD_DISPLAY: - - ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]); - AcpiOsPrintf ("%08X", Temp32); - - ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j + 4]); - AcpiOsPrintf ("%08X ", Temp32); - break; - } - - j += Display; - } - - /* - * Print the ASCII equivalent characters but watch out for the bad - * unprintable ones (printable chars are 0x20 through 0x7E) - */ - if (!DisplayDataOnly) - { - AcpiOsPrintf (" "); - for (j = 0; j < 16; j++) - { - if (i + j >= Count) - { - AcpiOsPrintf ("\n"); - return; - } - - /* - * Add comment characters so rest of line is ignored when - * compiled - */ - if (j == 0) - { - AcpiOsPrintf ("// "); - } - - BufChar = Buffer[(ACPI_SIZE) i + j]; - if (isprint (BufChar)) - { - AcpiOsPrintf ("%c", BufChar); - } - else - { - AcpiOsPrintf ("."); - } - } - - /* Done with that line. */ - - AcpiOsPrintf ("\n"); - } - i += 16; - } - - return; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtDebugDumpBuffer - * - * PARAMETERS: Buffer - Buffer to dump - * Count - Amount to dump, in bytes - * Display - BYTE, WORD, DWORD, or QWORD display: - * DB_BYTE_DISPLAY - * DB_WORD_DISPLAY - * DB_DWORD_DISPLAY - * DB_QWORD_DISPLAY - * ComponentID - Caller's component ID - * - * RETURN: None - * - * DESCRIPTION: Generic dump buffer in both hex and ascii. - * - ******************************************************************************/ - -void -AcpiUtDebugDumpBuffer ( - UINT8 *Buffer, - UINT32 Count, - UINT32 Display, - UINT32 ComponentId) -{ - - /* Only dump the buffer if tracing is enabled */ - - if (!((ACPI_LV_TABLES & AcpiDbgLevel) && - (ComponentId & AcpiDbgLayer))) - { - return; - } - - AcpiUtDumpBuffer (Buffer, Count, Display, 0); -} - - -#ifdef ACPI_APPLICATION -/******************************************************************************* - * - * FUNCTION: AcpiUtDumpBufferToFile - * - * PARAMETERS: File - File descriptor - * Buffer - Buffer to dump - * Count - Amount to dump, in bytes - * Display - BYTE, WORD, DWORD, or QWORD display: - * DB_BYTE_DISPLAY - * DB_WORD_DISPLAY - * DB_DWORD_DISPLAY - * DB_QWORD_DISPLAY - * BaseOffset - Beginning buffer offset (display only) - * - * RETURN: None - * - * DESCRIPTION: Generic dump buffer in both hex and ascii to a file. - * - ******************************************************************************/ - -void -AcpiUtDumpBufferToFile ( - ACPI_FILE File, - UINT8 *Buffer, - UINT32 Count, - UINT32 Display, - UINT32 BaseOffset) -{ - UINT32 i = 0; - UINT32 j; - UINT32 Temp32; - UINT8 BufChar; - - - if (!Buffer) - { - fprintf (File, "Null Buffer Pointer in DumpBuffer!\n"); - return; - } - - if ((Count < 4) || (Count & 0x01)) - { - Display = DB_BYTE_DISPLAY; - } - - /* Nasty little dump buffer routine! */ - - while (i < Count) - { - /* Print current offset */ - - fprintf (File, "%8.4X: ", (BaseOffset + i)); - - /* Print 16 hex chars */ - - for (j = 0; j < 16;) - { - if (i + j >= Count) - { - /* Dump fill spaces */ - - fprintf (File, "%*s", ((Display * 2) + 1), " "); - j += Display; - continue; - } - - switch (Display) - { - case DB_BYTE_DISPLAY: - default: /* Default is BYTE display */ - - fprintf (File, "%02X ", Buffer[(ACPI_SIZE) i + j]); - break; - - case DB_WORD_DISPLAY: - - ACPI_MOVE_16_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]); - fprintf (File, "%04X ", Temp32); - break; - - case DB_DWORD_DISPLAY: - - ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]); - fprintf (File, "%08X ", Temp32); - break; - - case DB_QWORD_DISPLAY: - - ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]); - fprintf (File, "%08X", Temp32); - - ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j + 4]); - fprintf (File, "%08X ", Temp32); - break; - } - - j += Display; - } - - /* - * Print the ASCII equivalent characters but watch out for the bad - * unprintable ones (printable chars are 0x20 through 0x7E) - */ - fprintf (File, " "); - for (j = 0; j < 16; j++) - { - if (i + j >= Count) - { - fprintf (File, "\n"); - return; - } - - BufChar = Buffer[(ACPI_SIZE) i + j]; - if (isprint (BufChar)) - { - fprintf (File, "%c", BufChar); - } - else - { - fprintf (File, "."); - } - } - - /* Done with that line. */ - - fprintf (File, "\n"); - i += 16; - } - - return; -} -#endif diff --git a/drivers/acpica/utcache.c b/drivers/acpica/utcache.c deleted file mode 100644 index 2f80c77..0000000 --- a/drivers/acpica/utcache.c +++ /dev/null @@ -1,462 +0,0 @@ -/****************************************************************************** - * - * Module Name: utcache - local cache allocation routines - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" - -#define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utcache") - - -#ifdef ACPI_USE_LOCAL_CACHE -/******************************************************************************* - * - * FUNCTION: AcpiOsCreateCache - * - * PARAMETERS: CacheName - Ascii name for the cache - * ObjectSize - Size of each cached object - * MaxDepth - Maximum depth of the cache (in objects) - * ReturnCache - Where the new cache object is returned - * - * RETURN: Status - * - * DESCRIPTION: Create a cache object - * - ******************************************************************************/ - -ACPI_STATUS -AcpiOsCreateCache ( - char *CacheName, - UINT16 ObjectSize, - UINT16 MaxDepth, - ACPI_MEMORY_LIST **ReturnCache) -{ - ACPI_MEMORY_LIST *Cache; - - - ACPI_FUNCTION_ENTRY (); - - - if (!CacheName || !ReturnCache || !ObjectSize) - { - return (AE_BAD_PARAMETER); - } - - /* Create the cache object */ - - Cache = AcpiOsAllocate (sizeof (ACPI_MEMORY_LIST)); - if (!Cache) - { - return (AE_NO_MEMORY); - } - - /* Populate the cache object and return it */ - - memset (Cache, 0, sizeof (ACPI_MEMORY_LIST)); - Cache->ListName = CacheName; - Cache->ObjectSize = ObjectSize; - Cache->MaxDepth = MaxDepth; - - *ReturnCache = Cache; - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiOsPurgeCache - * - * PARAMETERS: Cache - Handle to cache object - * - * RETURN: Status - * - * DESCRIPTION: Free all objects within the requested cache. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiOsPurgeCache ( - ACPI_MEMORY_LIST *Cache) -{ - void *Next; - ACPI_STATUS Status; - - - ACPI_FUNCTION_ENTRY (); - - - if (!Cache) - { - return (AE_BAD_PARAMETER); - } - - Status = AcpiUtAcquireMutex (ACPI_MTX_CACHES); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Walk the list of objects in this cache */ - - while (Cache->ListHead) - { - /* Delete and unlink one cached state object */ - - Next = ACPI_GET_DESCRIPTOR_PTR (Cache->ListHead); - ACPI_FREE (Cache->ListHead); - - Cache->ListHead = Next; - Cache->CurrentDepth--; - } - - (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES); - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiOsDeleteCache - * - * PARAMETERS: Cache - Handle to cache object - * - * RETURN: Status - * - * DESCRIPTION: Free all objects within the requested cache and delete the - * cache object. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiOsDeleteCache ( - ACPI_MEMORY_LIST *Cache) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_ENTRY (); - - - /* Purge all objects in the cache */ - - Status = AcpiOsPurgeCache (Cache); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Now we can delete the cache object */ - - AcpiOsFree (Cache); - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiOsReleaseObject - * - * PARAMETERS: Cache - Handle to cache object - * Object - The object to be released - * - * RETURN: None - * - * DESCRIPTION: Release an object to the specified cache. If cache is full, - * the object is deleted. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiOsReleaseObject ( - ACPI_MEMORY_LIST *Cache, - void *Object) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_ENTRY (); - - - if (!Cache || !Object) - { - return (AE_BAD_PARAMETER); - } - - /* If cache is full, just free this object */ - - if (Cache->CurrentDepth >= Cache->MaxDepth) - { - ACPI_FREE (Object); - ACPI_MEM_TRACKING (Cache->TotalFreed++); - } - - /* Otherwise put this object back into the cache */ - - else - { - Status = AcpiUtAcquireMutex (ACPI_MTX_CACHES); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Mark the object as cached */ - - memset (Object, 0xCA, Cache->ObjectSize); - ACPI_SET_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_CACHED); - - /* Put the object at the head of the cache list */ - - ACPI_SET_DESCRIPTOR_PTR (Object, Cache->ListHead); - Cache->ListHead = Object; - Cache->CurrentDepth++; - - (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES); - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiOsAcquireObject - * - * PARAMETERS: Cache - Handle to cache object - * - * RETURN: the acquired object. NULL on error - * - * DESCRIPTION: Get an object from the specified cache. If cache is empty, - * the object is allocated. - * - ******************************************************************************/ - -void * -AcpiOsAcquireObject ( - ACPI_MEMORY_LIST *Cache) -{ - ACPI_STATUS Status; - void *Object; - - - ACPI_FUNCTION_TRACE (OsAcquireObject); - - - if (!Cache) - { - return_PTR (NULL); - } - - Status = AcpiUtAcquireMutex (ACPI_MTX_CACHES); - if (ACPI_FAILURE (Status)) - { - return_PTR (NULL); - } - - ACPI_MEM_TRACKING (Cache->Requests++); - - /* Check the cache first */ - - if (Cache->ListHead) - { - /* There is an object available, use it */ - - Object = Cache->ListHead; - Cache->ListHead = ACPI_GET_DESCRIPTOR_PTR (Object); - - Cache->CurrentDepth--; - - ACPI_MEM_TRACKING (Cache->Hits++); - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, - "%s: Object %p from %s cache\n", - ACPI_GET_FUNCTION_NAME, Object, Cache->ListName)); - - Status = AcpiUtReleaseMutex (ACPI_MTX_CACHES); - if (ACPI_FAILURE (Status)) - { - return_PTR (NULL); - } - - /* Clear (zero) the previously used Object */ - - memset (Object, 0, Cache->ObjectSize); - } - else - { - /* The cache is empty, create a new object */ - -#ifdef ACPI_DBG_TRACK_ALLOCATIONS - ACPI_MEM_TRACKING (Cache->TotalAllocated++); - - if ((Cache->TotalAllocated - Cache->TotalFreed) > Cache->MaxOccupied) - { - Cache->MaxOccupied = Cache->TotalAllocated - Cache->TotalFreed; - } -#endif - - /* Avoid deadlock with ACPI_ALLOCATE_ZEROED */ - - Status = AcpiUtReleaseMutex (ACPI_MTX_CACHES); - if (ACPI_FAILURE (Status)) - { - return_PTR (NULL); - } - - Object = ACPI_ALLOCATE_ZEROED (Cache->ObjectSize); - if (!Object) - { - return_PTR (NULL); - } - } - - return_PTR (Object); -} -#endif /* ACPI_USE_LOCAL_CACHE */ diff --git a/drivers/acpica/utcksum.c b/drivers/acpica/utcksum.c deleted file mode 100644 index 5469075..0000000 --- a/drivers/acpica/utcksum.c +++ /dev/null @@ -1,335 +0,0 @@ -/****************************************************************************** - * - * Module Name: utcksum - Support generating table checksums - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acdisasm.h" -#include "acutils.h" - - -/* This module used for application-level code only */ - -#define _COMPONENT ACPI_CA_DISASSEMBLER - ACPI_MODULE_NAME ("utcksum") - - -/******************************************************************************* - * - * FUNCTION: AcpiUtVerifyChecksum - * - * PARAMETERS: Table - ACPI table to verify - * Length - Length of entire table - * - * RETURN: Status - * - * DESCRIPTION: Verifies that the table checksums to zero. Optionally returns - * exception on bad checksum. - * Note: We don't have to check for a CDAT here, since CDAT is - * not in the RSDT/XSDT, and the CDAT table is never installed - * via ACPICA. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtVerifyChecksum ( - ACPI_TABLE_HEADER *Table, - UINT32 Length) -{ - UINT8 Checksum; - - - /* - * FACS/S3PT: - * They are the odd tables, have no standard ACPI header and no checksum - */ - if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_S3PT) || - ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_FACS)) - { - return (AE_OK); - } - - /* Compute the checksum on the table */ - - Length = Table->Length; - Checksum = AcpiUtGenerateChecksum (ACPI_CAST_PTR (UINT8, Table), Length, Table->Checksum); - - /* Computed checksum matches table? */ - - if (Checksum != Table->Checksum) - { - ACPI_BIOS_WARNING ((AE_INFO, - "Incorrect checksum in table [%4.4s] - 0x%2.2X, " - "should be 0x%2.2X", - Table->Signature, Table->Checksum, - Table->Checksum - Checksum)); - -#if (ACPI_CHECKSUM_ABORT) - return (AE_BAD_CHECKSUM); -#endif - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtVerifyCdatChecksum - * - * PARAMETERS: Table - CDAT ACPI table to verify - * Length - Length of entire table - * - * RETURN: Status - * - * DESCRIPTION: Verifies that the CDAT table checksums to zero. Optionally - * returns an exception on bad checksum. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtVerifyCdatChecksum ( - ACPI_TABLE_CDAT *CdatTable, - UINT32 Length) -{ - UINT8 Checksum; - - - /* Compute the checksum on the table */ - - Checksum = AcpiUtGenerateChecksum (ACPI_CAST_PTR (UINT8, CdatTable), - CdatTable->Length, CdatTable->Checksum); - - /* Computed checksum matches table? */ - - if (Checksum != CdatTable->Checksum) - { - ACPI_BIOS_WARNING ((AE_INFO, - "Incorrect checksum in table [%4.4s] - 0x%2.2X, " - "should be 0x%2.2X", - AcpiGbl_CDAT, CdatTable->Checksum, Checksum)); - -#if (ACPI_CHECKSUM_ABORT) - return (AE_BAD_CHECKSUM); -#endif - } - - CdatTable->Checksum = Checksum; - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtGenerateChecksum - * - * PARAMETERS: Table - Pointer to table to be checksummed - * Length - Length of the table - * OriginalChecksum - Value of the checksum field - * - * RETURN: 8 bit checksum of buffer - * - * DESCRIPTION: Computes an 8 bit checksum of the table. - * - ******************************************************************************/ - -UINT8 -AcpiUtGenerateChecksum ( - void *Table, - UINT32 Length, - UINT8 OriginalChecksum) -{ - UINT8 Checksum; - - - /* Sum the entire table as-is */ - - Checksum = AcpiUtChecksum ((UINT8 *) Table, Length); - - /* Subtract off the existing checksum value in the table */ - - Checksum = (UINT8) (Checksum - OriginalChecksum); - - /* Compute and return the final checksum */ - - Checksum = (UINT8) (0 - Checksum); - return (Checksum); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtChecksum - * - * PARAMETERS: Buffer - Pointer to memory region to be checked - * Length - Length of this memory region - * - * RETURN: Checksum (UINT8) - * - * DESCRIPTION: Calculates circular checksum of memory region. - * - ******************************************************************************/ - -UINT8 -AcpiUtChecksum ( - UINT8 *Buffer, - UINT32 Length) -{ - UINT8 Sum = 0; - UINT8 *End = Buffer + Length; - - - while (Buffer < End) - { - Sum = (UINT8) (Sum + *(Buffer++)); - } - - return (Sum); -} diff --git a/drivers/acpica/utclib.c b/drivers/acpica/utclib.c deleted file mode 100644 index cf1acf0..0000000 --- a/drivers/acpica/utclib.c +++ /dev/null @@ -1,1168 +0,0 @@ -/****************************************************************************** - * - * Module Name: utclib - ACPICA implementations of C library functions - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#define ACPI_CLIBRARY -#include "acpi.h" -#include "accommon.h" - -/* - * This module contains implementations of the standard C library functions - * that are required by the ACPICA code at both application level and kernel - * level. - * - * The module is an optional feature that can be used if a local/system - * C library is not available. Some operating system kernels may not have - * an internal C library. - * - * In general, these functions are less efficient than an inline or assembly - * code implementation. - * - * These C functions and the associated prototypes are enabled by default - * unless the ACPI_USE_SYSTEM_CLIBRARY symbol is defined. This is usually - * automatically defined for the ACPICA applications such as iASL and - * AcpiExec, so that these user-level applications use the local C library - * instead of the functions in this module. - */ - -/******************************************************************************* - * - * Functions implemented in this module: - * - * FUNCTION: memcmp - * FUNCTION: memcpy - * FUNCTION: memset - * FUNCTION: strlen - * FUNCTION: strcpy - * FUNCTION: strncpy - * FUNCTION: strcmp - * FUNCTION: strchr - * FUNCTION: strncmp - * FUNCTION: strcat - * FUNCTION: strncat - * FUNCTION: strstr - * FUNCTION: strtoul - * FUNCTION: toupper - * FUNCTION: tolower - * FUNCTION: is* functions - * - ******************************************************************************/ - -#define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utclib") - - -#ifndef ACPI_USE_SYSTEM_CLIBRARY /* Entire module */ - - -/******************************************************************************* - * - * FUNCTION: memcmp - * - * PARAMETERS: Buffer1 - First Buffer - * Buffer2 - Second Buffer - * Count - Maximum # of bytes to compare - * - * RETURN: Index where Buffers mismatched, or 0 if Buffers matched - * - * DESCRIPTION: Compare two Buffers, with a maximum length - * - ******************************************************************************/ - -int -memcmp ( - void *VBuffer1, - void *VBuffer2, - ACPI_SIZE Count) -{ - char *Buffer1 = (char *) VBuffer1; - char *Buffer2 = (char *) VBuffer2; - - - for ( ; Count-- && (*Buffer1 == *Buffer2); Buffer1++, Buffer2++) - { - } - - return ((Count == ACPI_SIZE_MAX) ? 0 : ((unsigned char) *Buffer1 - - (unsigned char) *Buffer2)); -} - - -/******************************************************************************* - * - * FUNCTION: memmove - * - * PARAMETERS: Dest - Target of the copy - * Src - Source buffer to copy - * Count - Number of bytes to copy - * - * RETURN: Dest - * - * DESCRIPTION: Copy arbitrary bytes of memory with respect to the overlapping - * - ******************************************************************************/ - -void * -memmove ( - void *Dest, - const void *Src, - ACPI_SIZE Count) -{ - char *New = (char *) Dest; - char *Old = (char *) Src; - - - if (Old > New) - { - /* Copy from the beginning */ - - while (Count) - { - *New = *Old; - New++; - Old++; - Count--; - } - } - else if (Old < New) - { - /* Copy from the end */ - - New = New + Count - 1; - Old = Old + Count - 1; - while (Count) - { - *New = *Old; - New--; - Old--; - Count--; - } - } - - return (Dest); -} - - -/******************************************************************************* - * - * FUNCTION: memcpy - * - * PARAMETERS: Dest - Target of the copy - * Src - Source buffer to copy - * Count - Number of bytes to copy - * - * RETURN: Dest - * - * DESCRIPTION: Copy arbitrary bytes of memory - * - ******************************************************************************/ - -void * -memcpy ( - void *Dest, - const void *Src, - ACPI_SIZE Count) -{ - char *New = (char *) Dest; - char *Old = (char *) Src; - - - while (Count) - { - *New = *Old; - New++; - Old++; - Count--; - } - - return (Dest); -} - - -/******************************************************************************* - * - * FUNCTION: memset - * - * PARAMETERS: Dest - Buffer to set - * Value - Value to set each byte of memory - * Count - Number of bytes to set - * - * RETURN: Dest - * - * DESCRIPTION: Initialize a buffer to a known value. - * - ******************************************************************************/ - -void * -memset ( - void *Dest, - int Value, - ACPI_SIZE Count) -{ - char *New = (char *) Dest; - - - while (Count) - { - *New = (char) Value; - New++; - Count--; - } - - return (Dest); -} - - -/******************************************************************************* - * - * FUNCTION: strlen - * - * PARAMETERS: String - Null terminated string - * - * RETURN: Length - * - * DESCRIPTION: Returns the length of the input string - * - ******************************************************************************/ - - -ACPI_SIZE -strlen ( - const char *String) -{ - UINT32 Length = 0; - - - /* Count the string until a null is encountered */ - - while (*String) - { - Length++; - String++; - } - - return (Length); -} - - -/******************************************************************************* - * - * FUNCTION: strpbrk - * - * PARAMETERS: String - Null terminated string - * Delimiters - Delimiters to match - * - * RETURN: The first occurrence in the string of any of the bytes in the - * delimiters - * - * DESCRIPTION: Search a string for any of a set of the delimiters - * - ******************************************************************************/ - -char * -strpbrk ( - const char *String, - const char *Delimiters) -{ - const char *Delimiter; - - - for ( ; *String != '\0'; ++String) - { - for (Delimiter = Delimiters; *Delimiter != '\0'; Delimiter++) - { - if (*String == *Delimiter) - { - return (ACPI_CAST_PTR (char, String)); - } - } - } - - return (NULL); -} - - -/******************************************************************************* - * - * FUNCTION: strtok - * - * PARAMETERS: String - Null terminated string - * Delimiters - Delimiters to match - * - * RETURN: Pointer to the next token - * - * DESCRIPTION: Split string into tokens - * - ******************************************************************************/ - -char* -strtok ( - char *String, - const char *Delimiters) -{ - char *Begin = String; - static char *SavedPtr; - - - if (Begin == NULL) - { - if (SavedPtr == NULL) - { - return (NULL); - } - Begin = SavedPtr; - } - - SavedPtr = strpbrk (Begin, Delimiters); - while (SavedPtr == Begin) - { - *Begin++ = '\0'; - SavedPtr = strpbrk (Begin, Delimiters); - } - - if (SavedPtr) - { - *SavedPtr++ = '\0'; - return (Begin); - } - else - { - return (NULL); - } -} - - -/******************************************************************************* - * - * FUNCTION: strcpy - * - * PARAMETERS: DstString - Target of the copy - * SrcString - The source string to copy - * - * RETURN: DstString - * - * DESCRIPTION: Copy a null terminated string - * - ******************************************************************************/ - -char * -strcpy ( - char *DstString, - const char *SrcString) -{ - char *String = DstString; - - - /* Move bytes brute force */ - - while (*SrcString) - { - *String = *SrcString; - - String++; - SrcString++; - } - - /* Null terminate */ - - *String = 0; - return (DstString); -} - - -/******************************************************************************* - * - * FUNCTION: strncpy - * - * PARAMETERS: DstString - Target of the copy - * SrcString - The source string to copy - * Count - Maximum # of bytes to copy - * - * RETURN: DstString - * - * DESCRIPTION: Copy a null terminated string, with a maximum length - * - ******************************************************************************/ - -char * -strncpy ( - char *DstString, - const char *SrcString, - ACPI_SIZE Count) -{ - char *String = DstString; - - - /* Copy the string */ - - for (String = DstString; - Count && (Count--, (*String++ = *SrcString++)); ) - {;} - - /* Pad with nulls if necessary */ - - while (Count--) - { - *String = 0; - String++; - } - - /* Return original pointer */ - - return (DstString); -} - - -/******************************************************************************* - * - * FUNCTION: strcmp - * - * PARAMETERS: String1 - First string - * String2 - Second string - * - * RETURN: Index where strings mismatched, or 0 if strings matched - * - * DESCRIPTION: Compare two null terminated strings - * - ******************************************************************************/ - -int -strcmp ( - const char *String1, - const char *String2) -{ - - - for ( ; (*String1 == *String2); String2++) - { - if (!*String1++) - { - return (0); - } - } - - return ((unsigned char) *String1 - (unsigned char) *String2); -} - - -/******************************************************************************* - * - * FUNCTION: strchr - * - * PARAMETERS: String - Search string - * ch - character to search for - * - * RETURN: Ptr to char or NULL if not found - * - * DESCRIPTION: Search a string for a character - * - ******************************************************************************/ - -char * -strchr ( - const char *String, - int ch) -{ - - - for ( ; (*String); String++) - { - if ((*String) == (char) ch) - { - return ((char *) String); - } - } - - return (NULL); -} - - -/******************************************************************************* - * - * FUNCTION: strncmp - * - * PARAMETERS: String1 - First string - * String2 - Second string - * Count - Maximum # of bytes to compare - * - * RETURN: Index where strings mismatched, or 0 if strings matched - * - * DESCRIPTION: Compare two null terminated strings, with a maximum length - * - ******************************************************************************/ - -int -strncmp ( - const char *String1, - const char *String2, - ACPI_SIZE Count) -{ - - - for ( ; Count-- && (*String1 == *String2); String2++) - { - if (!*String1++) - { - return (0); - } - } - - return ((Count == ACPI_SIZE_MAX) ? 0 : ((unsigned char) *String1 - - (unsigned char) *String2)); -} - - -/******************************************************************************* - * - * FUNCTION: strcat - * - * PARAMETERS: DstString - Target of the copy - * SrcString - The source string to copy - * - * RETURN: DstString - * - * DESCRIPTION: Append a null terminated string to a null terminated string - * - ******************************************************************************/ - -char * -strcat ( - char *DstString, - const char *SrcString) -{ - char *String; - - - /* Find end of the destination string */ - - for (String = DstString; *String++; ) - { ; } - - /* Concatenate the string */ - - for (--String; (*String++ = *SrcString++); ) - { ; } - - return (DstString); -} - - -/******************************************************************************* - * - * FUNCTION: strncat - * - * PARAMETERS: DstString - Target of the copy - * SrcString - The source string to copy - * Count - Maximum # of bytes to copy - * - * RETURN: DstString - * - * DESCRIPTION: Append a null terminated string to a null terminated string, - * with a maximum count. - * - ******************************************************************************/ - -char * -strncat ( - char *DstString, - const char *SrcString, - ACPI_SIZE Count) -{ - char *String; - - - if (Count) - { - /* Find end of the destination string */ - - for (String = DstString; *String++; ) - { ; } - - /* Concatenate the string */ - - for (--String; (*String++ = *SrcString++) && --Count; ) - { ; } - - /* Null terminate if necessary */ - - if (!Count) - { - *String = 0; - } - } - - return (DstString); -} - - -/******************************************************************************* - * - * FUNCTION: strstr - * - * PARAMETERS: String1 - Target string - * String2 - Substring to search for - * - * RETURN: Where substring match starts, Null if no match found - * - * DESCRIPTION: Checks if String2 occurs in String1. This is not really a - * full implementation of strstr, only sufficient for command - * matching - * - ******************************************************************************/ - -char * -strstr ( - char *String1, - char *String2) -{ - ACPI_SIZE Length; - - - Length = strlen (String2); - if (!Length) - { - return (String1); - } - - while (strlen (String1) >= Length) - { - if (memcmp (String1, String2, Length) == 0) - { - return (String1); - } - String1++; - } - - return (NULL); -} - - -/******************************************************************************* - * - * FUNCTION: strtoul - * - * PARAMETERS: String - Null terminated string - * Terminator - Where a pointer to the terminating byte is - * returned - * Base - Radix of the string - * - * RETURN: Converted value - * - * DESCRIPTION: Convert a string into a 32-bit unsigned value. - * Note: use strtoul64 for 64-bit integers. - * - ******************************************************************************/ - -UINT32 -strtoul ( - const char *String, - char **Terminator, - UINT32 Base) -{ - UINT32 converted = 0; - UINT32 index; - UINT32 sign; - const char *StringStart; - UINT32 ReturnValue = 0; - ACPI_STATUS Status = AE_OK; - - - /* - * Save the value of the pointer to the buffer's first - * character, save the current errno value, and then - * skip over any white space in the buffer: - */ - StringStart = String; - while (isspace (*String) || *String == '\t') - { - ++String; - } - - /* - * The buffer may contain an optional plus or minus sign. - * If it does, then skip over it but remember what is was: - */ - if (*String == '-') - { - sign = ACPI_SIGN_NEGATIVE; - ++String; - } - else if (*String == '+') - { - ++String; - sign = ACPI_SIGN_POSITIVE; - } - else - { - sign = ACPI_SIGN_POSITIVE; - } - - /* - * If the input parameter Base is zero, then we need to - * determine if it is octal, decimal, or hexadecimal: - */ - if (Base == 0) - { - if (*String == '0') - { - if (tolower (*(++String)) == 'x') - { - Base = 16; - ++String; - } - else - { - Base = 8; - } - } - else - { - Base = 10; - } - } - else if (Base < 2 || Base > 36) - { - /* - * The specified Base parameter is not in the domain of - * this function: - */ - goto done; - } - - /* - * For octal and hexadecimal bases, skip over the leading - * 0 or 0x, if they are present. - */ - if (Base == 8 && *String == '0') - { - String++; - } - - if (Base == 16 && - *String == '0' && - tolower (*(++String)) == 'x') - { - String++; - } - - /* - * Main loop: convert the string to an unsigned long: - */ - while (*String) - { - if (isdigit (*String)) - { - index = (UINT32) ((UINT8) *String - '0'); - } - else - { - index = (UINT32) toupper (*String); - if (isupper (index)) - { - index = index - 'A' + 10; - } - else - { - goto done; - } - } - - if (index >= Base) - { - goto done; - } - - /* - * Check to see if value is out of range: - */ - - if (ReturnValue > ((ACPI_UINT32_MAX - (UINT32) index) / - (UINT32) Base)) - { - Status = AE_ERROR; - ReturnValue = 0; /* reset */ - } - else - { - ReturnValue *= Base; - ReturnValue += index; - converted = 1; - } - - ++String; - } - -done: - /* - * If appropriate, update the caller's pointer to the next - * unconverted character in the buffer. - */ - if (Terminator) - { - if (converted == 0 && ReturnValue == 0 && String != NULL) - { - *Terminator = (char *) StringStart; - } - else - { - *Terminator = (char *) String; - } - } - - if (Status == AE_ERROR) - { - ReturnValue = ACPI_UINT32_MAX; - } - - /* - * If a minus sign was present, then "the conversion is negated": - */ - if (sign == ACPI_SIGN_NEGATIVE) - { - ReturnValue = (ACPI_UINT32_MAX - ReturnValue) + 1; - } - - return (ReturnValue); -} - - -/******************************************************************************* - * - * FUNCTION: toupper - * - * PARAMETERS: c - Character to convert - * - * RETURN: Converted character as an int - * - * DESCRIPTION: Convert character to uppercase - * - ******************************************************************************/ - -int -toupper ( - int c) -{ - - return (islower(c) ? ((c)-0x20) : (c)); -} - - -/******************************************************************************* - * - * FUNCTION: tolower - * - * PARAMETERS: c - Character to convert - * - * RETURN: Converted character as an int - * - * DESCRIPTION: Convert character to lowercase - * - ******************************************************************************/ - -int -tolower ( - int c) -{ - - return (isupper(c) ? ((c)+0x20) : (c)); -} - - -/******************************************************************************* - * - * FUNCTION: is* function array - * - * DESCRIPTION: is* functions use the ctype table below - * - ******************************************************************************/ - -const UINT8 AcpiGbl_Ctypes[257] = { - _ACPI_CN, /* 0x00 0 NUL */ - _ACPI_CN, /* 0x01 1 SOH */ - _ACPI_CN, /* 0x02 2 STX */ - _ACPI_CN, /* 0x03 3 ETX */ - _ACPI_CN, /* 0x04 4 EOT */ - _ACPI_CN, /* 0x05 5 ENQ */ - _ACPI_CN, /* 0x06 6 ACK */ - _ACPI_CN, /* 0x07 7 BEL */ - _ACPI_CN, /* 0x08 8 BS */ - _ACPI_CN|_ACPI_SP, /* 0x09 9 TAB */ - _ACPI_CN|_ACPI_SP, /* 0x0A 10 LF */ - _ACPI_CN|_ACPI_SP, /* 0x0B 11 VT */ - _ACPI_CN|_ACPI_SP, /* 0x0C 12 FF */ - _ACPI_CN|_ACPI_SP, /* 0x0D 13 CR */ - _ACPI_CN, /* 0x0E 14 SO */ - _ACPI_CN, /* 0x0F 15 SI */ - _ACPI_CN, /* 0x10 16 DLE */ - _ACPI_CN, /* 0x11 17 DC1 */ - _ACPI_CN, /* 0x12 18 DC2 */ - _ACPI_CN, /* 0x13 19 DC3 */ - _ACPI_CN, /* 0x14 20 DC4 */ - _ACPI_CN, /* 0x15 21 NAK */ - _ACPI_CN, /* 0x16 22 SYN */ - _ACPI_CN, /* 0x17 23 ETB */ - _ACPI_CN, /* 0x18 24 CAN */ - _ACPI_CN, /* 0x19 25 EM */ - _ACPI_CN, /* 0x1A 26 SUB */ - _ACPI_CN, /* 0x1B 27 ESC */ - _ACPI_CN, /* 0x1C 28 FS */ - _ACPI_CN, /* 0x1D 29 GS */ - _ACPI_CN, /* 0x1E 30 RS */ - _ACPI_CN, /* 0x1F 31 US */ - _ACPI_XS|_ACPI_SP, /* 0x20 32 ' ' */ - _ACPI_PU, /* 0x21 33 '!' */ - _ACPI_PU, /* 0x22 34 '"' */ - _ACPI_PU, /* 0x23 35 '#' */ - _ACPI_PU, /* 0x24 36 '$' */ - _ACPI_PU, /* 0x25 37 '%' */ - _ACPI_PU, /* 0x26 38 '&' */ - _ACPI_PU, /* 0x27 39 ''' */ - _ACPI_PU, /* 0x28 40 '(' */ - _ACPI_PU, /* 0x29 41 ')' */ - _ACPI_PU, /* 0x2A 42 '*' */ - _ACPI_PU, /* 0x2B 43 '+' */ - _ACPI_PU, /* 0x2C 44 ',' */ - _ACPI_PU, /* 0x2D 45 '-' */ - _ACPI_PU, /* 0x2E 46 '.' */ - _ACPI_PU, /* 0x2F 47 '/' */ - _ACPI_XD|_ACPI_DI, /* 0x30 48 '0' */ - _ACPI_XD|_ACPI_DI, /* 0x31 49 '1' */ - _ACPI_XD|_ACPI_DI, /* 0x32 50 '2' */ - _ACPI_XD|_ACPI_DI, /* 0x33 51 '3' */ - _ACPI_XD|_ACPI_DI, /* 0x34 52 '4' */ - _ACPI_XD|_ACPI_DI, /* 0x35 53 '5' */ - _ACPI_XD|_ACPI_DI, /* 0x36 54 '6' */ - _ACPI_XD|_ACPI_DI, /* 0x37 55 '7' */ - _ACPI_XD|_ACPI_DI, /* 0x38 56 '8' */ - _ACPI_XD|_ACPI_DI, /* 0x39 57 '9' */ - _ACPI_PU, /* 0x3A 58 ':' */ - _ACPI_PU, /* 0x3B 59 ';' */ - _ACPI_PU, /* 0x3C 60 '<' */ - _ACPI_PU, /* 0x3D 61 '=' */ - _ACPI_PU, /* 0x3E 62 '>' */ - _ACPI_PU, /* 0x3F 63 '?' */ - _ACPI_PU, /* 0x40 64 '@' */ - _ACPI_XD|_ACPI_UP, /* 0x41 65 'A' */ - _ACPI_XD|_ACPI_UP, /* 0x42 66 'B' */ - _ACPI_XD|_ACPI_UP, /* 0x43 67 'C' */ - _ACPI_XD|_ACPI_UP, /* 0x44 68 'D' */ - _ACPI_XD|_ACPI_UP, /* 0x45 69 'E' */ - _ACPI_XD|_ACPI_UP, /* 0x46 70 'F' */ - _ACPI_UP, /* 0x47 71 'G' */ - _ACPI_UP, /* 0x48 72 'H' */ - _ACPI_UP, /* 0x49 73 'I' */ - _ACPI_UP, /* 0x4A 74 'J' */ - _ACPI_UP, /* 0x4B 75 'K' */ - _ACPI_UP, /* 0x4C 76 'L' */ - _ACPI_UP, /* 0x4D 77 'M' */ - _ACPI_UP, /* 0x4E 78 'N' */ - _ACPI_UP, /* 0x4F 79 'O' */ - _ACPI_UP, /* 0x50 80 'P' */ - _ACPI_UP, /* 0x51 81 'Q' */ - _ACPI_UP, /* 0x52 82 'R' */ - _ACPI_UP, /* 0x53 83 'S' */ - _ACPI_UP, /* 0x54 84 'T' */ - _ACPI_UP, /* 0x55 85 'U' */ - _ACPI_UP, /* 0x56 86 'V' */ - _ACPI_UP, /* 0x57 87 'W' */ - _ACPI_UP, /* 0x58 88 'X' */ - _ACPI_UP, /* 0x59 89 'Y' */ - _ACPI_UP, /* 0x5A 90 'Z' */ - _ACPI_PU, /* 0x5B 91 '[' */ - _ACPI_PU, /* 0x5C 92 '\' */ - _ACPI_PU, /* 0x5D 93 ']' */ - _ACPI_PU, /* 0x5E 94 '^' */ - _ACPI_PU, /* 0x5F 95 '_' */ - _ACPI_PU, /* 0x60 96 '`' */ - _ACPI_XD|_ACPI_LO, /* 0x61 97 'a' */ - _ACPI_XD|_ACPI_LO, /* 0x62 98 'b' */ - _ACPI_XD|_ACPI_LO, /* 0x63 99 'c' */ - _ACPI_XD|_ACPI_LO, /* 0x64 100 'd' */ - _ACPI_XD|_ACPI_LO, /* 0x65 101 'e' */ - _ACPI_XD|_ACPI_LO, /* 0x66 102 'f' */ - _ACPI_LO, /* 0x67 103 'g' */ - _ACPI_LO, /* 0x68 104 'h' */ - _ACPI_LO, /* 0x69 105 'i' */ - _ACPI_LO, /* 0x6A 106 'j' */ - _ACPI_LO, /* 0x6B 107 'k' */ - _ACPI_LO, /* 0x6C 108 'l' */ - _ACPI_LO, /* 0x6D 109 'm' */ - _ACPI_LO, /* 0x6E 110 'n' */ - _ACPI_LO, /* 0x6F 111 'o' */ - _ACPI_LO, /* 0x70 112 'p' */ - _ACPI_LO, /* 0x71 113 'q' */ - _ACPI_LO, /* 0x72 114 'r' */ - _ACPI_LO, /* 0x73 115 's' */ - _ACPI_LO, /* 0x74 116 't' */ - _ACPI_LO, /* 0x75 117 'u' */ - _ACPI_LO, /* 0x76 118 'v' */ - _ACPI_LO, /* 0x77 119 'w' */ - _ACPI_LO, /* 0x78 120 'x' */ - _ACPI_LO, /* 0x79 121 'y' */ - _ACPI_LO, /* 0x7A 122 'z' */ - _ACPI_PU, /* 0x7B 123 '{' */ - _ACPI_PU, /* 0x7C 124 '|' */ - _ACPI_PU, /* 0x7D 125 '}' */ - _ACPI_PU, /* 0x7E 126 '~' */ - _ACPI_CN, /* 0x7F 127 DEL */ - - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x80 to 0x8F */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x90 to 0x9F */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xA0 to 0xAF */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xB0 to 0xBF */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xC0 to 0xCF */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xD0 to 0xDF */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xE0 to 0xEF */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xF0 to 0xFF */ - 0 /* 0x100 */ -}; - - -#endif /* ACPI_USE_SYSTEM_CLIBRARY */ diff --git a/drivers/acpica/utcopy.c b/drivers/acpica/utcopy.c deleted file mode 100644 index 338b9f9..0000000 --- a/drivers/acpica/utcopy.c +++ /dev/null @@ -1,1184 +0,0 @@ -/****************************************************************************** - * - * Module Name: utcopy - Internal to external object translation utilities - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" - - -#define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utcopy") - -/* Local prototypes */ - -static ACPI_STATUS -AcpiUtCopyIsimpleToEsimple ( - ACPI_OPERAND_OBJECT *InternalObject, - ACPI_OBJECT *ExternalObject, - UINT8 *DataSpace, - ACPI_SIZE *BufferSpaceUsed); - -static ACPI_STATUS -AcpiUtCopyIelementToIelement ( - UINT8 ObjectType, - ACPI_OPERAND_OBJECT *SourceObject, - ACPI_GENERIC_STATE *State, - void *Context); - -static ACPI_STATUS -AcpiUtCopyIpackageToEpackage ( - ACPI_OPERAND_OBJECT *InternalObject, - UINT8 *Buffer, - ACPI_SIZE *SpaceUsed); - -static ACPI_STATUS -AcpiUtCopyEsimpleToIsimple( - ACPI_OBJECT *UserObj, - ACPI_OPERAND_OBJECT **ReturnObj); - -static ACPI_STATUS -AcpiUtCopyEpackageToIpackage ( - ACPI_OBJECT *ExternalObject, - ACPI_OPERAND_OBJECT **InternalObject); - -static ACPI_STATUS -AcpiUtCopySimpleObject ( - ACPI_OPERAND_OBJECT *SourceDesc, - ACPI_OPERAND_OBJECT *DestDesc); - -static ACPI_STATUS -AcpiUtCopyIelementToEelement ( - UINT8 ObjectType, - ACPI_OPERAND_OBJECT *SourceObject, - ACPI_GENERIC_STATE *State, - void *Context); - -static ACPI_STATUS -AcpiUtCopyIpackageToIpackage ( - ACPI_OPERAND_OBJECT *SourceObj, - ACPI_OPERAND_OBJECT *DestObj, - ACPI_WALK_STATE *WalkState); - - -/******************************************************************************* - * - * FUNCTION: AcpiUtCopyIsimpleToEsimple - * - * PARAMETERS: InternalObject - Source object to be copied - * ExternalObject - Where to return the copied object - * DataSpace - Where object data is returned (such as - * buffer and string data) - * BufferSpaceUsed - Length of DataSpace that was used - * - * RETURN: Status - * - * DESCRIPTION: This function is called to copy a simple internal object to - * an external object. - * - * The DataSpace buffer is assumed to have sufficient space for - * the object. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiUtCopyIsimpleToEsimple ( - ACPI_OPERAND_OBJECT *InternalObject, - ACPI_OBJECT *ExternalObject, - UINT8 *DataSpace, - ACPI_SIZE *BufferSpaceUsed) -{ - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE (UtCopyIsimpleToEsimple); - - - *BufferSpaceUsed = 0; - - /* - * Check for NULL object case (could be an uninitialized - * package element) - */ - if (!InternalObject) - { - return_ACPI_STATUS (AE_OK); - } - - /* Always clear the external object */ - - memset (ExternalObject, 0, sizeof (ACPI_OBJECT)); - - /* - * In general, the external object will be the same type as - * the internal object - */ - ExternalObject->Type = InternalObject->Common.Type; - - /* However, only a limited number of external types are supported */ - - switch (InternalObject->Common.Type) - { - case ACPI_TYPE_STRING: - - ExternalObject->String.Pointer = (char *) DataSpace; - ExternalObject->String.Length = InternalObject->String.Length; - *BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD ( - (ACPI_SIZE) InternalObject->String.Length + 1); - - memcpy ((void *) DataSpace, - (void *) InternalObject->String.Pointer, - (ACPI_SIZE) InternalObject->String.Length + 1); - break; - - case ACPI_TYPE_BUFFER: - - ExternalObject->Buffer.Pointer = DataSpace; - ExternalObject->Buffer.Length = InternalObject->Buffer.Length; - *BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD ( - InternalObject->String.Length); - - memcpy ((void *) DataSpace, - (void *) InternalObject->Buffer.Pointer, - InternalObject->Buffer.Length); - break; - - case ACPI_TYPE_INTEGER: - - ExternalObject->Integer.Value = InternalObject->Integer.Value; - break; - - case ACPI_TYPE_LOCAL_REFERENCE: - - /* This is an object reference. */ - - switch (InternalObject->Reference.Class) - { - case ACPI_REFCLASS_NAME: - /* - * For namepath, return the object handle ("reference") - * We are referring to the namespace node - */ - ExternalObject->Reference.Handle = - InternalObject->Reference.Node; - ExternalObject->Reference.ActualType = - AcpiNsGetType (InternalObject->Reference.Node); - break; - - default: - - /* All other reference types are unsupported */ - - return_ACPI_STATUS (AE_TYPE); - } - break; - - case ACPI_TYPE_PROCESSOR: - - ExternalObject->Processor.ProcId = - InternalObject->Processor.ProcId; - ExternalObject->Processor.PblkAddress = - InternalObject->Processor.Address; - ExternalObject->Processor.PblkLength = - InternalObject->Processor.Length; - break; - - case ACPI_TYPE_POWER: - - ExternalObject->PowerResource.SystemLevel = - InternalObject->PowerResource.SystemLevel; - - ExternalObject->PowerResource.ResourceOrder = - InternalObject->PowerResource.ResourceOrder; - break; - - default: - /* - * There is no corresponding external object type - */ - ACPI_ERROR ((AE_INFO, - "Unsupported object type, cannot convert to external object: %s", - AcpiUtGetTypeName (InternalObject->Common.Type))); - - return_ACPI_STATUS (AE_SUPPORT); - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtCopyIelementToEelement - * - * PARAMETERS: ACPI_PKG_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Copy one package element to another package element - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiUtCopyIelementToEelement ( - UINT8 ObjectType, - ACPI_OPERAND_OBJECT *SourceObject, - ACPI_GENERIC_STATE *State, - void *Context) -{ - ACPI_STATUS Status = AE_OK; - ACPI_PKG_INFO *Info = (ACPI_PKG_INFO *) Context; - ACPI_SIZE ObjectSpace; - UINT32 ThisIndex; - ACPI_OBJECT *TargetObject; - - - ACPI_FUNCTION_ENTRY (); - - - ThisIndex = State->Pkg.Index; - TargetObject = (ACPI_OBJECT *) &((ACPI_OBJECT *) - (State->Pkg.DestObject))->Package.Elements[ThisIndex]; - - switch (ObjectType) - { - case ACPI_COPY_TYPE_SIMPLE: - /* - * This is a simple or null object - */ - Status = AcpiUtCopyIsimpleToEsimple (SourceObject, - TargetObject, Info->FreeSpace, &ObjectSpace); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - break; - - case ACPI_COPY_TYPE_PACKAGE: - /* - * Build the package object - */ - TargetObject->Type = ACPI_TYPE_PACKAGE; - TargetObject->Package.Count = SourceObject->Package.Count; - TargetObject->Package.Elements = - ACPI_CAST_PTR (ACPI_OBJECT, Info->FreeSpace); - - /* - * Pass the new package object back to the package walk routine - */ - State->Pkg.ThisTargetObj = TargetObject; - - /* - * Save space for the array of objects (Package elements) - * update the buffer length counter - */ - ObjectSpace = ACPI_ROUND_UP_TO_NATIVE_WORD ( - (ACPI_SIZE) TargetObject->Package.Count * - sizeof (ACPI_OBJECT)); - break; - - default: - - return (AE_BAD_PARAMETER); - } - - Info->FreeSpace += ObjectSpace; - Info->Length += ObjectSpace; - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtCopyIpackageToEpackage - * - * PARAMETERS: InternalObject - Pointer to the object we are returning - * Buffer - Where the object is returned - * SpaceUsed - Where the object length is returned - * - * RETURN: Status - * - * DESCRIPTION: This function is called to place a package object in a user - * buffer. A package object by definition contains other objects. - * - * The buffer is assumed to have sufficient space for the object. - * The caller must have verified the buffer length needed using - * the AcpiUtGetObjectSize function before calling this function. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiUtCopyIpackageToEpackage ( - ACPI_OPERAND_OBJECT *InternalObject, - UINT8 *Buffer, - ACPI_SIZE *SpaceUsed) -{ - ACPI_OBJECT *ExternalObject; - ACPI_STATUS Status; - ACPI_PKG_INFO Info; - - - ACPI_FUNCTION_TRACE (UtCopyIpackageToEpackage); - - - /* - * First package at head of the buffer - */ - ExternalObject = ACPI_CAST_PTR (ACPI_OBJECT, Buffer); - - /* - * Free space begins right after the first package - */ - Info.Length = ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)); - Info.FreeSpace = Buffer + - ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)); - Info.ObjectSpace = 0; - Info.NumPackages = 1; - - ExternalObject->Type = InternalObject->Common.Type; - ExternalObject->Package.Count = InternalObject->Package.Count; - ExternalObject->Package.Elements = - ACPI_CAST_PTR (ACPI_OBJECT, Info.FreeSpace); - - /* - * Leave room for an array of ACPI_OBJECTS in the buffer - * and move the free space past it - */ - Info.Length += (ACPI_SIZE) ExternalObject->Package.Count * - ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)); - Info.FreeSpace += ExternalObject->Package.Count * - ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)); - - Status = AcpiUtWalkPackageTree (InternalObject, ExternalObject, - AcpiUtCopyIelementToEelement, &Info); - - *SpaceUsed = Info.Length; - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtCopyIobjectToEobject - * - * PARAMETERS: InternalObject - The internal object to be converted - * RetBuffer - Where the object is returned - * - * RETURN: Status - * - * DESCRIPTION: This function is called to build an API object to be returned - * to the caller. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtCopyIobjectToEobject ( - ACPI_OPERAND_OBJECT *InternalObject, - ACPI_BUFFER *RetBuffer) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (UtCopyIobjectToEobject); - - - if (InternalObject->Common.Type == ACPI_TYPE_PACKAGE) - { - /* - * Package object: Copy all subobjects (including - * nested packages) - */ - Status = AcpiUtCopyIpackageToEpackage (InternalObject, - RetBuffer->Pointer, &RetBuffer->Length); - } - else - { - /* - * Build a simple object (no nested objects) - */ - Status = AcpiUtCopyIsimpleToEsimple (InternalObject, - ACPI_CAST_PTR (ACPI_OBJECT, RetBuffer->Pointer), - ACPI_ADD_PTR (UINT8, RetBuffer->Pointer, - ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT))), - &RetBuffer->Length); - /* - * build simple does not include the object size in the length - * so we add it in here - */ - RetBuffer->Length += sizeof (ACPI_OBJECT); - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtCopyEsimpleToIsimple - * - * PARAMETERS: ExternalObject - The external object to be converted - * RetInternalObject - Where the internal object is returned - * - * RETURN: Status - * - * DESCRIPTION: This function copies an external object to an internal one. - * NOTE: Pointers can be copied, we don't need to copy data. - * (The pointers have to be valid in our address space no matter - * what we do with them!) - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiUtCopyEsimpleToIsimple ( - ACPI_OBJECT *ExternalObject, - ACPI_OPERAND_OBJECT **RetInternalObject) -{ - ACPI_OPERAND_OBJECT *InternalObject; - - - ACPI_FUNCTION_TRACE (UtCopyEsimpleToIsimple); - - - /* - * Simple types supported are: String, Buffer, Integer - */ - switch (ExternalObject->Type) - { - case ACPI_TYPE_STRING: - case ACPI_TYPE_BUFFER: - case ACPI_TYPE_INTEGER: - case ACPI_TYPE_LOCAL_REFERENCE: - - InternalObject = AcpiUtCreateInternalObject ( - (UINT8) ExternalObject->Type); - if (!InternalObject) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - break; - - case ACPI_TYPE_ANY: /* This is the case for a NULL object */ - - *RetInternalObject = NULL; - return_ACPI_STATUS (AE_OK); - - default: - - /* All other types are not supported */ - - ACPI_ERROR ((AE_INFO, - "Unsupported object type, cannot convert to internal object: %s", - AcpiUtGetTypeName (ExternalObject->Type))); - - return_ACPI_STATUS (AE_SUPPORT); - } - - - /* Must COPY string and buffer contents */ - - switch (ExternalObject->Type) - { - case ACPI_TYPE_STRING: - - InternalObject->String.Pointer = - ACPI_ALLOCATE_ZEROED ((ACPI_SIZE) - ExternalObject->String.Length + 1); - - if (!InternalObject->String.Pointer) - { - goto ErrorExit; - } - - memcpy (InternalObject->String.Pointer, - ExternalObject->String.Pointer, - ExternalObject->String.Length); - - InternalObject->String.Length = ExternalObject->String.Length; - break; - - case ACPI_TYPE_BUFFER: - - InternalObject->Buffer.Pointer = - ACPI_ALLOCATE_ZEROED (ExternalObject->Buffer.Length); - if (!InternalObject->Buffer.Pointer) - { - goto ErrorExit; - } - - memcpy (InternalObject->Buffer.Pointer, - ExternalObject->Buffer.Pointer, - ExternalObject->Buffer.Length); - - InternalObject->Buffer.Length = ExternalObject->Buffer.Length; - - /* Mark buffer data valid */ - - InternalObject->Buffer.Flags |= AOPOBJ_DATA_VALID; - break; - - case ACPI_TYPE_INTEGER: - - InternalObject->Integer.Value = ExternalObject->Integer.Value; - break; - - case ACPI_TYPE_LOCAL_REFERENCE: - - /* An incoming reference is defined to be a namespace node */ - - InternalObject->Reference.Class = ACPI_REFCLASS_REFOF; - InternalObject->Reference.Object = ExternalObject->Reference.Handle; - break; - - default: - - /* Other types can't get here */ - - break; - } - - *RetInternalObject = InternalObject; - return_ACPI_STATUS (AE_OK); - - -ErrorExit: - AcpiUtRemoveReference (InternalObject); - return_ACPI_STATUS (AE_NO_MEMORY); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtCopyEpackageToIpackage - * - * PARAMETERS: ExternalObject - The external object to be converted - * InternalObject - Where the internal object is returned - * - * RETURN: Status - * - * DESCRIPTION: Copy an external package object to an internal package. - * Handles nested packages. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiUtCopyEpackageToIpackage ( - ACPI_OBJECT *ExternalObject, - ACPI_OPERAND_OBJECT **InternalObject) -{ - ACPI_STATUS Status = AE_OK; - ACPI_OPERAND_OBJECT *PackageObject; - ACPI_OPERAND_OBJECT **PackageElements; - UINT32 i; - - - ACPI_FUNCTION_TRACE (UtCopyEpackageToIpackage); - - - /* Create the package object */ - - PackageObject = AcpiUtCreatePackageObject ( - ExternalObject->Package.Count); - if (!PackageObject) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - PackageElements = PackageObject->Package.Elements; - - /* - * Recursive implementation. Probably ok, since nested external - * packages as parameters should be very rare. - */ - for (i = 0; i < ExternalObject->Package.Count; i++) - { - Status = AcpiUtCopyEobjectToIobject ( - &ExternalObject->Package.Elements[i], - &PackageElements[i]); - if (ACPI_FAILURE (Status)) - { - /* Truncate package and delete it */ - - PackageObject->Package.Count = i; - PackageElements[i] = NULL; - AcpiUtRemoveReference (PackageObject); - return_ACPI_STATUS (Status); - } - } - - /* Mark package data valid */ - - PackageObject->Package.Flags |= AOPOBJ_DATA_VALID; - - *InternalObject = PackageObject; - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtCopyEobjectToIobject - * - * PARAMETERS: ExternalObject - The external object to be converted - * InternalObject - Where the internal object is returned - * - * RETURN: Status - * - * DESCRIPTION: Converts an external object to an internal object. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtCopyEobjectToIobject ( - ACPI_OBJECT *ExternalObject, - ACPI_OPERAND_OBJECT **InternalObject) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (UtCopyEobjectToIobject); - - - if (ExternalObject->Type == ACPI_TYPE_PACKAGE) - { - Status = AcpiUtCopyEpackageToIpackage ( - ExternalObject, InternalObject); - } - else - { - /* - * Build a simple object (no nested objects) - */ - Status = AcpiUtCopyEsimpleToIsimple (ExternalObject, - InternalObject); - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtCopySimpleObject - * - * PARAMETERS: SourceDesc - The internal object to be copied - * DestDesc - New target object - * - * RETURN: Status - * - * DESCRIPTION: Simple copy of one internal object to another. Reference count - * of the destination object is preserved. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiUtCopySimpleObject ( - ACPI_OPERAND_OBJECT *SourceDesc, - ACPI_OPERAND_OBJECT *DestDesc) -{ - UINT16 ReferenceCount; - ACPI_OPERAND_OBJECT *NextObject; - ACPI_STATUS Status; - ACPI_SIZE CopySize; - - - /* Save fields from destination that we don't want to overwrite */ - - ReferenceCount = DestDesc->Common.ReferenceCount; - NextObject = DestDesc->Common.NextObject; - - /* - * Copy the entire source object over the destination object. - * Note: Source can be either an operand object or namespace node. - */ - CopySize = sizeof (ACPI_OPERAND_OBJECT); - if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc) == ACPI_DESC_TYPE_NAMED) - { - CopySize = sizeof (ACPI_NAMESPACE_NODE); - } - - memcpy (ACPI_CAST_PTR (char, DestDesc), - ACPI_CAST_PTR (char, SourceDesc), CopySize); - - /* Restore the saved fields */ - - DestDesc->Common.ReferenceCount = ReferenceCount; - DestDesc->Common.NextObject = NextObject; - - /* New object is not static, regardless of source */ - - DestDesc->Common.Flags &= ~AOPOBJ_STATIC_POINTER; - - /* Handle the objects with extra data */ - - switch (DestDesc->Common.Type) - { - case ACPI_TYPE_BUFFER: - /* - * Allocate and copy the actual buffer if and only if: - * 1) There is a valid buffer pointer - * 2) The buffer has a length > 0 - */ - if ((SourceDesc->Buffer.Pointer) && - (SourceDesc->Buffer.Length)) - { - DestDesc->Buffer.Pointer = - ACPI_ALLOCATE (SourceDesc->Buffer.Length); - if (!DestDesc->Buffer.Pointer) - { - return (AE_NO_MEMORY); - } - - /* Copy the actual buffer data */ - - memcpy (DestDesc->Buffer.Pointer, - SourceDesc->Buffer.Pointer, SourceDesc->Buffer.Length); - } - break; - - case ACPI_TYPE_STRING: - /* - * Allocate and copy the actual string if and only if: - * 1) There is a valid string pointer - * (Pointer to a NULL string is allowed) - */ - if (SourceDesc->String.Pointer) - { - DestDesc->String.Pointer = - ACPI_ALLOCATE ((ACPI_SIZE) SourceDesc->String.Length + 1); - if (!DestDesc->String.Pointer) - { - return (AE_NO_MEMORY); - } - - /* Copy the actual string data */ - - memcpy (DestDesc->String.Pointer, SourceDesc->String.Pointer, - (ACPI_SIZE) SourceDesc->String.Length + 1); - } - break; - - case ACPI_TYPE_LOCAL_REFERENCE: - /* - * We copied the reference object, so we now must add a reference - * to the object pointed to by the reference - * - * DDBHandle reference (from Load/LoadTable) is a special reference, - * it does not have a Reference.Object, so does not need to - * increase the reference count - */ - if (SourceDesc->Reference.Class == ACPI_REFCLASS_TABLE) - { - break; - } - - AcpiUtAddReference (SourceDesc->Reference.Object); - break; - - case ACPI_TYPE_REGION: - /* - * We copied the Region Handler, so we now must add a reference - */ - if (DestDesc->Region.Handler) - { - AcpiUtAddReference (DestDesc->Region.Handler); - } - break; - - /* - * For Mutex and Event objects, we cannot simply copy the underlying - * OS object. We must create a new one. - */ - case ACPI_TYPE_MUTEX: - - Status = AcpiOsCreateMutex (&DestDesc->Mutex.OsMutex); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - break; - - case ACPI_TYPE_EVENT: - - Status = AcpiOsCreateSemaphore (ACPI_NO_UNIT_LIMIT, 0, - &DestDesc->Event.OsSemaphore); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - break; - - default: - - /* Nothing to do for other simple objects */ - - break; - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtCopyIelementToIelement - * - * PARAMETERS: ACPI_PKG_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Copy one package element to another package element - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiUtCopyIelementToIelement ( - UINT8 ObjectType, - ACPI_OPERAND_OBJECT *SourceObject, - ACPI_GENERIC_STATE *State, - void *Context) -{ - ACPI_STATUS Status = AE_OK; - UINT32 ThisIndex; - ACPI_OPERAND_OBJECT **ThisTargetPtr; - ACPI_OPERAND_OBJECT *TargetObject; - - - ACPI_FUNCTION_ENTRY (); - - - ThisIndex = State->Pkg.Index; - ThisTargetPtr = (ACPI_OPERAND_OBJECT **) - &State->Pkg.DestObject->Package.Elements[ThisIndex]; - - switch (ObjectType) - { - case ACPI_COPY_TYPE_SIMPLE: - - /* A null source object indicates a (legal) null package element */ - - if (SourceObject) - { - /* - * This is a simple object, just copy it - */ - TargetObject = AcpiUtCreateInternalObject ( - SourceObject->Common.Type); - if (!TargetObject) - { - return (AE_NO_MEMORY); - } - - Status = AcpiUtCopySimpleObject (SourceObject, TargetObject); - if (ACPI_FAILURE (Status)) - { - goto ErrorExit; - } - - *ThisTargetPtr = TargetObject; - } - else - { - /* Pass through a null element */ - - *ThisTargetPtr = NULL; - } - break; - - case ACPI_COPY_TYPE_PACKAGE: - /* - * This object is a package - go down another nesting level - * Create and build the package object - */ - TargetObject = AcpiUtCreatePackageObject ( - SourceObject->Package.Count); - if (!TargetObject) - { - return (AE_NO_MEMORY); - } - - TargetObject->Common.Flags = SourceObject->Common.Flags; - - /* Pass the new package object back to the package walk routine */ - - State->Pkg.ThisTargetObj = TargetObject; - - /* Store the object pointer in the parent package object */ - - *ThisTargetPtr = TargetObject; - break; - - default: - - return (AE_BAD_PARAMETER); - } - - return (Status); - -ErrorExit: - AcpiUtRemoveReference (TargetObject); - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtCopyIpackageToIpackage - * - * PARAMETERS: SourceObj - Pointer to the source package object - * DestObj - Where the internal object is returned - * WalkState - Current Walk state descriptor - * - * RETURN: Status - * - * DESCRIPTION: This function is called to copy an internal package object - * into another internal package object. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiUtCopyIpackageToIpackage ( - ACPI_OPERAND_OBJECT *SourceObj, - ACPI_OPERAND_OBJECT *DestObj, - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE (UtCopyIpackageToIpackage); - - - DestObj->Common.Type = SourceObj->Common.Type; - DestObj->Common.Flags = SourceObj->Common.Flags; - DestObj->Package.Count = SourceObj->Package.Count; - - /* - * Create the object array and walk the source package tree - */ - DestObj->Package.Elements = ACPI_ALLOCATE_ZEROED ( - ((ACPI_SIZE) SourceObj->Package.Count + 1) * - sizeof (void *)); - if (!DestObj->Package.Elements) - { - ACPI_ERROR ((AE_INFO, "Package allocation failure")); - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* - * Copy the package element-by-element by walking the package "tree". - * This handles nested packages of arbitrary depth. - */ - Status = AcpiUtWalkPackageTree (SourceObj, DestObj, - AcpiUtCopyIelementToIelement, WalkState); - if (ACPI_FAILURE (Status)) - { - /* On failure, delete the destination package object */ - - AcpiUtRemoveReference (DestObj); - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtCopyIobjectToIobject - * - * PARAMETERS: SourceDesc - The internal object to be copied - * DestDesc - Where the copied object is returned - * WalkState - Current walk state - * - * RETURN: Status - * - * DESCRIPTION: Copy an internal object to a new internal object - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtCopyIobjectToIobject ( - ACPI_OPERAND_OBJECT *SourceDesc, - ACPI_OPERAND_OBJECT **DestDesc, - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE (UtCopyIobjectToIobject); - - - /* Create the top level object */ - - *DestDesc = AcpiUtCreateInternalObject (SourceDesc->Common.Type); - if (!*DestDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Copy the object and possible subobjects */ - - if (SourceDesc->Common.Type == ACPI_TYPE_PACKAGE) - { - Status = AcpiUtCopyIpackageToIpackage ( - SourceDesc, *DestDesc, WalkState); - } - else - { - Status = AcpiUtCopySimpleObject (SourceDesc, *DestDesc); - } - - /* Delete the allocated object if copy failed */ - - if (ACPI_FAILURE (Status)) - { - AcpiUtRemoveReference (*DestDesc); - } - - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/utdebug.c b/drivers/acpica/utdebug.c deleted file mode 100644 index 0c7dd83..0000000 --- a/drivers/acpica/utdebug.c +++ /dev/null @@ -1,842 +0,0 @@ -/****************************************************************************** - * - * Module Name: utdebug - Debug print/trace routines - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#define EXPORT_ACPI_INTERFACES - -#include "acpi.h" -#include "accommon.h" -#include "acinterp.h" - -#define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utdebug") - - -#ifdef ACPI_DEBUG_OUTPUT - -static ACPI_THREAD_ID AcpiGbl_PreviousThreadId = (ACPI_THREAD_ID) 0xFFFFFFFF; -static const char *AcpiGbl_FunctionEntryPrefix = "----Entry"; -static const char *AcpiGbl_FunctionExitPrefix = "----Exit-"; - - -/******************************************************************************* - * - * FUNCTION: AcpiUtInitStackPtrTrace - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Save the current CPU stack pointer at subsystem startup - * - ******************************************************************************/ - -void -AcpiUtInitStackPtrTrace ( - void) -{ - ACPI_SIZE CurrentSp; - - -#pragma GCC diagnostic push -#if defined(__GNUC__) && __GNUC__ >= 12 -#pragma GCC diagnostic ignored "-Wdangling-pointer=" -#endif - AcpiGbl_EntryStackPointer = &CurrentSp; -#pragma GCC diagnostic pop -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtTrackStackPtr - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Save the current CPU stack pointer - * - ******************************************************************************/ - -void -AcpiUtTrackStackPtr ( - void) -{ - ACPI_SIZE CurrentSp; - - - if (&CurrentSp < AcpiGbl_LowestStackPointer) - { -#pragma GCC diagnostic push -#if defined(__GNUC__) && __GNUC__ >= 12 -#pragma GCC diagnostic ignored "-Wdangling-pointer=" -#endif - AcpiGbl_LowestStackPointer = &CurrentSp; -#pragma GCC diagnostic pop - } - - if (AcpiGbl_NestingLevel > AcpiGbl_DeepestNesting) - { - AcpiGbl_DeepestNesting = AcpiGbl_NestingLevel; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtTrimFunctionName - * - * PARAMETERS: FunctionName - Ascii string containing a procedure name - * - * RETURN: Updated pointer to the function name - * - * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present. - * This allows compiler macros such as __FUNCTION__ to be used - * with no change to the debug output. - * - ******************************************************************************/ - -static const char * -AcpiUtTrimFunctionName ( - const char *FunctionName) -{ - - /* All Function names are longer than 4 chars, check is safe */ - - if (*(ACPI_CAST_PTR (UINT32, FunctionName)) == ACPI_PREFIX_MIXED) - { - /* This is the case where the original source has not been modified */ - - return (FunctionName + 4); - } - - if (*(ACPI_CAST_PTR (UINT32, FunctionName)) == ACPI_PREFIX_LOWER) - { - /* This is the case where the source has been 'linuxized' */ - - return (FunctionName + 5); - } - - return (FunctionName); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDebugPrint - * - * PARAMETERS: RequestedDebugLevel - Requested debug print level - * LineNumber - Caller's line number (for error output) - * FunctionName - Caller's procedure name - * ModuleName - Caller's module name - * ComponentId - Caller's component ID - * Format - Printf format field - * ... - Optional printf arguments - * - * RETURN: None - * - * DESCRIPTION: Print error message with prefix consisting of the module name, - * line number, and component ID. - * - ******************************************************************************/ - -void ACPI_INTERNAL_VAR_XFACE -AcpiDebugPrint ( - UINT32 RequestedDebugLevel, - UINT32 LineNumber, - const char *FunctionName, - const char *ModuleName, - UINT32 ComponentId, - const char *Format, - ...) -{ - ACPI_THREAD_ID ThreadId; - va_list args; -#ifdef ACPI_APPLICATION - int FillCount; -#endif - - /* Check if debug output enabled */ - - if (!ACPI_IS_DEBUG_ENABLED (RequestedDebugLevel, ComponentId)) - { - return; - } - - /* - * Thread tracking and context switch notification - */ - ThreadId = AcpiOsGetThreadId (); - if (ThreadId != AcpiGbl_PreviousThreadId) - { - if (ACPI_LV_THREADS & AcpiDbgLevel) - { - AcpiOsPrintf ( - "\n**** Context Switch from TID %u to TID %u ****\n\n", - (UINT32) AcpiGbl_PreviousThreadId, (UINT32) ThreadId); - } - - AcpiGbl_PreviousThreadId = ThreadId; - AcpiGbl_NestingLevel = 0; - } - - /* - * Display the module name, current line number, thread ID (if requested), - * current procedure nesting level, and the current procedure name - */ - AcpiOsPrintf ("%9s-%04d ", ModuleName, LineNumber); - -#ifdef ACPI_APPLICATION - /* - * For AcpiExec/iASL only, emit the thread ID and nesting level. - * Note: nesting level is really only useful during a single-thread - * execution. Otherwise, multiple threads will keep resetting the - * level. - */ - if (ACPI_LV_THREADS & AcpiDbgLevel) - { - AcpiOsPrintf ("[%u] ", (UINT32) ThreadId); - } - - FillCount = 48 - AcpiGbl_NestingLevel - - strlen (AcpiUtTrimFunctionName (FunctionName)); - if (FillCount < 0) - { - FillCount = 0; - } - - AcpiOsPrintf ("[%02d] %*s", - AcpiGbl_NestingLevel, AcpiGbl_NestingLevel + 1, " "); - AcpiOsPrintf ("%s%*s: ", - AcpiUtTrimFunctionName (FunctionName), FillCount, " "); - -#else - AcpiOsPrintf ("%-22.22s: ", AcpiUtTrimFunctionName (FunctionName)); -#endif - - va_start (args, Format); - AcpiOsVprintf (Format, args); - va_end (args); -} - -ACPI_EXPORT_SYMBOL (AcpiDebugPrint) - - -/******************************************************************************* - * - * FUNCTION: AcpiDebugPrintRaw - * - * PARAMETERS: RequestedDebugLevel - Requested debug print level - * LineNumber - Caller's line number - * FunctionName - Caller's procedure name - * ModuleName - Caller's module name - * ComponentId - Caller's component ID - * Format - Printf format field - * ... - Optional printf arguments - * - * RETURN: None - * - * DESCRIPTION: Print message with no headers. Has same interface as - * DebugPrint so that the same macros can be used. - * - ******************************************************************************/ - -void ACPI_INTERNAL_VAR_XFACE -AcpiDebugPrintRaw ( - UINT32 RequestedDebugLevel, - UINT32 LineNumber, - const char *FunctionName, - const char *ModuleName, - UINT32 ComponentId, - const char *Format, - ...) -{ - va_list args; - - - /* Check if debug output enabled */ - - if (!ACPI_IS_DEBUG_ENABLED (RequestedDebugLevel, ComponentId)) - { - return; - } - - va_start (args, Format); - AcpiOsVprintf (Format, args); - va_end (args); -} - -ACPI_EXPORT_SYMBOL (AcpiDebugPrintRaw) - - -/******************************************************************************* - * - * FUNCTION: AcpiUtTrace - * - * PARAMETERS: LineNumber - Caller's line number - * FunctionName - Caller's procedure name - * ModuleName - Caller's module name - * ComponentId - Caller's component ID - * - * RETURN: None - * - * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is - * set in DebugLevel - * - ******************************************************************************/ - -void -AcpiUtTrace ( - UINT32 LineNumber, - const char *FunctionName, - const char *ModuleName, - UINT32 ComponentId) -{ - - AcpiGbl_NestingLevel++; - AcpiUtTrackStackPtr (); - - /* Check if enabled up-front for performance */ - - if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId)) - { - AcpiDebugPrint (ACPI_LV_FUNCTIONS, - LineNumber, FunctionName, ModuleName, ComponentId, - "%s\n", AcpiGbl_FunctionEntryPrefix); - } -} - -ACPI_EXPORT_SYMBOL (AcpiUtTrace) - - -/******************************************************************************* - * - * FUNCTION: AcpiUtTracePtr - * - * PARAMETERS: LineNumber - Caller's line number - * FunctionName - Caller's procedure name - * ModuleName - Caller's module name - * ComponentId - Caller's component ID - * Pointer - Pointer to display - * - * RETURN: None - * - * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is - * set in DebugLevel - * - ******************************************************************************/ - -void -AcpiUtTracePtr ( - UINT32 LineNumber, - const char *FunctionName, - const char *ModuleName, - UINT32 ComponentId, - const void *Pointer) -{ - - AcpiGbl_NestingLevel++; - AcpiUtTrackStackPtr (); - - /* Check if enabled up-front for performance */ - - if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId)) - { - AcpiDebugPrint (ACPI_LV_FUNCTIONS, - LineNumber, FunctionName, ModuleName, ComponentId, - "%s %p\n", AcpiGbl_FunctionEntryPrefix, Pointer); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtTraceStr - * - * PARAMETERS: LineNumber - Caller's line number - * FunctionName - Caller's procedure name - * ModuleName - Caller's module name - * ComponentId - Caller's component ID - * String - Additional string to display - * - * RETURN: None - * - * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is - * set in DebugLevel - * - ******************************************************************************/ - -void -AcpiUtTraceStr ( - UINT32 LineNumber, - const char *FunctionName, - const char *ModuleName, - UINT32 ComponentId, - const char *String) -{ - - AcpiGbl_NestingLevel++; - AcpiUtTrackStackPtr (); - - /* Check if enabled up-front for performance */ - - if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId)) - { - AcpiDebugPrint (ACPI_LV_FUNCTIONS, - LineNumber, FunctionName, ModuleName, ComponentId, - "%s %s\n", AcpiGbl_FunctionEntryPrefix, String); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtTraceU32 - * - * PARAMETERS: LineNumber - Caller's line number - * FunctionName - Caller's procedure name - * ModuleName - Caller's module name - * ComponentId - Caller's component ID - * Integer - Integer to display - * - * RETURN: None - * - * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is - * set in DebugLevel - * - ******************************************************************************/ - -void -AcpiUtTraceU32 ( - UINT32 LineNumber, - const char *FunctionName, - const char *ModuleName, - UINT32 ComponentId, - UINT32 Integer) -{ - - AcpiGbl_NestingLevel++; - AcpiUtTrackStackPtr (); - - /* Check if enabled up-front for performance */ - - if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId)) - { - AcpiDebugPrint (ACPI_LV_FUNCTIONS, - LineNumber, FunctionName, ModuleName, ComponentId, - "%s %08X\n", AcpiGbl_FunctionEntryPrefix, Integer); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtExit - * - * PARAMETERS: LineNumber - Caller's line number - * FunctionName - Caller's procedure name - * ModuleName - Caller's module name - * ComponentId - Caller's component ID - * - * RETURN: None - * - * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is - * set in DebugLevel - * - ******************************************************************************/ - -void -AcpiUtExit ( - UINT32 LineNumber, - const char *FunctionName, - const char *ModuleName, - UINT32 ComponentId) -{ - - /* Check if enabled up-front for performance */ - - if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId)) - { - AcpiDebugPrint (ACPI_LV_FUNCTIONS, - LineNumber, FunctionName, ModuleName, ComponentId, - "%s\n", AcpiGbl_FunctionExitPrefix); - } - - if (AcpiGbl_NestingLevel) - { - AcpiGbl_NestingLevel--; - } -} - -ACPI_EXPORT_SYMBOL (AcpiUtExit) - - -/******************************************************************************* - * - * FUNCTION: AcpiUtStatusExit - * - * PARAMETERS: LineNumber - Caller's line number - * FunctionName - Caller's procedure name - * ModuleName - Caller's module name - * ComponentId - Caller's component ID - * Status - Exit status code - * - * RETURN: None - * - * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is - * set in DebugLevel. Prints exit status also. - * - ******************************************************************************/ - -void -AcpiUtStatusExit ( - UINT32 LineNumber, - const char *FunctionName, - const char *ModuleName, - UINT32 ComponentId, - ACPI_STATUS Status) -{ - - /* Check if enabled up-front for performance */ - - if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId)) - { - if (ACPI_SUCCESS (Status)) - { - AcpiDebugPrint (ACPI_LV_FUNCTIONS, - LineNumber, FunctionName, ModuleName, ComponentId, - "%s %s\n", AcpiGbl_FunctionExitPrefix, - AcpiFormatException (Status)); - } - else - { - AcpiDebugPrint (ACPI_LV_FUNCTIONS, - LineNumber, FunctionName, ModuleName, ComponentId, - "%s ****Exception****: %s\n", AcpiGbl_FunctionExitPrefix, - AcpiFormatException (Status)); - } - } - - if (AcpiGbl_NestingLevel) - { - AcpiGbl_NestingLevel--; - } -} - -ACPI_EXPORT_SYMBOL (AcpiUtStatusExit) - - -/******************************************************************************* - * - * FUNCTION: AcpiUtValueExit - * - * PARAMETERS: LineNumber - Caller's line number - * FunctionName - Caller's procedure name - * ModuleName - Caller's module name - * ComponentId - Caller's component ID - * Value - Value to be printed with exit msg - * - * RETURN: None - * - * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is - * set in DebugLevel. Prints exit value also. - * - ******************************************************************************/ - -void -AcpiUtValueExit ( - UINT32 LineNumber, - const char *FunctionName, - const char *ModuleName, - UINT32 ComponentId, - UINT64 Value) -{ - - /* Check if enabled up-front for performance */ - - if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId)) - { - AcpiDebugPrint (ACPI_LV_FUNCTIONS, - LineNumber, FunctionName, ModuleName, ComponentId, - "%s %8.8X%8.8X\n", AcpiGbl_FunctionExitPrefix, - ACPI_FORMAT_UINT64 (Value)); - } - - if (AcpiGbl_NestingLevel) - { - AcpiGbl_NestingLevel--; - } -} - -ACPI_EXPORT_SYMBOL (AcpiUtValueExit) - - -/******************************************************************************* - * - * FUNCTION: AcpiUtPtrExit - * - * PARAMETERS: LineNumber - Caller's line number - * FunctionName - Caller's procedure name - * ModuleName - Caller's module name - * ComponentId - Caller's component ID - * Ptr - Pointer to display - * - * RETURN: None - * - * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is - * set in DebugLevel. Prints exit value also. - * - ******************************************************************************/ - -void -AcpiUtPtrExit ( - UINT32 LineNumber, - const char *FunctionName, - const char *ModuleName, - UINT32 ComponentId, - UINT8 *Ptr) -{ - - /* Check if enabled up-front for performance */ - - if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId)) - { - AcpiDebugPrint (ACPI_LV_FUNCTIONS, - LineNumber, FunctionName, ModuleName, ComponentId, - "%s %p\n", AcpiGbl_FunctionExitPrefix, Ptr); - } - - if (AcpiGbl_NestingLevel) - { - AcpiGbl_NestingLevel--; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtStrExit - * - * PARAMETERS: LineNumber - Caller's line number - * FunctionName - Caller's procedure name - * ModuleName - Caller's module name - * ComponentId - Caller's component ID - * String - String to display - * - * RETURN: None - * - * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is - * set in DebugLevel. Prints exit value also. - * - ******************************************************************************/ - -void -AcpiUtStrExit ( - UINT32 LineNumber, - const char *FunctionName, - const char *ModuleName, - UINT32 ComponentId, - const char *String) -{ - - /* Check if enabled up-front for performance */ - - if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId)) - { - AcpiDebugPrint (ACPI_LV_FUNCTIONS, - LineNumber, FunctionName, ModuleName, ComponentId, - "%s %s\n", AcpiGbl_FunctionExitPrefix, String); - } - - if (AcpiGbl_NestingLevel) - { - AcpiGbl_NestingLevel--; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTracePoint - * - * PARAMETERS: Type - Trace event type - * Begin - TRUE if before execution - * Aml - Executed AML address - * Pathname - Object path - * Pointer - Pointer to the related object - * - * RETURN: None - * - * DESCRIPTION: Interpreter execution trace. - * - ******************************************************************************/ - -void -AcpiTracePoint ( - ACPI_TRACE_EVENT_TYPE Type, - BOOLEAN Begin, - UINT8 *Aml, - char *Pathname) -{ - - ACPI_FUNCTION_ENTRY (); - - AcpiExTracePoint (Type, Begin, Aml, Pathname); - -#ifdef ACPI_USE_SYSTEM_TRACER - AcpiOsTracePoint (Type, Begin, Aml, Pathname); -#endif -} - -ACPI_EXPORT_SYMBOL (AcpiTracePoint) - - -#endif diff --git a/drivers/acpica/utdecode.c b/drivers/acpica/utdecode.c deleted file mode 100644 index 4f26e3a..0000000 --- a/drivers/acpica/utdecode.c +++ /dev/null @@ -1,801 +0,0 @@ -/****************************************************************************** - * - * Module Name: utdecode - Utility decoding routines (value-to-string) - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" -#include "amlcode.h" - -#define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utdecode") - - -/* - * Properties of the ACPI Object Types, both internal and external. - * The table is indexed by values of ACPI_OBJECT_TYPE - */ -const UINT8 AcpiGbl_NsProperties[ACPI_NUM_NS_TYPES] = -{ - ACPI_NS_NORMAL, /* 00 Any */ - ACPI_NS_NORMAL, /* 01 Number */ - ACPI_NS_NORMAL, /* 02 String */ - ACPI_NS_NORMAL, /* 03 Buffer */ - ACPI_NS_NORMAL, /* 04 Package */ - ACPI_NS_NORMAL, /* 05 FieldUnit */ - ACPI_NS_NEWSCOPE, /* 06 Device */ - ACPI_NS_NORMAL, /* 07 Event */ - ACPI_NS_NEWSCOPE, /* 08 Method */ - ACPI_NS_NORMAL, /* 09 Mutex */ - ACPI_NS_NORMAL, /* 10 Region */ - ACPI_NS_NEWSCOPE, /* 11 Power */ - ACPI_NS_NEWSCOPE, /* 12 Processor */ - ACPI_NS_NEWSCOPE, /* 13 Thermal */ - ACPI_NS_NORMAL, /* 14 BufferField */ - ACPI_NS_NORMAL, /* 15 DdbHandle */ - ACPI_NS_NORMAL, /* 16 Debug Object */ - ACPI_NS_NORMAL, /* 17 DefField */ - ACPI_NS_NORMAL, /* 18 BankField */ - ACPI_NS_NORMAL, /* 19 IndexField */ - ACPI_NS_NORMAL, /* 20 Reference */ - ACPI_NS_NORMAL, /* 21 Alias */ - ACPI_NS_NORMAL, /* 22 MethodAlias */ - ACPI_NS_NORMAL, /* 23 Notify */ - ACPI_NS_NORMAL, /* 24 Address Handler */ - ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 25 Resource Desc */ - ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 26 Resource Field */ - ACPI_NS_NEWSCOPE, /* 27 Scope */ - ACPI_NS_NORMAL, /* 28 Extra */ - ACPI_NS_NORMAL, /* 29 Data */ - ACPI_NS_NORMAL /* 30 Invalid */ -}; - - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetRegionName - * - * PARAMETERS: Space ID - ID for the region - * - * RETURN: Decoded region SpaceId name - * - * DESCRIPTION: Translate a Space ID into a name string (Debug only) - * - ******************************************************************************/ - -/* Region type decoding */ - -const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] = -{ - "SystemMemory", /* 0x00 */ - "SystemIO", /* 0x01 */ - "PCI_Config", /* 0x02 */ - "EmbeddedControl", /* 0x03 */ - "SMBus", /* 0x04 */ - "SystemCMOS", /* 0x05 */ - "PCIBARTarget", /* 0x06 */ - "IPMI", /* 0x07 */ - "GeneralPurposeIo", /* 0x08 */ - "GenericSerialBus", /* 0x09 */ - "PCC", /* 0x0A */ - "PlatformRtMechanism" /* 0x0B */ -}; - - -const char * -AcpiUtGetRegionName ( - UINT8 SpaceId) -{ - - if (SpaceId >= ACPI_USER_REGION_BEGIN) - { - return ("UserDefinedRegion"); - } - else if (SpaceId == ACPI_ADR_SPACE_DATA_TABLE) - { - return ("DataTable"); - } - else if (SpaceId == ACPI_ADR_SPACE_FIXED_HARDWARE) - { - return ("FunctionalFixedHW"); - } - else if (SpaceId >= ACPI_NUM_PREDEFINED_REGIONS) - { - return ("InvalidSpaceId"); - } - - return (AcpiGbl_RegionTypes[SpaceId]); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetEventName - * - * PARAMETERS: EventId - Fixed event ID - * - * RETURN: Decoded event ID name - * - * DESCRIPTION: Translate a Event ID into a name string (Debug only) - * - ******************************************************************************/ - -/* Event type decoding */ - -static const char *AcpiGbl_EventTypes[ACPI_NUM_FIXED_EVENTS] = -{ - "PM_Timer", - "GlobalLock", - "PowerButton", - "SleepButton", - "RealTimeClock", -}; - - -const char * -AcpiUtGetEventName ( - UINT32 EventId) -{ - - if (EventId > ACPI_EVENT_MAX) - { - return ("InvalidEventID"); - } - - return (AcpiGbl_EventTypes[EventId]); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetTypeName - * - * PARAMETERS: Type - An ACPI object type - * - * RETURN: Decoded ACPI object type name - * - * DESCRIPTION: Translate a Type ID into a name string (Debug only) - * - ******************************************************************************/ - -/* - * Elements of AcpiGbl_NsTypeNames below must match - * one-to-one with values of ACPI_OBJECT_TYPE - * - * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching; - * when stored in a table it really means that we have thus far seen no - * evidence to indicate what type is actually going to be stored for this - & entry. - */ -static const char AcpiGbl_BadType[] = "UNDEFINED"; - -/* Printable names of the ACPI object types */ - -static const char *AcpiGbl_NsTypeNames[] = -{ - /* 00 */ "Untyped", - /* 01 */ "Integer", - /* 02 */ "String", - /* 03 */ "Buffer", - /* 04 */ "Package", - /* 05 */ "FieldUnit", - /* 06 */ "Device", - /* 07 */ "Event", - /* 08 */ "Method", - /* 09 */ "Mutex", - /* 10 */ "Region", - /* 11 */ "Power", - /* 12 */ "Processor", - /* 13 */ "Thermal", - /* 14 */ "BufferField", - /* 15 */ "DdbHandle", - /* 16 */ "DebugObject", - /* 17 */ "RegionField", - /* 18 */ "BankField", - /* 19 */ "IndexField", - /* 20 */ "Reference", - /* 21 */ "Alias", - /* 22 */ "MethodAlias", - /* 23 */ "Notify", - /* 24 */ "AddrHandler", - /* 25 */ "ResourceDesc", - /* 26 */ "ResourceFld", - /* 27 */ "Scope", - /* 28 */ "Extra", - /* 29 */ "Data", - /* 30 */ "Invalid" -}; - - -const char * -AcpiUtGetTypeName ( - ACPI_OBJECT_TYPE Type) -{ - - if (Type > ACPI_TYPE_INVALID) - { - return (AcpiGbl_BadType); - } - - return (AcpiGbl_NsTypeNames[Type]); -} - - -const char * -AcpiUtGetObjectTypeName ( - ACPI_OPERAND_OBJECT *ObjDesc) -{ - ACPI_FUNCTION_TRACE (UtGetObjectTypeName); - - - if (!ObjDesc) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Null Object Descriptor\n")); - return_STR ("[NULL Object Descriptor]"); - } - - /* These descriptor types share a common area */ - - if ((ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) && - (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_NAMED)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Invalid object descriptor type: 0x%2.2X [%s] (%p)\n", - ACPI_GET_DESCRIPTOR_TYPE (ObjDesc), - AcpiUtGetDescriptorName (ObjDesc), ObjDesc)); - - return_STR ("Invalid object"); - } - - return_STR (AcpiUtGetTypeName (ObjDesc->Common.Type)); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetNodeName - * - * PARAMETERS: Object - A namespace node - * - * RETURN: ASCII name of the node - * - * DESCRIPTION: Validate the node and return the node's ACPI name. - * - ******************************************************************************/ - -const char * -AcpiUtGetNodeName ( - void *Object) -{ - ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) Object; - - - /* Must return a string of exactly 4 characters == ACPI_NAMESEG_SIZE */ - - if (!Object) - { - return ("NULL"); - } - - /* Check for Root node */ - - if ((Object == ACPI_ROOT_OBJECT) || - (Object == AcpiGbl_RootNode)) - { - return ("\"\\\" "); - } - - /* Descriptor must be a namespace node */ - - if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) - { - return ("####"); - } - - /* - * Ensure name is valid. The name was validated/repaired when the node - * was created, but make sure it has not been corrupted. - */ - AcpiUtRepairName (Node->Name.Ascii); - - /* Return the name */ - - return (Node->Name.Ascii); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetDescriptorName - * - * PARAMETERS: Object - An ACPI object - * - * RETURN: Decoded name of the descriptor type - * - * DESCRIPTION: Validate object and return the descriptor type - * - ******************************************************************************/ - -/* Printable names of object descriptor types */ - -static const char *AcpiGbl_DescTypeNames[] = -{ - /* 00 */ "Not a Descriptor", - /* 01 */ "Cached Object", - /* 02 */ "State-Generic", - /* 03 */ "State-Update", - /* 04 */ "State-Package", - /* 05 */ "State-Control", - /* 06 */ "State-RootParseScope", - /* 07 */ "State-ParseScope", - /* 08 */ "State-WalkScope", - /* 09 */ "State-Result", - /* 10 */ "State-Notify", - /* 11 */ "State-Thread", - /* 12 */ "Tree Walk State", - /* 13 */ "Parse Tree Op", - /* 14 */ "Operand Object", - /* 15 */ "Namespace Node" -}; - - -const char * -AcpiUtGetDescriptorName ( - void *Object) -{ - - if (!Object) - { - return ("NULL OBJECT"); - } - - if (ACPI_GET_DESCRIPTOR_TYPE (Object) > ACPI_DESC_TYPE_MAX) - { - return ("Not a Descriptor"); - } - - return (AcpiGbl_DescTypeNames[ACPI_GET_DESCRIPTOR_TYPE (Object)]); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetReferenceName - * - * PARAMETERS: Object - An ACPI reference object - * - * RETURN: Decoded name of the type of reference - * - * DESCRIPTION: Decode a reference object sub-type to a string. - * - ******************************************************************************/ - -/* Printable names of reference object sub-types */ - -static const char *AcpiGbl_RefClassNames[] = -{ - /* 00 */ "Local", - /* 01 */ "Argument", - /* 02 */ "RefOf", - /* 03 */ "Index", - /* 04 */ "DdbHandle", - /* 05 */ "Named Object", - /* 06 */ "Debug" -}; - -const char * -AcpiUtGetReferenceName ( - ACPI_OPERAND_OBJECT *Object) -{ - - if (!Object) - { - return ("NULL Object"); - } - - if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND) - { - return ("Not an Operand object"); - } - - if (Object->Common.Type != ACPI_TYPE_LOCAL_REFERENCE) - { - return ("Not a Reference object"); - } - - if (Object->Reference.Class > ACPI_REFCLASS_MAX) - { - return ("Unknown Reference class"); - } - - return (AcpiGbl_RefClassNames[Object->Reference.Class]); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetMutexName - * - * PARAMETERS: MutexId - The predefined ID for this mutex. - * - * RETURN: Decoded name of the internal mutex - * - * DESCRIPTION: Translate a mutex ID into a name string (Debug only) - * - ******************************************************************************/ - -/* Names for internal mutex objects, used for debug output */ - -static const char *AcpiGbl_MutexNames[ACPI_NUM_MUTEX] = -{ - "ACPI_MTX_Interpreter", - "ACPI_MTX_Namespace", - "ACPI_MTX_Tables", - "ACPI_MTX_Events", - "ACPI_MTX_Caches", - "ACPI_MTX_Memory", -}; - -const char * -AcpiUtGetMutexName ( - UINT32 MutexId) -{ - - if (MutexId > ACPI_MAX_MUTEX) - { - return ("Invalid Mutex ID"); - } - - return (AcpiGbl_MutexNames[MutexId]); -} - - -#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) - -/* - * Strings and procedures used for debug only - */ - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetNotifyName - * - * PARAMETERS: NotifyValue - Value from the Notify() request - * - * RETURN: Decoded name for the notify value - * - * DESCRIPTION: Translate a Notify Value to a notify namestring. - * - ******************************************************************************/ - -/* Names for Notify() values, used for debug output */ - -static const char *AcpiGbl_GenericNotify[ACPI_GENERIC_NOTIFY_MAX + 1] = -{ - /* 00 */ "Bus Check", - /* 01 */ "Device Check", - /* 02 */ "Device Wake", - /* 03 */ "Eject Request", - /* 04 */ "Device Check Light", - /* 05 */ "Frequency Mismatch", - /* 06 */ "Bus Mode Mismatch", - /* 07 */ "Power Fault", - /* 08 */ "Capabilities Check", - /* 09 */ "Device PLD Check", - /* 0A */ "Reserved", - /* 0B */ "System Locality Update", - /* 0C */ "Reserved (was previously Shutdown Request)", /* Reserved in ACPI 6.0 */ - /* 0D */ "System Resource Affinity Update", - /* 0E */ "Heterogeneous Memory Attributes Update", /* ACPI 6.2 */ - /* 0F */ "Error Disconnect Recover" /* ACPI 6.3 */ -}; - -static const char *AcpiGbl_DeviceNotify[5] = -{ - /* 80 */ "Status Change", - /* 81 */ "Information Change", - /* 82 */ "Device-Specific Change", - /* 83 */ "Device-Specific Change", - /* 84 */ "Reserved" -}; - -static const char *AcpiGbl_ProcessorNotify[5] = -{ - /* 80 */ "Performance Capability Change", - /* 81 */ "C-State Change", - /* 82 */ "Throttling Capability Change", - /* 83 */ "Guaranteed Change", - /* 84 */ "Minimum Excursion" -}; - -static const char *AcpiGbl_ThermalNotify[5] = -{ - /* 80 */ "Thermal Status Change", - /* 81 */ "Thermal Trip Point Change", - /* 82 */ "Thermal Device List Change", - /* 83 */ "Thermal Relationship Change", - /* 84 */ "Reserved" -}; - - -const char * -AcpiUtGetNotifyName ( - UINT32 NotifyValue, - ACPI_OBJECT_TYPE Type) -{ - - /* 00 - 0F are "common to all object types" (from ACPI Spec) */ - - if (NotifyValue <= ACPI_GENERIC_NOTIFY_MAX) - { - return (AcpiGbl_GenericNotify[NotifyValue]); - } - - /* 10 - 7F are reserved */ - - if (NotifyValue <= ACPI_MAX_SYS_NOTIFY) - { - return ("Reserved"); - } - - /* 80 - 84 are per-object-type */ - - if (NotifyValue <= ACPI_SPECIFIC_NOTIFY_MAX) - { - switch (Type) - { - case ACPI_TYPE_ANY: - case ACPI_TYPE_DEVICE: - return (AcpiGbl_DeviceNotify [NotifyValue - 0x80]); - - case ACPI_TYPE_PROCESSOR: - return (AcpiGbl_ProcessorNotify [NotifyValue - 0x80]); - - case ACPI_TYPE_THERMAL: - return (AcpiGbl_ThermalNotify [NotifyValue - 0x80]); - - default: - return ("Target object type does not support notifies"); - } - } - - /* 84 - BF are device-specific */ - - if (NotifyValue <= ACPI_MAX_DEVICE_SPECIFIC_NOTIFY) - { - return ("Device-Specific"); - } - - /* C0 and above are hardware-specific */ - - return ("Hardware-Specific"); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetArgumentTypeName - * - * PARAMETERS: ArgType - an ARGP_* parser argument type - * - * RETURN: Decoded ARGP_* type - * - * DESCRIPTION: Decode an ARGP_* parser type, as defined in the amlcode.h file, - * and used in the acopcode.h file. For example, ARGP_TERMARG. - * Used for debug only. - * - ******************************************************************************/ - -static const char *AcpiGbl_ArgumentType[20] = -{ - /* 00 */ "Unknown ARGP", - /* 01 */ "ByteData", - /* 02 */ "ByteList", - /* 03 */ "CharList", - /* 04 */ "DataObject", - /* 05 */ "DataObjectList", - /* 06 */ "DWordData", - /* 07 */ "FieldList", - /* 08 */ "Name", - /* 09 */ "NameString", - /* 0A */ "ObjectList", - /* 0B */ "PackageLength", - /* 0C */ "SuperName", - /* 0D */ "Target", - /* 0E */ "TermArg", - /* 0F */ "TermList", - /* 10 */ "WordData", - /* 11 */ "QWordData", - /* 12 */ "SimpleName", - /* 13 */ "NameOrRef" -}; - -const char * -AcpiUtGetArgumentTypeName ( - UINT32 ArgType) -{ - - if (ArgType > ARGP_MAX) - { - return ("Unknown ARGP"); - } - - return (AcpiGbl_ArgumentType[ArgType]); -} - -#endif - - -/******************************************************************************* - * - * FUNCTION: AcpiUtValidObjectType - * - * PARAMETERS: Type - Object type to be validated - * - * RETURN: TRUE if valid object type, FALSE otherwise - * - * DESCRIPTION: Validate an object type - * - ******************************************************************************/ - -BOOLEAN -AcpiUtValidObjectType ( - ACPI_OBJECT_TYPE Type) -{ - - if (Type > ACPI_TYPE_LOCAL_MAX) - { - /* Note: Assumes all TYPEs are contiguous (external/local) */ - - return (FALSE); - } - - return (TRUE); -} diff --git a/drivers/acpica/utdelete.c b/drivers/acpica/utdelete.c deleted file mode 100644 index 868ad0e..0000000 --- a/drivers/acpica/utdelete.c +++ /dev/null @@ -1,934 +0,0 @@ -/******************************************************************************* - * - * Module Name: utdelete - object deletion and reference count utilities - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acinterp.h" -#include "acnamesp.h" -#include "acevents.h" - - -#define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utdelete") - -/* Local prototypes */ - -static void -AcpiUtDeleteInternalObj ( - ACPI_OPERAND_OBJECT *Object); - -static void -AcpiUtUpdateRefCount ( - ACPI_OPERAND_OBJECT *Object, - UINT32 Action); - - -/******************************************************************************* - * - * FUNCTION: AcpiUtDeleteInternalObj - * - * PARAMETERS: Object - Object to be deleted - * - * RETURN: None - * - * DESCRIPTION: Low level object deletion, after reference counts have been - * updated (All reference counts, including sub-objects!) - * - ******************************************************************************/ - -static void -AcpiUtDeleteInternalObj ( - ACPI_OPERAND_OBJECT *Object) -{ - void *ObjPointer = NULL; - ACPI_OPERAND_OBJECT *HandlerDesc; - ACPI_OPERAND_OBJECT *SecondDesc; - ACPI_OPERAND_OBJECT *NextDesc; - ACPI_OPERAND_OBJECT *StartDesc; - ACPI_OPERAND_OBJECT **LastObjPtr; - - - ACPI_FUNCTION_TRACE_PTR (UtDeleteInternalObj, Object); - - - if (!Object) - { - return_VOID; - } - - /* - * Must delete or free any pointers within the object that are not - * actual ACPI objects (for example, a raw buffer pointer). - */ - switch (Object->Common.Type) - { - case ACPI_TYPE_STRING: - - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "**** String %p, ptr %p\n", - Object, Object->String.Pointer)); - - /* Free the actual string buffer */ - - if (!(Object->Common.Flags & AOPOBJ_STATIC_POINTER)) - { - /* But only if it is NOT a pointer into an ACPI table */ - - ObjPointer = Object->String.Pointer; - } - break; - - case ACPI_TYPE_BUFFER: - - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "**** Buffer %p, ptr %p\n", - Object, Object->Buffer.Pointer)); - - /* Free the actual buffer */ - - if (!(Object->Common.Flags & AOPOBJ_STATIC_POINTER)) - { - /* But only if it is NOT a pointer into an ACPI table */ - - ObjPointer = Object->Buffer.Pointer; - } - break; - - case ACPI_TYPE_PACKAGE: - - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, " **** Package of count %X\n", - Object->Package.Count)); - - /* - * Elements of the package are not handled here, they are deleted - * separately - */ - - /* Free the (variable length) element pointer array */ - - ObjPointer = Object->Package.Elements; - break; - - /* - * These objects have a possible list of notify handlers. - * Device object also may have a GPE block. - */ - case ACPI_TYPE_DEVICE: - - if (Object->Device.GpeBlock) - { - (void) AcpiEvDeleteGpeBlock (Object->Device.GpeBlock); - } - - ACPI_FALLTHROUGH; - - case ACPI_TYPE_PROCESSOR: - case ACPI_TYPE_THERMAL: - - /* Walk the address handler list for this object */ - - HandlerDesc = Object->CommonNotify.Handler; - while (HandlerDesc) - { - NextDesc = HandlerDesc->AddressSpace.Next; - AcpiUtRemoveReference (HandlerDesc); - HandlerDesc = NextDesc; - } - break; - - case ACPI_TYPE_MUTEX: - - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, - "***** Mutex %p, OS Mutex %p\n", - Object, Object->Mutex.OsMutex)); - - if (Object == AcpiGbl_GlobalLockMutex) - { - /* Global Lock has extra semaphore */ - - (void) AcpiOsDeleteSemaphore (AcpiGbl_GlobalLockSemaphore); - AcpiGbl_GlobalLockSemaphore = ACPI_SEMAPHORE_NULL; - - AcpiOsDeleteMutex (Object->Mutex.OsMutex); - AcpiGbl_GlobalLockMutex = NULL; - } - else - { - AcpiExUnlinkMutex (Object); - AcpiOsDeleteMutex (Object->Mutex.OsMutex); - } - break; - - case ACPI_TYPE_EVENT: - - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, - "***** Event %p, OS Semaphore %p\n", - Object, Object->Event.OsSemaphore)); - - (void) AcpiOsDeleteSemaphore (Object->Event.OsSemaphore); - Object->Event.OsSemaphore = ACPI_SEMAPHORE_NULL; - break; - - case ACPI_TYPE_METHOD: - - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, - "***** Method %p\n", Object)); - - /* Delete the method mutex if it exists */ - - if (Object->Method.Mutex) - { - AcpiOsDeleteMutex (Object->Method.Mutex->Mutex.OsMutex); - AcpiUtDeleteObjectDesc (Object->Method.Mutex); - Object->Method.Mutex = NULL; - } - - if (Object->Method.Node) - { - Object->Method.Node = NULL; - } - break; - - case ACPI_TYPE_REGION: - - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, - "***** Region %p\n", Object)); - - /* - * Update AddressRange list. However, only permanent regions - * are installed in this list. (Not created within a method) - */ - if (!(Object->Region.Node->Flags & ANOBJ_TEMPORARY)) - { - AcpiUtRemoveAddressRange (Object->Region.SpaceId, - Object->Region.Node); - } - - SecondDesc = AcpiNsGetSecondaryObject (Object); - if (SecondDesc) - { - /* - * Free the RegionContext if and only if the handler is one of the - * default handlers -- and therefore, we created the context object - * locally, it was not created by an external caller. - */ - HandlerDesc = Object->Region.Handler; - if (HandlerDesc) - { - NextDesc = HandlerDesc->AddressSpace.RegionList; - StartDesc = NextDesc; - LastObjPtr = &HandlerDesc->AddressSpace.RegionList; - - /* Remove the region object from the handler list */ - - while (NextDesc) - { - if (NextDesc == Object) - { - *LastObjPtr = NextDesc->Region.Next; - break; - } - - /* Walk the linked list of handlers */ - - LastObjPtr = &NextDesc->Region.Next; - NextDesc = NextDesc->Region.Next; - - /* Prevent infinite loop if list is corrupted */ - - if (NextDesc == StartDesc) - { - ACPI_ERROR ((AE_INFO, - "Circular region list in address handler object %p", - HandlerDesc)); - return_VOID; - } - } - - if (HandlerDesc->AddressSpace.HandlerFlags & - ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) - { - /* Deactivate region and free region context */ - - if (HandlerDesc->AddressSpace.Setup) - { - (void) HandlerDesc->AddressSpace.Setup (Object, - ACPI_REGION_DEACTIVATE, - HandlerDesc->AddressSpace.Context, - &SecondDesc->Extra.RegionContext); - } - } - - AcpiUtRemoveReference (HandlerDesc); - } - - /* Now we can free the Extra object */ - - AcpiUtDeleteObjectDesc (SecondDesc); - } - if (Object->Field.InternalPccBuffer) - { - ACPI_FREE(Object->Field.InternalPccBuffer); - } - - break; - - case ACPI_TYPE_BUFFER_FIELD: - - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, - "***** Buffer Field %p\n", Object)); - - SecondDesc = AcpiNsGetSecondaryObject (Object); - if (SecondDesc) - { - AcpiUtDeleteObjectDesc (SecondDesc); - } - break; - - case ACPI_TYPE_LOCAL_BANK_FIELD: - - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, - "***** Bank Field %p\n", Object)); - - SecondDesc = AcpiNsGetSecondaryObject (Object); - if (SecondDesc) - { - AcpiUtDeleteObjectDesc (SecondDesc); - } - break; - - case ACPI_TYPE_LOCAL_ADDRESS_HANDLER: - - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, - "***** Address handler %p\n", Object)); - - AcpiOsDeleteMutex (Object->AddressSpace.ContextMutex); - break; - - default: - - break; - } - - /* Free any allocated memory (pointer within the object) found above */ - - if (ObjPointer) - { - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Deleting Object Subptr %p\n", - ObjPointer)); - ACPI_FREE (ObjPointer); - } - - /* Now the object can be safely deleted */ - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ALLOCATIONS, "%s: Deleting Object %p [%s]\n", - ACPI_GET_FUNCTION_NAME, Object, AcpiUtGetObjectTypeName (Object))); - - AcpiUtDeleteObjectDesc (Object); - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtDeleteInternalObjectList - * - * PARAMETERS: ObjList - Pointer to the list to be deleted - * - * RETURN: None - * - * DESCRIPTION: This function deletes an internal object list, including both - * simple objects and package objects - * - ******************************************************************************/ - -void -AcpiUtDeleteInternalObjectList ( - ACPI_OPERAND_OBJECT **ObjList) -{ - ACPI_OPERAND_OBJECT **InternalObj; - - - ACPI_FUNCTION_ENTRY (); - - - /* Walk the null-terminated internal list */ - - for (InternalObj = ObjList; *InternalObj; InternalObj++) - { - AcpiUtRemoveReference (*InternalObj); - } - - /* Free the combined parameter pointer list and object array */ - - ACPI_FREE (ObjList); - return; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtUpdateRefCount - * - * PARAMETERS: Object - Object whose ref count is to be updated - * Action - What to do (REF_INCREMENT or REF_DECREMENT) - * - * RETURN: None. Sets new reference count within the object - * - * DESCRIPTION: Modify the reference count for an internal acpi object - * - ******************************************************************************/ - -static void -AcpiUtUpdateRefCount ( - ACPI_OPERAND_OBJECT *Object, - UINT32 Action) -{ - UINT16 OriginalCount; - UINT16 NewCount = 0; - ACPI_CPU_FLAGS LockFlags; - char *Message; - - - ACPI_FUNCTION_NAME (UtUpdateRefCount); - - - if (!Object) - { - return; - } - - /* - * Always get the reference count lock. Note: Interpreter and/or - * Namespace is not always locked when this function is called. - */ - LockFlags = AcpiOsAcquireLock (AcpiGbl_ReferenceCountLock); - OriginalCount = Object->Common.ReferenceCount; - - /* Perform the reference count action (increment, decrement) */ - - switch (Action) - { - case REF_INCREMENT: - - NewCount = OriginalCount + 1; - Object->Common.ReferenceCount = NewCount; - AcpiOsReleaseLock (AcpiGbl_ReferenceCountLock, LockFlags); - - /* The current reference count should never be zero here */ - - if (!OriginalCount) - { - ACPI_WARNING ((AE_INFO, - "Obj %p, Reference Count was zero before increment\n", - Object)); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, - "Obj %p Type %.2X [%s] Refs %.2X [Incremented]\n", - Object, Object->Common.Type, - AcpiUtGetObjectTypeName (Object), NewCount)); - Message = "Increment"; - break; - - case REF_DECREMENT: - - /* The current reference count must be non-zero */ - - if (OriginalCount) - { - NewCount = OriginalCount - 1; - Object->Common.ReferenceCount = NewCount; - } - - AcpiOsReleaseLock (AcpiGbl_ReferenceCountLock, LockFlags); - - if (!OriginalCount) - { - ACPI_WARNING ((AE_INFO, - "Obj %p, Reference Count is already zero, cannot decrement\n", - Object)); - return; - } - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ALLOCATIONS, - "%s: Obj %p Type %.2X Refs %.2X [Decremented]\n", - ACPI_GET_FUNCTION_NAME, Object, Object->Common.Type, NewCount)); - - /* Actually delete the object on a reference count of zero */ - - if (NewCount == 0) - { - AcpiUtDeleteInternalObj (Object); - } - Message = "Decrement"; - break; - - default: - - AcpiOsReleaseLock (AcpiGbl_ReferenceCountLock, LockFlags); - ACPI_ERROR ((AE_INFO, "Unknown Reference Count action (0x%X)", - Action)); - return; - } - - /* - * Sanity check the reference count, for debug purposes only. - * (A deleted object will have a huge reference count) - */ - if (NewCount > ACPI_MAX_REFERENCE_COUNT) - { - ACPI_WARNING ((AE_INFO, - "Large Reference Count (0x%X) in object %p, Type=0x%.2X Operation=%s", - NewCount, Object, Object->Common.Type, Message)); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtUpdateObjectReference - * - * PARAMETERS: Object - Increment or decrement the ref count for - * this object and all sub-objects - * Action - Either REF_INCREMENT or REF_DECREMENT - * - * RETURN: Status - * - * DESCRIPTION: Increment or decrement the object reference count - * - * Object references are incremented when: - * 1) An object is attached to a Node (namespace object) - * 2) An object is copied (all subobjects must be incremented) - * - * Object references are decremented when: - * 1) An object is detached from an Node - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtUpdateObjectReference ( - ACPI_OPERAND_OBJECT *Object, - UINT16 Action) -{ - ACPI_STATUS Status = AE_OK; - ACPI_GENERIC_STATE *StateList = NULL; - ACPI_OPERAND_OBJECT *NextObject = NULL; - ACPI_OPERAND_OBJECT *PrevObject; - ACPI_GENERIC_STATE *State; - UINT32 i; - - - ACPI_FUNCTION_NAME (UtUpdateObjectReference); - - - while (Object) - { - /* Make sure that this isn't a namespace handle */ - - if (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED) - { - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, - "Object %p is NS handle\n", Object)); - return (AE_OK); - } - - /* - * All sub-objects must have their reference count updated - * also. Different object types have different subobjects. - */ - switch (Object->Common.Type) - { - case ACPI_TYPE_DEVICE: - case ACPI_TYPE_PROCESSOR: - case ACPI_TYPE_POWER: - case ACPI_TYPE_THERMAL: - /* - * Update the notify objects for these types (if present) - * Two lists, system and device notify handlers. - */ - for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++) - { - PrevObject = Object->CommonNotify.NotifyList[i]; - while (PrevObject) - { - NextObject = PrevObject->Notify.Next[i]; - AcpiUtUpdateRefCount (PrevObject, Action); - PrevObject = NextObject; - } - } - break; - - case ACPI_TYPE_PACKAGE: - /* - * We must update all the sub-objects of the package, - * each of whom may have their own sub-objects. - */ - for (i = 0; i < Object->Package.Count; i++) - { - /* - * Null package elements are legal and can be simply - * ignored. - */ - NextObject = Object->Package.Elements[i]; - if (!NextObject) - { - continue; - } - - switch (NextObject->Common.Type) - { - case ACPI_TYPE_INTEGER: - case ACPI_TYPE_STRING: - case ACPI_TYPE_BUFFER: - /* - * For these very simple sub-objects, we can just - * update the reference count here and continue. - * Greatly increases performance of this operation. - */ - AcpiUtUpdateRefCount (NextObject, Action); - break; - - default: - /* - * For complex sub-objects, push them onto the stack - * for later processing (this eliminates recursion.) - */ - Status = AcpiUtCreateUpdateStateAndPush ( - NextObject, Action, &StateList); - if (ACPI_FAILURE (Status)) - { - goto ErrorExit; - } - break; - } - } - - NextObject = NULL; - break; - - case ACPI_TYPE_BUFFER_FIELD: - - NextObject = Object->BufferField.BufferObj; - break; - - case ACPI_TYPE_LOCAL_BANK_FIELD: - - NextObject = Object->BankField.BankObj; - Status = AcpiUtCreateUpdateStateAndPush ( - Object->BankField.RegionObj, Action, &StateList); - if (ACPI_FAILURE (Status)) - { - goto ErrorExit; - } - break; - - case ACPI_TYPE_LOCAL_INDEX_FIELD: - - NextObject = Object->IndexField.IndexObj; - Status = AcpiUtCreateUpdateStateAndPush ( - Object->IndexField.DataObj, Action, &StateList); - if (ACPI_FAILURE (Status)) - { - goto ErrorExit; - } - break; - - case ACPI_TYPE_LOCAL_REFERENCE: - /* - * The target of an Index (a package, string, or buffer) or a named - * reference must track changes to the ref count of the index or - * target object. - */ - if ((Object->Reference.Class == ACPI_REFCLASS_INDEX) || - (Object->Reference.Class== ACPI_REFCLASS_NAME)) - { - NextObject = Object->Reference.Object; - } - break; - - case ACPI_TYPE_LOCAL_REGION_FIELD: - case ACPI_TYPE_REGION: - default: - - break; /* No subobjects for all other types */ - } - - /* - * Now we can update the count in the main object. This can only - * happen after we update the sub-objects in case this causes the - * main object to be deleted. - */ - AcpiUtUpdateRefCount (Object, Action); - Object = NULL; - - /* Move on to the next object to be updated */ - - if (NextObject) - { - Object = NextObject; - NextObject = NULL; - } - else if (StateList) - { - State = AcpiUtPopGenericState (&StateList); - Object = State->Update.Object; - AcpiUtDeleteGenericState (State); - } - } - - return (AE_OK); - - -ErrorExit: - - ACPI_EXCEPTION ((AE_INFO, Status, - "Could not update object reference count")); - - /* Free any stacked Update State objects */ - - while (StateList) - { - State = AcpiUtPopGenericState (&StateList); - AcpiUtDeleteGenericState (State); - } - - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtAddReference - * - * PARAMETERS: Object - Object whose reference count is to be - * incremented - * - * RETURN: None - * - * DESCRIPTION: Add one reference to an ACPI object - * - ******************************************************************************/ - -void -AcpiUtAddReference ( - ACPI_OPERAND_OBJECT *Object) -{ - - ACPI_FUNCTION_NAME (UtAddReference); - - - /* Ensure that we have a valid object */ - - if (!AcpiUtValidInternalObject (Object)) - { - return; - } - - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, - "Obj %p Current Refs=%X [To Be Incremented]\n", - Object, Object->Common.ReferenceCount)); - - /* Increment the reference count */ - - (void) AcpiUtUpdateObjectReference (Object, REF_INCREMENT); - return; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtRemoveReference - * - * PARAMETERS: Object - Object whose ref count will be decremented - * - * RETURN: None - * - * DESCRIPTION: Decrement the reference count of an ACPI internal object - * - ******************************************************************************/ - -void -AcpiUtRemoveReference ( - ACPI_OPERAND_OBJECT *Object) -{ - - ACPI_FUNCTION_NAME (UtRemoveReference); - - - /* - * Allow a NULL pointer to be passed in, just ignore it. This saves - * each caller from having to check. Also, ignore NS nodes. - */ - if (!Object || - (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED)) - - { - return; - } - - /* Ensure that we have a valid object */ - - if (!AcpiUtValidInternalObject (Object)) - { - return; - } - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ALLOCATIONS, - "%s: Obj %p Current Refs=%X [To Be Decremented]\n", - ACPI_GET_FUNCTION_NAME, Object, Object->Common.ReferenceCount)); - - /* - * Decrement the reference count, and only actually delete the object - * if the reference count becomes 0. (Must also decrement the ref count - * of all subobjects!) - */ - (void) AcpiUtUpdateObjectReference (Object, REF_DECREMENT); - return; -} diff --git a/drivers/acpica/uterror.c b/drivers/acpica/uterror.c deleted file mode 100644 index 6502794..0000000 --- a/drivers/acpica/uterror.c +++ /dev/null @@ -1,510 +0,0 @@ -/******************************************************************************* - * - * Module Name: uterror - Various internal error/warning output functions - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" - - -#define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("uterror") - - -/* - * This module contains internal error functions that may - * be configured out. - */ -#if !defined (ACPI_NO_ERROR_MESSAGES) - -/******************************************************************************* - * - * FUNCTION: AcpiUtPredefinedWarning - * - * PARAMETERS: ModuleName - Caller's module name (for error output) - * LineNumber - Caller's line number (for error output) - * Pathname - Full pathname to the node - * NodeFlags - From Namespace node for the method/object - * Format - Printf format string + additional args - * - * RETURN: None - * - * DESCRIPTION: Warnings for the predefined validation module. Messages are - * only emitted the first time a problem with a particular - * method/object is detected. This prevents a flood of error - * messages for methods that are repeatedly evaluated. - * - ******************************************************************************/ - -void ACPI_INTERNAL_VAR_XFACE -AcpiUtPredefinedWarning ( - const char *ModuleName, - UINT32 LineNumber, - char *Pathname, - UINT16 NodeFlags, - const char *Format, - ...) -{ - va_list ArgList; - - - /* - * Warning messages for this method/object will be disabled after the - * first time a validation fails or an object is successfully repaired. - */ - if (NodeFlags & ANOBJ_EVALUATED) - { - return; - } - - AcpiOsPrintf (ACPI_MSG_WARNING "%s: ", Pathname); - - va_start (ArgList, Format); - AcpiOsVprintf (Format, ArgList); - ACPI_MSG_SUFFIX; - va_end (ArgList); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtPredefinedInfo - * - * PARAMETERS: ModuleName - Caller's module name (for error output) - * LineNumber - Caller's line number (for error output) - * Pathname - Full pathname to the node - * NodeFlags - From Namespace node for the method/object - * Format - Printf format string + additional args - * - * RETURN: None - * - * DESCRIPTION: Info messages for the predefined validation module. Messages - * are only emitted the first time a problem with a particular - * method/object is detected. This prevents a flood of - * messages for methods that are repeatedly evaluated. - * - ******************************************************************************/ - -void ACPI_INTERNAL_VAR_XFACE -AcpiUtPredefinedInfo ( - const char *ModuleName, - UINT32 LineNumber, - char *Pathname, - UINT16 NodeFlags, - const char *Format, - ...) -{ - va_list ArgList; - - - /* - * Warning messages for this method/object will be disabled after the - * first time a validation fails or an object is successfully repaired. - */ - if (NodeFlags & ANOBJ_EVALUATED) - { - return; - } - - AcpiOsPrintf (ACPI_MSG_INFO "%s: ", Pathname); - - va_start (ArgList, Format); - AcpiOsVprintf (Format, ArgList); - ACPI_MSG_SUFFIX; - va_end (ArgList); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtPredefinedBiosError - * - * PARAMETERS: ModuleName - Caller's module name (for error output) - * LineNumber - Caller's line number (for error output) - * Pathname - Full pathname to the node - * NodeFlags - From Namespace node for the method/object - * Format - Printf format string + additional args - * - * RETURN: None - * - * DESCRIPTION: BIOS error message for predefined names. Messages - * are only emitted the first time a problem with a particular - * method/object is detected. This prevents a flood of - * messages for methods that are repeatedly evaluated. - * - ******************************************************************************/ - -void ACPI_INTERNAL_VAR_XFACE -AcpiUtPredefinedBiosError ( - const char *ModuleName, - UINT32 LineNumber, - char *Pathname, - UINT16 NodeFlags, - const char *Format, - ...) -{ - va_list ArgList; - - - /* - * Warning messages for this method/object will be disabled after the - * first time a validation fails or an object is successfully repaired. - */ - if (NodeFlags & ANOBJ_EVALUATED) - { - return; - } - - AcpiOsPrintf (ACPI_MSG_BIOS_ERROR "%s: ", Pathname); - - va_start (ArgList, Format); - AcpiOsVprintf (Format, ArgList); - ACPI_MSG_SUFFIX; - va_end (ArgList); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtPrefixedNamespaceError - * - * PARAMETERS: ModuleName - Caller's module name (for error output) - * LineNumber - Caller's line number (for error output) - * PrefixScope - Scope/Path that prefixes the internal path - * InternalPath - Name or path of the namespace node - * LookupStatus - Exception code from NS lookup - * - * RETURN: None - * - * DESCRIPTION: Print error message with the full pathname constructed this way: - * - * PrefixScopeNodeFullPath.ExternalizedInternalPath - * - * NOTE: 10/2017: Treat the major NsLookup errors as firmware errors - * - ******************************************************************************/ - -void -AcpiUtPrefixedNamespaceError ( - const char *ModuleName, - UINT32 LineNumber, - ACPI_GENERIC_STATE *PrefixScope, - const char *InternalPath, - ACPI_STATUS LookupStatus) -{ - char *FullPath; - const char *Message; - - - /* - * Main cases: - * 1) Object creation, object must not already exist - * 2) Object lookup, object must exist - */ - switch (LookupStatus) - { - case AE_ALREADY_EXISTS: - - AcpiOsPrintf (ACPI_MSG_BIOS_ERROR); - Message = "Failure creating named object"; - break; - - case AE_NOT_FOUND: - - AcpiOsPrintf (ACPI_MSG_BIOS_ERROR); - Message = "Could not resolve symbol"; - break; - - default: - - AcpiOsPrintf (ACPI_MSG_ERROR); - Message = "Failure resolving symbol"; - break; - } - - /* Concatenate the prefix path and the internal path */ - - FullPath = AcpiNsBuildPrefixedPathname (PrefixScope, InternalPath); - - AcpiOsPrintf ("%s [%s], %s", Message, - FullPath ? FullPath : "Could not get pathname", - AcpiFormatException (LookupStatus)); - - if (FullPath) - { - ACPI_FREE (FullPath); - } - - ACPI_MSG_SUFFIX; -} - - -#ifdef __OBSOLETE_FUNCTION -/******************************************************************************* - * - * FUNCTION: AcpiUtNamespaceError - * - * PARAMETERS: ModuleName - Caller's module name (for error output) - * LineNumber - Caller's line number (for error output) - * InternalName - Name or path of the namespace node - * LookupStatus - Exception code from NS lookup - * - * RETURN: None - * - * DESCRIPTION: Print error message with the full pathname for the NS node. - * - ******************************************************************************/ - -void -AcpiUtNamespaceError ( - const char *ModuleName, - UINT32 LineNumber, - const char *InternalName, - ACPI_STATUS LookupStatus) -{ - ACPI_STATUS Status; - UINT32 BadName; - char *Name = NULL; - - - ACPI_MSG_REDIRECT_BEGIN; - AcpiOsPrintf (ACPI_MSG_ERROR); - - if (LookupStatus == AE_BAD_CHARACTER) - { - /* There is a non-ascii character in the name */ - - ACPI_MOVE_32_TO_32 (&BadName, ACPI_CAST_PTR (UINT32, InternalName)); - AcpiOsPrintf ("[0x%.8X] (NON-ASCII)", BadName); - } - else - { - /* Convert path to external format */ - - Status = AcpiNsExternalizeName ( - ACPI_UINT32_MAX, InternalName, NULL, &Name); - - /* Print target name */ - - if (ACPI_SUCCESS (Status)) - { - AcpiOsPrintf ("[%s]", Name); - } - else - { - AcpiOsPrintf ("[COULD NOT EXTERNALIZE NAME]"); - } - - if (Name) - { - ACPI_FREE (Name); - } - } - - AcpiOsPrintf (" Namespace lookup failure, %s", - AcpiFormatException (LookupStatus)); - - ACPI_MSG_SUFFIX; - ACPI_MSG_REDIRECT_END; -} -#endif - -/******************************************************************************* - * - * FUNCTION: AcpiUtMethodError - * - * PARAMETERS: ModuleName - Caller's module name (for error output) - * LineNumber - Caller's line number (for error output) - * Message - Error message to use on failure - * PrefixNode - Prefix relative to the path - * Path - Path to the node (optional) - * MethodStatus - Execution status - * - * RETURN: None - * - * DESCRIPTION: Print error message with the full pathname for the method. - * - ******************************************************************************/ - -void -AcpiUtMethodError ( - const char *ModuleName, - UINT32 LineNumber, - const char *Message, - ACPI_NAMESPACE_NODE *PrefixNode, - const char *Path, - ACPI_STATUS MethodStatus) -{ - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node = PrefixNode; - - - ACPI_MSG_REDIRECT_BEGIN; - AcpiOsPrintf (ACPI_MSG_ERROR); - - if (Path) - { - Status = AcpiNsGetNode (PrefixNode, Path, - ACPI_NS_NO_UPSEARCH, &Node); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("[Could not get node by pathname]"); - } - } - - AcpiNsPrintNodePathname (Node, Message); - AcpiOsPrintf (" due to previous error (%s)", - AcpiFormatException (MethodStatus)); - - ACPI_MSG_SUFFIX; - ACPI_MSG_REDIRECT_END; -} - -#endif /* ACPI_NO_ERROR_MESSAGES */ diff --git a/drivers/acpica/uteval.c b/drivers/acpica/uteval.c deleted file mode 100644 index d33d736..0000000 --- a/drivers/acpica/uteval.c +++ /dev/null @@ -1,487 +0,0 @@ -/****************************************************************************** - * - * Module Name: uteval - Object evaluation - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" - - -#define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("uteval") - - -/******************************************************************************* - * - * FUNCTION: AcpiUtEvaluateObject - * - * PARAMETERS: PrefixNode - Starting node - * Path - Path to object from starting node - * ExpectedReturnTypes - Bitmap of allowed return types - * ReturnDesc - Where a return value is stored - * - * RETURN: Status - * - * DESCRIPTION: Evaluates a namespace object and verifies the type of the - * return object. Common code that simplifies accessing objects - * that have required return objects of fixed types. - * - * NOTE: Internal function, no parameter validation - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtEvaluateObject ( - ACPI_NAMESPACE_NODE *PrefixNode, - const char *Path, - UINT32 ExpectedReturnBtypes, - ACPI_OPERAND_OBJECT **ReturnDesc) -{ - ACPI_EVALUATE_INFO *Info; - ACPI_STATUS Status; - UINT32 ReturnBtype; - - - ACPI_FUNCTION_TRACE (UtEvaluateObject); - - - /* Allocate the evaluation information block */ - - Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO)); - if (!Info) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - Info->PrefixNode = PrefixNode; - Info->RelativePathname = Path; - - /* Evaluate the object/method */ - - Status = AcpiNsEvaluate (Info); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_NOT_FOUND) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s.%s] was not found\n", - AcpiUtGetNodeName (PrefixNode), Path)); - } - else - { - ACPI_ERROR_METHOD ("Method execution failed", - PrefixNode, Path, Status); - } - - goto Cleanup; - } - - /* Did we get a return object? */ - - if (!Info->ReturnObject) - { - if (ExpectedReturnBtypes) - { - ACPI_ERROR_METHOD ("No object was returned from", - PrefixNode, Path, AE_NOT_EXIST); - - Status = AE_NOT_EXIST; - } - - goto Cleanup; - } - - /* Map the return object type to the bitmapped type */ - - switch ((Info->ReturnObject)->Common.Type) - { - case ACPI_TYPE_INTEGER: - - ReturnBtype = ACPI_BTYPE_INTEGER; - break; - - case ACPI_TYPE_BUFFER: - - ReturnBtype = ACPI_BTYPE_BUFFER; - break; - - case ACPI_TYPE_STRING: - - ReturnBtype = ACPI_BTYPE_STRING; - break; - - case ACPI_TYPE_PACKAGE: - - ReturnBtype = ACPI_BTYPE_PACKAGE; - break; - - default: - - ReturnBtype = 0; - break; - } - - if ((AcpiGbl_EnableInterpreterSlack) && - (!ExpectedReturnBtypes)) - { - /* - * We received a return object, but one was not expected. This can - * happen frequently if the "implicit return" feature is enabled. - * Just delete the return object and return AE_OK. - */ - AcpiUtRemoveReference (Info->ReturnObject); - goto Cleanup; - } - - /* Is the return object one of the expected types? */ - - if (!(ExpectedReturnBtypes & ReturnBtype)) - { - ACPI_ERROR_METHOD ("Return object type is incorrect", - PrefixNode, Path, AE_TYPE); - - ACPI_ERROR ((AE_INFO, - "Type returned from %s was incorrect: %s, expected Btypes: 0x%X", - Path, AcpiUtGetObjectTypeName (Info->ReturnObject), - ExpectedReturnBtypes)); - - /* On error exit, we must delete the return object */ - - AcpiUtRemoveReference (Info->ReturnObject); - Status = AE_TYPE; - goto Cleanup; - } - - /* Object type is OK, return it */ - - *ReturnDesc = Info->ReturnObject; - -Cleanup: - ACPI_FREE (Info); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtEvaluateNumericObject - * - * PARAMETERS: ObjectName - Object name to be evaluated - * DeviceNode - Node for the device - * Value - Where the value is returned - * - * RETURN: Status - * - * DESCRIPTION: Evaluates a numeric namespace object for a selected device - * and stores result in *Value. - * - * NOTE: Internal function, no parameter validation - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtEvaluateNumericObject ( - const char *ObjectName, - ACPI_NAMESPACE_NODE *DeviceNode, - UINT64 *Value) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (UtEvaluateNumericObject); - - - Status = AcpiUtEvaluateObject (DeviceNode, ObjectName, - ACPI_BTYPE_INTEGER, &ObjDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Get the returned Integer */ - - *Value = ObjDesc->Integer.Value; - - /* On exit, we must delete the return object */ - - AcpiUtRemoveReference (ObjDesc); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtExecute_STA - * - * PARAMETERS: DeviceNode - Node for the device - * Flags - Where the status flags are returned - * - * RETURN: Status - * - * DESCRIPTION: Executes _STA for selected device and stores results in - * *Flags. If _STA does not exist, then the device is assumed - * to be present/functional/enabled (as per the ACPI spec). - * - * NOTE: Internal function, no parameter validation - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtExecute_STA ( - ACPI_NAMESPACE_NODE *DeviceNode, - UINT32 *Flags) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (UtExecute_STA); - - - Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__STA, - ACPI_BTYPE_INTEGER, &ObjDesc); - if (ACPI_FAILURE (Status)) - { - if (AE_NOT_FOUND == Status) - { - /* - * if _STA does not exist, then (as per the ACPI specification), - * the returned flags will indicate that the device is present, - * functional, and enabled. - */ - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "_STA on %4.4s was not found, assuming device is present\n", - AcpiUtGetNodeName (DeviceNode))); - - *Flags = ACPI_UINT32_MAX; - Status = AE_OK; - } - - return_ACPI_STATUS (Status); - } - - /* Extract the status flags */ - - *Flags = (UINT32) ObjDesc->Integer.Value; - - /* On exit, we must delete the return object */ - - AcpiUtRemoveReference (ObjDesc); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtExecutePowerMethods - * - * PARAMETERS: DeviceNode - Node for the device - * MethodNames - Array of power method names - * MethodCount - Number of methods to execute - * OutValues - Where the power method values are returned - * - * RETURN: Status, OutValues - * - * DESCRIPTION: Executes the specified power methods for the device and returns - * the result(s). - * - * NOTE: Internal function, no parameter validation - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtExecutePowerMethods ( - ACPI_NAMESPACE_NODE *DeviceNode, - const char **MethodNames, - UINT8 MethodCount, - UINT8 *OutValues) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_STATUS Status; - ACPI_STATUS FinalStatus = AE_NOT_FOUND; - UINT32 i; - - - ACPI_FUNCTION_TRACE (UtExecutePowerMethods); - - - for (i = 0; i < MethodCount; i++) - { - /* - * Execute the power method (_SxD or _SxW). The only allowable - * return type is an Integer. - */ - Status = AcpiUtEvaluateObject (DeviceNode, - ACPI_CAST_PTR (char, MethodNames[i]), - ACPI_BTYPE_INTEGER, &ObjDesc); - if (ACPI_SUCCESS (Status)) - { - OutValues[i] = (UINT8) ObjDesc->Integer.Value; - - /* Delete the return object */ - - AcpiUtRemoveReference (ObjDesc); - FinalStatus = AE_OK; /* At least one value is valid */ - continue; - } - - OutValues[i] = ACPI_UINT8_MAX; - if (Status == AE_NOT_FOUND) - { - continue; /* Ignore if not found */ - } - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Failed %s on Device %4.4s, %s\n", - ACPI_CAST_PTR (char, MethodNames[i]), - AcpiUtGetNodeName (DeviceNode), AcpiFormatException (Status))); - } - - return_ACPI_STATUS (FinalStatus); -} diff --git a/drivers/acpica/utexcep.c b/drivers/acpica/utexcep.c deleted file mode 100644 index aa0ff78..0000000 --- a/drivers/acpica/utexcep.c +++ /dev/null @@ -1,287 +0,0 @@ -/******************************************************************************* - * - * Module Name: utexcep - Exception code support - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#define EXPORT_ACPI_INTERFACES - -#define ACPI_DEFINE_EXCEPTION_TABLE -#include "acpi.h" -#include "accommon.h" - - -#define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utexcep") - - -/******************************************************************************* - * - * FUNCTION: AcpiFormatException - * - * PARAMETERS: Status - The ACPI_STATUS code to be formatted - * - * RETURN: A string containing the exception text. A valid pointer is - * always returned. - * - * DESCRIPTION: This function translates an ACPI exception into an ASCII - * string. Returns "unknown status" string for invalid codes. - * - ******************************************************************************/ - -const char * -AcpiFormatException ( - ACPI_STATUS Status) -{ - const ACPI_EXCEPTION_INFO *Exception; - - - ACPI_FUNCTION_ENTRY (); - - - Exception = AcpiUtValidateException (Status); - if (!Exception) - { - /* Exception code was not recognized */ - - ACPI_ERROR ((AE_INFO, - "Unknown exception code: 0x%8.8X", Status)); - - return ("UNKNOWN_STATUS_CODE"); - } - - return (Exception->Name); -} - -ACPI_EXPORT_SYMBOL (AcpiFormatException) - - -/******************************************************************************* - * - * FUNCTION: AcpiUtValidateException - * - * PARAMETERS: Status - The ACPI_STATUS code to be formatted - * - * RETURN: A string containing the exception text. NULL if exception is - * not valid. - * - * DESCRIPTION: This function validates and translates an ACPI exception into - * an ASCII string. - * - ******************************************************************************/ - -const ACPI_EXCEPTION_INFO * -AcpiUtValidateException ( - ACPI_STATUS Status) -{ - UINT32 SubStatus; - const ACPI_EXCEPTION_INFO *Exception = NULL; - - - ACPI_FUNCTION_ENTRY (); - - - /* - * Status is composed of two parts, a "type" and an actual code - */ - SubStatus = (Status & ~AE_CODE_MASK); - - switch (Status & AE_CODE_MASK) - { - case AE_CODE_ENVIRONMENTAL: - - if (SubStatus <= AE_CODE_ENV_MAX) - { - Exception = &AcpiGbl_ExceptionNames_Env [SubStatus]; - } - break; - - case AE_CODE_PROGRAMMER: - - if (SubStatus <= AE_CODE_PGM_MAX) - { - Exception = &AcpiGbl_ExceptionNames_Pgm [SubStatus]; - } - break; - - case AE_CODE_ACPI_TABLES: - - if (SubStatus <= AE_CODE_TBL_MAX) - { - Exception = &AcpiGbl_ExceptionNames_Tbl [SubStatus]; - } - break; - - case AE_CODE_AML: - - if (SubStatus <= AE_CODE_AML_MAX) - { - Exception = &AcpiGbl_ExceptionNames_Aml [SubStatus]; - } - break; - - case AE_CODE_CONTROL: - - if (SubStatus <= AE_CODE_CTRL_MAX) - { - Exception = &AcpiGbl_ExceptionNames_Ctrl [SubStatus]; - } - break; - - default: - - break; - } - - if (!Exception || !Exception->Name) - { - return (NULL); - } - - return (Exception); -} diff --git a/drivers/acpica/utglobal.c b/drivers/acpica/utglobal.c deleted file mode 100644 index 2b953dd..0000000 --- a/drivers/acpica/utglobal.c +++ /dev/null @@ -1,348 +0,0 @@ -/****************************************************************************** - * - * Module Name: utglobal - Global variables for the ACPI subsystem - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#define EXPORT_ACPI_INTERFACES -#define DEFINE_ACPI_GLOBALS - -#include "acpi.h" -#include "accommon.h" - -#define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utglobal") - - -/******************************************************************************* - * - * Static global variable initialization. - * - ******************************************************************************/ - -/* Various state name strings */ - -const char *AcpiGbl_SleepStateNames[ACPI_S_STATE_COUNT] = -{ - "\\_S0_", - "\\_S1_", - "\\_S2_", - "\\_S3_", - "\\_S4_", - "\\_S5_" -}; - -const char *AcpiGbl_LowestDstateNames[ACPI_NUM_SxW_METHODS] = -{ - "_S0W", - "_S1W", - "_S2W", - "_S3W", - "_S4W" -}; - -const char *AcpiGbl_HighestDstateNames[ACPI_NUM_SxD_METHODS] = -{ - "_S1D", - "_S2D", - "_S3D", - "_S4D" -}; - - -/* Hex-to-ascii */ - -const char AcpiGbl_LowerHexDigits[] = "0123456789abcdef"; -const char AcpiGbl_UpperHexDigits[] = "0123456789ABCDEF"; - - -/******************************************************************************* - * - * Namespace globals - * - ******************************************************************************/ - -/* - * Predefined ACPI Names (Built-in to the Interpreter) - * - * NOTES: - * 1) _SB_ is defined to be a device to allow \_SB_._INI to be run - * during the initialization sequence. - * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to - * perform a Notify() operation on it. 09/2010: Changed to type Device. - * This still allows notifies, but does not confuse host code that - * searches for valid ThermalZone objects. - */ -const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames[] = -{ - {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL}, - {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL}, - {"_SB_", ACPI_TYPE_DEVICE, NULL}, - {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL}, - {"_TZ_", ACPI_TYPE_DEVICE, NULL}, - /* - * March, 2015: - * The _REV object is in the process of being deprecated, because - * other ACPI implementations permanently return 2. Thus, it - * has little or no value. Return 2 for compatibility with - * other ACPI implementations. - */ - {"_REV", ACPI_TYPE_INTEGER, ACPI_CAST_PTR (char, 2)}, - {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, - {"_GL_", ACPI_TYPE_MUTEX, ACPI_CAST_PTR (char, 1)}, - {"_OSI", ACPI_TYPE_METHOD, ACPI_CAST_PTR (char, 1)}, - - /* Table terminator */ - - {NULL, ACPI_TYPE_ANY, NULL} -}; - - -#if (!ACPI_REDUCED_HARDWARE) -/****************************************************************************** - * - * Event and Hardware globals - * - ******************************************************************************/ - -ACPI_BIT_REGISTER_INFO AcpiGbl_BitRegisterInfo[ACPI_NUM_BITREG] = -{ - /* Name Parent Register Register Bit Position Register Bit Mask */ - - /* ACPI_BITREG_TIMER_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_TIMER_STATUS, ACPI_BITMASK_TIMER_STATUS}, - /* ACPI_BITREG_BUS_MASTER_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_BUS_MASTER_STATUS, ACPI_BITMASK_BUS_MASTER_STATUS}, - /* ACPI_BITREG_GLOBAL_LOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_GLOBAL_LOCK_STATUS, ACPI_BITMASK_GLOBAL_LOCK_STATUS}, - /* ACPI_BITREG_POWER_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_POWER_BUTTON_STATUS, ACPI_BITMASK_POWER_BUTTON_STATUS}, - /* ACPI_BITREG_SLEEP_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_SLEEP_BUTTON_STATUS, ACPI_BITMASK_SLEEP_BUTTON_STATUS}, - /* ACPI_BITREG_RT_CLOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_RT_CLOCK_STATUS, ACPI_BITMASK_RT_CLOCK_STATUS}, - /* ACPI_BITREG_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_WAKE_STATUS, ACPI_BITMASK_WAKE_STATUS}, - /* ACPI_BITREG_PCIEXP_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_PCIEXP_WAKE_STATUS, ACPI_BITMASK_PCIEXP_WAKE_STATUS}, - - /* ACPI_BITREG_TIMER_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_TIMER_ENABLE, ACPI_BITMASK_TIMER_ENABLE}, - /* ACPI_BITREG_GLOBAL_LOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE, ACPI_BITMASK_GLOBAL_LOCK_ENABLE}, - /* ACPI_BITREG_POWER_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_POWER_BUTTON_ENABLE, ACPI_BITMASK_POWER_BUTTON_ENABLE}, - /* ACPI_BITREG_SLEEP_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE, ACPI_BITMASK_SLEEP_BUTTON_ENABLE}, - /* ACPI_BITREG_RT_CLOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_RT_CLOCK_ENABLE, ACPI_BITMASK_RT_CLOCK_ENABLE}, - /* ACPI_BITREG_PCIEXP_WAKE_DISABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE, ACPI_BITMASK_PCIEXP_WAKE_DISABLE}, - - /* ACPI_BITREG_SCI_ENABLE */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_SCI_ENABLE, ACPI_BITMASK_SCI_ENABLE}, - /* ACPI_BITREG_BUS_MASTER_RLD */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_BUS_MASTER_RLD, ACPI_BITMASK_BUS_MASTER_RLD}, - /* ACPI_BITREG_GLOBAL_LOCK_RELEASE */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE, ACPI_BITMASK_GLOBAL_LOCK_RELEASE}, - /* ACPI_BITREG_SLEEP_TYPE */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_SLEEP_TYPE, ACPI_BITMASK_SLEEP_TYPE}, - /* ACPI_BITREG_SLEEP_ENABLE */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_SLEEP_ENABLE, ACPI_BITMASK_SLEEP_ENABLE}, - - /* ACPI_BITREG_ARB_DIS */ {ACPI_REGISTER_PM2_CONTROL, ACPI_BITPOSITION_ARB_DISABLE, ACPI_BITMASK_ARB_DISABLE} -}; - - -ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS] = -{ - /* ACPI_EVENT_PMTIMER */ {ACPI_BITREG_TIMER_STATUS, ACPI_BITREG_TIMER_ENABLE, ACPI_BITMASK_TIMER_STATUS, ACPI_BITMASK_TIMER_ENABLE}, - /* ACPI_EVENT_GLOBAL */ {ACPI_BITREG_GLOBAL_LOCK_STATUS, ACPI_BITREG_GLOBAL_LOCK_ENABLE, ACPI_BITMASK_GLOBAL_LOCK_STATUS, ACPI_BITMASK_GLOBAL_LOCK_ENABLE}, - /* ACPI_EVENT_POWER_BUTTON */ {ACPI_BITREG_POWER_BUTTON_STATUS, ACPI_BITREG_POWER_BUTTON_ENABLE, ACPI_BITMASK_POWER_BUTTON_STATUS, ACPI_BITMASK_POWER_BUTTON_ENABLE}, - /* ACPI_EVENT_SLEEP_BUTTON */ {ACPI_BITREG_SLEEP_BUTTON_STATUS, ACPI_BITREG_SLEEP_BUTTON_ENABLE, ACPI_BITMASK_SLEEP_BUTTON_STATUS, ACPI_BITMASK_SLEEP_BUTTON_ENABLE}, - /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS, ACPI_BITREG_RT_CLOCK_ENABLE, ACPI_BITMASK_RT_CLOCK_STATUS, ACPI_BITMASK_RT_CLOCK_ENABLE}, -}; -#endif /* !ACPI_REDUCED_HARDWARE */ - - -#if defined (ACPI_DISASSEMBLER) || defined (ACPI_ASL_COMPILER) - -/* ToPld macro: compile/disassemble strings */ - -const char *AcpiGbl_PldPanelList[] = -{ - "TOP", - "BOTTOM", - "LEFT", - "RIGHT", - "FRONT", - "BACK", - "UNKNOWN", - NULL -}; - -const char *AcpiGbl_PldVerticalPositionList[] = -{ - "UPPER", - "CENTER", - "LOWER", - NULL -}; - -const char *AcpiGbl_PldHorizontalPositionList[] = -{ - "LEFT", - "CENTER", - "RIGHT", - NULL -}; - -const char *AcpiGbl_PldShapeList[] = -{ - "ROUND", - "OVAL", - "SQUARE", - "VERTICALRECTANGLE", - "HORIZONTALRECTANGLE", - "VERTICALTRAPEZOID", - "HORIZONTALTRAPEZOID", - "UNKNOWN", - "CHAMFERED", - NULL -}; -#endif - - -/* Public globals */ - -ACPI_EXPORT_SYMBOL (AcpiGbl_FADT) -ACPI_EXPORT_SYMBOL (AcpiDbgLevel) -ACPI_EXPORT_SYMBOL (AcpiDbgLayer) -ACPI_EXPORT_SYMBOL (AcpiGpeCount) -ACPI_EXPORT_SYMBOL (AcpiCurrentGpeCount) diff --git a/drivers/acpica/uthex.c b/drivers/acpica/uthex.c deleted file mode 100644 index 7343b99..0000000 --- a/drivers/acpica/uthex.c +++ /dev/null @@ -1,264 +0,0 @@ -/****************************************************************************** - * - * Module Name: uthex -- Hex/ASCII support functions - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("uthex") - - -/* Hex to ASCII conversion table */ - -static const char AcpiGbl_HexToAscii[] = -{ - '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' -}; - - -/******************************************************************************* - * - * FUNCTION: AcpiUtHexToAsciiChar - * - * PARAMETERS: Integer - Contains the hex digit - * Position - bit position of the digit within the - * integer (multiple of 4) - * - * RETURN: The converted Ascii character - * - * DESCRIPTION: Convert a hex digit to an Ascii character - * - ******************************************************************************/ - -char -AcpiUtHexToAsciiChar ( - UINT64 Integer, - UINT32 Position) -{ - UINT64 Index; - - AcpiUtShortShiftRight (Integer, Position, &Index); - return (AcpiGbl_HexToAscii[Index & 0xF]); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtAsciiToHexByte - * - * PARAMETERS: TwoAsciiChars - Pointer to two ASCII characters - * ReturnByte - Where converted byte is returned - * - * RETURN: Status and converted hex byte - * - * DESCRIPTION: Perform ascii-to-hex translation, exactly two ASCII characters - * to a single converted byte value. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtAsciiToHexByte ( - char *TwoAsciiChars, - UINT8 *ReturnByte) -{ - - /* Both ASCII characters must be valid hex digits */ - - if (!isxdigit ((int) TwoAsciiChars[0]) || - !isxdigit ((int) TwoAsciiChars[1])) - { - return (AE_BAD_HEX_CONSTANT); - } - - *ReturnByte = - AcpiUtAsciiCharToHex (TwoAsciiChars[1]) | - (AcpiUtAsciiCharToHex (TwoAsciiChars[0]) << 4); - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtAsciiCharToHex - * - * PARAMETERS: HexChar - Hex character in Ascii. Must be: - * 0-9 or A-F or a-f - * - * RETURN: The binary value of the ascii/hex character - * - * DESCRIPTION: Perform ascii-to-hex translation - * - ******************************************************************************/ - -UINT8 -AcpiUtAsciiCharToHex ( - int HexChar) -{ - - /* Values 0-9 */ - - if (HexChar <= '9') - { - return ((UINT8) (HexChar - '0')); - } - - /* Upper case A-F */ - - if (HexChar <= 'F') - { - return ((UINT8) (HexChar - 0x37)); - } - - /* Lower case a-f */ - - return ((UINT8) (HexChar - 0x57)); -} diff --git a/drivers/acpica/utids.c b/drivers/acpica/utids.c deleted file mode 100644 index 9d9b075..0000000 --- a/drivers/acpica/utids.c +++ /dev/null @@ -1,586 +0,0 @@ -/****************************************************************************** - * - * Module Name: utids - support for device IDs - HID, UID, CID, SUB, CLS - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acinterp.h" - - -#define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utids") - - -/******************************************************************************* - * - * FUNCTION: AcpiUtExecute_HID - * - * PARAMETERS: DeviceNode - Node for the device - * ReturnId - Where the string HID is returned - * - * RETURN: Status - * - * DESCRIPTION: Executes the _HID control method that returns the hardware - * ID of the device. The HID is either an 32-bit encoded EISAID - * Integer or a String. A string is always returned. An EISAID - * is converted to a string. - * - * NOTE: Internal function, no parameter validation - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtExecute_HID ( - ACPI_NAMESPACE_NODE *DeviceNode, - ACPI_PNP_DEVICE_ID **ReturnId) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_PNP_DEVICE_ID *Hid; - UINT32 Length; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (UtExecute_HID); - - - Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__HID, - ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, &ObjDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Get the size of the String to be returned, includes null terminator */ - - if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER) - { - Length = ACPI_EISAID_STRING_SIZE; - } - else - { - Length = ObjDesc->String.Length + 1; - } - - /* Allocate a buffer for the HID */ - - Hid = ACPI_ALLOCATE_ZEROED ( - sizeof (ACPI_PNP_DEVICE_ID) + (ACPI_SIZE) Length); - if (!Hid) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - /* Area for the string starts after PNP_DEVICE_ID struct */ - - Hid->String = ACPI_ADD_PTR (char, Hid, sizeof (ACPI_PNP_DEVICE_ID)); - - /* Convert EISAID to a string or simply copy existing string */ - - if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER) - { - AcpiExEisaIdToString (Hid->String, ObjDesc->Integer.Value); - } - else - { - strcpy (Hid->String, ObjDesc->String.Pointer); - } - - Hid->Length = Length; - *ReturnId = Hid; - - -Cleanup: - - /* On exit, we must delete the return object */ - - AcpiUtRemoveReference (ObjDesc); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtExecute_UID - * - * PARAMETERS: DeviceNode - Node for the device - * ReturnId - Where the string UID is returned - * - * RETURN: Status - * - * DESCRIPTION: Executes the _UID control method that returns the unique - * ID of the device. The UID is either a 64-bit Integer (NOT an - * EISAID) or a string. Always returns a string. A 64-bit integer - * is converted to a decimal string. - * - * NOTE: Internal function, no parameter validation - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtExecute_UID ( - ACPI_NAMESPACE_NODE *DeviceNode, - ACPI_PNP_DEVICE_ID **ReturnId) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_PNP_DEVICE_ID *Uid; - UINT32 Length; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (UtExecute_UID); - - - Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__UID, - ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, &ObjDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Get the size of the String to be returned, includes null terminator */ - - if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER) - { - Length = ACPI_MAX64_DECIMAL_DIGITS + 1; - } - else - { - Length = ObjDesc->String.Length + 1; - } - - /* Allocate a buffer for the UID */ - - Uid = ACPI_ALLOCATE_ZEROED ( - sizeof (ACPI_PNP_DEVICE_ID) + (ACPI_SIZE) Length); - if (!Uid) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - /* Area for the string starts after PNP_DEVICE_ID struct */ - - Uid->String = ACPI_ADD_PTR (char, Uid, sizeof (ACPI_PNP_DEVICE_ID)); - - /* Convert an Integer to string, or just copy an existing string */ - - if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER) - { - AcpiExIntegerToString (Uid->String, ObjDesc->Integer.Value); - } - else - { - strcpy (Uid->String, ObjDesc->String.Pointer); - } - - Uid->Length = Length; - *ReturnId = Uid; - - -Cleanup: - - /* On exit, we must delete the return object */ - - AcpiUtRemoveReference (ObjDesc); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtExecute_CID - * - * PARAMETERS: DeviceNode - Node for the device - * ReturnCidList - Where the CID list is returned - * - * RETURN: Status, list of CID strings - * - * DESCRIPTION: Executes the _CID control method that returns one or more - * compatible hardware IDs for the device. - * - * NOTE: Internal function, no parameter validation - * - * A _CID method can return either a single compatible ID or a package of - * compatible IDs. Each compatible ID can be one of the following: - * 1) Integer (32 bit compressed EISA ID) or - * 2) String (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss") - * - * The Integer CIDs are converted to string format by this function. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtExecute_CID ( - ACPI_NAMESPACE_NODE *DeviceNode, - ACPI_PNP_DEVICE_ID_LIST **ReturnCidList) -{ - ACPI_OPERAND_OBJECT **CidObjects; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_PNP_DEVICE_ID_LIST *CidList; - char *NextIdString; - UINT32 StringAreaSize; - UINT32 Length; - UINT32 CidListSize; - ACPI_STATUS Status; - UINT32 Count; - UINT32 i; - - - ACPI_FUNCTION_TRACE (UtExecute_CID); - - - /* Evaluate the _CID method for this device */ - - Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__CID, - ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_PACKAGE, - &ObjDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* - * Get the count and size of the returned _CIDs. _CID can return either - * a Package of Integers/Strings or a single Integer or String. - * Note: This section also validates that all CID elements are of the - * correct type (Integer or String). - */ - if (ObjDesc->Common.Type == ACPI_TYPE_PACKAGE) - { - Count = ObjDesc->Package.Count; - CidObjects = ObjDesc->Package.Elements; - } - else /* Single Integer or String CID */ - { - Count = 1; - CidObjects = &ObjDesc; - } - - StringAreaSize = 0; - for (i = 0; i < Count; i++) - { - /* String lengths include null terminator */ - - switch (CidObjects[i]->Common.Type) - { - case ACPI_TYPE_INTEGER: - - StringAreaSize += ACPI_EISAID_STRING_SIZE; - break; - - case ACPI_TYPE_STRING: - - StringAreaSize += CidObjects[i]->String.Length + 1; - break; - - default: - - Status = AE_TYPE; - goto Cleanup; - } - } - - /* - * Now that we know the length of the CIDs, allocate return buffer: - * 1) Size of the base structure + - * 2) Size of the CID PNP_DEVICE_ID array + - * 3) Size of the actual CID strings - */ - CidListSize = sizeof (ACPI_PNP_DEVICE_ID_LIST) + - (Count * sizeof (ACPI_PNP_DEVICE_ID)) + - StringAreaSize; - - CidList = ACPI_ALLOCATE_ZEROED (CidListSize); - if (!CidList) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - /* Area for CID strings starts after the CID PNP_DEVICE_ID array */ - - NextIdString = ACPI_CAST_PTR (char, CidList->Ids) + - ((ACPI_SIZE) Count * sizeof (ACPI_PNP_DEVICE_ID)); - - /* Copy/convert the CIDs to the return buffer */ - - for (i = 0; i < Count; i++) - { - if (CidObjects[i]->Common.Type == ACPI_TYPE_INTEGER) - { - /* Convert the Integer (EISAID) CID to a string */ - - AcpiExEisaIdToString ( - NextIdString, CidObjects[i]->Integer.Value); - Length = ACPI_EISAID_STRING_SIZE; - } - else /* ACPI_TYPE_STRING */ - { - /* Copy the String CID from the returned object */ - - strcpy (NextIdString, CidObjects[i]->String.Pointer); - Length = CidObjects[i]->String.Length + 1; - } - - CidList->Ids[i].String = NextIdString; - CidList->Ids[i].Length = Length; - NextIdString += Length; - } - - /* Finish the CID list */ - - CidList->Count = Count; - CidList->ListSize = CidListSize; - *ReturnCidList = CidList; - - -Cleanup: - - /* On exit, we must delete the _CID return object */ - - AcpiUtRemoveReference (ObjDesc); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtExecute_CLS - * - * PARAMETERS: DeviceNode - Node for the device - * ReturnId - Where the _CLS is returned - * - * RETURN: Status - * - * DESCRIPTION: Executes the _CLS control method that returns PCI-defined - * class code of the device. The _CLS value is always a package - * containing PCI class information as a list of integers. - * The returned string has format "BBSSPP", where: - * BB = Base-class code - * SS = Sub-class code - * PP = Programming Interface code - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtExecute_CLS ( - ACPI_NAMESPACE_NODE *DeviceNode, - ACPI_PNP_DEVICE_ID **ReturnId) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_OPERAND_OBJECT **ClsObjects; - UINT32 Count; - ACPI_PNP_DEVICE_ID *Cls; - UINT32 Length; - ACPI_STATUS Status; - UINT8 ClassCode[3] = {0, 0, 0}; - - - ACPI_FUNCTION_TRACE (UtExecute_CLS); - - - Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__CLS, - ACPI_BTYPE_PACKAGE, &ObjDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Get the size of the String to be returned, includes null terminator */ - - Length = ACPI_PCICLS_STRING_SIZE; - ClsObjects = ObjDesc->Package.Elements; - Count = ObjDesc->Package.Count; - - if (ObjDesc->Common.Type == ACPI_TYPE_PACKAGE) - { - if (Count > 0 && ClsObjects[0]->Common.Type == ACPI_TYPE_INTEGER) - { - ClassCode[0] = (UINT8) ClsObjects[0]->Integer.Value; - } - if (Count > 1 && ClsObjects[1]->Common.Type == ACPI_TYPE_INTEGER) - { - ClassCode[1] = (UINT8) ClsObjects[1]->Integer.Value; - } - if (Count > 2 && ClsObjects[2]->Common.Type == ACPI_TYPE_INTEGER) - { - ClassCode[2] = (UINT8) ClsObjects[2]->Integer.Value; - } - } - - /* Allocate a buffer for the CLS */ - - Cls = ACPI_ALLOCATE_ZEROED ( - sizeof (ACPI_PNP_DEVICE_ID) + (ACPI_SIZE) Length); - if (!Cls) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - /* Area for the string starts after PNP_DEVICE_ID struct */ - - Cls->String = ACPI_ADD_PTR (char, Cls, sizeof (ACPI_PNP_DEVICE_ID)); - - /* Simply copy existing string */ - - AcpiExPciClsToString (Cls->String, ClassCode); - Cls->Length = Length; - *ReturnId = Cls; - - -Cleanup: - - /* On exit, we must delete the return object */ - - AcpiUtRemoveReference (ObjDesc); - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/utinit.c b/drivers/acpica/utinit.c deleted file mode 100644 index 2299f58..0000000 --- a/drivers/acpica/utinit.c +++ /dev/null @@ -1,459 +0,0 @@ -/****************************************************************************** - * - * Module Name: utinit - Common ACPI subsystem initialization - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" -#include "acevents.h" -#include "actables.h" - -#define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utinit") - -/* Local prototypes */ - -static void AcpiUtTerminate ( - void); - -#if (!ACPI_REDUCED_HARDWARE) - -static void -AcpiUtFreeGpeLists ( - void); - -#else - -#define AcpiUtFreeGpeLists() -#endif /* !ACPI_REDUCED_HARDWARE */ - - -#if (!ACPI_REDUCED_HARDWARE) -/****************************************************************************** - * - * FUNCTION: AcpiUtFreeGpeLists - * - * PARAMETERS: none - * - * RETURN: none - * - * DESCRIPTION: Free global GPE lists - * - ******************************************************************************/ - -static void -AcpiUtFreeGpeLists ( - void) -{ - ACPI_GPE_BLOCK_INFO *GpeBlock; - ACPI_GPE_BLOCK_INFO *NextGpeBlock; - ACPI_GPE_XRUPT_INFO *GpeXruptInfo; - ACPI_GPE_XRUPT_INFO *NextGpeXruptInfo; - - - /* Free global GPE blocks and related info structures */ - - GpeXruptInfo = AcpiGbl_GpeXruptListHead; - while (GpeXruptInfo) - { - GpeBlock = GpeXruptInfo->GpeBlockListHead; - while (GpeBlock) - { - NextGpeBlock = GpeBlock->Next; - ACPI_FREE (GpeBlock->EventInfo); - ACPI_FREE (GpeBlock->RegisterInfo); - ACPI_FREE (GpeBlock); - - GpeBlock = NextGpeBlock; - } - NextGpeXruptInfo = GpeXruptInfo->Next; - ACPI_FREE (GpeXruptInfo); - GpeXruptInfo = NextGpeXruptInfo; - } -} -#endif /* !ACPI_REDUCED_HARDWARE */ - - -/******************************************************************************* - * - * FUNCTION: AcpiUtInitGlobals - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Initialize ACPICA globals. All globals that require specific - * initialization should be initialized here. This allows for - * a warm restart. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtInitGlobals ( - void) -{ - ACPI_STATUS Status; - UINT32 i; - - - ACPI_FUNCTION_TRACE (UtInitGlobals); - - - /* Create all memory caches */ - - Status = AcpiUtCreateCaches (); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Address Range lists */ - - for (i = 0; i < ACPI_ADDRESS_RANGE_MAX; i++) - { - AcpiGbl_AddressRangeList[i] = NULL; - } - - /* Mutex locked flags */ - - for (i = 0; i < ACPI_NUM_MUTEX; i++) - { - AcpiGbl_MutexInfo[i].Mutex = NULL; - AcpiGbl_MutexInfo[i].ThreadId = ACPI_MUTEX_NOT_ACQUIRED; - AcpiGbl_MutexInfo[i].UseCount = 0; - } - - for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++) - { - AcpiGbl_OwnerIdMask[i] = 0; - } - - /* Last OwnerID is never valid */ - - AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000; - - /* Event counters */ - - AcpiMethodCount = 0; - AcpiSciCount = 0; - AcpiGpeCount = 0; - - for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) - { - AcpiFixedEventCount[i] = 0; - } - -#if (!ACPI_REDUCED_HARDWARE) - - /* GPE/SCI support */ - - AcpiGbl_AllGpesInitialized = FALSE; - AcpiGbl_GpeXruptListHead = NULL; - AcpiGbl_GpeFadtBlocks[0] = NULL; - AcpiGbl_GpeFadtBlocks[1] = NULL; - AcpiCurrentGpeCount = 0; - - AcpiGbl_GlobalEventHandler = NULL; - AcpiGbl_SciHandlerList = NULL; - -#endif /* !ACPI_REDUCED_HARDWARE */ - - /* Global handlers */ - - AcpiGbl_GlobalNotify[0].Handler = NULL; - AcpiGbl_GlobalNotify[1].Handler = NULL; - AcpiGbl_ExceptionHandler = NULL; - AcpiGbl_InitHandler = NULL; - AcpiGbl_TableHandler = NULL; - AcpiGbl_InterfaceHandler = NULL; - - /* Global Lock support */ - - AcpiGbl_GlobalLockSemaphore = ACPI_SEMAPHORE_NULL; - AcpiGbl_GlobalLockMutex = NULL; - AcpiGbl_GlobalLockAcquired = FALSE; - AcpiGbl_GlobalLockHandle = 0; - AcpiGbl_GlobalLockPresent = FALSE; - - /* Miscellaneous variables */ - - AcpiGbl_DSDT = NULL; - AcpiGbl_CmSingleStep = FALSE; - AcpiGbl_Shutdown = FALSE; - AcpiGbl_NsLookupCount = 0; - AcpiGbl_PsFindCount = 0; - AcpiGbl_AcpiHardwarePresent = TRUE; - AcpiGbl_LastOwnerIdIndex = 0; - AcpiGbl_NextOwnerIdOffset = 0; - AcpiGbl_DebuggerConfiguration = DEBUGGER_THREADING; - AcpiGbl_OsiMutex = NULL; - - /* Hardware oriented */ - - AcpiGbl_EventsInitialized = FALSE; - AcpiGbl_SystemAwakeAndRunning = TRUE; - - /* Namespace */ - - AcpiGbl_RootNode = NULL; - AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME; - AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED; - AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_DEVICE; - AcpiGbl_RootNodeStruct.Parent = NULL; - AcpiGbl_RootNodeStruct.Child = NULL; - AcpiGbl_RootNodeStruct.Peer = NULL; - AcpiGbl_RootNodeStruct.Object = NULL; - - -#ifdef ACPI_DISASSEMBLER - AcpiGbl_ExternalList = NULL; - AcpiGbl_NumExternalMethods = 0; - AcpiGbl_ResolvedExternalMethods = 0; -#endif - -#ifdef ACPI_DEBUG_OUTPUT - AcpiGbl_LowestStackPointer = ACPI_CAST_PTR (ACPI_SIZE, ACPI_SIZE_MAX); -#endif - -#ifdef ACPI_DBG_TRACK_ALLOCATIONS - AcpiGbl_DisplayFinalMemStats = FALSE; - AcpiGbl_DisableMemTracking = FALSE; -#endif - - return_ACPI_STATUS (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiUtTerminate - * - * PARAMETERS: none - * - * RETURN: none - * - * DESCRIPTION: Free global memory - * - ******************************************************************************/ - -static void -AcpiUtTerminate ( - void) -{ - ACPI_FUNCTION_TRACE (UtTerminate); - - AcpiUtFreeGpeLists (); - AcpiUtDeleteAddressLists (); - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtSubsystemShutdown - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Shutdown the various components. Do not delete the mutex - * objects here, because the AML debugger may be still running. - * - ******************************************************************************/ - -void -AcpiUtSubsystemShutdown ( - void) -{ - ACPI_FUNCTION_TRACE (UtSubsystemShutdown); - - - /* Just exit if subsystem is already shutdown */ - - if (AcpiGbl_Shutdown) - { - ACPI_ERROR ((AE_INFO, "ACPI Subsystem is already terminated")); - return_VOID; - } - - /* Subsystem appears active, go ahead and shut it down */ - - AcpiGbl_Shutdown = TRUE; - AcpiGbl_StartupFlags = 0; - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n")); - -#ifndef ACPI_ASL_COMPILER - - /* Close the AcpiEvent Handling */ - - AcpiEvTerminate (); - - /* Delete any dynamic _OSI interfaces */ - - AcpiUtInterfaceTerminate (); -#endif - - /* Close the Namespace */ - - AcpiNsTerminate (); - - /* Delete the ACPI tables */ - - AcpiTbTerminate (); - - /* Close the globals */ - - AcpiUtTerminate (); - - /* Purge the local caches */ - - (void) AcpiUtDeleteCaches (); - return_VOID; -} diff --git a/drivers/acpica/utlock.c b/drivers/acpica/utlock.c deleted file mode 100644 index c7ee5a5..0000000 --- a/drivers/acpica/utlock.c +++ /dev/null @@ -1,310 +0,0 @@ -/****************************************************************************** - * - * Module Name: utlock - Reader/Writer lock interfaces - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" - - -#define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utlock") - - -/******************************************************************************* - * - * FUNCTION: AcpiUtCreateRwLock - * AcpiUtDeleteRwLock - * - * PARAMETERS: Lock - Pointer to a valid RW lock - * - * RETURN: Status - * - * DESCRIPTION: Reader/writer lock creation and deletion interfaces. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtCreateRwLock ( - ACPI_RW_LOCK *Lock) -{ - ACPI_STATUS Status; - - - Lock->NumReaders = 0; - Status = AcpiOsCreateMutex (&Lock->ReaderMutex); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - Status = AcpiOsCreateMutex (&Lock->WriterMutex); - return (Status); -} - - -void -AcpiUtDeleteRwLock ( - ACPI_RW_LOCK *Lock) -{ - - AcpiOsDeleteMutex (Lock->ReaderMutex); - AcpiOsDeleteMutex (Lock->WriterMutex); - - Lock->NumReaders = 0; - Lock->ReaderMutex = NULL; - Lock->WriterMutex = NULL; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtAcquireReadLock - * AcpiUtReleaseReadLock - * - * PARAMETERS: Lock - Pointer to a valid RW lock - * - * RETURN: Status - * - * DESCRIPTION: Reader interfaces for reader/writer locks. On acquisition, - * only the first reader acquires the write mutex. On release, - * only the last reader releases the write mutex. Although this - * algorithm can in theory starve writers, this should not be a - * problem with ACPICA since the subsystem is infrequently used - * in comparison to (for example) an I/O system. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtAcquireReadLock ( - ACPI_RW_LOCK *Lock) -{ - ACPI_STATUS Status; - - - Status = AcpiOsAcquireMutex (Lock->ReaderMutex, ACPI_WAIT_FOREVER); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Acquire the write lock only for the first reader */ - - Lock->NumReaders++; - if (Lock->NumReaders == 1) - { - Status = AcpiOsAcquireMutex (Lock->WriterMutex, ACPI_WAIT_FOREVER); - } - - AcpiOsReleaseMutex (Lock->ReaderMutex); - return (Status); -} - - -ACPI_STATUS -AcpiUtReleaseReadLock ( - ACPI_RW_LOCK *Lock) -{ - ACPI_STATUS Status; - - - Status = AcpiOsAcquireMutex (Lock->ReaderMutex, ACPI_WAIT_FOREVER); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Release the write lock only for the very last reader */ - - Lock->NumReaders--; - if (Lock->NumReaders == 0) - { - AcpiOsReleaseMutex (Lock->WriterMutex); - } - - AcpiOsReleaseMutex (Lock->ReaderMutex); - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtAcquireWriteLock - * AcpiUtReleaseWriteLock - * - * PARAMETERS: Lock - Pointer to a valid RW lock - * - * RETURN: Status - * - * DESCRIPTION: Writer interfaces for reader/writer locks. Simply acquire or - * release the writer mutex associated with the lock. Acquisition - * of the lock is fully exclusive and will block all readers and - * writers until it is released. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtAcquireWriteLock ( - ACPI_RW_LOCK *Lock) -{ - ACPI_STATUS Status; - - - Status = AcpiOsAcquireMutex (Lock->WriterMutex, ACPI_WAIT_FOREVER); - return (Status); -} - - -void -AcpiUtReleaseWriteLock ( - ACPI_RW_LOCK *Lock) -{ - - AcpiOsReleaseMutex (Lock->WriterMutex); -} diff --git a/drivers/acpica/utmath.c b/drivers/acpica/utmath.c deleted file mode 100644 index a3692d7..0000000 --- a/drivers/acpica/utmath.c +++ /dev/null @@ -1,724 +0,0 @@ -/******************************************************************************* - * - * Module Name: utmath - Integer math support routines - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" - - -#define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utmath") - -/* Structures used only for 64-bit divide */ - -typedef struct uint64_struct -{ - UINT32 Lo; - UINT32 Hi; - -} UINT64_STRUCT; - -typedef union uint64_overlay -{ - UINT64 Full; - UINT64_STRUCT Part; - -} UINT64_OVERLAY; - -/* - * Optional support for 64-bit double-precision integer multiply and shift. - * This code is configurable and is implemented in order to support 32-bit - * kernel environments where a 64-bit double-precision math library is not - * available. - */ -#ifndef ACPI_USE_NATIVE_MATH64 - -/******************************************************************************* - * - * FUNCTION: AcpiUtShortMultiply - * - * PARAMETERS: Multiplicand - 64-bit multiplicand - * Multiplier - 32-bit multiplier - * OutProduct - Pointer to where the product is returned - * - * DESCRIPTION: Perform a short multiply. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtShortMultiply ( - UINT64 Multiplicand, - UINT32 Multiplier, - UINT64 *OutProduct) -{ - UINT64_OVERLAY MultiplicandOvl; - UINT64_OVERLAY Product; - UINT32 Carry32; - - - ACPI_FUNCTION_TRACE (UtShortMultiply); - - - MultiplicandOvl.Full = Multiplicand; - - /* - * The Product is 64 bits, the carry is always 32 bits, - * and is generated by the second multiply. - */ - ACPI_MUL_64_BY_32 (0, MultiplicandOvl.Part.Hi, Multiplier, - Product.Part.Hi, Carry32); - - ACPI_MUL_64_BY_32 (0, MultiplicandOvl.Part.Lo, Multiplier, - Product.Part.Lo, Carry32); - - Product.Part.Hi += Carry32; - - /* Return only what was requested */ - - if (OutProduct) - { - *OutProduct = Product.Full; - } - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtShortShiftLeft - * - * PARAMETERS: Operand - 64-bit shift operand - * Count - 32-bit shift count - * OutResult - Pointer to where the result is returned - * - * DESCRIPTION: Perform a short left shift. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtShortShiftLeft ( - UINT64 Operand, - UINT32 Count, - UINT64 *OutResult) -{ - UINT64_OVERLAY OperandOvl; - - - ACPI_FUNCTION_TRACE (UtShortShiftLeft); - - - OperandOvl.Full = Operand; - - if ((Count & 63) >= 32) - { - OperandOvl.Part.Hi = OperandOvl.Part.Lo; - OperandOvl.Part.Lo = 0; - Count = (Count & 63) - 32; - } - ACPI_SHIFT_LEFT_64_BY_32 (OperandOvl.Part.Hi, - OperandOvl.Part.Lo, Count); - - /* Return only what was requested */ - - if (OutResult) - { - *OutResult = OperandOvl.Full; - } - - return_ACPI_STATUS (AE_OK); -} - -/******************************************************************************* - * - * FUNCTION: AcpiUtShortShiftRight - * - * PARAMETERS: Operand - 64-bit shift operand - * Count - 32-bit shift count - * OutResult - Pointer to where the result is returned - * - * DESCRIPTION: Perform a short right shift. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtShortShiftRight ( - UINT64 Operand, - UINT32 Count, - UINT64 *OutResult) -{ - UINT64_OVERLAY OperandOvl; - - - ACPI_FUNCTION_TRACE (UtShortShiftRight); - - - OperandOvl.Full = Operand; - - if ((Count & 63) >= 32) - { - OperandOvl.Part.Lo = OperandOvl.Part.Hi; - OperandOvl.Part.Hi = 0; - Count = (Count & 63) - 32; - } - ACPI_SHIFT_RIGHT_64_BY_32 (OperandOvl.Part.Hi, - OperandOvl.Part.Lo, Count); - - /* Return only what was requested */ - - if (OutResult) - { - *OutResult = OperandOvl.Full; - } - - return_ACPI_STATUS (AE_OK); -} -#else - -/******************************************************************************* - * - * FUNCTION: AcpiUtShortMultiply - * - * PARAMETERS: See function headers above - * - * DESCRIPTION: Native version of the UtShortMultiply function. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtShortMultiply ( - UINT64 Multiplicand, - UINT32 Multiplier, - UINT64 *OutProduct) -{ - - ACPI_FUNCTION_TRACE (UtShortMultiply); - - - /* Return only what was requested */ - - if (OutProduct) - { - *OutProduct = Multiplicand * Multiplier; - } - - return_ACPI_STATUS (AE_OK); -} - -/******************************************************************************* - * - * FUNCTION: AcpiUtShortShiftLeft - * - * PARAMETERS: See function headers above - * - * DESCRIPTION: Native version of the UtShortShiftLeft function. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtShortShiftLeft ( - UINT64 Operand, - UINT32 Count, - UINT64 *OutResult) -{ - - ACPI_FUNCTION_TRACE (UtShortShiftLeft); - - - /* Return only what was requested */ - - if (OutResult) - { - *OutResult = Operand << Count; - } - - return_ACPI_STATUS (AE_OK); -} - -/******************************************************************************* - * - * FUNCTION: AcpiUtShortShiftRight - * - * PARAMETERS: See function headers above - * - * DESCRIPTION: Native version of the UtShortShiftRight function. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtShortShiftRight ( - UINT64 Operand, - UINT32 Count, - UINT64 *OutResult) -{ - - ACPI_FUNCTION_TRACE (UtShortShiftRight); - - - /* Return only what was requested */ - - if (OutResult) - { - *OutResult = Operand >> Count; - } - - return_ACPI_STATUS (AE_OK); -} -#endif - -/* - * Optional support for 64-bit double-precision integer divide. This code - * is configurable and is implemented in order to support 32-bit kernel - * environments where a 64-bit double-precision math library is not available. - * - * Support for a more normal 64-bit divide/modulo (with check for a divide- - * by-zero) appears after this optional section of code. - */ -#ifndef ACPI_USE_NATIVE_DIVIDE - - -/******************************************************************************* - * - * FUNCTION: AcpiUtShortDivide - * - * PARAMETERS: Dividend - 64-bit dividend - * Divisor - 32-bit divisor - * OutQuotient - Pointer to where the quotient is returned - * OutRemainder - Pointer to where the remainder is returned - * - * RETURN: Status (Checks for divide-by-zero) - * - * DESCRIPTION: Perform a short (maximum 64 bits divided by 32 bits) - * divide and modulo. The result is a 64-bit quotient and a - * 32-bit remainder. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtShortDivide ( - UINT64 Dividend, - UINT32 Divisor, - UINT64 *OutQuotient, - UINT32 *OutRemainder) -{ - UINT64_OVERLAY DividendOvl; - UINT64_OVERLAY Quotient; - UINT32 Remainder32; - - - ACPI_FUNCTION_TRACE (UtShortDivide); - - - /* Always check for a zero divisor */ - - if (Divisor == 0) - { - ACPI_ERROR ((AE_INFO, "Divide by zero")); - return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO); - } - - DividendOvl.Full = Dividend; - - /* - * The quotient is 64 bits, the remainder is always 32 bits, - * and is generated by the second divide. - */ - ACPI_DIV_64_BY_32 (0, DividendOvl.Part.Hi, Divisor, - Quotient.Part.Hi, Remainder32); - - ACPI_DIV_64_BY_32 (Remainder32, DividendOvl.Part.Lo, Divisor, - Quotient.Part.Lo, Remainder32); - - /* Return only what was requested */ - - if (OutQuotient) - { - *OutQuotient = Quotient.Full; - } - if (OutRemainder) - { - *OutRemainder = Remainder32; - } - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtDivide - * - * PARAMETERS: InDividend - Dividend - * InDivisor - Divisor - * OutQuotient - Pointer to where the quotient is returned - * OutRemainder - Pointer to where the remainder is returned - * - * RETURN: Status (Checks for divide-by-zero) - * - * DESCRIPTION: Perform a divide and modulo. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtDivide ( - UINT64 InDividend, - UINT64 InDivisor, - UINT64 *OutQuotient, - UINT64 *OutRemainder) -{ - UINT64_OVERLAY Dividend; - UINT64_OVERLAY Divisor; - UINT64_OVERLAY Quotient; - UINT64_OVERLAY Remainder; - UINT64_OVERLAY NormalizedDividend; - UINT64_OVERLAY NormalizedDivisor; - UINT32 Partial1; - UINT64_OVERLAY Partial2; - UINT64_OVERLAY Partial3; - - - ACPI_FUNCTION_TRACE (UtDivide); - - - /* Always check for a zero divisor */ - - if (InDivisor == 0) - { - ACPI_ERROR ((AE_INFO, "Divide by zero")); - return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO); - } - - Divisor.Full = InDivisor; - Dividend.Full = InDividend; - if (Divisor.Part.Hi == 0) - { - /* - * 1) Simplest case is where the divisor is 32 bits, we can - * just do two divides - */ - Remainder.Part.Hi = 0; - - /* - * The quotient is 64 bits, the remainder is always 32 bits, - * and is generated by the second divide. - */ - ACPI_DIV_64_BY_32 (0, Dividend.Part.Hi, Divisor.Part.Lo, - Quotient.Part.Hi, Partial1); - - ACPI_DIV_64_BY_32 (Partial1, Dividend.Part.Lo, Divisor.Part.Lo, - Quotient.Part.Lo, Remainder.Part.Lo); - } - - else - { - /* - * 2) The general case where the divisor is a full 64 bits - * is more difficult - */ - Quotient.Part.Hi = 0; - NormalizedDividend = Dividend; - NormalizedDivisor = Divisor; - - /* Normalize the operands (shift until the divisor is < 32 bits) */ - - do - { - ACPI_SHIFT_RIGHT_64 ( - NormalizedDivisor.Part.Hi, NormalizedDivisor.Part.Lo); - ACPI_SHIFT_RIGHT_64 ( - NormalizedDividend.Part.Hi, NormalizedDividend.Part.Lo); - - } while (NormalizedDivisor.Part.Hi != 0); - - /* Partial divide */ - - ACPI_DIV_64_BY_32 ( - NormalizedDividend.Part.Hi, NormalizedDividend.Part.Lo, - NormalizedDivisor.Part.Lo, Quotient.Part.Lo, Partial1); - - /* - * The quotient is always 32 bits, and simply requires - * adjustment. The 64-bit remainder must be generated. - */ - Partial1 = Quotient.Part.Lo * Divisor.Part.Hi; - Partial2.Full = (UINT64) Quotient.Part.Lo * Divisor.Part.Lo; - Partial3.Full = (UINT64) Partial2.Part.Hi + Partial1; - - Remainder.Part.Hi = Partial3.Part.Lo; - Remainder.Part.Lo = Partial2.Part.Lo; - - if (Partial3.Part.Hi == 0) - { - if (Partial3.Part.Lo >= Dividend.Part.Hi) - { - if (Partial3.Part.Lo == Dividend.Part.Hi) - { - if (Partial2.Part.Lo > Dividend.Part.Lo) - { - Quotient.Part.Lo--; - Remainder.Full -= Divisor.Full; - } - } - else - { - Quotient.Part.Lo--; - Remainder.Full -= Divisor.Full; - } - } - - Remainder.Full = Remainder.Full - Dividend.Full; - Remainder.Part.Hi = (UINT32) -((INT32) Remainder.Part.Hi); - Remainder.Part.Lo = (UINT32) -((INT32) Remainder.Part.Lo); - - if (Remainder.Part.Lo) - { - Remainder.Part.Hi--; - } - } - } - - /* Return only what was requested */ - - if (OutQuotient) - { - *OutQuotient = Quotient.Full; - } - if (OutRemainder) - { - *OutRemainder = Remainder.Full; - } - - return_ACPI_STATUS (AE_OK); -} - -#else - -/******************************************************************************* - * - * FUNCTION: AcpiUtShortDivide, AcpiUtDivide - * - * PARAMETERS: See function headers above - * - * DESCRIPTION: Native versions of the UtDivide functions. Use these if either - * 1) The target is a 64-bit platform and therefore 64-bit - * integer math is supported directly by the machine. - * 2) The target is a 32-bit or 16-bit platform, and the - * double-precision integer math library is available to - * perform the divide. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtShortDivide ( - UINT64 InDividend, - UINT32 Divisor, - UINT64 *OutQuotient, - UINT32 *OutRemainder) -{ - - ACPI_FUNCTION_TRACE (UtShortDivide); - - - /* Always check for a zero divisor */ - - if (Divisor == 0) - { - ACPI_ERROR ((AE_INFO, "Divide by zero")); - return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO); - } - - /* Return only what was requested */ - - if (OutQuotient) - { - *OutQuotient = InDividend / Divisor; - } - if (OutRemainder) - { - *OutRemainder = (UINT32) (InDividend % Divisor); - } - - return_ACPI_STATUS (AE_OK); -} - -ACPI_STATUS -AcpiUtDivide ( - UINT64 InDividend, - UINT64 InDivisor, - UINT64 *OutQuotient, - UINT64 *OutRemainder) -{ - ACPI_FUNCTION_TRACE (UtDivide); - - - /* Always check for a zero divisor */ - - if (InDivisor == 0) - { - ACPI_ERROR ((AE_INFO, "Divide by zero")); - return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO); - } - - - /* Return only what was requested */ - - if (OutQuotient) - { - *OutQuotient = InDividend / InDivisor; - } - if (OutRemainder) - { - *OutRemainder = InDividend % InDivisor; - } - - return_ACPI_STATUS (AE_OK); -} - -#endif diff --git a/drivers/acpica/utmisc.c b/drivers/acpica/utmisc.c deleted file mode 100644 index 7c0f981..0000000 --- a/drivers/acpica/utmisc.c +++ /dev/null @@ -1,573 +0,0 @@ -/******************************************************************************* - * - * Module Name: utmisc - common utility procedures - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" - - -#define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utmisc") - - -/******************************************************************************* - * - * FUNCTION: AcpiUtIsPciRootBridge - * - * PARAMETERS: Id - The HID/CID in string format - * - * RETURN: TRUE if the Id is a match for a PCI/PCI-Express Root Bridge - * - * DESCRIPTION: Determine if the input ID is a PCI Root Bridge ID. - * - ******************************************************************************/ - -BOOLEAN -AcpiUtIsPciRootBridge ( - char *Id) -{ - - /* - * Check if this is a PCI root bridge. - * ACPI 3.0+: check for a PCI Express root also. - */ - if (!(strcmp (Id, - PCI_ROOT_HID_STRING)) || - - !(strcmp (Id, - PCI_EXPRESS_ROOT_HID_STRING))) - { - return (TRUE); - } - - return (FALSE); -} - - -#if (defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP || defined ACPI_NAMES_APP) -/******************************************************************************* - * - * FUNCTION: AcpiUtIsAmlTable - * - * PARAMETERS: Table - An ACPI table - * - * RETURN: TRUE if table contains executable AML; FALSE otherwise - * - * DESCRIPTION: Check ACPI Signature for a table that contains AML code. - * Currently, these are DSDT,SSDT,PSDT. All other table types are - * data tables that do not contain AML code. - * - ******************************************************************************/ - -BOOLEAN -AcpiUtIsAmlTable ( - ACPI_TABLE_HEADER *Table) -{ - - /* These are the only tables that contain executable AML */ - - if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_DSDT) || - ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_PSDT) || - ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_SSDT) || - ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_OSDT) || - ACPI_IS_OEM_SIG (Table->Signature)) - { - return (TRUE); - } - - return (FALSE); -} -#endif - - -/******************************************************************************* - * - * FUNCTION: AcpiUtDwordByteSwap - * - * PARAMETERS: Value - Value to be converted - * - * RETURN: UINT32 integer with bytes swapped - * - * DESCRIPTION: Convert a 32-bit value to big-endian (swap the bytes) - * - ******************************************************************************/ - -UINT32 -AcpiUtDwordByteSwap ( - UINT32 Value) -{ - union - { - UINT32 Value; - UINT8 Bytes[4]; - } Out; - union - { - UINT32 Value; - UINT8 Bytes[4]; - } In; - - - ACPI_FUNCTION_ENTRY (); - - - In.Value = Value; - - Out.Bytes[0] = In.Bytes[3]; - Out.Bytes[1] = In.Bytes[2]; - Out.Bytes[2] = In.Bytes[1]; - Out.Bytes[3] = In.Bytes[0]; - - return (Out.Value); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtSetIntegerWidth - * - * PARAMETERS: Revision From DSDT header - * - * RETURN: None - * - * DESCRIPTION: Set the global integer bit width based upon the revision - * of the DSDT. For Revision 1 and 0, Integers are 32 bits. - * For Revision 2 and above, Integers are 64 bits. Yes, this - * makes a difference. - * - ******************************************************************************/ - -void -AcpiUtSetIntegerWidth ( - UINT8 Revision) -{ - - if (Revision < 2) - { - /* 32-bit case */ - - AcpiGbl_IntegerBitWidth = 32; - AcpiGbl_IntegerNybbleWidth = 8; - AcpiGbl_IntegerByteWidth = 4; - } - else - { - /* 64-bit case (ACPI 2.0+) */ - - AcpiGbl_IntegerBitWidth = 64; - AcpiGbl_IntegerNybbleWidth = 16; - AcpiGbl_IntegerByteWidth = 8; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtCreateUpdateStateAndPush - * - * PARAMETERS: Object - Object to be added to the new state - * Action - Increment/Decrement - * StateList - List the state will be added to - * - * RETURN: Status - * - * DESCRIPTION: Create a new state and push it - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtCreateUpdateStateAndPush ( - ACPI_OPERAND_OBJECT *Object, - UINT16 Action, - ACPI_GENERIC_STATE **StateList) -{ - ACPI_GENERIC_STATE *State; - - - ACPI_FUNCTION_ENTRY (); - - - /* Ignore null objects; these are expected */ - - if (!Object) - { - return (AE_OK); - } - - State = AcpiUtCreateUpdateState (Object, Action); - if (!State) - { - return (AE_NO_MEMORY); - } - - AcpiUtPushGenericState (StateList, State); - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtWalkPackageTree - * - * PARAMETERS: SourceObject - The package to walk - * TargetObject - Target object (if package is being copied) - * WalkCallback - Called once for each package element - * Context - Passed to the callback function - * - * RETURN: Status - * - * DESCRIPTION: Walk through a package, including subpackages - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtWalkPackageTree ( - ACPI_OPERAND_OBJECT *SourceObject, - void *TargetObject, - ACPI_PKG_CALLBACK WalkCallback, - void *Context) -{ - ACPI_STATUS Status = AE_OK; - ACPI_GENERIC_STATE *StateList = NULL; - ACPI_GENERIC_STATE *State; - ACPI_OPERAND_OBJECT *ThisSourceObj; - UINT32 ThisIndex; - - - ACPI_FUNCTION_TRACE (UtWalkPackageTree); - - - State = AcpiUtCreatePkgState (SourceObject, TargetObject, 0); - if (!State) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - while (State) - { - /* Get one element of the package */ - - ThisIndex = State->Pkg.Index; - ThisSourceObj = - State->Pkg.SourceObject->Package.Elements[ThisIndex]; - State->Pkg.ThisTargetObj = - &State->Pkg.SourceObject->Package.Elements[ThisIndex]; - - /* - * Check for: - * 1) An uninitialized package element. It is completely - * legal to declare a package and leave it uninitialized - * 2) Not an internal object - can be a namespace node instead - * 3) Any type other than a package. Packages are handled in else - * case below. - */ - if ((!ThisSourceObj) || - (ACPI_GET_DESCRIPTOR_TYPE (ThisSourceObj) != - ACPI_DESC_TYPE_OPERAND) || - (ThisSourceObj->Common.Type != ACPI_TYPE_PACKAGE)) - { - Status = WalkCallback (ACPI_COPY_TYPE_SIMPLE, ThisSourceObj, - State, Context); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - State->Pkg.Index++; - while (State->Pkg.Index >= - State->Pkg.SourceObject->Package.Count) - { - /* - * We've handled all of the objects at this level, This means - * that we have just completed a package. That package may - * have contained one or more packages itself. - * - * Delete this state and pop the previous state (package). - */ - AcpiUtDeleteGenericState (State); - State = AcpiUtPopGenericState (&StateList); - - /* Finished when there are no more states */ - - if (!State) - { - /* - * We have handled all of the objects in the top level - * package just add the length of the package objects - * and exit - */ - return_ACPI_STATUS (AE_OK); - } - - /* - * Go back up a level and move the index past the just - * completed package object. - */ - State->Pkg.Index++; - } - } - else - { - /* This is a subobject of type package */ - - Status = WalkCallback ( - ACPI_COPY_TYPE_PACKAGE, ThisSourceObj, State, Context); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* - * Push the current state and create a new one - * The callback above returned a new target package object. - */ - AcpiUtPushGenericState (&StateList, State); - State = AcpiUtCreatePkgState ( - ThisSourceObj, State->Pkg.ThisTargetObj, 0); - if (!State) - { - /* Free any stacked Update State objects */ - - while (StateList) - { - State = AcpiUtPopGenericState (&StateList); - AcpiUtDeleteGenericState (State); - } - return_ACPI_STATUS (AE_NO_MEMORY); - } - } - } - - /* We should never get here */ - - ACPI_ERROR ((AE_INFO, - "State list did not terminate correctly")); - - return_ACPI_STATUS (AE_AML_INTERNAL); -} - - -#ifdef ACPI_DEBUG_OUTPUT -/******************************************************************************* - * - * FUNCTION: AcpiUtDisplayInitPathname - * - * PARAMETERS: Type - Object type of the node - * ObjHandle - Handle whose pathname will be displayed - * Path - Additional path string to be appended. - * (NULL if no extra path) - * - * RETURN: ACPI_STATUS - * - * DESCRIPTION: Display full pathname of an object, DEBUG ONLY - * - ******************************************************************************/ - -void -AcpiUtDisplayInitPathname ( - UINT8 Type, - ACPI_NAMESPACE_NODE *ObjHandle, - const char *Path) -{ - ACPI_STATUS Status; - ACPI_BUFFER Buffer; - - - ACPI_FUNCTION_ENTRY (); - - - /* Only print the path if the appropriate debug level is enabled */ - - if (!(AcpiDbgLevel & ACPI_LV_INIT_NAMES)) - { - return; - } - - /* Get the full pathname to the node */ - - Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiNsHandleToPathname (ObjHandle, &Buffer, TRUE); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* Print what we're doing */ - - switch (Type) - { - case ACPI_TYPE_METHOD: - - AcpiOsPrintf ("Executing "); - break; - - default: - - AcpiOsPrintf ("Initializing "); - break; - } - - /* Print the object type and pathname */ - - AcpiOsPrintf ("%-12s %s", - AcpiUtGetTypeName (Type), (char *) Buffer.Pointer); - - /* Extra path is used to append names like _STA, _INI, etc. */ - - if (Path) - { - AcpiOsPrintf (".%s", Path); - } - AcpiOsPrintf ("\n"); - - ACPI_FREE (Buffer.Pointer); -} -#endif diff --git a/drivers/acpica/utmutex.c b/drivers/acpica/utmutex.c deleted file mode 100644 index bc1a43a..0000000 --- a/drivers/acpica/utmutex.c +++ /dev/null @@ -1,518 +0,0 @@ -/******************************************************************************* - * - * Module Name: utmutex - local mutex support - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" - -#define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utmutex") - -/* Local prototypes */ - -static ACPI_STATUS -AcpiUtCreateMutex ( - ACPI_MUTEX_HANDLE MutexId); - -static void -AcpiUtDeleteMutex ( - ACPI_MUTEX_HANDLE MutexId); - - -/******************************************************************************* - * - * FUNCTION: AcpiUtMutexInitialize - * - * PARAMETERS: None. - * - * RETURN: Status - * - * DESCRIPTION: Create the system mutex objects. This includes mutexes, - * spin locks, and reader/writer locks. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtMutexInitialize ( - void) -{ - UINT32 i; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (UtMutexInitialize); - - - /* Create each of the predefined mutex objects */ - - for (i = 0; i < ACPI_NUM_MUTEX; i++) - { - Status = AcpiUtCreateMutex (i); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - /* Create the spinlocks for use at interrupt level or for speed */ - - Status = AcpiOsCreateLock (&AcpiGbl_GpeLock); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Status = AcpiOsCreateLock (&AcpiGbl_HardwareLock); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Status = AcpiOsCreateLock (&AcpiGbl_ReferenceCountLock); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Mutex for _OSI support */ - - Status = AcpiOsCreateMutex (&AcpiGbl_OsiMutex); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Create the reader/writer lock for namespace access */ - - Status = AcpiUtCreateRwLock (&AcpiGbl_NamespaceRwLock); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtMutexTerminate - * - * PARAMETERS: None. - * - * RETURN: None. - * - * DESCRIPTION: Delete all of the system mutex objects. This includes mutexes, - * spin locks, and reader/writer locks. - * - ******************************************************************************/ - -void -AcpiUtMutexTerminate ( - void) -{ - UINT32 i; - - - ACPI_FUNCTION_TRACE (UtMutexTerminate); - - - /* Delete each predefined mutex object */ - - for (i = 0; i < ACPI_NUM_MUTEX; i++) - { - AcpiUtDeleteMutex (i); - } - - AcpiOsDeleteMutex (AcpiGbl_OsiMutex); - - /* Delete the spinlocks */ - - AcpiOsDeleteLock (AcpiGbl_GpeLock); - AcpiOsDeleteLock (AcpiGbl_HardwareLock); - AcpiOsDeleteLock (AcpiGbl_ReferenceCountLock); - - /* Delete the reader/writer lock */ - - AcpiUtDeleteRwLock (&AcpiGbl_NamespaceRwLock); - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtCreateMutex - * - * PARAMETERS: MutexID - ID of the mutex to be created - * - * RETURN: Status - * - * DESCRIPTION: Create a mutex object. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiUtCreateMutex ( - ACPI_MUTEX_HANDLE MutexId) -{ - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE_U32 (UtCreateMutex, MutexId); - - - if (!AcpiGbl_MutexInfo[MutexId].Mutex) - { - Status = AcpiOsCreateMutex (&AcpiGbl_MutexInfo[MutexId].Mutex); - AcpiGbl_MutexInfo[MutexId].ThreadId = ACPI_MUTEX_NOT_ACQUIRED; - AcpiGbl_MutexInfo[MutexId].UseCount = 0; - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtDeleteMutex - * - * PARAMETERS: MutexID - ID of the mutex to be deleted - * - * RETURN: Status - * - * DESCRIPTION: Delete a mutex object. - * - ******************************************************************************/ - -static void -AcpiUtDeleteMutex ( - ACPI_MUTEX_HANDLE MutexId) -{ - - ACPI_FUNCTION_TRACE_U32 (UtDeleteMutex, MutexId); - - - AcpiOsDeleteMutex (AcpiGbl_MutexInfo[MutexId].Mutex); - - AcpiGbl_MutexInfo[MutexId].Mutex = NULL; - AcpiGbl_MutexInfo[MutexId].ThreadId = ACPI_MUTEX_NOT_ACQUIRED; - - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtAcquireMutex - * - * PARAMETERS: MutexID - ID of the mutex to be acquired - * - * RETURN: Status - * - * DESCRIPTION: Acquire a mutex object. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtAcquireMutex ( - ACPI_MUTEX_HANDLE MutexId) -{ - ACPI_STATUS Status; - ACPI_THREAD_ID ThisThreadId; - - - ACPI_FUNCTION_NAME (UtAcquireMutex); - - - if (MutexId > ACPI_MAX_MUTEX) - { - return (AE_BAD_PARAMETER); - } - - ThisThreadId = AcpiOsGetThreadId (); - -#ifdef ACPI_MUTEX_DEBUG - { - UINT32 i; - /* - * Mutex debug code, for internal debugging only. - * - * Deadlock prevention. Check if this thread owns any mutexes of value - * greater than or equal to this one. If so, the thread has violated - * the mutex ordering rule. This indicates a coding error somewhere in - * the ACPI subsystem code. - */ - for (i = MutexId; i < ACPI_NUM_MUTEX; i++) - { - if (AcpiGbl_MutexInfo[i].ThreadId == ThisThreadId) - { - if (i == MutexId) - { - ACPI_ERROR ((AE_INFO, - "Mutex [%s] already acquired by this thread [%u]", - AcpiUtGetMutexName (MutexId), - (UINT32) ThisThreadId)); - - return (AE_ALREADY_ACQUIRED); - } - - ACPI_ERROR ((AE_INFO, - "Invalid acquire order: Thread %u owns [%s], wants [%s]", - (UINT32) ThisThreadId, AcpiUtGetMutexName (i), - AcpiUtGetMutexName (MutexId))); - - return (AE_ACQUIRE_DEADLOCK); - } - } - } -#endif - - ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, - "Thread %u attempting to acquire Mutex [%s]\n", - (UINT32) ThisThreadId, AcpiUtGetMutexName (MutexId))); - - Status = AcpiOsAcquireMutex ( - AcpiGbl_MutexInfo[MutexId].Mutex, ACPI_WAIT_FOREVER); - if (ACPI_SUCCESS (Status)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, - "Thread %u acquired Mutex [%s]\n", - (UINT32) ThisThreadId, AcpiUtGetMutexName (MutexId))); - - AcpiGbl_MutexInfo[MutexId].UseCount++; - AcpiGbl_MutexInfo[MutexId].ThreadId = ThisThreadId; - } - else - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Thread %u could not acquire Mutex [%s] (0x%X)", - (UINT32) ThisThreadId, AcpiUtGetMutexName (MutexId), MutexId)); - } - - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtReleaseMutex - * - * PARAMETERS: MutexID - ID of the mutex to be released - * - * RETURN: Status - * - * DESCRIPTION: Release a mutex object. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtReleaseMutex ( - ACPI_MUTEX_HANDLE MutexId) -{ - ACPI_FUNCTION_NAME (UtReleaseMutex); - - - ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %u releasing Mutex [%s]\n", - (UINT32) AcpiOsGetThreadId (), AcpiUtGetMutexName (MutexId))); - - if (MutexId > ACPI_MAX_MUTEX) - { - return (AE_BAD_PARAMETER); - } - - /* - * Mutex must be acquired in order to release it! - */ - if (AcpiGbl_MutexInfo[MutexId].ThreadId == ACPI_MUTEX_NOT_ACQUIRED) - { - ACPI_ERROR ((AE_INFO, - "Mutex [%s] (0x%X) is not acquired, cannot release", - AcpiUtGetMutexName (MutexId), MutexId)); - - return (AE_NOT_ACQUIRED); - } - -#ifdef ACPI_MUTEX_DEBUG - { - UINT32 i; - /* - * Mutex debug code, for internal debugging only. - * - * Deadlock prevention. Check if this thread owns any mutexes of value - * greater than this one. If so, the thread has violated the mutex - * ordering rule. This indicates a coding error somewhere in - * the ACPI subsystem code. - */ - for (i = MutexId; i < ACPI_NUM_MUTEX; i++) - { - if (AcpiGbl_MutexInfo[i].ThreadId == AcpiOsGetThreadId ()) - { - if (i == MutexId) - { - continue; - } - - ACPI_ERROR ((AE_INFO, - "Invalid release order: owns [%s], releasing [%s]", - AcpiUtGetMutexName (i), AcpiUtGetMutexName (MutexId))); - - return (AE_RELEASE_DEADLOCK); - } - } - } -#endif - - /* Mark unlocked FIRST */ - - AcpiGbl_MutexInfo[MutexId].ThreadId = ACPI_MUTEX_NOT_ACQUIRED; - - AcpiOsReleaseMutex (AcpiGbl_MutexInfo[MutexId].Mutex); - return (AE_OK); -} diff --git a/drivers/acpica/utnonansi.c b/drivers/acpica/utnonansi.c deleted file mode 100644 index 76fa07f..0000000 --- a/drivers/acpica/utnonansi.c +++ /dev/null @@ -1,360 +0,0 @@ -/******************************************************************************* - * - * Module Name: utnonansi - Non-ansi C library functions - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" - - -#define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utnonansi") - -/* - * Non-ANSI C library functions - strlwr, strupr, stricmp, and "safe" - * string functions. - */ - -/******************************************************************************* - * - * FUNCTION: AcpiUtStrlwr (strlwr) - * - * PARAMETERS: SrcString - The source string to convert - * - * RETURN: None - * - * DESCRIPTION: Convert a string to lowercase - * - ******************************************************************************/ - -void -AcpiUtStrlwr ( - char *SrcString) -{ - char *String; - - - ACPI_FUNCTION_ENTRY (); - - - if (!SrcString) - { - return; - } - - /* Walk entire string, lowercasing the letters */ - - for (String = SrcString; *String; String++) - { - *String = (char) tolower ((int) *String); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtStrupr (strupr) - * - * PARAMETERS: SrcString - The source string to convert - * - * RETURN: None - * - * DESCRIPTION: Convert a string to uppercase - * - ******************************************************************************/ - -void -AcpiUtStrupr ( - char *SrcString) -{ - char *String; - - - ACPI_FUNCTION_ENTRY (); - - - if (!SrcString) - { - return; - } - - /* Walk entire string, uppercasing the letters */ - - for (String = SrcString; *String; String++) - { - *String = (char) toupper ((int) *String); - } -} - - -/****************************************************************************** - * - * FUNCTION: AcpiUtStricmp (stricmp) - * - * PARAMETERS: String1 - first string to compare - * String2 - second string to compare - * - * RETURN: int that signifies string relationship. Zero means strings - * are equal. - * - * DESCRIPTION: Case-insensitive string compare. Implementation of the - * non-ANSI stricmp function. - * - ******************************************************************************/ - -int -AcpiUtStricmp ( - char *String1, - char *String2) -{ - int c1; - int c2; - - - do - { - c1 = tolower ((int) *String1); - c2 = tolower ((int) *String2); - - String1++; - String2++; - } - while ((c1 == c2) && (c1)); - - return (c1 - c2); -} - - -#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION) || defined (ACPI_DEBUG_OUTPUT) -/******************************************************************************* - * - * FUNCTION: AcpiUtSafeStrcpy, AcpiUtSafeStrcat, AcpiUtSafeStrncat - * - * PARAMETERS: Adds a "DestSize" parameter to each of the standard string - * functions. This is the size of the Destination buffer. - * - * RETURN: TRUE if the operation would overflow the destination buffer. - * - * DESCRIPTION: Safe versions of standard Clib string functions. Ensure that - * the result of the operation will not overflow the output string - * buffer. - * - * NOTE: These functions are typically only helpful for processing - * user input and command lines. For most ACPICA code, the - * required buffer length is precisely calculated before buffer - * allocation, so the use of these functions is unnecessary. - * - ******************************************************************************/ - -BOOLEAN -AcpiUtSafeStrcpy ( - char *Dest, - ACPI_SIZE DestSize, - char *Source) -{ - - if (strlen (Source) >= DestSize) - { - return (TRUE); - } - - strcpy (Dest, Source); - return (FALSE); -} - -BOOLEAN -AcpiUtSafeStrcat ( - char *Dest, - ACPI_SIZE DestSize, - char *Source) -{ - - if ((strlen (Dest) + strlen (Source)) >= DestSize) - { - return (TRUE); - } - - strcat (Dest, Source); - return (FALSE); -} - -BOOLEAN -AcpiUtSafeStrncat ( - char *Dest, - ACPI_SIZE DestSize, - char *Source, - ACPI_SIZE MaxTransferLength) -{ - ACPI_SIZE ActualTransferLength; - - - ActualTransferLength = ACPI_MIN (MaxTransferLength, strlen (Source)); - - if ((strlen (Dest) + ActualTransferLength) >= DestSize) - { - return (TRUE); - } - - strncat (Dest, Source, MaxTransferLength); - return (FALSE); -} - -void -AcpiUtSafeStrncpy ( - char *Dest, - char *Source, - ACPI_SIZE DestSize) -{ - /* Always terminate destination string */ - - strncpy (Dest, Source, DestSize); - Dest[DestSize - 1] = 0; -} - -#endif diff --git a/drivers/acpica/utobject.c b/drivers/acpica/utobject.c deleted file mode 100644 index 3278f05..0000000 --- a/drivers/acpica/utobject.c +++ /dev/null @@ -1,892 +0,0 @@ -/****************************************************************************** - * - * Module Name: utobject - ACPI object create/delete/size/cache routines - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" - - -#define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utobject") - -/* Local prototypes */ - -static ACPI_STATUS -AcpiUtGetSimpleObjectSize ( - ACPI_OPERAND_OBJECT *Obj, - ACPI_SIZE *ObjLength); - -static ACPI_STATUS -AcpiUtGetPackageObjectSize ( - ACPI_OPERAND_OBJECT *Obj, - ACPI_SIZE *ObjLength); - -static ACPI_STATUS -AcpiUtGetElementLength ( - UINT8 ObjectType, - ACPI_OPERAND_OBJECT *SourceObject, - ACPI_GENERIC_STATE *State, - void *Context); - - -/******************************************************************************* - * - * FUNCTION: AcpiUtCreateInternalObjectDbg - * - * PARAMETERS: ModuleName - Source file name of caller - * LineNumber - Line number of caller - * ComponentId - Component type of caller - * Type - ACPI Type of the new object - * - * RETURN: A new internal object, null on failure - * - * DESCRIPTION: Create and initialize a new internal object. - * - * NOTE: We always allocate the worst-case object descriptor because - * these objects are cached, and we want them to be - * one-size-satisfies-any-request. This in itself may not be - * the most memory efficient, but the efficiency of the object - * cache should more than make up for this! - * - ******************************************************************************/ - -ACPI_OPERAND_OBJECT * -AcpiUtCreateInternalObjectDbg ( - const char *ModuleName, - UINT32 LineNumber, - UINT32 ComponentId, - ACPI_OBJECT_TYPE Type) -{ - ACPI_OPERAND_OBJECT *Object; - ACPI_OPERAND_OBJECT *SecondObject; - - - ACPI_FUNCTION_TRACE_STR (UtCreateInternalObjectDbg, - AcpiUtGetTypeName (Type)); - - - /* Allocate the raw object descriptor */ - - Object = AcpiUtAllocateObjectDescDbg ( - ModuleName, LineNumber, ComponentId); - if (!Object) - { - return_PTR (NULL); - } - - switch (Type) - { - case ACPI_TYPE_REGION: - case ACPI_TYPE_BUFFER_FIELD: - case ACPI_TYPE_LOCAL_BANK_FIELD: - - /* These types require a secondary object */ - - SecondObject = AcpiUtAllocateObjectDescDbg ( - ModuleName, LineNumber, ComponentId); - if (!SecondObject) - { - AcpiUtDeleteObjectDesc (Object); - return_PTR (NULL); - } - - SecondObject->Common.Type = ACPI_TYPE_LOCAL_EXTRA; - SecondObject->Common.ReferenceCount = 1; - - /* Link the second object to the first */ - - Object->Common.NextObject = SecondObject; - break; - - default: - - /* All others have no secondary object */ - break; - } - - /* Save the object type in the object descriptor */ - - Object->Common.Type = (UINT8) Type; - - /* Init the reference count */ - - Object->Common.ReferenceCount = 1; - - /* Any per-type initialization should go here */ - - return_PTR (Object); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtCreatePackageObject - * - * PARAMETERS: Count - Number of package elements - * - * RETURN: Pointer to a new Package object, null on failure - * - * DESCRIPTION: Create a fully initialized package object - * - ******************************************************************************/ - -ACPI_OPERAND_OBJECT * -AcpiUtCreatePackageObject ( - UINT32 Count) -{ - ACPI_OPERAND_OBJECT *PackageDesc; - ACPI_OPERAND_OBJECT **PackageElements; - - - ACPI_FUNCTION_TRACE_U32 (UtCreatePackageObject, Count); - - - /* Create a new Package object */ - - PackageDesc = AcpiUtCreateInternalObject (ACPI_TYPE_PACKAGE); - if (!PackageDesc) - { - return_PTR (NULL); - } - - /* - * Create the element array. Count+1 allows the array to be null - * terminated. - */ - PackageElements = ACPI_ALLOCATE_ZEROED ( - ((ACPI_SIZE) Count + 1) * sizeof (void *)); - if (!PackageElements) - { - AcpiUtDeleteObjectDesc (PackageDesc); - return_PTR (NULL); - } - - PackageDesc->Package.Count = Count; - PackageDesc->Package.Elements = PackageElements; - return_PTR (PackageDesc); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtCreateIntegerObject - * - * PARAMETERS: InitialValue - Initial value for the integer - * - * RETURN: Pointer to a new Integer object, null on failure - * - * DESCRIPTION: Create an initialized integer object - * - ******************************************************************************/ - -ACPI_OPERAND_OBJECT * -AcpiUtCreateIntegerObject ( - UINT64 InitialValue) -{ - ACPI_OPERAND_OBJECT *IntegerDesc; - - - ACPI_FUNCTION_TRACE (UtCreateIntegerObject); - - - /* Create and initialize a new integer object */ - - IntegerDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); - if (!IntegerDesc) - { - return_PTR (NULL); - } - - IntegerDesc->Integer.Value = InitialValue; - return_PTR (IntegerDesc); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtCreateBufferObject - * - * PARAMETERS: BufferSize - Size of buffer to be created - * - * RETURN: Pointer to a new Buffer object, null on failure - * - * DESCRIPTION: Create a fully initialized buffer object - * - ******************************************************************************/ - -ACPI_OPERAND_OBJECT * -AcpiUtCreateBufferObject ( - ACPI_SIZE BufferSize) -{ - ACPI_OPERAND_OBJECT *BufferDesc; - UINT8 *Buffer = NULL; - - - ACPI_FUNCTION_TRACE_U32 (UtCreateBufferObject, BufferSize); - - - /* Create a new Buffer object */ - - BufferDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER); - if (!BufferDesc) - { - return_PTR (NULL); - } - - /* Create an actual buffer only if size > 0 */ - - if (BufferSize > 0) - { - /* Allocate the actual buffer */ - - Buffer = ACPI_ALLOCATE_ZEROED (BufferSize); - if (!Buffer) - { - ACPI_ERROR ((AE_INFO, "Could not allocate size %u", - (UINT32) BufferSize)); - - AcpiUtRemoveReference (BufferDesc); - return_PTR (NULL); - } - } - - /* Complete buffer object initialization */ - - BufferDesc->Buffer.Flags |= AOPOBJ_DATA_VALID; - BufferDesc->Buffer.Pointer = Buffer; - BufferDesc->Buffer.Length = (UINT32) BufferSize; - - /* Return the new buffer descriptor */ - - return_PTR (BufferDesc); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtCreateStringObject - * - * PARAMETERS: StringSize - Size of string to be created. Does not - * include NULL terminator, this is added - * automatically. - * - * RETURN: Pointer to a new String object - * - * DESCRIPTION: Create a fully initialized string object - * - ******************************************************************************/ - -ACPI_OPERAND_OBJECT * -AcpiUtCreateStringObject ( - ACPI_SIZE StringSize) -{ - ACPI_OPERAND_OBJECT *StringDesc; - char *String; - - - ACPI_FUNCTION_TRACE_U32 (UtCreateStringObject, StringSize); - - - /* Create a new String object */ - - StringDesc = AcpiUtCreateInternalObject (ACPI_TYPE_STRING); - if (!StringDesc) - { - return_PTR (NULL); - } - - /* - * Allocate the actual string buffer -- (Size + 1) for NULL terminator. - * NOTE: Zero-length strings are NULL terminated - */ - String = ACPI_ALLOCATE_ZEROED (StringSize + 1); - if (!String) - { - ACPI_ERROR ((AE_INFO, "Could not allocate size %u", - (UINT32) StringSize)); - - AcpiUtRemoveReference (StringDesc); - return_PTR (NULL); - } - - /* Complete string object initialization */ - - StringDesc->String.Pointer = String; - StringDesc->String.Length = (UINT32) StringSize; - - /* Return the new string descriptor */ - - return_PTR (StringDesc); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtValidInternalObject - * - * PARAMETERS: Object - Object to be validated - * - * RETURN: TRUE if object is valid, FALSE otherwise - * - * DESCRIPTION: Validate a pointer to be of type ACPI_OPERAND_OBJECT - * - ******************************************************************************/ - -BOOLEAN -AcpiUtValidInternalObject ( - void *Object) -{ - - ACPI_FUNCTION_NAME (UtValidInternalObject); - - - /* Check for a null pointer */ - - if (!Object) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "**** Null Object Ptr\n")); - return (FALSE); - } - - /* Check the descriptor type field */ - - switch (ACPI_GET_DESCRIPTOR_TYPE (Object)) - { - case ACPI_DESC_TYPE_OPERAND: - - /* The object appears to be a valid ACPI_OPERAND_OBJECT */ - - return (TRUE); - - default: - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "%p is not an ACPI operand obj [%s]\n", - Object, AcpiUtGetDescriptorName (Object))); - break; - } - - return (FALSE); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtAllocateObjectDescDbg - * - * PARAMETERS: ModuleName - Caller's module name (for error output) - * LineNumber - Caller's line number (for error output) - * ComponentId - Caller's component ID (for error output) - * - * RETURN: Pointer to newly allocated object descriptor. Null on error - * - * DESCRIPTION: Allocate a new object descriptor. Gracefully handle - * error conditions. - * - ******************************************************************************/ - -void * -AcpiUtAllocateObjectDescDbg ( - const char *ModuleName, - UINT32 LineNumber, - UINT32 ComponentId) -{ - ACPI_OPERAND_OBJECT *Object; - - - ACPI_FUNCTION_TRACE (UtAllocateObjectDescDbg); - - - Object = AcpiOsAcquireObject (AcpiGbl_OperandCache); - if (!Object) - { - ACPI_ERROR ((ModuleName, LineNumber, - "Could not allocate an object descriptor")); - - return_PTR (NULL); - } - - /* Mark the descriptor type */ - - ACPI_SET_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_OPERAND); - - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p Size %X\n", - Object, (UINT32) sizeof (ACPI_OPERAND_OBJECT))); - - return_PTR (Object); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtDeleteObjectDesc - * - * PARAMETERS: Object - An Acpi internal object to be deleted - * - * RETURN: None. - * - * DESCRIPTION: Free an ACPI object descriptor or add it to the object cache - * - ******************************************************************************/ - -void -AcpiUtDeleteObjectDesc ( - ACPI_OPERAND_OBJECT *Object) -{ - ACPI_FUNCTION_TRACE_PTR (UtDeleteObjectDesc, Object); - - - /* Object must be of type ACPI_OPERAND_OBJECT */ - - if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND) - { - ACPI_ERROR ((AE_INFO, - "%p is not an ACPI Operand object [%s]", Object, - AcpiUtGetDescriptorName (Object))); - return_VOID; - } - - (void) AcpiOsReleaseObject (AcpiGbl_OperandCache, Object); - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetSimpleObjectSize - * - * PARAMETERS: InternalObject - An ACPI operand object - * ObjLength - Where the length is returned - * - * RETURN: Status - * - * DESCRIPTION: This function is called to determine the space required to - * contain a simple object for return to an external user. - * - * The length includes the object structure plus any additional - * needed space. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiUtGetSimpleObjectSize ( - ACPI_OPERAND_OBJECT *InternalObject, - ACPI_SIZE *ObjLength) -{ - ACPI_SIZE Length; - ACPI_SIZE Size; - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE_PTR (UtGetSimpleObjectSize, InternalObject); - - - /* Start with the length of the (external) Acpi object */ - - Length = sizeof (ACPI_OBJECT); - - /* A NULL object is allowed, can be a legal uninitialized package element */ - - if (!InternalObject) - { - /* - * Object is NULL, just return the length of ACPI_OBJECT - * (A NULL ACPI_OBJECT is an object of all zeroes.) - */ - *ObjLength = ACPI_ROUND_UP_TO_NATIVE_WORD (Length); - return_ACPI_STATUS (AE_OK); - } - - /* A Namespace Node should never appear here */ - - if (ACPI_GET_DESCRIPTOR_TYPE (InternalObject) == ACPI_DESC_TYPE_NAMED) - { - /* A namespace node should never get here */ - - ACPI_ERROR ((AE_INFO, - "Received a namespace node [%4.4s] " - "where an operand object is required", - ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, InternalObject)->Name.Ascii)); - return_ACPI_STATUS (AE_AML_INTERNAL); - } - - /* - * The final length depends on the object type - * Strings and Buffers are packed right up against the parent object and - * must be accessed bytewise or there may be alignment problems on - * certain processors - */ - switch (InternalObject->Common.Type) - { - case ACPI_TYPE_STRING: - - Length += (ACPI_SIZE) InternalObject->String.Length + 1; - break; - - case ACPI_TYPE_BUFFER: - - Length += (ACPI_SIZE) InternalObject->Buffer.Length; - break; - - case ACPI_TYPE_INTEGER: - case ACPI_TYPE_PROCESSOR: - case ACPI_TYPE_POWER: - - /* No extra data for these types */ - - break; - - case ACPI_TYPE_LOCAL_REFERENCE: - - switch (InternalObject->Reference.Class) - { - case ACPI_REFCLASS_NAME: - /* - * Get the actual length of the full pathname to this object. - * The reference will be converted to the pathname to the object - */ - Size = AcpiNsGetPathnameLength (InternalObject->Reference.Node); - if (!Size) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - Length += ACPI_ROUND_UP_TO_NATIVE_WORD (Size); - break; - - default: - /* - * No other reference opcodes are supported. - * Notably, Locals and Args are not supported, but this may be - * required eventually. - */ - ACPI_ERROR ((AE_INFO, "Cannot convert to external object - " - "unsupported Reference Class [%s] 0x%X in object %p", - AcpiUtGetReferenceName (InternalObject), - InternalObject->Reference.Class, InternalObject)); - Status = AE_TYPE; - break; - } - break; - - default: - - ACPI_ERROR ((AE_INFO, "Cannot convert to external object - " - "unsupported type [%s] 0x%X in object %p", - AcpiUtGetObjectTypeName (InternalObject), - InternalObject->Common.Type, InternalObject)); - Status = AE_TYPE; - break; - } - - /* - * Account for the space required by the object rounded up to the next - * multiple of the machine word size. This keeps each object aligned - * on a machine word boundary. (preventing alignment faults on some - * machines.) - */ - *ObjLength = ACPI_ROUND_UP_TO_NATIVE_WORD (Length); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetElementLength - * - * PARAMETERS: ACPI_PKG_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Get the length of one package element. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiUtGetElementLength ( - UINT8 ObjectType, - ACPI_OPERAND_OBJECT *SourceObject, - ACPI_GENERIC_STATE *State, - void *Context) -{ - ACPI_STATUS Status = AE_OK; - ACPI_PKG_INFO *Info = (ACPI_PKG_INFO *) Context; - ACPI_SIZE ObjectSpace; - - - switch (ObjectType) - { - case ACPI_COPY_TYPE_SIMPLE: - /* - * Simple object - just get the size (Null object/entry is handled - * here also) and sum it into the running package length - */ - Status = AcpiUtGetSimpleObjectSize (SourceObject, &ObjectSpace); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - Info->Length += ObjectSpace; - break; - - case ACPI_COPY_TYPE_PACKAGE: - - /* Package object - nothing much to do here, let the walk handle it */ - - Info->NumPackages++; - State->Pkg.ThisTargetObj = NULL; - break; - - default: - - /* No other types allowed */ - - return (AE_BAD_PARAMETER); - } - - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetPackageObjectSize - * - * PARAMETERS: InternalObject - An ACPI internal object - * ObjLength - Where the length is returned - * - * RETURN: Status - * - * DESCRIPTION: This function is called to determine the space required to - * contain a package object for return to an external user. - * - * This is moderately complex since a package contains other - * objects including packages. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiUtGetPackageObjectSize ( - ACPI_OPERAND_OBJECT *InternalObject, - ACPI_SIZE *ObjLength) -{ - ACPI_STATUS Status; - ACPI_PKG_INFO Info; - - - ACPI_FUNCTION_TRACE_PTR (UtGetPackageObjectSize, InternalObject); - - - Info.Length = 0; - Info.ObjectSpace = 0; - Info.NumPackages = 1; - - Status = AcpiUtWalkPackageTree ( - InternalObject, NULL, AcpiUtGetElementLength, &Info); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* - * We have handled all of the objects in all levels of the package. - * just add the length of the package objects themselves. - * Round up to the next machine word. - */ - Info.Length += ACPI_ROUND_UP_TO_NATIVE_WORD ( - sizeof (ACPI_OBJECT)) * (ACPI_SIZE) Info.NumPackages; - - /* Return the total package length */ - - *ObjLength = Info.Length; - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetObjectSize - * - * PARAMETERS: InternalObject - An ACPI internal object - * ObjLength - Where the length will be returned - * - * RETURN: Status - * - * DESCRIPTION: This function is called to determine the space required to - * contain an object for return to an API user. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtGetObjectSize ( - ACPI_OPERAND_OBJECT *InternalObject, - ACPI_SIZE *ObjLength) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_ENTRY (); - - - if ((ACPI_GET_DESCRIPTOR_TYPE (InternalObject) == - ACPI_DESC_TYPE_OPERAND) && - (InternalObject->Common.Type == ACPI_TYPE_PACKAGE)) - { - Status = AcpiUtGetPackageObjectSize (InternalObject, ObjLength); - } - else - { - Status = AcpiUtGetSimpleObjectSize (InternalObject, ObjLength); - } - - return (Status); -} diff --git a/drivers/acpica/utosi.c b/drivers/acpica/utosi.c deleted file mode 100644 index 6e034eb..0000000 --- a/drivers/acpica/utosi.c +++ /dev/null @@ -1,671 +0,0 @@ -/****************************************************************************** - * - * Module Name: utosi - Support for the _OSI predefined control method - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" - - -#define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utosi") - - -/****************************************************************************** - * - * ACPICA policy for new _OSI strings: - * - * It is the stated policy of ACPICA that new _OSI strings will be integrated - * into this module as soon as possible after they are defined. It is strongly - * recommended that all ACPICA hosts mirror this policy and integrate any - * changes to this module as soon as possible. There are several historical - * reasons behind this policy: - * - * 1) New BIOSs tend to test only the case where the host responds TRUE to - * the latest version of Windows, which would respond to the latest/newest - * _OSI string. Not responding TRUE to the latest version of Windows will - * risk executing untested code paths throughout the DSDT and SSDTs. - * - * 2) If a new _OSI string is recognized only after a significant delay, this - * has the potential to cause problems on existing working machines because - * of the possibility that a new and different path through the ASL code - * will be executed. - * - * 3) New _OSI strings are tending to come out about once per year. A delay - * in recognizing a new string for a significant amount of time risks the - * release of another string which only compounds the initial problem. - * - *****************************************************************************/ - - -/* - * Strings supported by the _OSI predefined control method (which is - * implemented internally within this module.) - * - * March 2009: Removed "Linux" as this host no longer wants to respond true - * for this string. Basically, the only safe OS strings are windows-related - * and in many or most cases represent the only test path within the - * BIOS-provided ASL code. - * - * The last element of each entry is used to track the newest version of - * Windows that the BIOS has requested. - */ -static ACPI_INTERFACE_INFO AcpiDefaultSupportedInterfaces[] = -{ - /* Operating System Vendor Strings */ - - {"Windows 2000", NULL, 0, ACPI_OSI_WIN_2000}, /* Windows 2000 */ - {"Windows 2001", NULL, 0, ACPI_OSI_WIN_XP}, /* Windows XP */ - {"Windows 2001 SP1", NULL, 0, ACPI_OSI_WIN_XP_SP1}, /* Windows XP SP1 */ - {"Windows 2001.1", NULL, 0, ACPI_OSI_WINSRV_2003}, /* Windows Server 2003 */ - {"Windows 2001 SP2", NULL, 0, ACPI_OSI_WIN_XP_SP2}, /* Windows XP SP2 */ - {"Windows 2001.1 SP1", NULL, 0, ACPI_OSI_WINSRV_2003_SP1}, /* Windows Server 2003 SP1 - Added 03/2006 */ - {"Windows 2006", NULL, 0, ACPI_OSI_WIN_VISTA}, /* Windows Vista - Added 03/2006 */ - {"Windows 2006.1", NULL, 0, ACPI_OSI_WINSRV_2008}, /* Windows Server 2008 - Added 09/2009 */ - {"Windows 2006 SP1", NULL, 0, ACPI_OSI_WIN_VISTA_SP1}, /* Windows Vista SP1 - Added 09/2009 */ - {"Windows 2006 SP2", NULL, 0, ACPI_OSI_WIN_VISTA_SP2}, /* Windows Vista SP2 - Added 09/2010 */ - {"Windows 2009", NULL, 0, ACPI_OSI_WIN_7}, /* Windows 7 and Server 2008 R2 - Added 09/2009 */ - {"Windows 2012", NULL, 0, ACPI_OSI_WIN_8}, /* Windows 8 and Server 2012 - Added 08/2012 */ - {"Windows 2013", NULL, 0, ACPI_OSI_WIN_8_1}, /* Windows 8.1 and Server 2012 R2 - Added 01/2014 */ - {"Windows 2015", NULL, 0, ACPI_OSI_WIN_10}, /* Windows 10 - Added 03/2015 */ - {"Windows 2016", NULL, 0, ACPI_OSI_WIN_10_RS1}, /* Windows 10 version 1607 - Added 12/2017 */ - {"Windows 2017", NULL, 0, ACPI_OSI_WIN_10_RS2}, /* Windows 10 version 1703 - Added 12/2017 */ - {"Windows 2017.2", NULL, 0, ACPI_OSI_WIN_10_RS3}, /* Windows 10 version 1709 - Added 02/2018 */ - {"Windows 2018", NULL, 0, ACPI_OSI_WIN_10_RS4}, /* Windows 10 version 1803 - Added 11/2018 */ - {"Windows 2018.2", NULL, 0, ACPI_OSI_WIN_10_RS5}, /* Windows 10 version 1809 - Added 11/2018 */ - {"Windows 2019", NULL, 0, ACPI_OSI_WIN_10_19H1}, /* Windows 10 version 1903 - Added 08/2019 */ - {"Windows 2020", NULL, 0, ACPI_OSI_WIN_10_20H1}, /* Windows 10 version 2004 - Added 08/2021 */ - {"Windows 2021", NULL, 0, ACPI_OSI_WIN_11}, /* Windows 11 - Added 01/2022 */ - {"Windows 2022", NULL, 0, ACPI_OSI_WIN_11_22H2}, /* Windows 11 version 22H2 - Added 04/2024 */ - - /* Feature Group Strings */ - - {"Extended Address Space Descriptor", NULL, ACPI_OSI_FEATURE, 0}, - - /* - * All "optional" feature group strings (features that are implemented - * by the host) should be dynamically modified to VALID by the host via - * AcpiInstallInterface or AcpiUpdateInterfaces. Such optional feature - * group strings are set as INVALID by default here. - */ - - {"Module Device", NULL, ACPI_OSI_OPTIONAL_FEATURE, 0}, - {"Processor Device", NULL, ACPI_OSI_OPTIONAL_FEATURE, 0}, - {"3.0 Thermal Model", NULL, ACPI_OSI_OPTIONAL_FEATURE, 0}, - {"3.0 _SCP Extensions", NULL, ACPI_OSI_OPTIONAL_FEATURE, 0}, - {"Processor Aggregator Device", NULL, ACPI_OSI_OPTIONAL_FEATURE, 0}, - - /* See https://learn.microsoft.com/en-us/windows-hardware/drivers/display/automatic-display-switch */ - - {"DisplayMux", NULL, ACPI_OSI_OPTIONAL_FEATURE, 0} -}; - - -/******************************************************************************* - * - * FUNCTION: AcpiUtInitializeInterfaces - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Initialize the global _OSI supported interfaces list - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtInitializeInterfaces ( - void) -{ - ACPI_STATUS Status; - UINT32 i; - - - Status = AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - AcpiGbl_SupportedInterfaces = AcpiDefaultSupportedInterfaces; - - /* Link the static list of supported interfaces */ - - for (i = 0; - i < (ACPI_ARRAY_LENGTH (AcpiDefaultSupportedInterfaces) - 1); - i++) - { - AcpiDefaultSupportedInterfaces[i].Next = - &AcpiDefaultSupportedInterfaces[(ACPI_SIZE) i + 1]; - } - - AcpiOsReleaseMutex (AcpiGbl_OsiMutex); - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtInterfaceTerminate - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Delete all interfaces in the global list. Sets - * AcpiGbl_SupportedInterfaces to NULL. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtInterfaceTerminate ( - void) -{ - ACPI_STATUS Status; - ACPI_INTERFACE_INFO *NextInterface; - - - Status = AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - NextInterface = AcpiGbl_SupportedInterfaces; - while (NextInterface) - { - AcpiGbl_SupportedInterfaces = NextInterface->Next; - - if (NextInterface->Flags & ACPI_OSI_DYNAMIC) - { - /* Only interfaces added at runtime can be freed */ - - ACPI_FREE (NextInterface->Name); - ACPI_FREE (NextInterface); - } - else - { - /* Interface is in static list. Reset it to invalid or valid. */ - - if (NextInterface->Flags & ACPI_OSI_DEFAULT_INVALID) - { - NextInterface->Flags |= ACPI_OSI_INVALID; - } - else - { - NextInterface->Flags &= ~ACPI_OSI_INVALID; - } - } - - NextInterface = AcpiGbl_SupportedInterfaces; - } - - AcpiOsReleaseMutex (AcpiGbl_OsiMutex); - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtInstallInterface - * - * PARAMETERS: InterfaceName - The interface to install - * - * RETURN: Status - * - * DESCRIPTION: Install the interface into the global interface list. - * Caller MUST hold AcpiGbl_OsiMutex - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtInstallInterface ( - ACPI_STRING InterfaceName) -{ - ACPI_INTERFACE_INFO *InterfaceInfo; - - - /* Allocate info block and space for the name string */ - - InterfaceInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_INTERFACE_INFO)); - if (!InterfaceInfo) - { - return (AE_NO_MEMORY); - } - - InterfaceInfo->Name = ACPI_ALLOCATE_ZEROED (strlen (InterfaceName) + 1); - if (!InterfaceInfo->Name) - { - ACPI_FREE (InterfaceInfo); - return (AE_NO_MEMORY); - } - - /* Initialize new info and insert at the head of the global list */ - - strcpy (InterfaceInfo->Name, InterfaceName); - InterfaceInfo->Flags = ACPI_OSI_DYNAMIC; - InterfaceInfo->Next = AcpiGbl_SupportedInterfaces; - - AcpiGbl_SupportedInterfaces = InterfaceInfo; - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtRemoveInterface - * - * PARAMETERS: InterfaceName - The interface to remove - * - * RETURN: Status - * - * DESCRIPTION: Remove the interface from the global interface list. - * Caller MUST hold AcpiGbl_OsiMutex - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtRemoveInterface ( - ACPI_STRING InterfaceName) -{ - ACPI_INTERFACE_INFO *PreviousInterface; - ACPI_INTERFACE_INFO *NextInterface; - - - PreviousInterface = NextInterface = AcpiGbl_SupportedInterfaces; - while (NextInterface) - { - if (!strcmp (InterfaceName, NextInterface->Name)) - { - /* - * Found: name is in either the static list - * or was added at runtime - */ - if (NextInterface->Flags & ACPI_OSI_DYNAMIC) - { - /* Interface was added dynamically, remove and free it */ - - if (PreviousInterface == NextInterface) - { - AcpiGbl_SupportedInterfaces = NextInterface->Next; - } - else - { - PreviousInterface->Next = NextInterface->Next; - } - - ACPI_FREE (NextInterface->Name); - ACPI_FREE (NextInterface); - } - else - { - /* - * Interface is in static list. If marked invalid, then - * it does not actually exist. Else, mark it invalid. - */ - if (NextInterface->Flags & ACPI_OSI_INVALID) - { - return (AE_NOT_EXIST); - } - - NextInterface->Flags |= ACPI_OSI_INVALID; - } - - return (AE_OK); - } - - PreviousInterface = NextInterface; - NextInterface = NextInterface->Next; - } - - /* Interface was not found */ - - return (AE_NOT_EXIST); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtUpdateInterfaces - * - * PARAMETERS: Action - Actions to be performed during the - * update - * - * RETURN: Status - * - * DESCRIPTION: Update _OSI interface strings, disabling or enabling OS vendor - * strings or/and feature group strings. - * Caller MUST hold AcpiGbl_OsiMutex - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtUpdateInterfaces ( - UINT8 Action) -{ - ACPI_INTERFACE_INFO *NextInterface; - - - NextInterface = AcpiGbl_SupportedInterfaces; - while (NextInterface) - { - if (((NextInterface->Flags & ACPI_OSI_FEATURE) && - (Action & ACPI_FEATURE_STRINGS)) || - (!(NextInterface->Flags & ACPI_OSI_FEATURE) && - (Action & ACPI_VENDOR_STRINGS))) - { - if (Action & ACPI_DISABLE_INTERFACES) - { - /* Mark the interfaces as invalid */ - - NextInterface->Flags |= ACPI_OSI_INVALID; - } - else - { - /* Mark the interfaces as valid */ - - NextInterface->Flags &= ~ACPI_OSI_INVALID; - } - } - - NextInterface = NextInterface->Next; - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetInterface - * - * PARAMETERS: InterfaceName - The interface to find - * - * RETURN: ACPI_INTERFACE_INFO if found. NULL if not found. - * - * DESCRIPTION: Search for the specified interface name in the global list. - * Caller MUST hold AcpiGbl_OsiMutex - * - ******************************************************************************/ - -ACPI_INTERFACE_INFO * -AcpiUtGetInterface ( - ACPI_STRING InterfaceName) -{ - ACPI_INTERFACE_INFO *NextInterface; - - - NextInterface = AcpiGbl_SupportedInterfaces; - while (NextInterface) - { - if (!strcmp (InterfaceName, NextInterface->Name)) - { - return (NextInterface); - } - - NextInterface = NextInterface->Next; - } - - return (NULL); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtOsiImplementation - * - * PARAMETERS: WalkState - Current walk state - * - * RETURN: Status - * Integer: TRUE (0) if input string is matched - * FALSE (-1) if string is not matched - * - * DESCRIPTION: Implementation of the _OSI predefined control method. When - * an invocation of _OSI is encountered in the system AML, - * control is transferred to this function. - * - * (August 2016) - * Note: _OSI is now defined to return "Ones" to indicate a match, for - * compatibility with other ACPI implementations. On a 32-bit DSDT, Ones - * is 0xFFFFFFFF. On a 64-bit DSDT, Ones is 0xFFFFFFFFFFFFFFFF - * (ACPI_UINT64_MAX). - * - * This function always returns ACPI_UINT64_MAX for TRUE, and later code - * will truncate this to 32 bits if necessary. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtOsiImplementation ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_OPERAND_OBJECT *StringDesc; - ACPI_OPERAND_OBJECT *ReturnDesc; - ACPI_INTERFACE_INFO *InterfaceInfo; - ACPI_INTERFACE_HANDLER InterfaceHandler; - ACPI_STATUS Status; - UINT64 ReturnValue; - - - ACPI_FUNCTION_TRACE (UtOsiImplementation); - - - /* Validate the string input argument (from the AML caller) */ - - StringDesc = WalkState->Arguments[0].Object; - if (!StringDesc || - (StringDesc->Common.Type != ACPI_TYPE_STRING)) - { - return_ACPI_STATUS (AE_TYPE); - } - - /* Create a return object */ - - ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); - if (!ReturnDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Default return value is 0, NOT SUPPORTED */ - - ReturnValue = 0; - Status = AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); - if (ACPI_FAILURE (Status)) - { - AcpiUtRemoveReference (ReturnDesc); - return_ACPI_STATUS (Status); - } - - /* Lookup the interface in the global _OSI list */ - - InterfaceInfo = AcpiUtGetInterface (StringDesc->String.Pointer); - if (InterfaceInfo && - !(InterfaceInfo->Flags & ACPI_OSI_INVALID)) - { - /* - * The interface is supported. - * Update the OsiData if necessary. We keep track of the latest - * version of Windows that has been requested by the BIOS. - */ - if (InterfaceInfo->Value > AcpiGbl_OsiData) - { - AcpiGbl_OsiData = InterfaceInfo->Value; - } - - ReturnValue = ACPI_UINT64_MAX; - } - - AcpiOsReleaseMutex (AcpiGbl_OsiMutex); - - /* - * Invoke an optional _OSI interface handler. The host OS may wish - * to do some interface-specific handling. For example, warn about - * certain interfaces or override the true/false support value. - */ - InterfaceHandler = AcpiGbl_InterfaceHandler; - if (InterfaceHandler) - { - if (InterfaceHandler ( - StringDesc->String.Pointer, (UINT32) ReturnValue)) - { - ReturnValue = ACPI_UINT64_MAX; - } - } - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, - "ACPI: BIOS _OSI(\"%s\") is %ssupported\n", - StringDesc->String.Pointer, ReturnValue == 0 ? "not " : "")); - - /* Complete the return object */ - - ReturnDesc->Integer.Value = ReturnValue; - WalkState->ReturnDesc = ReturnDesc; - return_ACPI_STATUS (AE_OK); -} diff --git a/drivers/acpica/utownerid.c b/drivers/acpica/utownerid.c deleted file mode 100644 index 31c6db0..0000000 --- a/drivers/acpica/utownerid.c +++ /dev/null @@ -1,353 +0,0 @@ -/******************************************************************************* - * - * Module Name: utownerid - Support for Table/Method Owner IDs - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" - - -#define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utownerid") - - -/******************************************************************************* - * - * FUNCTION: AcpiUtAllocateOwnerId - * - * PARAMETERS: OwnerId - Where the new owner ID is returned - * - * RETURN: Status - * - * DESCRIPTION: Allocate a table or method owner ID. The owner ID is used to - * track objects created by the table or method, to be deleted - * when the method exits or the table is unloaded. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtAllocateOwnerId ( - ACPI_OWNER_ID *OwnerId) -{ - UINT32 i; - UINT32 j; - UINT32 k; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (UtAllocateOwnerId); - - - /* Guard against multiple allocations of ID to the same location */ - - if (*OwnerId) - { - ACPI_ERROR ((AE_INFO, - "Owner ID [0x%3.3X] already exists", *OwnerId)); - return_ACPI_STATUS (AE_ALREADY_EXISTS); - } - - /* Mutex for the global ID mask */ - - Status = AcpiUtAcquireMutex (ACPI_MTX_CACHES); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* - * Find a free owner ID, cycle through all possible IDs on repeated - * allocations. (ACPI_NUM_OWNERID_MASKS + 1) because first index - * may have to be scanned twice. - */ - for (i = 0, j = AcpiGbl_LastOwnerIdIndex; - i < (ACPI_NUM_OWNERID_MASKS + 1); - i++, j++) - { - if (j >= ACPI_NUM_OWNERID_MASKS) - { - j = 0; /* Wraparound to start of mask array */ - } - - for (k = AcpiGbl_NextOwnerIdOffset; k < 32; k++) - { - if (AcpiGbl_OwnerIdMask[j] == ACPI_UINT32_MAX) - { - /* There are no free IDs in this mask */ - - break; - } - - /* - * Note: the UINT32 cast ensures that 1 is stored as a unsigned - * integer. Omitting the cast may result in 1 being stored as an - * int. Some compilers or runtime error detection may flag this as - * an error. - */ - if (!(AcpiGbl_OwnerIdMask[j] & ((UINT32) 1 << k))) - { - /* - * Found a free ID. The actual ID is the bit index plus one, - * making zero an invalid Owner ID. Save this as the last ID - * allocated and update the global ID mask. - */ - AcpiGbl_OwnerIdMask[j] |= ((UINT32) 1 << k); - - AcpiGbl_LastOwnerIdIndex = (UINT8) j; - AcpiGbl_NextOwnerIdOffset = (UINT8) (k + 1); - - /* - * Construct encoded ID from the index and bit position - * - * Note: Last [j].k (bit 4095) is never used and is marked - * permanently allocated (prevents +1 overflow) - */ - *OwnerId = (ACPI_OWNER_ID) ((k + 1) + ACPI_MUL_32 (j)); - - ACPI_DEBUG_PRINT ((ACPI_DB_VALUES, - "Allocated OwnerId: 0x%3.3X\n", (unsigned int) *OwnerId)); - goto Exit; - } - } - - AcpiGbl_NextOwnerIdOffset = 0; - } - - /* - * All OwnerIds have been allocated. This typically should - * not happen since the IDs are reused after deallocation. The IDs are - * allocated upon table load (one per table) and method execution, and - * they are released when a table is unloaded or a method completes - * execution. - * - * If this error happens, there may be very deep nesting of invoked - * control methods, or there may be a bug where the IDs are not released. - */ - Status = AE_OWNER_ID_LIMIT; - ACPI_ERROR ((AE_INFO, - "Could not allocate new OwnerId (4095 max), AE_OWNER_ID_LIMIT")); - -Exit: - (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtReleaseOwnerId - * - * PARAMETERS: OwnerIdPtr - Pointer to a previously allocated OwnerID - * - * RETURN: None. No error is returned because we are either exiting a - * control method or unloading a table. Either way, we would - * ignore any error anyway. - * - * DESCRIPTION: Release a table or method owner ID. Valid IDs are 1 - 255 - * - ******************************************************************************/ - -void -AcpiUtReleaseOwnerId ( - ACPI_OWNER_ID *OwnerIdPtr) -{ - ACPI_OWNER_ID OwnerId = *OwnerIdPtr; - ACPI_STATUS Status; - UINT32 Index; - UINT32 Bit; - - - ACPI_FUNCTION_TRACE_U32 (UtReleaseOwnerId, OwnerId); - - - /* Always clear the input OwnerId (zero is an invalid ID) */ - - *OwnerIdPtr = 0; - - /* Zero is not a valid OwnerID */ - - if (OwnerId == 0) - { - ACPI_ERROR ((AE_INFO, "Invalid OwnerId: 0x%3.3X", OwnerId)); - return_VOID; - } - - /* Mutex for the global ID mask */ - - Status = AcpiUtAcquireMutex (ACPI_MTX_CACHES); - if (ACPI_FAILURE (Status)) - { - return_VOID; - } - - /* Normalize the ID to zero */ - - OwnerId--; - - /* Decode ID to index/offset pair */ - - Index = ACPI_DIV_32 (OwnerId); - Bit = (UINT32) 1 << ACPI_MOD_32 (OwnerId); - - /* Free the owner ID only if it is valid */ - - if (AcpiGbl_OwnerIdMask[Index] & Bit) - { - AcpiGbl_OwnerIdMask[Index] ^= Bit; - } - else - { - ACPI_ERROR ((AE_INFO, - "Attempted release of non-allocated OwnerId: 0x%3.3X", OwnerId + 1)); - } - - (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES); - return_VOID; -} diff --git a/drivers/acpica/utpredef.c b/drivers/acpica/utpredef.c deleted file mode 100644 index 1bda772..0000000 --- a/drivers/acpica/utpredef.c +++ /dev/null @@ -1,558 +0,0 @@ -/****************************************************************************** - * - * Module Name: utpredef - support functions for predefined names - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acpredef.h" - - -#define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utpredef") - - -/* - * Names for the types that can be returned by the predefined objects. - * Used for warning messages. Must be in the same order as the ACPI_RTYPEs - */ -static const char *UtRtypeNames[] = -{ - "/Integer", - "/String", - "/Buffer", - "/Package", - "/Reference", -}; - - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetNextPredefinedMethod - * - * PARAMETERS: ThisName - Entry in the predefined method/name table - * - * RETURN: Pointer to next entry in predefined table. - * - * DESCRIPTION: Get the next entry in the predefine method table. Handles the - * cases where a package info entry follows a method name that - * returns a package. - * - ******************************************************************************/ - -const ACPI_PREDEFINED_INFO * -AcpiUtGetNextPredefinedMethod ( - const ACPI_PREDEFINED_INFO *ThisName) -{ - - /* - * Skip next entry in the table if this name returns a Package - * (next entry contains the package info) - */ - if ((ThisName->Info.ExpectedBtypes & ACPI_RTYPE_PACKAGE) && - (ThisName->Info.ExpectedBtypes != ACPI_RTYPE_ALL)) - { - ThisName++; - } - - ThisName++; - return (ThisName); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtMatchPredefinedMethod - * - * PARAMETERS: Name - Name to find - * - * RETURN: Pointer to entry in predefined table. NULL indicates not found. - * - * DESCRIPTION: Check an object name against the predefined object list. - * - ******************************************************************************/ - -const ACPI_PREDEFINED_INFO * -AcpiUtMatchPredefinedMethod ( - char *Name) -{ - const ACPI_PREDEFINED_INFO *ThisName; - - - /* Quick check for a predefined name, first character must be underscore */ - - if (Name[0] != '_') - { - return (NULL); - } - - /* Search info table for a predefined method/object name */ - - ThisName = AcpiGbl_PredefinedMethods; - while (ThisName->Info.Name[0]) - { - if (ACPI_COMPARE_NAMESEG (Name, ThisName->Info.Name)) - { - return (ThisName); - } - - ThisName = AcpiUtGetNextPredefinedMethod (ThisName); - } - - return (NULL); /* Not found */ -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetExpectedReturnTypes - * - * PARAMETERS: Buffer - Where the formatted string is returned - * ExpectedBTypes - Bitfield of expected data types - * - * RETURN: Formatted string in Buffer. - * - * DESCRIPTION: Format the expected object types into a printable string. - * - ******************************************************************************/ - -void -AcpiUtGetExpectedReturnTypes ( - char *Buffer, - UINT32 ExpectedBtypes) -{ - UINT32 ThisRtype; - UINT32 i; - UINT32 j; - - - if (!ExpectedBtypes) - { - strcpy (Buffer, "NONE"); - return; - } - - j = 1; - Buffer[0] = 0; - ThisRtype = ACPI_RTYPE_INTEGER; - - for (i = 0; i < ACPI_NUM_RTYPES; i++) - { - /* If one of the expected types, concatenate the name of this type */ - - if (ExpectedBtypes & ThisRtype) - { - strcat (Buffer, &UtRtypeNames[i][j]); - j = 0; /* Use name separator from now on */ - } - - ThisRtype <<= 1; /* Next Rtype */ - } -} - - -/******************************************************************************* - * - * The remaining functions are used by iASL and AcpiHelp only - * - ******************************************************************************/ - -#if (defined ACPI_ASL_COMPILER || defined ACPI_HELP_APP) - -/* Local prototypes */ - -static UINT32 -AcpiUtGetArgumentTypes ( - char *Buffer, - UINT16 ArgumentTypes); - - -/* Types that can be returned externally by a predefined name */ - -static const char *UtExternalTypeNames[] = /* Indexed by ACPI_TYPE_* */ -{ - ", Type_ANY", - ", Integer", - ", String", - ", Buffer", - ", Package" -}; - -/* Bit widths for resource descriptor predefined names */ - -static const char *UtResourceTypeNames[] = -{ - "/1", - "/2", - "/3", - "/8", - "/16", - "/32", - "/64", - "/variable", -}; - - -/******************************************************************************* - * - * FUNCTION: AcpiUtMatchResourceName - * - * PARAMETERS: Name - Name to find - * - * RETURN: Pointer to entry in the resource table. NULL indicates not - * found. - * - * DESCRIPTION: Check an object name against the predefined resource - * descriptor object list. - * - ******************************************************************************/ - -const ACPI_PREDEFINED_INFO * -AcpiUtMatchResourceName ( - char *Name) -{ - const ACPI_PREDEFINED_INFO *ThisName; - - - /* - * Quick check for a predefined name, first character must - * be underscore - */ - if (Name[0] != '_') - { - return (NULL); - } - - /* Search info table for a predefined method/object name */ - - ThisName = AcpiGbl_ResourceNames; - while (ThisName->Info.Name[0]) - { - if (ACPI_COMPARE_NAMESEG (Name, ThisName->Info.Name)) - { - return (ThisName); - } - - ThisName++; - } - - return (NULL); /* Not found */ -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtDisplayPredefinedMethod - * - * PARAMETERS: Buffer - Scratch buffer for this function - * ThisName - Entry in the predefined method/name table - * MultiLine - TRUE if output should be on >1 line - * - * RETURN: None - * - * DESCRIPTION: Display information about a predefined method. Number and - * type of the input arguments, and expected type(s) for the - * return value, if any. - * - ******************************************************************************/ - -void -AcpiUtDisplayPredefinedMethod ( - char *Buffer, - const ACPI_PREDEFINED_INFO *ThisName, - BOOLEAN MultiLine) -{ - UINT32 ArgCount; - - /* - * Get the argument count and the string buffer - * containing all argument types - */ - ArgCount = AcpiUtGetArgumentTypes (Buffer, - ThisName->Info.ArgumentList); - - if (MultiLine) - { - printf (" "); - } - - printf ("%4.4s Requires %s%u argument%s", - ThisName->Info.Name, - (ThisName->Info.ArgumentList & ARG_COUNT_IS_MINIMUM) ? - "(at least) " : "", - ArgCount, ArgCount != 1 ? "s" : ""); - - /* Display the types for any arguments */ - - if (ArgCount > 0) - { - printf (" (%s)", Buffer); - } - - if (MultiLine) - { - printf ("\n "); - } - - /* Get the return value type(s) allowed */ - - if (ThisName->Info.ExpectedBtypes) - { - AcpiUtGetExpectedReturnTypes (Buffer, ThisName->Info.ExpectedBtypes); - printf (" Return value types: %s\n", Buffer); - } - else - { - printf (" No return value\n"); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetArgumentTypes - * - * PARAMETERS: Buffer - Where to return the formatted types - * ArgumentTypes - Types field for this method - * - * RETURN: Count - the number of arguments required for this method - * - * DESCRIPTION: Format the required data types for this method (Integer, - * String, Buffer, or Package) and return the required argument - * count. - * - ******************************************************************************/ - -static UINT32 -AcpiUtGetArgumentTypes ( - char *Buffer, - UINT16 ArgumentTypes) -{ - UINT16 ThisArgumentType; - UINT16 SubIndex; - UINT16 ArgCount; - UINT32 i; - - - *Buffer = 0; - SubIndex = 2; - - /* First field in the types list is the count of args to follow */ - - ArgCount = METHOD_GET_ARG_COUNT (ArgumentTypes); - if (ArgCount > METHOD_PREDEF_ARGS_MAX) - { - printf ("**** Invalid argument count (%u) " - "in predefined info structure\n", ArgCount); - return (ArgCount); - } - - /* Get each argument from the list, convert to ascii, store to buffer */ - - for (i = 0; i < ArgCount; i++) - { - ThisArgumentType = METHOD_GET_NEXT_TYPE (ArgumentTypes); - - if (ThisArgumentType > METHOD_MAX_ARG_TYPE) - { - printf ("**** Invalid argument type (%u) " - "in predefined info structure\n", ThisArgumentType); - return (ArgCount); - } - - strcat (Buffer, UtExternalTypeNames[ThisArgumentType] + SubIndex); - SubIndex = 0; - } - - return (ArgCount); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetResourceBitWidth - * - * PARAMETERS: Buffer - Where the formatted string is returned - * Types - Bitfield of expected data types - * - * RETURN: Count of return types. Formatted string in Buffer. - * - * DESCRIPTION: Format the resource bit widths into a printable string. - * - ******************************************************************************/ - -UINT32 -AcpiUtGetResourceBitWidth ( - char *Buffer, - UINT16 Types) -{ - UINT32 i; - UINT16 SubIndex; - UINT32 Found; - - - *Buffer = 0; - SubIndex = 1; - Found = 0; - - for (i = 0; i < NUM_RESOURCE_WIDTHS; i++) - { - if (Types & 1) - { - strcat (Buffer, &(UtResourceTypeNames[i][SubIndex])); - SubIndex = 0; - Found++; - } - - Types >>= 1; - } - - return (Found); -} -#endif diff --git a/drivers/acpica/utprint.c b/drivers/acpica/utprint.c deleted file mode 100644 index 3d26ab5..0000000 --- a/drivers/acpica/utprint.c +++ /dev/null @@ -1,1016 +0,0 @@ -/****************************************************************************** - * - * Module Name: utprint - Formatted printing routines - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2023, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" - -#define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utprint") - - -#define ACPI_FORMAT_SIGN 0x01 -#define ACPI_FORMAT_SIGN_PLUS 0x02 -#define ACPI_FORMAT_SIGN_PLUS_SPACE 0x04 -#define ACPI_FORMAT_ZERO 0x08 -#define ACPI_FORMAT_LEFT 0x10 -#define ACPI_FORMAT_UPPER 0x20 -#define ACPI_FORMAT_PREFIX 0x40 - - -/* Local prototypes */ - -static ACPI_SIZE -AcpiUtBoundStringLength ( - const char *String, - ACPI_SIZE Count); - -static char * -AcpiUtBoundStringOutput ( - char *String, - const char *End, - char c); - -static char * -AcpiUtFormatNumber ( - char *String, - char *End, - UINT64 Number, - UINT8 Base, - INT32 Width, - INT32 Precision, - UINT8 Type); - -static char * -AcpiUtPutNumber ( - char *String, - UINT64 Number, - UINT8 Base, - BOOLEAN Upper); - - -/******************************************************************************* - * - * FUNCTION: AcpiUtBoundStringLength - * - * PARAMETERS: String - String with boundary - * Count - Boundary of the string - * - * RETURN: Length of the string. Less than or equal to Count. - * - * DESCRIPTION: Calculate the length of a string with boundary. - * - ******************************************************************************/ - -static ACPI_SIZE -AcpiUtBoundStringLength ( - const char *String, - ACPI_SIZE Count) -{ - UINT32 Length = 0; - - - while (*String && Count) - { - Length++; - String++; - Count--; - } - - return (Length); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtBoundStringOutput - * - * PARAMETERS: String - String with boundary - * End - Boundary of the string - * c - Character to be output to the string - * - * RETURN: Updated position for next valid character - * - * DESCRIPTION: Output a character into a string with boundary check. - * - ******************************************************************************/ - -static char * -AcpiUtBoundStringOutput ( - char *String, - const char *End, - char c) -{ - - if (String < End) - { - *String = c; - } - - ++String; - return (String); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtPutNumber - * - * PARAMETERS: String - Buffer to hold reverse-ordered string - * Number - Integer to be converted - * Base - Base of the integer - * Upper - Whether or not using upper cased digits - * - * RETURN: Updated position for next valid character - * - * DESCRIPTION: Convert an integer into a string, note that, the string holds a - * reversed ordered number without the trailing zero. - * - ******************************************************************************/ - -static char * -AcpiUtPutNumber ( - char *String, - UINT64 Number, - UINT8 Base, - BOOLEAN Upper) -{ - const char *Digits; - UINT64 DigitIndex; - char *Pos; - - - Pos = String; - Digits = Upper ? AcpiGbl_UpperHexDigits : AcpiGbl_LowerHexDigits; - - if (Number == 0) - { - *(Pos++) = '0'; - } - else - { - while (Number) - { - (void) AcpiUtDivide (Number, Base, &Number, &DigitIndex); - *(Pos++) = Digits[DigitIndex]; - } - } - - /* *(Pos++) = '0'; */ - return (Pos); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtScanNumber - * - * PARAMETERS: String - String buffer - * NumberPtr - Where the number is returned - * - * RETURN: Updated position for next valid character - * - * DESCRIPTION: Scan a string for a decimal integer. - * - ******************************************************************************/ - -const char * -AcpiUtScanNumber ( - const char *String, - UINT64 *NumberPtr) -{ - UINT64 Number = 0; - - - while (isdigit ((int) *String)) - { - AcpiUtShortMultiply (Number, 10, &Number); - Number += *(String++) - '0'; - } - - *NumberPtr = Number; - return (String); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtPrintNumber - * - * PARAMETERS: String - String buffer - * Number - The number to be converted - * - * RETURN: Updated position for next valid character - * - * DESCRIPTION: Print a decimal integer into a string. - * - ******************************************************************************/ - -const char * -AcpiUtPrintNumber ( - char *String, - UINT64 Number) -{ - char AsciiString[20]; - const char *Pos1; - char *Pos2; - - - Pos1 = AcpiUtPutNumber (AsciiString, Number, 10, FALSE); - Pos2 = String; - - while (Pos1 != AsciiString) - { - *(Pos2++) = *(--Pos1); - } - - *Pos2 = 0; - return (String); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtFormatNumber - * - * PARAMETERS: String - String buffer with boundary - * End - Boundary of the string - * Number - The number to be converted - * Base - Base of the integer - * Width - Field width - * Precision - Precision of the integer - * Type - Special printing flags - * - * RETURN: Updated position for next valid character - * - * DESCRIPTION: Print an integer into a string with any base and any precision. - * - ******************************************************************************/ - -static char * -AcpiUtFormatNumber ( - char *String, - char *End, - UINT64 Number, - UINT8 Base, - INT32 Width, - INT32 Precision, - UINT8 Type) -{ - char *Pos; - char Sign; - char Zero; - BOOLEAN NeedPrefix; - BOOLEAN Upper; - INT32 i; - char ReversedString[66]; - - - /* Parameter validation */ - - if (Base < 2 || Base > 16) - { - return (NULL); - } - - if (Type & ACPI_FORMAT_LEFT) - { - Type &= ~ACPI_FORMAT_ZERO; - } - - NeedPrefix = ((Type & ACPI_FORMAT_PREFIX) && Base != 10) ? TRUE : FALSE; - Upper = (Type & ACPI_FORMAT_UPPER) ? TRUE : FALSE; - Zero = (Type & ACPI_FORMAT_ZERO) ? '0' : ' '; - - /* Calculate size according to sign and prefix */ - - Sign = '\0'; - if (Type & ACPI_FORMAT_SIGN) - { - if ((INT64) Number < 0) - { - Sign = '-'; - Number = - (INT64) Number; - Width--; - } - else if (Type & ACPI_FORMAT_SIGN_PLUS) - { - Sign = '+'; - Width--; - } - else if (Type & ACPI_FORMAT_SIGN_PLUS_SPACE) - { - Sign = ' '; - Width--; - } - } - if (NeedPrefix) - { - Width--; - if (Base == 16) - { - Width--; - } - } - - /* Generate full string in reverse order */ - - Pos = AcpiUtPutNumber (ReversedString, Number, Base, Upper); - i = (INT32) ACPI_PTR_DIFF (Pos, ReversedString); - - /* Printing 100 using %2d gives "100", not "00" */ - - if (i > Precision) - { - Precision = i; - } - - Width -= Precision; - - /* Output the string */ - - if (!(Type & (ACPI_FORMAT_ZERO | ACPI_FORMAT_LEFT))) - { - while (--Width >= 0) - { - String = AcpiUtBoundStringOutput (String, End, ' '); - } - } - if (Sign) - { - String = AcpiUtBoundStringOutput (String, End, Sign); - } - if (NeedPrefix) - { - String = AcpiUtBoundStringOutput (String, End, '0'); - if (Base == 16) - { - String = AcpiUtBoundStringOutput ( - String, End, Upper ? 'X' : 'x'); - } - } - if (!(Type & ACPI_FORMAT_LEFT)) - { - while (--Width >= 0) - { - String = AcpiUtBoundStringOutput (String, End, Zero); - } - } - - while (i <= --Precision) - { - String = AcpiUtBoundStringOutput (String, End, '0'); - } - while (--i >= 0) - { - String = AcpiUtBoundStringOutput (String, End, - ReversedString[i]); - } - while (--Width >= 0) - { - String = AcpiUtBoundStringOutput (String, End, ' '); - } - - return (String); -} - - -/******************************************************************************* - * - * FUNCTION: vsnprintf - * - * PARAMETERS: String - String with boundary - * Size - Boundary of the string - * Format - Standard printf format - * Args - Argument list - * - * RETURN: Number of bytes actually written. - * - * DESCRIPTION: Formatted output to a string using argument list pointer. - * - ******************************************************************************/ - -int -vsnprintf ( - char *String, - ACPI_SIZE Size, - const char *Format, - va_list Args) -{ - UINT8 Base; - UINT8 Type; - INT32 Width; - INT32 Precision; - char Qualifier; - UINT64 Number; - char *Pos; - char *End; - char c; - const char *s; - const void *p; - INT32 Length; - int i; - - - Pos = String; - - Size = ACPI_MIN(Size, ACPI_PTR_DIFF(ACPI_MAX_PTR, String)); - End = String + Size; - - for (; *Format; ++Format) - { - if (*Format != '%') - { - Pos = AcpiUtBoundStringOutput (Pos, End, *Format); - continue; - } - - Type = 0; - Base = 10; - - /* Process sign */ - - do - { - ++Format; - if (*Format == '#') - { - Type |= ACPI_FORMAT_PREFIX; - } - else if (*Format == '0') - { - Type |= ACPI_FORMAT_ZERO; - } - else if (*Format == '+') - { - Type |= ACPI_FORMAT_SIGN_PLUS; - } - else if (*Format == ' ') - { - Type |= ACPI_FORMAT_SIGN_PLUS_SPACE; - } - else if (*Format == '-') - { - Type |= ACPI_FORMAT_LEFT; - } - else - { - break; - } - - } while (1); - - /* Process width */ - - Width = -1; - if (isdigit ((int) *Format)) - { - Format = AcpiUtScanNumber (Format, &Number); - Width = (INT32) Number; - } - else if (*Format == '*') - { - ++Format; - Width = va_arg (Args, int); - if (Width < 0) - { - Width = -Width; - Type |= ACPI_FORMAT_LEFT; - } - } - - /* Process precision */ - - Precision = -1; - if (*Format == '.') - { - ++Format; - if (isdigit ((int) *Format)) - { - Format = AcpiUtScanNumber (Format, &Number); - Precision = (INT32) Number; - } - else if (*Format == '*') - { - ++Format; - Precision = va_arg (Args, int); - } - - if (Precision < 0) - { - Precision = 0; - } - } - - /* Process qualifier */ - - Qualifier = -1; - if (*Format == 'h' || *Format == 'l' || *Format == 'L') - { - Qualifier = *Format; - ++Format; - - if (Qualifier == 'l' && *Format == 'l') - { - Qualifier = 'L'; - ++Format; - } - } - - switch (*Format) - { - case '%': - - Pos = AcpiUtBoundStringOutput (Pos, End, '%'); - continue; - - case 'c': - - if (!(Type & ACPI_FORMAT_LEFT)) - { - while (--Width > 0) - { - Pos = AcpiUtBoundStringOutput (Pos, End, ' '); - } - } - - c = (char) va_arg (Args, int); - Pos = AcpiUtBoundStringOutput (Pos, End, c); - - while (--Width > 0) - { - Pos = AcpiUtBoundStringOutput (Pos, End, ' '); - } - continue; - - case 's': - - s = va_arg (Args, char *); - if (!s) - { - s = ""; - } - Length = (INT32) AcpiUtBoundStringLength (s, Precision); - if (!(Type & ACPI_FORMAT_LEFT)) - { - while (Length < Width--) - { - Pos = AcpiUtBoundStringOutput (Pos, End, ' '); - } - } - - for (i = 0; i < Length; ++i) - { - Pos = AcpiUtBoundStringOutput (Pos, End, *s); - ++s; - } - - while (Length < Width--) - { - Pos = AcpiUtBoundStringOutput (Pos, End, ' '); - } - continue; - - case 'o': - - Base = 8; - break; - - case 'X': - - Type |= ACPI_FORMAT_UPPER; - ACPI_FALLTHROUGH; - - case 'x': - - Base = 16; - break; - - case 'd': - case 'i': - - Type |= ACPI_FORMAT_SIGN; - - case 'u': - - break; - - case 'p': - - if (Width == -1) - { - Width = 2 * sizeof (void *); - Type |= ACPI_FORMAT_ZERO; - } - - p = va_arg (Args, void *); - Pos = AcpiUtFormatNumber ( - Pos, End, ACPI_TO_INTEGER (p), 16, Width, Precision, Type); - continue; - - default: - - Pos = AcpiUtBoundStringOutput (Pos, End, '%'); - if (*Format) - { - Pos = AcpiUtBoundStringOutput (Pos, End, *Format); - } - else - { - --Format; - } - continue; - } - - if (Qualifier == 'L') - { - Number = va_arg (Args, UINT64); - if (Type & ACPI_FORMAT_SIGN) - { - Number = (INT64) Number; - } - } - else if (Qualifier == 'l') - { - Number = va_arg (Args, unsigned long); - if (Type & ACPI_FORMAT_SIGN) - { - Number = (INT32) Number; - } - } - else if (Qualifier == 'h') - { - Number = (UINT16) va_arg (Args, int); - if (Type & ACPI_FORMAT_SIGN) - { - Number = (INT16) Number; - } - } - else - { - Number = va_arg (Args, unsigned int); - if (Type & ACPI_FORMAT_SIGN) - { - Number = (signed int) Number; - } - } - - Pos = AcpiUtFormatNumber (Pos, End, Number, Base, - Width, Precision, Type); - } - - if (Size > 0) - { - if (Pos < End) - { - *Pos = '\0'; - } - else - { - End[-1] = '\0'; - } - } - - return ((int) ACPI_PTR_DIFF (Pos, String)); -} - - -/******************************************************************************* - * - * FUNCTION: snprintf - * - * PARAMETERS: String - String with boundary - * Size - Boundary of the string - * Format, ... - Standard printf format - * - * RETURN: Number of bytes actually written. - * - * DESCRIPTION: Formatted output to a string. - * - ******************************************************************************/ - -int -snprintf ( - char *String, - ACPI_SIZE Size, - const char *Format, - ...) -{ - va_list Args; - int Length; - - - va_start (Args, Format); - Length = vsnprintf (String, Size, Format, Args); - va_end (Args); - - return (Length); -} - - -/******************************************************************************* - * - * FUNCTION: sprintf - * - * PARAMETERS: String - String with boundary - * Format, ... - Standard printf format - * - * RETURN: Number of bytes actually written. - * - * DESCRIPTION: Formatted output to a string. - * - ******************************************************************************/ - -int -sprintf ( - char *String, - const char *Format, - ...) -{ - va_list Args; - int Length; - - - va_start (Args, Format); - Length = vsnprintf (String, ACPI_UINT32_MAX, Format, Args); - va_end (Args); - - return (Length); -} - - -#ifdef ACPI_APPLICATION -/******************************************************************************* - * - * FUNCTION: vprintf - * - * PARAMETERS: Format - Standard printf format - * Args - Argument list - * - * RETURN: Number of bytes actually written. - * - * DESCRIPTION: Formatted output to stdout using argument list pointer. - * - ******************************************************************************/ - -int -vprintf ( - const char *Format, - va_list Args) -{ - ACPI_CPU_FLAGS Flags; - int Length; - - - Flags = AcpiOsAcquireLock (AcpiGbl_PrintLock); - Length = vsnprintf (AcpiGbl_PrintBuffer, - sizeof (AcpiGbl_PrintBuffer), Format, Args); - - (void) fwrite (AcpiGbl_PrintBuffer, Length, 1, ACPI_FILE_OUT); - AcpiOsReleaseLock (AcpiGbl_PrintLock, Flags); - - return (Length); -} - - -/******************************************************************************* - * - * FUNCTION: printf - * - * PARAMETERS: Format, ... - Standard printf format - * - * RETURN: Number of bytes actually written. - * - * DESCRIPTION: Formatted output to stdout. - * - ******************************************************************************/ - -int -printf ( - const char *Format, - ...) -{ - va_list Args; - int Length; - - - va_start (Args, Format); - Length = vprintf (Format, Args); - va_end (Args); - - return (Length); -} - - -/******************************************************************************* - * - * FUNCTION: vfprintf - * - * PARAMETERS: File - File descriptor - * Format - Standard printf format - * Args - Argument list - * - * RETURN: Number of bytes actually written. - * - * DESCRIPTION: Formatted output to a file using argument list pointer. - * - ******************************************************************************/ - -int -vfprintf ( - FILE *File, - const char *Format, - va_list Args) -{ - ACPI_CPU_FLAGS Flags; - int Length; - - - Flags = AcpiOsAcquireLock (AcpiGbl_PrintLock); - Length = vsnprintf (AcpiGbl_PrintBuffer, - sizeof (AcpiGbl_PrintBuffer), Format, Args); - - (void) fwrite (AcpiGbl_PrintBuffer, Length, 1, File); - AcpiOsReleaseLock (AcpiGbl_PrintLock, Flags); - - return (Length); -} - - -/******************************************************************************* - * - * FUNCTION: fprintf - * - * PARAMETERS: File - File descriptor - * Format, ... - Standard printf format - * - * RETURN: Number of bytes actually written. - * - * DESCRIPTION: Formatted output to a file. - * - ******************************************************************************/ - -int -fprintf ( - FILE *File, - const char *Format, - ...) -{ - va_list Args; - int Length; - - - va_start (Args, Format); - Length = vfprintf (File, Format, Args); - va_end (Args); - - return (Length); -} -#endif diff --git a/drivers/acpica/utresdecode.c b/drivers/acpica/utresdecode.c deleted file mode 100644 index 070552f..0000000 --- a/drivers/acpica/utresdecode.c +++ /dev/null @@ -1,483 +0,0 @@ -/******************************************************************************* - * - * Module Name: utresdecode - Resource descriptor keyword strings - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acresrc.h" - - -#define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utresdecode") - - -#if defined (ACPI_DEBUG_OUTPUT) || \ - defined (ACPI_DISASSEMBLER) || \ - defined (ACPI_DEBUGGER) - -/* - * Strings used to decode resource descriptors. - * Used by both the disassembler and the debugger resource dump routines - */ -const char *AcpiGbl_BmDecode[] = -{ - "NotBusMaster", - "BusMaster" -}; - -const char *AcpiGbl_ConfigDecode[] = -{ - "0 - Good Configuration", - "1 - Acceptable Configuration", - "2 - Suboptimal Configuration", - "3 - ***Invalid Configuration***", -}; - -const char *AcpiGbl_ConsumeDecode[] = -{ - "ResourceProducer", - "ResourceConsumer" -}; - -const char *AcpiGbl_DecDecode[] = -{ - "PosDecode", - "SubDecode" -}; - -const char *AcpiGbl_HeDecode[] = -{ - "Level", - "Edge" -}; - -const char *AcpiGbl_IoDecode[] = -{ - "Decode10", - "Decode16" -}; - -const char *AcpiGbl_LlDecode[] = -{ - "ActiveHigh", - "ActiveLow", - "ActiveBoth", - "Reserved" -}; - -const char *AcpiGbl_MaxDecode[] = -{ - "MaxNotFixed", - "MaxFixed" -}; - -const char *AcpiGbl_MemDecode[] = -{ - "NonCacheable", - "Cacheable", - "WriteCombining", - "Prefetchable" -}; - -const char *AcpiGbl_MinDecode[] = -{ - "MinNotFixed", - "MinFixed" -}; - -const char *AcpiGbl_MtpDecode[] = -{ - "AddressRangeMemory", - "AddressRangeReserved", - "AddressRangeACPI", - "AddressRangeNVS" -}; - -const char *AcpiGbl_PhyDecode[] = -{ - "Type C", - "Type D", - "Unknown Type", - "Unknown Type" -}; - -const char *AcpiGbl_RngDecode[] = -{ - "InvalidRanges", - "NonISAOnlyRanges", - "ISAOnlyRanges", - "EntireRange" -}; - -const char *AcpiGbl_RwDecode[] = -{ - "ReadOnly", - "ReadWrite" -}; - -const char *AcpiGbl_ShrDecode[] = -{ - "Exclusive", - "Shared", - "ExclusiveAndWake", /* ACPI 5.0 */ - "SharedAndWake" /* ACPI 5.0 */ -}; - -const char *AcpiGbl_SizDecode[] = -{ - "Transfer8", - "Transfer8_16", - "Transfer16", - "InvalidSize" -}; - -const char *AcpiGbl_TrsDecode[] = -{ - "DenseTranslation", - "SparseTranslation" -}; - -const char *AcpiGbl_TtpDecode[] = -{ - "TypeStatic", - "TypeTranslation" -}; - -const char *AcpiGbl_TypDecode[] = -{ - "Compatibility", - "TypeA", - "TypeB", - "TypeF" -}; - -const char *AcpiGbl_PpcDecode[] = -{ - "PullDefault", - "PullUp", - "PullDown", - "PullNone" -}; - -const char *AcpiGbl_IorDecode[] = -{ - "IoRestrictionNone", - "IoRestrictionInputOnly", - "IoRestrictionOutputOnly", - "IoRestrictionNoneAndPreserve" -}; - -const char *AcpiGbl_DtsDecode[] = -{ - "Width8bit", - "Width16bit", - "Width32bit", - "Width64bit", - "Width128bit", - "Width256bit", -}; - -/* GPIO connection type */ - -const char *AcpiGbl_CtDecode[] = -{ - "Interrupt", - "I/O" -}; - -/* Serial bus type */ - -const char *AcpiGbl_SbtDecode[] = -{ - "/* UNKNOWN serial bus type */", - "I2C", - "SPI", - "UART", - "CSI2" -}; - -/* I2C serial bus access mode */ - -const char *AcpiGbl_AmDecode[] = -{ - "AddressingMode7Bit", - "AddressingMode10Bit" -}; - -/* I2C serial bus slave mode */ - -const char *AcpiGbl_SmDecode[] = -{ - "ControllerInitiated", - "DeviceInitiated" -}; - -/* SPI serial bus wire mode */ - -const char *AcpiGbl_WmDecode[] = -{ - "FourWireMode", - "ThreeWireMode" -}; - -/* SPI serial clock phase */ - -const char *AcpiGbl_CphDecode[] = -{ - "ClockPhaseFirst", - "ClockPhaseSecond" -}; - -/* SPI serial bus clock polarity */ - -const char *AcpiGbl_CpoDecode[] = -{ - "ClockPolarityLow", - "ClockPolarityHigh" -}; - -/* SPI serial bus device polarity */ - -const char *AcpiGbl_DpDecode[] = -{ - "PolarityLow", - "PolarityHigh" -}; - -/* UART serial bus endian */ - -const char *AcpiGbl_EdDecode[] = -{ - "LittleEndian", - "BigEndian" -}; - -/* UART serial bus bits per byte */ - -const char *AcpiGbl_BpbDecode[] = -{ - "DataBitsFive", - "DataBitsSix", - "DataBitsSeven", - "DataBitsEight", - "DataBitsNine", - "/* UNKNOWN Bits per byte */", - "/* UNKNOWN Bits per byte */", - "/* UNKNOWN Bits per byte */" -}; - -/* UART serial bus stop bits */ - -const char *AcpiGbl_SbDecode[] = -{ - "StopBitsZero", - "StopBitsOne", - "StopBitsOnePlusHalf", - "StopBitsTwo" -}; - -/* UART serial bus flow control */ - -const char *AcpiGbl_FcDecode[] = -{ - "FlowControlNone", - "FlowControlHardware", - "FlowControlXON", - "/* UNKNOWN flow control keyword */" -}; - -/* UART serial bus parity type */ - -const char *AcpiGbl_PtDecode[] = -{ - "ParityTypeNone", - "ParityTypeEven", - "ParityTypeOdd", - "ParityTypeMark", - "ParityTypeSpace", - "/* UNKNOWN parity keyword */", - "/* UNKNOWN parity keyword */", - "/* UNKNOWN parity keyword */" -}; - -/* PinConfig type */ - -const char *AcpiGbl_PtypDecode[] = -{ - "Default", - "Bias Pull-up", - "Bias Pull-down", - "Bias Default", - "Bias Disable", - "Bias High Impedance", - "Bias Bus Hold", - "Drive Open Drain", - "Drive Open Source", - "Drive Push Pull", - "Drive Strength", - "Slew Rate", - "Input Debounce", - "Input Schmitt Trigger", -}; - -const char *AcpiGbl_ClockInputMode[] = -{ - "Fixed", - "Variable", -}; - -const char *AcpiGbl_ClockInputScale[] = -{ - "Hz", - "KHz", - "MHz", -}; - -#endif diff --git a/drivers/acpica/utresrc.c b/drivers/acpica/utresrc.c deleted file mode 100644 index c952e76..0000000 --- a/drivers/acpica/utresrc.c +++ /dev/null @@ -1,771 +0,0 @@ -/******************************************************************************* - * - * Module Name: utresrc - Resource management utilities - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acresrc.h" - - -#define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utresrc") - - -/* - * Base sizes of the raw AML resource descriptors, indexed by resource type. - * Zero indicates a reserved (and therefore invalid) resource type. - */ -const UINT8 AcpiGbl_ResourceAmlSizes[] = -{ - /* Small descriptors */ - - 0, - 0, - 0, - 0, - ACPI_AML_SIZE_SMALL (AML_RESOURCE_IRQ), - ACPI_AML_SIZE_SMALL (AML_RESOURCE_DMA), - ACPI_AML_SIZE_SMALL (AML_RESOURCE_START_DEPENDENT), - ACPI_AML_SIZE_SMALL (AML_RESOURCE_END_DEPENDENT), - ACPI_AML_SIZE_SMALL (AML_RESOURCE_IO), - ACPI_AML_SIZE_SMALL (AML_RESOURCE_FIXED_IO), - ACPI_AML_SIZE_SMALL (AML_RESOURCE_FIXED_DMA), - 0, - 0, - 0, - ACPI_AML_SIZE_SMALL (AML_RESOURCE_VENDOR_SMALL), - ACPI_AML_SIZE_SMALL (AML_RESOURCE_END_TAG), - - /* Large descriptors */ - - 0, - ACPI_AML_SIZE_LARGE (AML_RESOURCE_MEMORY24), - ACPI_AML_SIZE_LARGE (AML_RESOURCE_GENERIC_REGISTER), - 0, - ACPI_AML_SIZE_LARGE (AML_RESOURCE_VENDOR_LARGE), - ACPI_AML_SIZE_LARGE (AML_RESOURCE_MEMORY32), - ACPI_AML_SIZE_LARGE (AML_RESOURCE_FIXED_MEMORY32), - ACPI_AML_SIZE_LARGE (AML_RESOURCE_ADDRESS32), - ACPI_AML_SIZE_LARGE (AML_RESOURCE_ADDRESS16), - ACPI_AML_SIZE_LARGE (AML_RESOURCE_EXTENDED_IRQ), - ACPI_AML_SIZE_LARGE (AML_RESOURCE_ADDRESS64), - ACPI_AML_SIZE_LARGE (AML_RESOURCE_EXTENDED_ADDRESS64), - ACPI_AML_SIZE_LARGE (AML_RESOURCE_GPIO), - ACPI_AML_SIZE_LARGE (AML_RESOURCE_PIN_FUNCTION), - ACPI_AML_SIZE_LARGE (AML_RESOURCE_COMMON_SERIALBUS), - ACPI_AML_SIZE_LARGE (AML_RESOURCE_PIN_CONFIG), - ACPI_AML_SIZE_LARGE (AML_RESOURCE_PIN_GROUP), - ACPI_AML_SIZE_LARGE (AML_RESOURCE_PIN_GROUP_FUNCTION), - ACPI_AML_SIZE_LARGE (AML_RESOURCE_PIN_GROUP_CONFIG), - ACPI_AML_SIZE_LARGE (AML_RESOURCE_CLOCK_INPUT), - -}; - -const UINT8 AcpiGbl_ResourceAmlSerialBusSizes[] = -{ - 0, - ACPI_AML_SIZE_LARGE (AML_RESOURCE_I2C_SERIALBUS), - ACPI_AML_SIZE_LARGE (AML_RESOURCE_SPI_SERIALBUS), - ACPI_AML_SIZE_LARGE (AML_RESOURCE_UART_SERIALBUS), - ACPI_AML_SIZE_LARGE (AML_RESOURCE_CSI2_SERIALBUS), -}; - - -/* - * Resource types, used to validate the resource length field. - * The length of fixed-length types must match exactly, variable - * lengths must meet the minimum required length, etc. - * Zero indicates a reserved (and therefore invalid) resource type. - */ -static const UINT8 AcpiGbl_ResourceTypes[] = -{ - /* Small descriptors */ - - 0, - 0, - 0, - 0, - ACPI_SMALL_VARIABLE_LENGTH, /* 04 IRQ */ - ACPI_FIXED_LENGTH, /* 05 DMA */ - ACPI_SMALL_VARIABLE_LENGTH, /* 06 StartDependentFunctions */ - ACPI_FIXED_LENGTH, /* 07 EndDependentFunctions */ - ACPI_FIXED_LENGTH, /* 08 IO */ - ACPI_FIXED_LENGTH, /* 09 FixedIO */ - ACPI_FIXED_LENGTH, /* 0A FixedDMA */ - 0, - 0, - 0, - ACPI_VARIABLE_LENGTH, /* 0E VendorShort */ - ACPI_FIXED_LENGTH, /* 0F EndTag */ - - /* Large descriptors */ - - 0, - ACPI_FIXED_LENGTH, /* 01 Memory24 */ - ACPI_FIXED_LENGTH, /* 02 GenericRegister */ - 0, - ACPI_VARIABLE_LENGTH, /* 04 VendorLong */ - ACPI_FIXED_LENGTH, /* 05 Memory32 */ - ACPI_FIXED_LENGTH, /* 06 Memory32Fixed */ - ACPI_VARIABLE_LENGTH, /* 07 Dword* address */ - ACPI_VARIABLE_LENGTH, /* 08 Word* address */ - ACPI_VARIABLE_LENGTH, /* 09 ExtendedIRQ */ - ACPI_VARIABLE_LENGTH, /* 0A Qword* address */ - ACPI_FIXED_LENGTH, /* 0B Extended* address */ - ACPI_VARIABLE_LENGTH, /* 0C Gpio* */ - ACPI_VARIABLE_LENGTH, /* 0D PinFunction */ - ACPI_VARIABLE_LENGTH, /* 0E *SerialBus */ - ACPI_VARIABLE_LENGTH, /* 0F PinConfig */ - ACPI_VARIABLE_LENGTH, /* 10 PinGroup */ - ACPI_VARIABLE_LENGTH, /* 11 PinGroupFunction */ - ACPI_VARIABLE_LENGTH, /* 12 PinGroupConfig */ - ACPI_VARIABLE_LENGTH, /* 13 ClockInput */ -}; - - -/******************************************************************************* - * - * FUNCTION: AcpiUtWalkAmlResources - * - * PARAMETERS: WalkState - Current walk info - * PARAMETERS: Aml - Pointer to the raw AML resource template - * AmlLength - Length of the entire template - * UserFunction - Called once for each descriptor found. If - * NULL, a pointer to the EndTag is returned - * Context - Passed to UserFunction - * - * RETURN: Status - * - * DESCRIPTION: Walk a raw AML resource list(buffer). User function called - * once for each resource found. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtWalkAmlResources ( - ACPI_WALK_STATE *WalkState, - UINT8 *Aml, - ACPI_SIZE AmlLength, - ACPI_WALK_AML_CALLBACK UserFunction, - void **Context) -{ - ACPI_STATUS Status; - UINT8 *EndAml; - UINT8 ResourceIndex; - UINT32 Length; - UINT32 Offset = 0; - UINT8 EndTag[2] = {0x79, 0x00}; - - - ACPI_FUNCTION_TRACE (UtWalkAmlResources); - - - /* The absolute minimum resource template is one EndTag descriptor */ - - if (AmlLength < sizeof (AML_RESOURCE_END_TAG)) - { - return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG); - } - - /* Point to the end of the resource template buffer */ - - EndAml = Aml + AmlLength; - - /* Walk the byte list, abort on any invalid descriptor type or length */ - - while (Aml < EndAml) - { - /* Validate the Resource Type and Resource Length */ - - Status = AcpiUtValidateResource (WalkState, Aml, &ResourceIndex); - if (ACPI_FAILURE (Status)) - { - /* - * Exit on failure. Cannot continue because the descriptor - * length may be bogus also. - */ - return_ACPI_STATUS (Status); - } - - /* Get the length of this descriptor */ - - Length = AcpiUtGetDescriptorLength (Aml); - - /* Invoke the user function */ - - if (UserFunction) - { - Status = UserFunction ( - Aml, Length, Offset, ResourceIndex, Context); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - /* An EndTag descriptor terminates this resource template */ - - if (AcpiUtGetResourceType (Aml) == ACPI_RESOURCE_NAME_END_TAG) - { - /* - * There must be at least one more byte in the buffer for - * the 2nd byte of the EndTag - */ - if ((Aml + 1) >= EndAml) - { - return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG); - } - - /* - * Don't attempt to perform any validation on the 2nd byte. - * Although all known ASL compilers insert a zero for the 2nd - * byte, it can also be a checksum (as per the ACPI spec), - * and this is occasionally seen in the field. July 2017. - */ - - /* Return the pointer to the EndTag if requested */ - - if (!UserFunction) - { - *Context = Aml; - } - - /* Normal exit */ - - return_ACPI_STATUS (AE_OK); - } - - Aml += Length; - Offset += Length; - } - - /* Did not find an EndTag descriptor */ - - if (UserFunction) - { - /* Insert an EndTag anyway. AcpiRsGetListLength always leaves room */ - - (void) AcpiUtValidateResource (WalkState, EndTag, &ResourceIndex); - Status = UserFunction (EndTag, 2, Offset, ResourceIndex, Context); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtValidateResource - * - * PARAMETERS: WalkState - Current walk info - * Aml - Pointer to the raw AML resource descriptor - * ReturnIndex - Where the resource index is returned. NULL - * if the index is not required. - * - * RETURN: Status, and optionally the Index into the global resource tables - * - * DESCRIPTION: Validate an AML resource descriptor by checking the Resource - * Type and Resource Length. Returns an index into the global - * resource information/dispatch tables for later use. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtValidateResource ( - ACPI_WALK_STATE *WalkState, - void *Aml, - UINT8 *ReturnIndex) -{ - AML_RESOURCE *AmlResource; - UINT8 ResourceType; - UINT8 ResourceIndex; - ACPI_RS_LENGTH ResourceLength; - ACPI_RS_LENGTH MinimumResourceLength; - - - ACPI_FUNCTION_ENTRY (); - - - /* - * 1) Validate the ResourceType field (Byte 0) - */ - ResourceType = ACPI_GET8 (Aml); - - /* - * Byte 0 contains the descriptor name (Resource Type) - * Examine the large/small bit in the resource header - */ - if (ResourceType & ACPI_RESOURCE_NAME_LARGE) - { - /* Verify the large resource type (name) against the max */ - - if (ResourceType > ACPI_RESOURCE_NAME_LARGE_MAX) - { - goto InvalidResource; - } - - /* - * Large Resource Type -- bits 6:0 contain the name - * Translate range 0x80-0x8B to index range 0x10-0x1B - */ - ResourceIndex = (UINT8) (ResourceType - 0x70); - } - else - { - /* - * Small Resource Type -- bits 6:3 contain the name - * Shift range to index range 0x00-0x0F - */ - ResourceIndex = (UINT8) - ((ResourceType & ACPI_RESOURCE_NAME_SMALL_MASK) >> 3); - } - - /* - * Check validity of the resource type, via AcpiGbl_ResourceTypes. - * Zero indicates an invalid resource. - */ - if (!AcpiGbl_ResourceTypes[ResourceIndex]) - { - goto InvalidResource; - } - - /* - * Validate the ResourceLength field. This ensures that the length - * is at least reasonable, and guarantees that it is non-zero. - */ - ResourceLength = AcpiUtGetResourceLength (Aml); - MinimumResourceLength = AcpiGbl_ResourceAmlSizes[ResourceIndex]; - - /* Validate based upon the type of resource - fixed length or variable */ - - switch (AcpiGbl_ResourceTypes[ResourceIndex]) - { - case ACPI_FIXED_LENGTH: - - /* Fixed length resource, length must match exactly */ - - if (ResourceLength != MinimumResourceLength) - { - goto BadResourceLength; - } - break; - - case ACPI_VARIABLE_LENGTH: - - /* Variable length resource, length must be at least the minimum */ - - if (ResourceLength < MinimumResourceLength) - { - goto BadResourceLength; - } - break; - - case ACPI_SMALL_VARIABLE_LENGTH: - - /* Small variable length resource, length can be (Min) or (Min-1) */ - - if ((ResourceLength > MinimumResourceLength) || - (ResourceLength < (MinimumResourceLength - 1))) - { - goto BadResourceLength; - } - break; - - default: - - /* Shouldn't happen (because of validation earlier), but be sure */ - - goto InvalidResource; - } - - AmlResource = ACPI_CAST_PTR (AML_RESOURCE, Aml); - if (ResourceType == ACPI_RESOURCE_NAME_SERIAL_BUS) - { - /* Validate the BusType field */ - - if ((AmlResource->CommonSerialBus.Type == 0) || - (AmlResource->CommonSerialBus.Type > AML_RESOURCE_MAX_SERIALBUSTYPE)) - { - if (WalkState) - { - ACPI_ERROR ((AE_INFO, - "Invalid/unsupported SerialBus resource descriptor: BusType 0x%2.2X", - AmlResource->CommonSerialBus.Type)); - } - return (AE_AML_INVALID_RESOURCE_TYPE); - } - } - - /* Optionally return the resource table index */ - - if (ReturnIndex) - { - *ReturnIndex = ResourceIndex; - } - - return (AE_OK); - - -InvalidResource: - - if (WalkState) - { - ACPI_ERROR ((AE_INFO, - "Invalid/unsupported resource descriptor: Type 0x%2.2X", - ResourceType)); - } - return (AE_AML_INVALID_RESOURCE_TYPE); - -BadResourceLength: - - if (WalkState) - { - ACPI_ERROR ((AE_INFO, - "Invalid resource descriptor length: Type " - "0x%2.2X, Length 0x%4.4X, MinLength 0x%4.4X", - ResourceType, ResourceLength, MinimumResourceLength)); - } - return (AE_AML_BAD_RESOURCE_LENGTH); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetResourceType - * - * PARAMETERS: Aml - Pointer to the raw AML resource descriptor - * - * RETURN: The Resource Type with no extraneous bits (except the - * Large/Small descriptor bit -- this is left alone) - * - * DESCRIPTION: Extract the Resource Type/Name from the first byte of - * a resource descriptor. - * - ******************************************************************************/ - -UINT8 -AcpiUtGetResourceType ( - void *Aml) -{ - ACPI_FUNCTION_ENTRY (); - - - /* - * Byte 0 contains the descriptor name (Resource Type) - * Examine the large/small bit in the resource header - */ - if (ACPI_GET8 (Aml) & ACPI_RESOURCE_NAME_LARGE) - { - /* Large Resource Type -- bits 6:0 contain the name */ - - return (ACPI_GET8 (Aml)); - } - else - { - /* Small Resource Type -- bits 6:3 contain the name */ - - return ((UINT8) (ACPI_GET8 (Aml) & ACPI_RESOURCE_NAME_SMALL_MASK)); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetResourceLength - * - * PARAMETERS: Aml - Pointer to the raw AML resource descriptor - * - * RETURN: Byte Length - * - * DESCRIPTION: Get the "Resource Length" of a raw AML descriptor. By - * definition, this does not include the size of the descriptor - * header or the length field itself. - * - ******************************************************************************/ - -UINT16 -AcpiUtGetResourceLength ( - void *Aml) -{ - ACPI_RS_LENGTH ResourceLength; - - - ACPI_FUNCTION_ENTRY (); - - - /* - * Byte 0 contains the descriptor name (Resource Type) - * Examine the large/small bit in the resource header - */ - if (ACPI_GET8 (Aml) & ACPI_RESOURCE_NAME_LARGE) - { - /* Large Resource type -- bytes 1-2 contain the 16-bit length */ - - ACPI_MOVE_16_TO_16 (&ResourceLength, ACPI_ADD_PTR (UINT8, Aml, 1)); - - } - else - { - /* Small Resource type -- bits 2:0 of byte 0 contain the length */ - - ResourceLength = (UINT16) (ACPI_GET8 (Aml) & - ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK); - } - - return (ResourceLength); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetResourceHeaderLength - * - * PARAMETERS: Aml - Pointer to the raw AML resource descriptor - * - * RETURN: Length of the AML header (depends on large/small descriptor) - * - * DESCRIPTION: Get the length of the header for this resource. - * - ******************************************************************************/ - -UINT8 -AcpiUtGetResourceHeaderLength ( - void *Aml) -{ - ACPI_FUNCTION_ENTRY (); - - - /* Examine the large/small bit in the resource header */ - - if (ACPI_GET8 (Aml) & ACPI_RESOURCE_NAME_LARGE) - { - return (sizeof (AML_RESOURCE_LARGE_HEADER)); - } - else - { - return (sizeof (AML_RESOURCE_SMALL_HEADER)); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetDescriptorLength - * - * PARAMETERS: Aml - Pointer to the raw AML resource descriptor - * - * RETURN: Byte length - * - * DESCRIPTION: Get the total byte length of a raw AML descriptor, including the - * length of the descriptor header and the length field itself. - * Used to walk descriptor lists. - * - ******************************************************************************/ - -UINT32 -AcpiUtGetDescriptorLength ( - void *Aml) -{ - ACPI_FUNCTION_ENTRY (); - - - /* - * Get the Resource Length (does not include header length) and add - * the header length (depends on if this is a small or large resource) - */ - return (AcpiUtGetResourceLength (Aml) + - AcpiUtGetResourceHeaderLength (Aml)); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetResourceEndTag - * - * PARAMETERS: ObjDesc - The resource template buffer object - * EndTag - Where the pointer to the EndTag is returned - * - * RETURN: Status, pointer to the end tag - * - * DESCRIPTION: Find the EndTag resource descriptor in an AML resource template - * Note: allows a buffer length of zero. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtGetResourceEndTag ( - ACPI_OPERAND_OBJECT *ObjDesc, - UINT8 **EndTag) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (UtGetResourceEndTag); - - - /* Allow a buffer length of zero */ - - if (!ObjDesc->Buffer.Length) - { - *EndTag = ObjDesc->Buffer.Pointer; - return_ACPI_STATUS (AE_OK); - } - - /* Validate the template and get a pointer to the EndTag */ - - Status = AcpiUtWalkAmlResources (NULL, ObjDesc->Buffer.Pointer, - ObjDesc->Buffer.Length, NULL, (void **) EndTag); - - return_ACPI_STATUS (Status); -} diff --git a/drivers/acpica/utstate.c b/drivers/acpica/utstate.c deleted file mode 100644 index 1dbecba..0000000 --- a/drivers/acpica/utstate.c +++ /dev/null @@ -1,462 +0,0 @@ -/******************************************************************************* - * - * Module Name: utstate - state object support procedures - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" - -#define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utstate") - - -/******************************************************************************* - * - * FUNCTION: AcpiUtPushGenericState - * - * PARAMETERS: ListHead - Head of the state stack - * State - State object to push - * - * RETURN: None - * - * DESCRIPTION: Push a state object onto a state stack - * - ******************************************************************************/ - -void -AcpiUtPushGenericState ( - ACPI_GENERIC_STATE **ListHead, - ACPI_GENERIC_STATE *State) -{ - ACPI_FUNCTION_ENTRY (); - - - /* Push the state object onto the front of the list (stack) */ - - State->Common.Next = *ListHead; - *ListHead = State; - return; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtPopGenericState - * - * PARAMETERS: ListHead - Head of the state stack - * - * RETURN: The popped state object - * - * DESCRIPTION: Pop a state object from a state stack - * - ******************************************************************************/ - -ACPI_GENERIC_STATE * -AcpiUtPopGenericState ( - ACPI_GENERIC_STATE **ListHead) -{ - ACPI_GENERIC_STATE *State; - - - ACPI_FUNCTION_ENTRY (); - - - /* Remove the state object at the head of the list (stack) */ - - State = *ListHead; - if (State) - { - /* Update the list head */ - - *ListHead = State->Common.Next; - } - - return (State); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtCreateGenericState - * - * PARAMETERS: None - * - * RETURN: The new state object. NULL on failure. - * - * DESCRIPTION: Create a generic state object. Attempt to obtain one from - * the global state cache; If none available, create a new one. - * - ******************************************************************************/ - -ACPI_GENERIC_STATE * -AcpiUtCreateGenericState ( - void) -{ - ACPI_GENERIC_STATE *State; - - - ACPI_FUNCTION_ENTRY (); - - - State = AcpiOsAcquireObject (AcpiGbl_StateCache); - if (State) - { - /* Initialize */ - State->Common.DescriptorType = ACPI_DESC_TYPE_STATE; - } - - return (State); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtCreateThreadState - * - * PARAMETERS: None - * - * RETURN: New Thread State. NULL on failure - * - * DESCRIPTION: Create a "Thread State" - a flavor of the generic state used - * to track per-thread info during method execution - * - ******************************************************************************/ - -ACPI_THREAD_STATE * -AcpiUtCreateThreadState ( - void) -{ - ACPI_GENERIC_STATE *State; - - - ACPI_FUNCTION_ENTRY (); - - - /* Create the generic state object */ - - State = AcpiUtCreateGenericState (); - if (!State) - { - return (NULL); - } - - /* Init fields specific to the update struct */ - - State->Common.DescriptorType = ACPI_DESC_TYPE_STATE_THREAD; - State->Thread.ThreadId = AcpiOsGetThreadId (); - - /* Check for invalid thread ID - zero is very bad, it will break things */ - - if (!State->Thread.ThreadId) - { - ACPI_ERROR ((AE_INFO, "Invalid zero ID from AcpiOsGetThreadId")); - State->Thread.ThreadId = (ACPI_THREAD_ID) 1; - } - - return ((ACPI_THREAD_STATE *) State); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtCreateUpdateState - * - * PARAMETERS: Object - Initial Object to be installed in the state - * Action - Update action to be performed - * - * RETURN: New state object, null on failure - * - * DESCRIPTION: Create an "Update State" - a flavor of the generic state used - * to update reference counts and delete complex objects such - * as packages. - * - ******************************************************************************/ - -ACPI_GENERIC_STATE * -AcpiUtCreateUpdateState ( - ACPI_OPERAND_OBJECT *Object, - UINT16 Action) -{ - ACPI_GENERIC_STATE *State; - - - ACPI_FUNCTION_ENTRY (); - - - /* Create the generic state object */ - - State = AcpiUtCreateGenericState (); - if (!State) - { - return (NULL); - } - - /* Init fields specific to the update struct */ - - State->Common.DescriptorType = ACPI_DESC_TYPE_STATE_UPDATE; - State->Update.Object = Object; - State->Update.Value = Action; - return (State); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtCreatePkgState - * - * PARAMETERS: Object - Initial Object to be installed in the state - * Action - Update action to be performed - * - * RETURN: New state object, null on failure - * - * DESCRIPTION: Create a "Package State" - * - ******************************************************************************/ - -ACPI_GENERIC_STATE * -AcpiUtCreatePkgState ( - void *InternalObject, - void *ExternalObject, - UINT32 Index) -{ - ACPI_GENERIC_STATE *State; - - - ACPI_FUNCTION_ENTRY (); - - - /* Create the generic state object */ - - State = AcpiUtCreateGenericState (); - if (!State) - { - return (NULL); - } - - /* Init fields specific to the update struct */ - - State->Common.DescriptorType = ACPI_DESC_TYPE_STATE_PACKAGE; - State->Pkg.SourceObject = (ACPI_OPERAND_OBJECT *) InternalObject; - State->Pkg.DestObject = ExternalObject; - State->Pkg.Index= Index; - State->Pkg.NumPackages = 1; - - return (State); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtCreateControlState - * - * PARAMETERS: None - * - * RETURN: New state object, null on failure - * - * DESCRIPTION: Create a "Control State" - a flavor of the generic state used - * to support nested IF/WHILE constructs in the AML. - * - ******************************************************************************/ - -ACPI_GENERIC_STATE * -AcpiUtCreateControlState ( - void) -{ - ACPI_GENERIC_STATE *State; - - - ACPI_FUNCTION_ENTRY (); - - - /* Create the generic state object */ - - State = AcpiUtCreateGenericState (); - if (!State) - { - return (NULL); - } - - /* Init fields specific to the control struct */ - - State->Common.DescriptorType = ACPI_DESC_TYPE_STATE_CONTROL; - State->Common.State = ACPI_CONTROL_CONDITIONAL_EXECUTING; - - return (State); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtDeleteGenericState - * - * PARAMETERS: State - The state object to be deleted - * - * RETURN: None - * - * DESCRIPTION: Release a state object to the state cache. NULL state objects - * are ignored. - * - ******************************************************************************/ - -void -AcpiUtDeleteGenericState ( - ACPI_GENERIC_STATE *State) -{ - ACPI_FUNCTION_ENTRY (); - - - /* Ignore null state */ - - if (State) - { - (void) AcpiOsReleaseObject (AcpiGbl_StateCache, State); - } - - return; -} diff --git a/drivers/acpica/utstring.c b/drivers/acpica/utstring.c deleted file mode 100644 index 19ddd25..0000000 --- a/drivers/acpica/utstring.c +++ /dev/null @@ -1,385 +0,0 @@ -/******************************************************************************* - * - * Module Name: utstring - Common functions for strings and characters - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" - - -#define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utstring") - - -/******************************************************************************* - * - * FUNCTION: AcpiUtPrintString - * - * PARAMETERS: String - Null terminated ASCII string - * MaxLength - Maximum output length. Used to constrain the - * length of strings during debug output only. - * - * RETURN: None - * - * DESCRIPTION: Dump an ASCII string with support for ACPI-defined escape - * sequences. - * - ******************************************************************************/ - -void -AcpiUtPrintString ( - char *String, - UINT16 MaxLength) -{ - UINT32 i; - - - if (!String) - { - AcpiOsPrintf ("<\"NULL STRING PTR\">"); - return; - } - - AcpiOsPrintf ("\""); - for (i = 0; (i < MaxLength) && String[i]; i++) - { - /* Escape sequences */ - - switch (String[i]) - { - case 0x07: - - AcpiOsPrintf ("\\a"); /* BELL */ - break; - - case 0x08: - - AcpiOsPrintf ("\\b"); /* BACKSPACE */ - break; - - case 0x0C: - - AcpiOsPrintf ("\\f"); /* FORMFEED */ - break; - - case 0x0A: - - AcpiOsPrintf ("\\n"); /* LINEFEED */ - break; - - case 0x0D: - - AcpiOsPrintf ("\\r"); /* CARRIAGE RETURN*/ - break; - - case 0x09: - - AcpiOsPrintf ("\\t"); /* HORIZONTAL TAB */ - break; - - case 0x0B: - - AcpiOsPrintf ("\\v"); /* VERTICAL TAB */ - break; - - case '\'': /* Single Quote */ - case '\"': /* Double Quote */ - case '\\': /* Backslash */ - - AcpiOsPrintf ("\\%c", (int) String[i]); - break; - - default: - - /* Check for printable character or hex escape */ - - if (isprint ((int) String[i])) - { - /* This is a normal character */ - - AcpiOsPrintf ("%c", (int) String[i]); - } - else - { - /* All others will be Hex escapes */ - - AcpiOsPrintf ("\\x%2.2X", (INT32) String[i]); - } - break; - } - } - - AcpiOsPrintf ("\""); - - if (i == MaxLength && String[i]) - { - AcpiOsPrintf ("..."); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtRepairName - * - * PARAMETERS: Name - The ACPI name to be repaired - * - * RETURN: Repaired version of the name - * - * DESCRIPTION: Repair an ACPI name: Change invalid characters to '*' and - * return the new name. NOTE: the Name parameter must reside in - * read/write memory, cannot be a const. - * - * An ACPI Name must consist of valid ACPI characters. We will repair the name - * if necessary because we don't want to abort because of this, but we want - * all namespace names to be printable. A warning message is appropriate. - * - * This issue came up because there are in fact machines that exhibit - * this problem, and we want to be able to enable ACPI support for them, - * even though there are a few bad names. - * - ******************************************************************************/ - -void -AcpiUtRepairName ( - char *Name) -{ - UINT32 i; - BOOLEAN FoundBadChar = FALSE; - UINT32 OriginalName; - - - ACPI_FUNCTION_NAME (UtRepairName); - - - /* - * Special case for the root node. This can happen if we get an - * error during the execution of module-level code. - */ - if (ACPI_COMPARE_NAMESEG (Name, ACPI_ROOT_PATHNAME)) - { - return; - } - - ACPI_COPY_NAMESEG (&OriginalName, &Name[0]); - - /* Check each character in the name */ - - for (i = 0; i < ACPI_NAMESEG_SIZE; i++) - { - if (AcpiUtValidNameChar (Name[i], i)) - { - continue; - } - - /* - * Replace a bad character with something printable, yet technically - * "odd". This prevents any collisions with existing "good" - * names in the namespace. - */ - Name[i] = '_'; - FoundBadChar = TRUE; - } - - if (FoundBadChar) - { - /* Report warning only if in strict mode or debug mode */ - - if (!AcpiGbl_EnableInterpreterSlack) - { - ACPI_WARNING ((AE_INFO, - "Invalid character(s) in name (0x%.8X) %p, repaired: [%4.4s]", - OriginalName, Name, &Name[0])); - } - else - { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Invalid character(s) in name (0x%.8X), repaired: [%4.4s]", - OriginalName, Name)); - } - } -} - - -#if defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP -/******************************************************************************* - * - * FUNCTION: UtConvertBackslashes - * - * PARAMETERS: Pathname - File pathname string to be converted - * - * RETURN: Modifies the input Pathname - * - * DESCRIPTION: Convert all backslashes (0x5C) to forward slashes (0x2F) within - * the entire input file pathname string. - * - ******************************************************************************/ - -void -UtConvertBackslashes ( - char *Pathname) -{ - - if (!Pathname) - { - return; - } - - while (*Pathname) - { - if (*Pathname == '\\') - { - *Pathname = '/'; - } - - Pathname++; - } -} -#endif diff --git a/drivers/acpica/utstrsuppt.c b/drivers/acpica/utstrsuppt.c deleted file mode 100644 index 0c96520..0000000 --- a/drivers/acpica/utstrsuppt.c +++ /dev/null @@ -1,663 +0,0 @@ -/******************************************************************************* - * - * Module Name: utstrsuppt - Support functions for string-to-integer conversion - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" - -#define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utstrsuppt") - - -/* Local prototypes */ - -static ACPI_STATUS -AcpiUtInsertDigit ( - UINT64 *AccumulatedValue, - UINT32 Base, - int AsciiDigit); - -static ACPI_STATUS -AcpiUtStrtoulMultiply64 ( - UINT64 Multiplicand, - UINT32 Base, - UINT64 *OutProduct); - -static ACPI_STATUS -AcpiUtStrtoulAdd64 ( - UINT64 Addend1, - UINT32 Digit, - UINT64 *OutSum); - - -/******************************************************************************* - * - * FUNCTION: AcpiUtConvertOctalString - * - * PARAMETERS: String - Null terminated input string - * ReturnValuePtr - Where the converted value is returned - * - * RETURN: Status and 64-bit converted integer - * - * DESCRIPTION: Performs a base 8 conversion of the input string to an - * integer value, either 32 or 64 bits. - * - * NOTE: Maximum 64-bit unsigned octal value is 01777777777777777777777 - * Maximum 32-bit unsigned octal value is 037777777777 - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtConvertOctalString ( - char *String, - UINT64 *ReturnValuePtr) -{ - UINT64 AccumulatedValue = 0; - ACPI_STATUS Status = AE_OK; - - - /* Convert each ASCII byte in the input string */ - - while (*String) - { - /* - * Character must be ASCII 0-7, otherwise: - * 1) Runtime: terminate with no error, per the ACPI spec - * 2) Compiler: return an error - */ - if (!(ACPI_IS_OCTAL_DIGIT (*String))) - { -#ifdef ACPI_ASL_COMPILER - Status = AE_BAD_OCTAL_CONSTANT; -#endif - break; - } - - /* Convert and insert this octal digit into the accumulator */ - - Status = AcpiUtInsertDigit (&AccumulatedValue, 8, *String); - if (ACPI_FAILURE (Status)) - { - Status = AE_OCTAL_OVERFLOW; - break; - } - - String++; - } - - /* Always return the value that has been accumulated */ - - *ReturnValuePtr = AccumulatedValue; - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtConvertDecimalString - * - * PARAMETERS: String - Null terminated input string - * ReturnValuePtr - Where the converted value is returned - * - * RETURN: Status and 64-bit converted integer - * - * DESCRIPTION: Performs a base 10 conversion of the input string to an - * integer value, either 32 or 64 bits. - * - * NOTE: Maximum 64-bit unsigned decimal value is 18446744073709551615 - * Maximum 32-bit unsigned decimal value is 4294967295 - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtConvertDecimalString ( - char *String, - UINT64 *ReturnValuePtr) -{ - UINT64 AccumulatedValue = 0; - ACPI_STATUS Status = AE_OK; - - - /* Convert each ASCII byte in the input string */ - - while (*String) - { - /* - * Character must be ASCII 0-9, otherwise: - * 1) Runtime: terminate with no error, per the ACPI spec - * 2) Compiler: return an error - */ - if (!isdigit ((int) *String)) - { -#ifdef ACPI_ASL_COMPILER - Status = AE_BAD_DECIMAL_CONSTANT; -#endif - break; - } - - /* Convert and insert this decimal digit into the accumulator */ - - Status = AcpiUtInsertDigit (&AccumulatedValue, 10, *String); - if (ACPI_FAILURE (Status)) - { - Status = AE_DECIMAL_OVERFLOW; - break; - } - - String++; - } - - /* Always return the value that has been accumulated */ - - *ReturnValuePtr = AccumulatedValue; - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtConvertHexString - * - * PARAMETERS: String - Null terminated input string - * ReturnValuePtr - Where the converted value is returned - * - * RETURN: Status and 64-bit converted integer - * - * DESCRIPTION: Performs a base 16 conversion of the input string to an - * integer value, either 32 or 64 bits. - * - * NOTE: Maximum 64-bit unsigned hex value is 0xFFFFFFFFFFFFFFFF - * Maximum 32-bit unsigned hex value is 0xFFFFFFFF - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtConvertHexString ( - char *String, - UINT64 *ReturnValuePtr) -{ - UINT64 AccumulatedValue = 0; - ACPI_STATUS Status = AE_OK; - - - /* Convert each ASCII byte in the input string */ - - while (*String) - { - /* - * Character must be ASCII A-F, a-f, or 0-9, otherwise: - * 1) Runtime: terminate with no error, per the ACPI spec - * 2) Compiler: return an error - */ - if (!isxdigit ((int) *String)) - { -#ifdef ACPI_ASL_COMPILER - Status = AE_BAD_HEX_CONSTANT; -#endif - break; - } - - /* Convert and insert this hex digit into the accumulator */ - - Status = AcpiUtInsertDigit (&AccumulatedValue, 16, *String); - if (ACPI_FAILURE (Status)) - { - Status = AE_HEX_OVERFLOW; - break; - } - - String++; - } - - /* Always return the value that has been accumulated */ - - *ReturnValuePtr = AccumulatedValue; - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtRemoveLeadingZeros - * - * PARAMETERS: String - Pointer to input ASCII string - * - * RETURN: Next character after any leading zeros. This character may be - * used by the caller to detect end-of-string. - * - * DESCRIPTION: Remove any leading zeros in the input string. Return the - * next character after the final ASCII zero to enable the caller - * to check for the end of the string (NULL terminator). - * - ******************************************************************************/ - -char -AcpiUtRemoveLeadingZeros ( - char **String) -{ - - while (**String == ACPI_ASCII_ZERO) - { - *String += 1; - } - - return (**String); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtRemoveWhitespace - * - * PARAMETERS: String - Pointer to input ASCII string - * - * RETURN: Next character after any whitespace. This character may be - * used by the caller to detect end-of-string. - * - * DESCRIPTION: Remove any leading whitespace in the input string. Return the - * next character after the final ASCII zero to enable the caller - * to check for the end of the string (NULL terminator). - * - ******************************************************************************/ - -char -AcpiUtRemoveWhitespace ( - char **String) -{ - - while (isspace ((UINT8) **String)) - { - *String += 1; - } - - return (**String); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtDetectHexPrefix - * - * PARAMETERS: String - Pointer to input ASCII string - * - * RETURN: TRUE if a "0x" prefix was found at the start of the string - * - * DESCRIPTION: Detect and remove a hex "0x" prefix - * - ******************************************************************************/ - -BOOLEAN -AcpiUtDetectHexPrefix ( - char **String) -{ - char *InitialPosition = *String; - - AcpiUtRemoveHexPrefix (String); - if (*String != InitialPosition) - { - return (TRUE); /* String is past leading 0x */ - } - - return (FALSE); /* Not a hex string */ -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtRemoveHexPrefix - * - * PARAMETERS: String - Pointer to input ASCII string - * - * RETURN: none - * - * DESCRIPTION: Remove a hex "0x" prefix - * - ******************************************************************************/ - -void -AcpiUtRemoveHexPrefix ( - char **String) -{ - if ((**String == ACPI_ASCII_ZERO) && - (tolower ((int) *(*String + 1)) == 'x')) - { - *String += 2; /* Go past the leading 0x */ - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtDetectOctalPrefix - * - * PARAMETERS: String - Pointer to input ASCII string - * - * RETURN: True if an octal "0" prefix was found at the start of the - * string - * - * DESCRIPTION: Detect and remove an octal prefix (zero) - * - ******************************************************************************/ - -BOOLEAN -AcpiUtDetectOctalPrefix ( - char **String) -{ - - if (**String == ACPI_ASCII_ZERO) - { - *String += 1; /* Go past the leading 0 */ - return (TRUE); - } - - return (FALSE); /* Not an octal string */ -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtInsertDigit - * - * PARAMETERS: AccumulatedValue - Current value of the integer value - * accumulator. The new value is - * returned here. - * Base - Radix, either 8/10/16 - * AsciiDigit - ASCII single digit to be inserted - * - * RETURN: Status and result of the convert/insert operation. The only - * possible returned exception code is numeric overflow of - * either the multiply or add conversion operations. - * - * DESCRIPTION: Generic conversion and insertion function for all bases: - * - * 1) Multiply the current accumulated/converted value by the - * base in order to make room for the new character. - * - * 2) Convert the new character to binary and add it to the - * current accumulated value. - * - * Note: The only possible exception indicates an integer - * overflow (AE_NUMERIC_OVERFLOW) - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiUtInsertDigit ( - UINT64 *AccumulatedValue, - UINT32 Base, - int AsciiDigit) -{ - ACPI_STATUS Status; - UINT64 Product; - - - /* Make room in the accumulated value for the incoming digit */ - - Status = AcpiUtStrtoulMultiply64 (*AccumulatedValue, Base, &Product); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Add in the new digit, and store the sum to the accumulated value */ - - Status = AcpiUtStrtoulAdd64 (Product, AcpiUtAsciiCharToHex (AsciiDigit), - AccumulatedValue); - - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtStrtoulMultiply64 - * - * PARAMETERS: Multiplicand - Current accumulated converted integer - * Base - Base/Radix - * OutProduct - Where the product is returned - * - * RETURN: Status and 64-bit product - * - * DESCRIPTION: Multiply two 64-bit values, with checking for 64-bit overflow as - * well as 32-bit overflow if necessary (if the current global - * integer width is 32). - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiUtStrtoulMultiply64 ( - UINT64 Multiplicand, - UINT32 Base, - UINT64 *OutProduct) -{ - UINT64 Product; - UINT64 Quotient; - - - /* Exit if either operand is zero */ - - *OutProduct = 0; - if (!Multiplicand || !Base) - { - return (AE_OK); - } - - /* - * Check for 64-bit overflow before the actual multiplication. - * - * Notes: 64-bit division is often not supported on 32-bit platforms - * (it requires a library function), Therefore ACPICA has a local - * 64-bit divide function. Also, Multiplier is currently only used - * as the radix (8/10/16), to the 64/32 divide will always work. - */ - AcpiUtShortDivide (ACPI_UINT64_MAX, Base, &Quotient, NULL); - if (Multiplicand > Quotient) - { - return (AE_NUMERIC_OVERFLOW); - } - - Product = Multiplicand * Base; - - /* Check for 32-bit overflow if necessary */ - - if ((AcpiGbl_IntegerBitWidth == 32) && (Product > ACPI_UINT32_MAX)) - { - return (AE_NUMERIC_OVERFLOW); - } - - *OutProduct = Product; - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtStrtoulAdd64 - * - * PARAMETERS: Addend1 - Current accumulated converted integer - * Digit - New hex value/char - * OutSum - Where sum is returned (Accumulator) - * - * RETURN: Status and 64-bit sum - * - * DESCRIPTION: Add two 64-bit values, with checking for 64-bit overflow as - * well as 32-bit overflow if necessary (if the current global - * integer width is 32). - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiUtStrtoulAdd64 ( - UINT64 Addend1, - UINT32 Digit, - UINT64 *OutSum) -{ - UINT64 Sum; - - - /* Check for 64-bit overflow before the actual addition */ - - if ((Addend1 > 0) && (Digit > (ACPI_UINT64_MAX - Addend1))) - { - return (AE_NUMERIC_OVERFLOW); - } - - Sum = Addend1 + Digit; - - /* Check for 32-bit overflow if necessary */ - - if ((AcpiGbl_IntegerBitWidth == 32) && (Sum > ACPI_UINT32_MAX)) - { - return (AE_NUMERIC_OVERFLOW); - } - - *OutSum = Sum; - return (AE_OK); -} diff --git a/drivers/acpica/utstrtoul64.c b/drivers/acpica/utstrtoul64.c deleted file mode 100644 index 8b927db..0000000 --- a/drivers/acpica/utstrtoul64.c +++ /dev/null @@ -1,502 +0,0 @@ -/******************************************************************************* - * - * Module Name: utstrtoul64 - String-to-integer conversion support for both - * 64-bit and 32-bit integers - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" - -#define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utstrtoul64") - - -/******************************************************************************* - * - * This module contains the top-level string to 64/32-bit unsigned integer - * conversion functions: - * - * 1) A standard strtoul() function that supports 64-bit integers, base - * 8/10/16, with integer overflow support. This is used mainly by the - * iASL compiler, which implements tighter constraints on integer - * constants than the runtime (interpreter) integer-to-string conversions. - * 2) Runtime "Explicit conversion" as defined in the ACPI specification. - * 3) Runtime "Implicit conversion" as defined in the ACPI specification. - * - * Current users of this module: - * - * iASL - Preprocessor (constants and math expressions) - * iASL - Main parser, conversion of constants to integers - * iASL - Data Table Compiler parser (constants and math expressions) - * Interpreter - Implicit and explicit conversions, GPE method names - * Interpreter - Repair code for return values from predefined names - * Debugger - Command line input string conversion - * AcpiDump - ACPI table physical addresses - * AcpiExec - Support for namespace overrides - * - * Notes concerning users of these interfaces: - * - * AcpiGbl_IntegerByteWidth is used to set the 32/64 bit limit for explicit - * and implicit conversions. This global must be set to the proper width. - * For the core ACPICA code, the width depends on the DSDT version. For the - * AcpiUtStrtoul64 interface, all conversions are 64 bits. This interface is - * used primarily for iASL, where the default width is 64 bits for all parsers, - * but error checking is performed later to flag cases where a 64-bit constant - * is wrongly defined in a 32-bit DSDT/SSDT. - * - * In ACPI, the only place where octal numbers are supported is within - * the ASL language itself. This is implemented via the main AcpiUtStrtoul64 - * interface. According the ACPI specification, there is no ACPI runtime - * support (explicit/implicit) for octal string conversions. - * - ******************************************************************************/ - - -/******************************************************************************* - * - * FUNCTION: AcpiUtStrtoul64 - * - * PARAMETERS: String - Null terminated input string, - * must be a valid pointer - * ReturnValue - Where the converted integer is - * returned. Must be a valid pointer - * - * RETURN: Status and converted integer. Returns an exception on a - * 64-bit numeric overflow - * - * DESCRIPTION: Convert a string into an unsigned integer. Always performs a - * full 64-bit conversion, regardless of the current global - * integer width. Supports Decimal, Hex, and Octal strings. - * - * Current users of this function: - * - * iASL - Preprocessor (constants and math expressions) - * iASL - Main ASL parser, conversion of ASL constants to integers - * iASL - Data Table Compiler parser (constants and math expressions) - * Interpreter - Repair code for return values from predefined names - * AcpiDump - ACPI table physical addresses - * AcpiExec - Support for namespace overrides - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtStrtoul64 ( - char *String, - UINT64 *ReturnValue) -{ - ACPI_STATUS Status = AE_OK; - UINT8 OriginalBitWidth; - UINT32 Base = 10; /* Default is decimal */ - - - ACPI_FUNCTION_TRACE_STR (UtStrtoul64, String); - - - *ReturnValue = 0; - - /* A NULL return string returns a value of zero */ - - if (*String == 0) - { - return_ACPI_STATUS (AE_OK); - } - - if (!AcpiUtRemoveWhitespace (&String)) - { - return_ACPI_STATUS (AE_OK); - } - - /* - * 1) Check for a hex constant. A "0x" prefix indicates base 16. - */ - if (AcpiUtDetectHexPrefix (&String)) - { - Base = 16; - } - - /* - * 2) Check for an octal constant, defined to be a leading zero - * followed by sequence of octal digits (0-7) - */ - else if (AcpiUtDetectOctalPrefix (&String)) - { - Base = 8; - } - - if (!AcpiUtRemoveLeadingZeros (&String)) - { - return_ACPI_STATUS (AE_OK); /* Return value 0 */ - } - - /* - * Force a full 64-bit conversion. The caller (usually iASL) must - * check for a 32-bit overflow later as necessary (If current mode - * is 32-bit, meaning a 32-bit DSDT). - */ - OriginalBitWidth = AcpiGbl_IntegerBitWidth; - AcpiGbl_IntegerBitWidth = 64; - - /* - * Perform the base 8, 10, or 16 conversion. A 64-bit numeric overflow - * will return an exception (to allow iASL to flag the statement). - */ - switch (Base) - { - case 8: - Status = AcpiUtConvertOctalString (String, ReturnValue); - break; - - case 10: - Status = AcpiUtConvertDecimalString (String, ReturnValue); - break; - - case 16: - default: - Status = AcpiUtConvertHexString (String, ReturnValue); - break; - } - - /* Only possible exception from above is a 64-bit overflow */ - - AcpiGbl_IntegerBitWidth = OriginalBitWidth; - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtImplicitStrtoul64 - * - * PARAMETERS: String - Null terminated input string, - * must be a valid pointer - * - * RETURN: Converted integer - * - * DESCRIPTION: Perform a 64-bit conversion with restrictions placed upon - * an "implicit conversion" by the ACPI specification. Used by - * many ASL operators that require an integer operand, and support - * an automatic (implicit) conversion from a string operand - * to the final integer operand. The major restriction is that - * only hex strings are supported. - * - * ----------------------------------------------------------------------------- - * - * Base is always 16, either with or without the 0x prefix. Decimal and - * Octal strings are not supported, as per the ACPI specification. - * - * Examples (both are hex values): - * Add ("BA98", Arg0, Local0) - * Subtract ("0x12345678", Arg1, Local1) - * - * Conversion rules as extracted from the ACPI specification: - * - * The converted integer is initialized to the value zero. - * The ASCII string is always interpreted as a hexadecimal constant. - * - * 1) According to the ACPI specification, a "0x" prefix is not allowed. - * However, ACPICA allows this as an ACPI extension on general - * principle. (NO ERROR) - * - * 2) The conversion terminates when the size of an integer is reached - * (32 or 64 bits). There are no numeric overflow conditions. (NO ERROR) - * - * 3) The first non-hex character terminates the conversion and returns - * the current accumulated value of the converted integer (NO ERROR). - * - * 4) Conversion of a null (zero-length) string to an integer is - * technically not allowed. However, ACPICA allows this as an ACPI - * extension. The conversion returns the value 0. (NO ERROR) - * - * NOTE: There are no error conditions returned by this function. At - * the minimum, a value of zero is returned. - * - * Current users of this function: - * - * Interpreter - All runtime implicit conversions, as per ACPI specification - * iASL - Data Table Compiler parser (constants and math expressions) - * - ******************************************************************************/ - -UINT64 -AcpiUtImplicitStrtoul64 ( - char *String) -{ - UINT64 ConvertedInteger = 0; - - - ACPI_FUNCTION_TRACE_STR (UtImplicitStrtoul64, String); - - - if (!AcpiUtRemoveWhitespace (&String)) - { - return_VALUE (0); - } - - /* - * Per the ACPI specification, only hexadecimal is supported for - * implicit conversions, and the "0x" prefix is "not allowed". - * However, allow a "0x" prefix as an ACPI extension. - */ - AcpiUtRemoveHexPrefix (&String); - - if (!AcpiUtRemoveLeadingZeros (&String)) - { - return_VALUE (0); - } - - /* - * Ignore overflow as per the ACPI specification. This is implemented by - * ignoring the return status from the conversion function called below. - * On overflow, the input string is simply truncated. - */ - AcpiUtConvertHexString (String, &ConvertedInteger); - return_VALUE (ConvertedInteger); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtExplicitStrtoul64 - * - * PARAMETERS: String - Null terminated input string, - * must be a valid pointer - * - * RETURN: Converted integer - * - * DESCRIPTION: Perform a 64-bit conversion with the restrictions placed upon - * an "explicit conversion" by the ACPI specification. The - * main restriction is that only hex and decimal are supported. - * - * ----------------------------------------------------------------------------- - * - * Base is either 10 (default) or 16 (with 0x prefix). Octal (base 8) strings - * are not supported, as per the ACPI specification. - * - * Examples: - * ToInteger ("1000") Decimal - * ToInteger ("0xABCD") Hex - * - * Conversion rules as extracted from the ACPI specification: - * - * 1) The input string is either a decimal or hexadecimal numeric string. - * A hex value must be prefixed by "0x" or it is interpreted as decimal. - * - * 2) The value must not exceed the maximum of an integer value - * (32 or 64 bits). The ACPI specification states the behavior is - * "unpredictable", so ACPICA matches the behavior of the implicit - * conversion case. There are no numeric overflow conditions. (NO ERROR) - * - * 3) Behavior on the first non-hex character is not defined by the ACPI - * specification (for the ToInteger operator), so ACPICA matches the - * behavior of the implicit conversion case. It terminates the - * conversion and returns the current accumulated value of the converted - * integer. (NO ERROR) - * - * 4) Conversion of a null (zero-length) string to an integer is - * technically not allowed. However, ACPICA allows this as an ACPI - * extension. The conversion returns the value 0. (NO ERROR) - * - * NOTE: There are no error conditions returned by this function. At the - * minimum, a value of zero is returned. - * - * Current users of this function: - * - * Interpreter - Runtime ASL ToInteger operator, as per the ACPI specification - * - ******************************************************************************/ - -UINT64 -AcpiUtExplicitStrtoul64 ( - char *String) -{ - UINT64 ConvertedInteger = 0; - UINT32 Base = 10; /* Default is decimal */ - - - ACPI_FUNCTION_TRACE_STR (UtExplicitStrtoul64, String); - - - if (!AcpiUtRemoveWhitespace (&String)) - { - return_VALUE (0); - } - - /* - * Only Hex and Decimal are supported, as per the ACPI specification. - * A "0x" prefix indicates hex; otherwise decimal is assumed. - */ - if (AcpiUtDetectHexPrefix (&String)) - { - Base = 16; - } - - if (!AcpiUtRemoveLeadingZeros (&String)) - { - return_VALUE (0); - } - - /* - * Ignore overflow as per the ACPI specification. This is implemented by - * ignoring the return status from the conversion functions called below. - * On overflow, the input string is simply truncated. - */ - switch (Base) - { - case 10: - default: - AcpiUtConvertDecimalString (String, &ConvertedInteger); - break; - - case 16: - AcpiUtConvertHexString (String, &ConvertedInteger); - break; - } - - return_VALUE (ConvertedInteger); -} diff --git a/drivers/acpica/uttrack.c b/drivers/acpica/uttrack.c deleted file mode 100644 index fa5c49f..0000000 --- a/drivers/acpica/uttrack.c +++ /dev/null @@ -1,909 +0,0 @@ -/****************************************************************************** - * - * Module Name: uttrack - Memory allocation tracking routines (debug only) - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -/* - * These procedures are used for tracking memory leaks in the subsystem, and - * they get compiled out when the ACPI_DBG_TRACK_ALLOCATIONS is not set. - * - * Each memory allocation is tracked via a doubly linked list. Each - * element contains the caller's component, module name, function name, and - * line number. AcpiUtAllocate and AcpiUtAllocateZeroed call - * AcpiUtTrackAllocation to add an element to the list; deletion - * occurs in the body of AcpiUtFree. - */ - -#include "acpi.h" -#include "accommon.h" - -#ifdef ACPI_DBG_TRACK_ALLOCATIONS - -#define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("uttrack") - - -/* Local prototypes */ - -static ACPI_DEBUG_MEM_BLOCK * -AcpiUtFindAllocation ( - ACPI_DEBUG_MEM_BLOCK *Allocation); - -static ACPI_STATUS -AcpiUtTrackAllocation ( - ACPI_DEBUG_MEM_BLOCK *Address, - ACPI_SIZE Size, - UINT8 AllocType, - UINT32 Component, - const char *Module, - UINT32 Line); - -static ACPI_STATUS -AcpiUtRemoveAllocation ( - ACPI_DEBUG_MEM_BLOCK *Address, - UINT32 Component, - const char *Module, - UINT32 Line); - - -/******************************************************************************* - * - * FUNCTION: AcpiUtCreateList - * - * PARAMETERS: CacheName - Ascii name for the cache - * ObjectSize - Size of each cached object - * ReturnCache - Where the new cache object is returned - * - * RETURN: Status - * - * DESCRIPTION: Create a local memory list for tracking purposed - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtCreateList ( - const char *ListName, - UINT16 ObjectSize, - ACPI_MEMORY_LIST **ReturnCache) -{ - ACPI_MEMORY_LIST *Cache; - - - Cache = AcpiOsAllocateZeroed (sizeof (ACPI_MEMORY_LIST)); - if (!Cache) - { - return (AE_NO_MEMORY); - } - - Cache->ListName = ListName; - Cache->ObjectSize = ObjectSize; - - *ReturnCache = Cache; - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtAllocateAndTrack - * - * PARAMETERS: Size - Size of the allocation - * Component - Component type of caller - * Module - Source file name of caller - * Line - Line number of caller - * - * RETURN: Address of the allocated memory on success, NULL on failure. - * - * DESCRIPTION: The subsystem's equivalent of malloc. - * - ******************************************************************************/ - -void * -AcpiUtAllocateAndTrack ( - ACPI_SIZE Size, - UINT32 Component, - const char *Module, - UINT32 Line) -{ - ACPI_DEBUG_MEM_BLOCK *Allocation; - ACPI_STATUS Status; - - - /* Check for an inadvertent size of zero bytes */ - - if (!Size) - { - ACPI_WARNING ((Module, Line, - "Attempt to allocate zero bytes, allocating 1 byte")); - Size = 1; - } - - Allocation = AcpiOsAllocate (Size + sizeof (ACPI_DEBUG_MEM_HEADER)); - if (!Allocation) - { - /* Report allocation error */ - - ACPI_WARNING ((Module, Line, - "Could not allocate size %u", (UINT32) Size)); - - return (NULL); - } - - Status = AcpiUtTrackAllocation ( - Allocation, Size, ACPI_MEM_MALLOC, Component, Module, Line); - if (ACPI_FAILURE (Status)) - { - AcpiOsFree (Allocation); - return (NULL); - } - - AcpiGbl_GlobalList->TotalAllocated++; - AcpiGbl_GlobalList->TotalSize += (UINT32) Size; - AcpiGbl_GlobalList->CurrentTotalSize += (UINT32) Size; - - if (AcpiGbl_GlobalList->CurrentTotalSize > - AcpiGbl_GlobalList->MaxOccupied) - { - AcpiGbl_GlobalList->MaxOccupied = - AcpiGbl_GlobalList->CurrentTotalSize; - } - - return ((void *) &Allocation->UserSpace); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtAllocateZeroedAndTrack - * - * PARAMETERS: Size - Size of the allocation - * Component - Component type of caller - * Module - Source file name of caller - * Line - Line number of caller - * - * RETURN: Address of the allocated memory on success, NULL on failure. - * - * DESCRIPTION: Subsystem equivalent of calloc. - * - ******************************************************************************/ - -void * -AcpiUtAllocateZeroedAndTrack ( - ACPI_SIZE Size, - UINT32 Component, - const char *Module, - UINT32 Line) -{ - ACPI_DEBUG_MEM_BLOCK *Allocation; - ACPI_STATUS Status; - - - /* Check for an inadvertent size of zero bytes */ - - if (!Size) - { - ACPI_WARNING ((Module, Line, - "Attempt to allocate zero bytes, allocating 1 byte")); - Size = 1; - } - - Allocation = AcpiOsAllocateZeroed ( - Size + sizeof (ACPI_DEBUG_MEM_HEADER)); - if (!Allocation) - { - /* Report allocation error */ - - ACPI_ERROR ((Module, Line, - "Could not allocate size %u", (UINT32) Size)); - return (NULL); - } - - Status = AcpiUtTrackAllocation (Allocation, Size, - ACPI_MEM_CALLOC, Component, Module, Line); - if (ACPI_FAILURE (Status)) - { - AcpiOsFree (Allocation); - return (NULL); - } - - AcpiGbl_GlobalList->TotalAllocated++; - AcpiGbl_GlobalList->TotalSize += (UINT32) Size; - AcpiGbl_GlobalList->CurrentTotalSize += (UINT32) Size; - - if (AcpiGbl_GlobalList->CurrentTotalSize > - AcpiGbl_GlobalList->MaxOccupied) - { - AcpiGbl_GlobalList->MaxOccupied = - AcpiGbl_GlobalList->CurrentTotalSize; - } - - return ((void *) &Allocation->UserSpace); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtFreeAndTrack - * - * PARAMETERS: Allocation - Address of the memory to deallocate - * Component - Component type of caller - * Module - Source file name of caller - * Line - Line number of caller - * - * RETURN: None - * - * DESCRIPTION: Frees the memory at Allocation - * - ******************************************************************************/ - -void -AcpiUtFreeAndTrack ( - void *Allocation, - UINT32 Component, - const char *Module, - UINT32 Line) -{ - ACPI_DEBUG_MEM_BLOCK *DebugBlock; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE_PTR (UtFree, Allocation); - - - if (NULL == Allocation) - { - ACPI_ERROR ((Module, Line, - "Attempt to delete a NULL address")); - - return_VOID; - } - - DebugBlock = ACPI_CAST_PTR (ACPI_DEBUG_MEM_BLOCK, - (((char *) Allocation) - sizeof (ACPI_DEBUG_MEM_HEADER))); - - AcpiGbl_GlobalList->TotalFreed++; - AcpiGbl_GlobalList->CurrentTotalSize -= DebugBlock->Size; - - Status = AcpiUtRemoveAllocation (DebugBlock, Component, Module, Line); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, "Could not free memory")); - } - - AcpiOsFree (DebugBlock); - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p freed (block %p)\n", - Allocation, DebugBlock)); - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtFindAllocation - * - * PARAMETERS: Allocation - Address of allocated memory - * - * RETURN: Three cases: - * 1) List is empty, NULL is returned. - * 2) Element was found. Returns Allocation parameter. - * 3) Element was not found. Returns position where it should be - * inserted into the list. - * - * DESCRIPTION: Searches for an element in the global allocation tracking list. - * If the element is not found, returns the location within the - * list where the element should be inserted. - * - * Note: The list is ordered by larger-to-smaller addresses. - * - * This global list is used to detect memory leaks in ACPICA as - * well as other issues such as an attempt to release the same - * internal object more than once. Although expensive as far - * as cpu time, this list is much more helpful for finding these - * types of issues than using memory leak detectors outside of - * the ACPICA code. - * - ******************************************************************************/ - -static ACPI_DEBUG_MEM_BLOCK * -AcpiUtFindAllocation ( - ACPI_DEBUG_MEM_BLOCK *Allocation) -{ - ACPI_DEBUG_MEM_BLOCK *Element; - - - Element = AcpiGbl_GlobalList->ListHead; - if (!Element) - { - return (NULL); - } - - /* - * Search for the address. - * - * Note: List is ordered by larger-to-smaller addresses, on the - * assumption that a new allocation usually has a larger address - * than previous allocations. - */ - while (Element > Allocation) - { - /* Check for end-of-list */ - - if (!Element->Next) - { - return (Element); - } - - Element = Element->Next; - } - - if (Element == Allocation) - { - return (Element); - } - - return (Element->Previous); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtTrackAllocation - * - * PARAMETERS: Allocation - Address of allocated memory - * Size - Size of the allocation - * AllocType - MEM_MALLOC or MEM_CALLOC - * Component - Component type of caller - * Module - Source file name of caller - * Line - Line number of caller - * - * RETURN: Status - * - * DESCRIPTION: Inserts an element into the global allocation tracking list. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiUtTrackAllocation ( - ACPI_DEBUG_MEM_BLOCK *Allocation, - ACPI_SIZE Size, - UINT8 AllocType, - UINT32 Component, - const char *Module, - UINT32 Line) -{ - ACPI_MEMORY_LIST *MemList; - ACPI_DEBUG_MEM_BLOCK *Element; - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE_PTR (UtTrackAllocation, Allocation); - - - if (AcpiGbl_DisableMemTracking) - { - return_ACPI_STATUS (AE_OK); - } - - MemList = AcpiGbl_GlobalList; - Status = AcpiUtAcquireMutex (ACPI_MTX_MEMORY); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* - * Search the global list for this address to make sure it is not - * already present. This will catch several kinds of problems. - */ - Element = AcpiUtFindAllocation (Allocation); - if (Element == Allocation) - { - ACPI_ERROR ((AE_INFO, - "UtTrackAllocation: Allocation (%p) already present in global list!", - Allocation)); - goto UnlockAndExit; - } - - /* Fill in the instance data */ - - Allocation->Size = (UINT32) Size; - Allocation->AllocType = AllocType; - Allocation->Component = Component; - Allocation->Line = Line; - - AcpiUtSafeStrncpy (Allocation->Module, (char *) Module, ACPI_MAX_MODULE_NAME); - - if (!Element) - { - /* Insert at list head */ - - if (MemList->ListHead) - { - ((ACPI_DEBUG_MEM_BLOCK *)(MemList->ListHead))->Previous = - Allocation; - } - - Allocation->Next = MemList->ListHead; - Allocation->Previous = NULL; - - MemList->ListHead = Allocation; - } - else - { - /* Insert after element */ - - Allocation->Next = Element->Next; - Allocation->Previous = Element; - - if (Element->Next) - { - (Element->Next)->Previous = Allocation; - } - - Element->Next = Allocation; - } - - -UnlockAndExit: - Status = AcpiUtReleaseMutex (ACPI_MTX_MEMORY); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtRemoveAllocation - * - * PARAMETERS: Allocation - Address of allocated memory - * Component - Component type of caller - * Module - Source file name of caller - * Line - Line number of caller - * - * RETURN: Status - * - * DESCRIPTION: Deletes an element from the global allocation tracking list. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiUtRemoveAllocation ( - ACPI_DEBUG_MEM_BLOCK *Allocation, - UINT32 Component, - const char *Module, - UINT32 Line) -{ - ACPI_MEMORY_LIST *MemList; - ACPI_STATUS Status; - - - ACPI_FUNCTION_NAME (UtRemoveAllocation); - - - if (AcpiGbl_DisableMemTracking) - { - return (AE_OK); - } - - MemList = AcpiGbl_GlobalList; - if (NULL == MemList->ListHead) - { - /* No allocations! */ - - ACPI_ERROR ((Module, Line, - "Empty allocation list, nothing to free!")); - - return (AE_OK); - } - - Status = AcpiUtAcquireMutex (ACPI_MTX_MEMORY); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Unlink */ - - if (Allocation->Previous) - { - (Allocation->Previous)->Next = Allocation->Next; - } - else - { - MemList->ListHead = Allocation->Next; - } - - if (Allocation->Next) - { - (Allocation->Next)->Previous = Allocation->Previous; - } - - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Freeing %p, size 0%X\n", - &Allocation->UserSpace, Allocation->Size)); - - /* Mark the segment as deleted */ - - memset (&Allocation->UserSpace, 0xEA, Allocation->Size); - - Status = AcpiUtReleaseMutex (ACPI_MTX_MEMORY); - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtDumpAllocationInfo - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Print some info about the outstanding allocations. - * - ******************************************************************************/ - -void -AcpiUtDumpAllocationInfo ( - void) -{ -/* - ACPI_MEMORY_LIST *MemList; -*/ - - ACPI_FUNCTION_TRACE (UtDumpAllocationInfo); - -/* - ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Current allocations", - MemList->CurrentCount, - ROUND_UP_TO_1K (MemList->CurrentSize))); - - ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Max concurrent allocations", - MemList->MaxConcurrentCount, - ROUND_UP_TO_1K (MemList->MaxConcurrentSize))); - - - ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Total (all) internal objects", - RunningObjectCount, - ROUND_UP_TO_1K (RunningObjectSize))); - - ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Total (all) allocations", - RunningAllocCount, - ROUND_UP_TO_1K (RunningAllocSize))); - - - ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Current Nodes", - AcpiGbl_CurrentNodeCount, - ROUND_UP_TO_1K (AcpiGbl_CurrentNodeSize))); - - ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Max Nodes", - AcpiGbl_MaxConcurrentNodeCount, - ROUND_UP_TO_1K ((AcpiGbl_MaxConcurrentNodeCount * - sizeof (ACPI_NAMESPACE_NODE))))); -*/ - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtDumpAllocations - * - * PARAMETERS: Component - Component(s) to dump info for. - * Module - Module to dump info for. NULL means all. - * - * RETURN: None - * - * DESCRIPTION: Print a list of all outstanding allocations. - * - ******************************************************************************/ - -void -AcpiUtDumpAllocations ( - UINT32 Component, - const char *Module) -{ - ACPI_DEBUG_MEM_BLOCK *Element; - ACPI_DESCRIPTOR *Descriptor; - UINT32 NumOutstanding = 0; - UINT8 DescriptorType; - - - ACPI_FUNCTION_TRACE (UtDumpAllocations); - - - if (AcpiGbl_DisableMemTracking) - { - return_VOID; - } - - /* - * Walk the allocation list. - */ - if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_MEMORY))) - { - return_VOID; - } - - if (!AcpiGbl_GlobalList) - { - goto Exit; - } - - Element = AcpiGbl_GlobalList->ListHead; - while (Element) - { - if ((Element->Component & Component) && - ((Module == NULL) || (0 == strcmp (Module, Element->Module)))) - { - Descriptor = ACPI_CAST_PTR ( - ACPI_DESCRIPTOR, &Element->UserSpace); - - if (Element->Size < sizeof (ACPI_COMMON_DESCRIPTOR)) - { - AcpiOsPrintf ("%p Length 0x%04X %9.9s-%4.4u " - "[Not a Descriptor - too small]\n", - Descriptor, Element->Size, Element->Module, - Element->Line); - } - else - { - /* Ignore allocated objects that are in a cache */ - - if (ACPI_GET_DESCRIPTOR_TYPE (Descriptor) != - ACPI_DESC_TYPE_CACHED) - { - AcpiOsPrintf ("%p Length 0x%04X %9.9s-%4.4u [%s] ", - Descriptor, Element->Size, Element->Module, - Element->Line, AcpiUtGetDescriptorName (Descriptor)); - - /* Optional object hex dump */ - - if (AcpiGbl_VerboseLeakDump) - { - AcpiOsPrintf ("\n"); - AcpiUtDumpBuffer ((UINT8 *) Descriptor, Element->Size, - DB_BYTE_DISPLAY, 0); - } - - /* Validate the descriptor type using Type field and length */ - - DescriptorType = 0; /* Not a valid descriptor type */ - - switch (ACPI_GET_DESCRIPTOR_TYPE (Descriptor)) - { - case ACPI_DESC_TYPE_OPERAND: - - if (Element->Size == sizeof (ACPI_OPERAND_OBJECT)) - { - DescriptorType = ACPI_DESC_TYPE_OPERAND; - } - break; - - case ACPI_DESC_TYPE_PARSER: - - if (Element->Size == sizeof (ACPI_PARSE_OBJECT)) - { - DescriptorType = ACPI_DESC_TYPE_PARSER; - } - break; - - case ACPI_DESC_TYPE_NAMED: - - if (Element->Size == sizeof (ACPI_NAMESPACE_NODE)) - { - DescriptorType = ACPI_DESC_TYPE_NAMED; - } - break; - - default: - - break; - } - - /* Display additional info for the major descriptor types */ - - switch (DescriptorType) - { - case ACPI_DESC_TYPE_OPERAND: - - AcpiOsPrintf ("%12.12s RefCount 0x%04X\n", - AcpiUtGetTypeName (Descriptor->Object.Common.Type), - Descriptor->Object.Common.ReferenceCount); - break; - - case ACPI_DESC_TYPE_PARSER: - - AcpiOsPrintf ("AmlOpcode 0x%04X\n", - Descriptor->Op.Asl.AmlOpcode); - break; - - case ACPI_DESC_TYPE_NAMED: - - AcpiOsPrintf ("%4.4s\n", - AcpiUtGetNodeName (&Descriptor->Node)); - break; - - default: - - AcpiOsPrintf ( "\n"); - break; - } - } - } - - NumOutstanding++; - } - - Element = Element->Next; - } - -Exit: - (void) AcpiUtReleaseMutex (ACPI_MTX_MEMORY); - - /* Print summary */ - - if (!NumOutstanding) - { - ACPI_INFO (("No outstanding allocations")); - } - else - { - ACPI_ERROR ((AE_INFO, "%u (0x%X) Outstanding cache allocations", - NumOutstanding, NumOutstanding)); - } - - return_VOID; -} - -#endif /* ACPI_DBG_TRACK_ALLOCATIONS */ diff --git a/drivers/acpica/utuuid.c b/drivers/acpica/utuuid.c deleted file mode 100644 index 5eacf9f..0000000 --- a/drivers/acpica/utuuid.c +++ /dev/null @@ -1,259 +0,0 @@ -/****************************************************************************** - * - * Module Name: utuuid -- UUID support functions - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("utuuid") - - -#if (defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP || defined ACPI_HELP_APP) -/* - * UUID support functions. - * - * This table is used to convert an input UUID ascii string to a 16 byte - * buffer and the reverse. The table maps a UUID buffer index 0-15 to - * the index within the 36-byte UUID string where the associated 2-byte - * hex value can be found. - * - * 36-byte UUID strings are of the form: - * aabbccdd-eeff-gghh-iijj-kkllmmnnoopp - * Where aa-pp are one byte hex numbers, made up of two hex digits - * - * Note: This table is basically the inverse of the string-to-offset table - * found in the ACPI spec in the description of the ToUUID macro. - */ -const UINT8 AcpiGbl_MapToUuidOffset[UUID_BUFFER_LENGTH] = -{ - 6,4,2,0,11,9,16,14,19,21,24,26,28,30,32,34 -}; - - -/******************************************************************************* - * - * FUNCTION: AcpiUtConvertStringToUuid - * - * PARAMETERS: InString - 36-byte formatted UUID string - * UuidBuffer - Where the 16-byte UUID buffer is returned - * - * RETURN: None. Output data is returned in the UuidBuffer - * - * DESCRIPTION: Convert a 36-byte formatted UUID string to 16-byte UUID buffer - * - ******************************************************************************/ - -void -AcpiUtConvertStringToUuid ( - char *InString, - UINT8 *UuidBuffer) -{ - UINT32 i; - - - for (i = 0; i < UUID_BUFFER_LENGTH; i++) - { - UuidBuffer[i] = (AcpiUtAsciiCharToHex ( - InString[AcpiGbl_MapToUuidOffset[i]]) << 4); - - UuidBuffer[i] |= AcpiUtAsciiCharToHex ( - InString[AcpiGbl_MapToUuidOffset[i] + 1]); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtConvertUuidToString - * - * PARAMETERS: UuidBuffer - 16-byte UUID buffer - * OutString - 36-byte formatted UUID string - * - * RETURN: Status - * - * DESCRIPTION: Convert 16-byte UUID buffer to 36-byte formatted UUID string - * OutString must be 37 bytes to include null terminator. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtConvertUuidToString ( - char *UuidBuffer, - char *OutString) -{ - UINT32 i; - - - if (!UuidBuffer || !OutString) - { - return (AE_BAD_PARAMETER); - } - - for (i = 0; i < UUID_BUFFER_LENGTH; i++) - { - OutString[AcpiGbl_MapToUuidOffset[i]] = - AcpiUtHexToAsciiChar (UuidBuffer[i], 4); - - OutString[AcpiGbl_MapToUuidOffset[i] + 1] = - AcpiUtHexToAsciiChar (UuidBuffer[i], 0); - } - - /* Insert required hyphens (dashes) */ - - OutString[UUID_HYPHEN1_OFFSET] = - OutString[UUID_HYPHEN2_OFFSET] = - OutString[UUID_HYPHEN3_OFFSET] = - OutString[UUID_HYPHEN4_OFFSET] = '-'; - - OutString[UUID_STRING_LENGTH] = 0; /* Null terminate */ - return (AE_OK); -} -#endif diff --git a/drivers/acpica/utxface.c b/drivers/acpica/utxface.c deleted file mode 100644 index 5e10fc2..0000000 --- a/drivers/acpica/utxface.c +++ /dev/null @@ -1,751 +0,0 @@ -/****************************************************************************** - * - * Module Name: utxface - External interfaces, miscellaneous utility functions - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#define EXPORT_ACPI_INTERFACES - -#include "acpi.h" -#include "accommon.h" -#include "acdebug.h" - -#define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utxface") - - -/******************************************************************************* - * - * FUNCTION: AcpiTerminate - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Shutdown the ACPICA subsystem and release all resources. - * - ******************************************************************************/ - -ACPI_STATUS ACPI_INIT_FUNCTION -AcpiTerminate ( - void) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiTerminate); - - - /* Shutdown and free all resources */ - - AcpiUtSubsystemShutdown (); - - /* Free the mutex objects */ - - AcpiUtMutexTerminate (); - - /* Now we can shutdown the OS-dependent layer */ - - Status = AcpiOsTerminate (); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL_INIT (AcpiTerminate) - - -#ifndef ACPI_ASL_COMPILER -/******************************************************************************* - * - * FUNCTION: AcpiSubsystemStatus - * - * PARAMETERS: None - * - * RETURN: Status of the ACPI subsystem - * - * DESCRIPTION: Other drivers that use the ACPI subsystem should call this - * before making any other calls, to ensure the subsystem - * initialized successfully. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiSubsystemStatus ( - void) -{ - - if (AcpiGbl_StartupFlags & ACPI_INITIALIZED_OK) - { - return (AE_OK); - } - else - { - return (AE_ERROR); - } -} - -ACPI_EXPORT_SYMBOL (AcpiSubsystemStatus) - - -/******************************************************************************* - * - * FUNCTION: AcpiGetSystemInfo - * - * PARAMETERS: OutBuffer - A buffer to receive the resources for the - * device - * - * RETURN: Status - the status of the call - * - * DESCRIPTION: This function is called to get information about the current - * state of the ACPI subsystem. It will return system information - * in the OutBuffer. - * - * If the function fails an appropriate status will be returned - * and the value of OutBuffer is undefined. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiGetSystemInfo ( - ACPI_BUFFER *OutBuffer) -{ - ACPI_SYSTEM_INFO *InfoPtr; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiGetSystemInfo); - - - /* Parameter validation */ - - Status = AcpiUtValidateBuffer (OutBuffer); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Validate/Allocate/Clear caller buffer */ - - Status = AcpiUtInitializeBuffer (OutBuffer, sizeof (ACPI_SYSTEM_INFO)); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* - * Populate the return buffer - */ - InfoPtr = (ACPI_SYSTEM_INFO *) OutBuffer->Pointer; - InfoPtr->AcpiCaVersion = ACPI_CA_VERSION; - - /* System flags (ACPI capabilities) */ - - InfoPtr->Flags = ACPI_SYS_MODE_ACPI; - - /* Timer resolution - 24 or 32 bits */ - - if (AcpiGbl_FADT.Flags & ACPI_FADT_32BIT_TIMER) - { - InfoPtr->TimerResolution = 24; - } - else - { - InfoPtr->TimerResolution = 32; - } - - /* Clear the reserved fields */ - - InfoPtr->Reserved1 = 0; - InfoPtr->Reserved2 = 0; - - /* Current debug levels */ - - InfoPtr->DebugLayer = AcpiDbgLayer; - InfoPtr->DebugLevel = AcpiDbgLevel; - - return_ACPI_STATUS (AE_OK); -} - -ACPI_EXPORT_SYMBOL (AcpiGetSystemInfo) - - -/******************************************************************************* - * - * FUNCTION: AcpiGetStatistics - * - * PARAMETERS: Stats - Where the statistics are returned - * - * RETURN: Status - the status of the call - * - * DESCRIPTION: Get the contents of the various system counters - * - ******************************************************************************/ - -ACPI_STATUS -AcpiGetStatistics ( - ACPI_STATISTICS *Stats) -{ - ACPI_FUNCTION_TRACE (AcpiGetStatistics); - - - /* Parameter validation */ - - if (!Stats) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* Various interrupt-based event counters */ - - Stats->SciCount = AcpiSciCount; - Stats->GpeCount = AcpiGpeCount; - - memcpy (Stats->FixedEventCount, AcpiFixedEventCount, - sizeof (AcpiFixedEventCount)); - - /* Other counters */ - - Stats->MethodCount = AcpiMethodCount; - return_ACPI_STATUS (AE_OK); -} - -ACPI_EXPORT_SYMBOL (AcpiGetStatistics) - - -/***************************************************************************** - * - * FUNCTION: AcpiInstallInitializationHandler - * - * PARAMETERS: Handler - Callback procedure - * Function - Not (currently) used, see below - * - * RETURN: Status - * - * DESCRIPTION: Install an initialization handler - * - * TBD: When a second function is added, must save the Function also. - * - ****************************************************************************/ - -ACPI_STATUS -AcpiInstallInitializationHandler ( - ACPI_INIT_HANDLER Handler, - UINT32 Function) -{ - - if (!Handler) - { - return (AE_BAD_PARAMETER); - } - - if (AcpiGbl_InitHandler) - { - return (AE_ALREADY_EXISTS); - } - - AcpiGbl_InitHandler = Handler; - return (AE_OK); -} - -ACPI_EXPORT_SYMBOL (AcpiInstallInitializationHandler) - - -/***************************************************************************** - * - * FUNCTION: AcpiPurgeCachedObjects - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Empty all caches (delete the cached objects) - * - ****************************************************************************/ - -ACPI_STATUS -AcpiPurgeCachedObjects ( - void) -{ - ACPI_FUNCTION_TRACE (AcpiPurgeCachedObjects); - - - (void) AcpiOsPurgeCache (AcpiGbl_StateCache); - (void) AcpiOsPurgeCache (AcpiGbl_OperandCache); - (void) AcpiOsPurgeCache (AcpiGbl_PsNodeCache); - (void) AcpiOsPurgeCache (AcpiGbl_PsNodeExtCache); - - return_ACPI_STATUS (AE_OK); -} - -ACPI_EXPORT_SYMBOL (AcpiPurgeCachedObjects) - - -/***************************************************************************** - * - * FUNCTION: AcpiInstallInterface - * - * PARAMETERS: InterfaceName - The interface to install - * - * RETURN: Status - * - * DESCRIPTION: Install an _OSI interface to the global list - * - ****************************************************************************/ - -ACPI_STATUS -AcpiInstallInterface ( - ACPI_STRING InterfaceName) -{ - ACPI_STATUS Status; - ACPI_INTERFACE_INFO *InterfaceInfo; - - - /* Parameter validation */ - - if (!InterfaceName || (strlen (InterfaceName) == 0)) - { - return (AE_BAD_PARAMETER); - } - - Status = AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Check if the interface name is already in the global list */ - - InterfaceInfo = AcpiUtGetInterface (InterfaceName); - if (InterfaceInfo) - { - /* - * The interface already exists in the list. This is OK if the - * interface has been marked invalid -- just clear the bit. - */ - if (InterfaceInfo->Flags & ACPI_OSI_INVALID) - { - InterfaceInfo->Flags &= ~ACPI_OSI_INVALID; - Status = AE_OK; - } - else - { - Status = AE_ALREADY_EXISTS; - } - } - else - { - /* New interface name, install into the global list */ - - Status = AcpiUtInstallInterface (InterfaceName); - } - - AcpiOsReleaseMutex (AcpiGbl_OsiMutex); - return (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiInstallInterface) - - -/***************************************************************************** - * - * FUNCTION: AcpiRemoveInterface - * - * PARAMETERS: InterfaceName - The interface to remove - * - * RETURN: Status - * - * DESCRIPTION: Remove an _OSI interface from the global list - * - ****************************************************************************/ - -ACPI_STATUS -AcpiRemoveInterface ( - ACPI_STRING InterfaceName) -{ - ACPI_STATUS Status; - - - /* Parameter validation */ - - if (!InterfaceName || (strlen (InterfaceName) == 0)) - { - return (AE_BAD_PARAMETER); - } - - Status = AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - Status = AcpiUtRemoveInterface (InterfaceName); - - AcpiOsReleaseMutex (AcpiGbl_OsiMutex); - return (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiRemoveInterface) - - -/***************************************************************************** - * - * FUNCTION: AcpiInstallInterfaceHandler - * - * PARAMETERS: Handler - The _OSI interface handler to install - * NULL means "remove existing handler" - * - * RETURN: Status - * - * DESCRIPTION: Install a handler for the predefined _OSI ACPI method. - * invoked during execution of the internal implementation of - * _OSI. A NULL handler simply removes any existing handler. - * - ****************************************************************************/ - -ACPI_STATUS -AcpiInstallInterfaceHandler ( - ACPI_INTERFACE_HANDLER Handler) -{ - ACPI_STATUS Status; - - - Status = AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - if (Handler && AcpiGbl_InterfaceHandler) - { - Status = AE_ALREADY_EXISTS; - } - else - { - AcpiGbl_InterfaceHandler = Handler; - } - - AcpiOsReleaseMutex (AcpiGbl_OsiMutex); - return (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiInstallInterfaceHandler) - - -/***************************************************************************** - * - * FUNCTION: AcpiUpdateInterfaces - * - * PARAMETERS: Action - Actions to be performed during the - * update - * - * RETURN: Status - * - * DESCRIPTION: Update _OSI interface strings, disabling or enabling OS vendor - * string or/and feature group strings. - * - ****************************************************************************/ - -ACPI_STATUS -AcpiUpdateInterfaces ( - UINT8 Action) -{ - ACPI_STATUS Status; - - - Status = AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - Status = AcpiUtUpdateInterfaces (Action); - - AcpiOsReleaseMutex (AcpiGbl_OsiMutex); - return (Status); -} - - -/***************************************************************************** - * - * FUNCTION: AcpiCheckAddressRange - * - * PARAMETERS: SpaceId - Address space ID - * Address - Start address - * Length - Length - * Warn - TRUE if warning on overlap desired - * - * RETURN: Count of the number of conflicts detected. - * - * DESCRIPTION: Check if the input address range overlaps any of the - * ASL operation region address ranges. - * - ****************************************************************************/ - -UINT32 -AcpiCheckAddressRange ( - ACPI_ADR_SPACE_TYPE SpaceId, - ACPI_PHYSICAL_ADDRESS Address, - ACPI_SIZE Length, - BOOLEAN Warn) -{ - UINT32 Overlaps; - ACPI_STATUS Status; - - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return (0); - } - - Overlaps = AcpiUtCheckAddressRange (SpaceId, Address, - (UINT32) Length, Warn); - - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return (Overlaps); -} - -ACPI_EXPORT_SYMBOL (AcpiCheckAddressRange) - -#endif /* !ACPI_ASL_COMPILER */ - - -/******************************************************************************* - * - * FUNCTION: AcpiDecodePldBuffer - * - * PARAMETERS: InBuffer - Buffer returned by _PLD method - * Length - Length of the InBuffer - * ReturnBuffer - Where the decode buffer is returned - * - * RETURN: Status and the decoded _PLD buffer. User must deallocate - * the buffer via ACPI_FREE. - * - * DESCRIPTION: Decode the bit-packed buffer returned by the _PLD method into - * a local struct that is much more useful to an ACPI driver. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDecodePldBuffer ( - UINT8 *InBuffer, - ACPI_SIZE Length, - ACPI_PLD_INFO **ReturnBuffer) -{ - ACPI_PLD_INFO *PldInfo; - UINT32 *Buffer = ACPI_CAST_PTR (UINT32, InBuffer); - UINT32 Dword; - - - /* Parameter validation */ - - if (!InBuffer || !ReturnBuffer || (Length < ACPI_PLD_REV1_BUFFER_SIZE)) - { - return (AE_BAD_PARAMETER); - } - - PldInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_PLD_INFO)); - if (!PldInfo) - { - return (AE_NO_MEMORY); - } - - /* First 32-bit DWord */ - - ACPI_MOVE_32_TO_32 (&Dword, &Buffer[0]); - PldInfo->Revision = ACPI_PLD_GET_REVISION (&Dword); - PldInfo->IgnoreColor = ACPI_PLD_GET_IGNORE_COLOR (&Dword); - PldInfo->Red = ACPI_PLD_GET_RED (&Dword); - PldInfo->Green = ACPI_PLD_GET_GREEN (&Dword); - PldInfo->Blue = ACPI_PLD_GET_BLUE (&Dword); - - /* Second 32-bit DWord */ - - ACPI_MOVE_32_TO_32 (&Dword, &Buffer[1]); - PldInfo->Width = ACPI_PLD_GET_WIDTH (&Dword); - PldInfo->Height = ACPI_PLD_GET_HEIGHT(&Dword); - - /* Third 32-bit DWord */ - - ACPI_MOVE_32_TO_32 (&Dword, &Buffer[2]); - PldInfo->UserVisible = ACPI_PLD_GET_USER_VISIBLE (&Dword); - PldInfo->Dock = ACPI_PLD_GET_DOCK (&Dword); - PldInfo->Lid = ACPI_PLD_GET_LID (&Dword); - PldInfo->Panel = ACPI_PLD_GET_PANEL (&Dword); - PldInfo->VerticalPosition = ACPI_PLD_GET_VERTICAL (&Dword); - PldInfo->HorizontalPosition = ACPI_PLD_GET_HORIZONTAL (&Dword); - PldInfo->Shape = ACPI_PLD_GET_SHAPE (&Dword); - PldInfo->GroupOrientation = ACPI_PLD_GET_ORIENTATION (&Dword); - PldInfo->GroupToken = ACPI_PLD_GET_TOKEN (&Dword); - PldInfo->GroupPosition = ACPI_PLD_GET_POSITION (&Dword); - PldInfo->Bay = ACPI_PLD_GET_BAY (&Dword); - - /* Fourth 32-bit DWord */ - - ACPI_MOVE_32_TO_32 (&Dword, &Buffer[3]); - PldInfo->Ejectable = ACPI_PLD_GET_EJECTABLE (&Dword); - PldInfo->OspmEjectRequired = ACPI_PLD_GET_OSPM_EJECT (&Dword); - PldInfo->CabinetNumber = ACPI_PLD_GET_CABINET (&Dword); - PldInfo->CardCageNumber = ACPI_PLD_GET_CARD_CAGE (&Dword); - PldInfo->Reference = ACPI_PLD_GET_REFERENCE (&Dword); - PldInfo->Rotation = ACPI_PLD_GET_ROTATION (&Dword); - PldInfo->Order = ACPI_PLD_GET_ORDER (&Dword); - - if (Length >= ACPI_PLD_REV2_BUFFER_SIZE) - { - /* Fifth 32-bit DWord (Revision 2 of _PLD) */ - - ACPI_MOVE_32_TO_32 (&Dword, &Buffer[4]); - PldInfo->VerticalOffset = ACPI_PLD_GET_VERT_OFFSET (&Dword); - PldInfo->HorizontalOffset = ACPI_PLD_GET_HORIZ_OFFSET (&Dword); - } - - *ReturnBuffer = PldInfo; - return (AE_OK); -} - -ACPI_EXPORT_SYMBOL (AcpiDecodePldBuffer) diff --git a/drivers/acpica/utxferror.c b/drivers/acpica/utxferror.c deleted file mode 100644 index 43e940f..0000000 --- a/drivers/acpica/utxferror.c +++ /dev/null @@ -1,462 +0,0 @@ -/******************************************************************************* - * - * Module Name: utxferror - Various error/warning output functions - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#define EXPORT_ACPI_INTERFACES - -#include "acpi.h" -#include "accommon.h" - - -#define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utxferror") - -/* - * This module is used for the in-kernel ACPICA as well as the ACPICA - * tools/applications. - */ - -#ifndef ACPI_NO_ERROR_MESSAGES /* Entire module */ - -/******************************************************************************* - * - * FUNCTION: AcpiError - * - * PARAMETERS: ModuleName - Caller's module name (for error output) - * LineNumber - Caller's line number (for error output) - * Format - Printf format string + additional args - * - * RETURN: None - * - * DESCRIPTION: Print "ACPI Error" message with module/line/version info - * - ******************************************************************************/ - -void ACPI_INTERNAL_VAR_XFACE -AcpiError ( - const char *ModuleName, - UINT32 LineNumber, - const char *Format, - ...) -{ - va_list ArgList; - - - ACPI_MSG_REDIRECT_BEGIN; - AcpiOsPrintf (ACPI_MSG_ERROR); - - va_start (ArgList, Format); - AcpiOsVprintf (Format, ArgList); - ACPI_MSG_SUFFIX; - va_end (ArgList); - - ACPI_MSG_REDIRECT_END; -} - -ACPI_EXPORT_SYMBOL (AcpiError) - - -/******************************************************************************* - * - * FUNCTION: AcpiException - * - * PARAMETERS: ModuleName - Caller's module name (for error output) - * LineNumber - Caller's line number (for error output) - * Status - Status value to be decoded/formatted - * Format - Printf format string + additional args - * - * RETURN: None - * - * DESCRIPTION: Print an "ACPI Error" message with module/line/version - * info as well as decoded ACPI_STATUS. - * - ******************************************************************************/ - -void ACPI_INTERNAL_VAR_XFACE -AcpiException ( - const char *ModuleName, - UINT32 LineNumber, - ACPI_STATUS Status, - const char *Format, - ...) -{ - va_list ArgList; - - - ACPI_MSG_REDIRECT_BEGIN; - - /* For AE_OK, just print the message */ - - if (ACPI_SUCCESS (Status)) - { - AcpiOsPrintf (ACPI_MSG_ERROR); - - } - else - { - AcpiOsPrintf (ACPI_MSG_ERROR "%s, ", - AcpiFormatException (Status)); - } - - va_start (ArgList, Format); - AcpiOsVprintf (Format, ArgList); - ACPI_MSG_SUFFIX; - va_end (ArgList); - - ACPI_MSG_REDIRECT_END; -} - -ACPI_EXPORT_SYMBOL (AcpiException) - - -/******************************************************************************* - * - * FUNCTION: AcpiWarning - * - * PARAMETERS: ModuleName - Caller's module name (for warning output) - * LineNumber - Caller's line number (for warning output) - * Format - Printf format string + additional args - * - * RETURN: None - * - * DESCRIPTION: Print "ACPI Warning" message with module/line/version info - * - ******************************************************************************/ - -void ACPI_INTERNAL_VAR_XFACE -AcpiWarning ( - const char *ModuleName, - UINT32 LineNumber, - const char *Format, - ...) -{ - va_list ArgList; - - - ACPI_MSG_REDIRECT_BEGIN; - AcpiOsPrintf (ACPI_MSG_WARNING); - - va_start (ArgList, Format); - AcpiOsVprintf (Format, ArgList); - ACPI_MSG_SUFFIX; - va_end (ArgList); - - ACPI_MSG_REDIRECT_END; -} - -ACPI_EXPORT_SYMBOL (AcpiWarning) - - -/******************************************************************************* - * - * FUNCTION: AcpiInfo - * - * PARAMETERS: Format - Printf format string + additional args - * - * RETURN: None - * - * DESCRIPTION: Print generic "ACPI:" information message. There is no - * module/line/version info in order to keep the message simple. - * - ******************************************************************************/ - -void ACPI_INTERNAL_VAR_XFACE -AcpiInfo ( - const char *Format, - ...) -{ - va_list ArgList; - - - ACPI_MSG_REDIRECT_BEGIN; - AcpiOsPrintf (ACPI_MSG_INFO); - - va_start (ArgList, Format); - AcpiOsVprintf (Format, ArgList); - AcpiOsPrintf ("\n"); - va_end (ArgList); - - ACPI_MSG_REDIRECT_END; -} - -ACPI_EXPORT_SYMBOL (AcpiInfo) - - -/******************************************************************************* - * - * FUNCTION: AcpiBiosError - * - * PARAMETERS: ModuleName - Caller's module name (for error output) - * LineNumber - Caller's line number (for error output) - * Format - Printf format string + additional args - * - * RETURN: None - * - * DESCRIPTION: Print "ACPI Firmware Error" message with module/line/version - * info - * - ******************************************************************************/ - -void ACPI_INTERNAL_VAR_XFACE -AcpiBiosError ( - const char *ModuleName, - UINT32 LineNumber, - const char *Format, - ...) -{ - va_list ArgList; - - - ACPI_MSG_REDIRECT_BEGIN; - AcpiOsPrintf (ACPI_MSG_BIOS_ERROR); - - va_start (ArgList, Format); - AcpiOsVprintf (Format, ArgList); - ACPI_MSG_SUFFIX; - va_end (ArgList); - - ACPI_MSG_REDIRECT_END; -} - -ACPI_EXPORT_SYMBOL (AcpiBiosError) - - -/******************************************************************************* - * - * FUNCTION: AcpiBiosException - * - * PARAMETERS: ModuleName - Caller's module name (for error output) - * LineNumber - Caller's line number (for error output) - * Status - Status value to be decoded/formatted - * Format - Printf format string + additional args - * - * RETURN: None - * - * DESCRIPTION: Print an "ACPI Firmware Error" message with module/line/version - * info as well as decoded ACPI_STATUS. - * - ******************************************************************************/ - -void ACPI_INTERNAL_VAR_XFACE -AcpiBiosException ( - const char *ModuleName, - UINT32 LineNumber, - ACPI_STATUS Status, - const char *Format, - ...) -{ - va_list ArgList; - - - ACPI_MSG_REDIRECT_BEGIN; - - /* For AE_OK, just print the message */ - - if (ACPI_SUCCESS (Status)) - { - AcpiOsPrintf (ACPI_MSG_BIOS_ERROR); - - } - else - { - AcpiOsPrintf (ACPI_MSG_BIOS_ERROR "%s, ", - AcpiFormatException (Status)); - } - - va_start (ArgList, Format); - AcpiOsVprintf (Format, ArgList); - ACPI_MSG_SUFFIX; - va_end (ArgList); - - ACPI_MSG_REDIRECT_END; -} - -ACPI_EXPORT_SYMBOL (AcpiBiosException) - - -/******************************************************************************* - * - * FUNCTION: AcpiBiosWarning - * - * PARAMETERS: ModuleName - Caller's module name (for warning output) - * LineNumber - Caller's line number (for warning output) - * Format - Printf format string + additional args - * - * RETURN: None - * - * DESCRIPTION: Print "ACPI Firmware Warning" message with module/line/version - * info - * - ******************************************************************************/ - -void ACPI_INTERNAL_VAR_XFACE -AcpiBiosWarning ( - const char *ModuleName, - UINT32 LineNumber, - const char *Format, - ...) -{ - va_list ArgList; - - - ACPI_MSG_REDIRECT_BEGIN; - AcpiOsPrintf (ACPI_MSG_BIOS_WARNING); - - va_start (ArgList, Format); - AcpiOsVprintf (Format, ArgList); - ACPI_MSG_SUFFIX; - va_end (ArgList); - - ACPI_MSG_REDIRECT_END; -} - -ACPI_EXPORT_SYMBOL (AcpiBiosWarning) - -#endif /* ACPI_NO_ERROR_MESSAGES */ diff --git a/drivers/acpica/utxfinit.c b/drivers/acpica/utxfinit.c deleted file mode 100644 index 8c6da2f..0000000 --- a/drivers/acpica/utxfinit.c +++ /dev/null @@ -1,430 +0,0 @@ -/****************************************************************************** - * - * Module Name: utxfinit - External interfaces for ACPICA initialization - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#define EXPORT_ACPI_INTERFACES - -#include "acpi.h" -#include "accommon.h" -#include "acevents.h" -#include "acnamesp.h" -#include "acdebug.h" -#include "actables.h" - -#define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utxfinit") - -/* For AcpiExec only */ -void -AeDoObjectOverrides ( - void); - - -/******************************************************************************* - * - * FUNCTION: AcpiInitializeSubsystem - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Initializes all global variables. This is the first function - * called, so any early initialization belongs here. - * - ******************************************************************************/ - -ACPI_STATUS ACPI_INIT_FUNCTION -AcpiInitializeSubsystem ( - void) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiInitializeSubsystem); - - - AcpiGbl_StartupFlags = ACPI_SUBSYSTEM_INITIALIZE; - ACPI_DEBUG_EXEC (AcpiUtInitStackPtrTrace ()); - - /* Initialize the OS-Dependent layer */ - - Status = AcpiOsInitialize (); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, "During OSL initialization")); - return_ACPI_STATUS (Status); - } - - /* Initialize all globals used by the subsystem */ - - Status = AcpiUtInitGlobals (); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, "During initialization of globals")); - return_ACPI_STATUS (Status); - } - - /* Create the default mutex objects */ - - Status = AcpiUtMutexInitialize (); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, "During Global Mutex creation")); - return_ACPI_STATUS (Status); - } - - /* - * Initialize the namespace manager and - * the root of the namespace tree - */ - Status = AcpiNsRootInitialize (); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, "During Namespace initialization")); - return_ACPI_STATUS (Status); - } - - /* Initialize the global OSI interfaces list with the static names */ - - Status = AcpiUtInitializeInterfaces (); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, "During OSI interfaces initialization")); - return_ACPI_STATUS (Status); - } - - return_ACPI_STATUS (AE_OK); -} - -ACPI_EXPORT_SYMBOL_INIT (AcpiInitializeSubsystem) - - -/******************************************************************************* - * - * FUNCTION: AcpiEnableSubsystem - * - * PARAMETERS: Flags - Init/enable Options - * - * RETURN: Status - * - * DESCRIPTION: Completes the subsystem initialization including hardware. - * Puts system into ACPI mode if it isn't already. - * - ******************************************************************************/ - -ACPI_STATUS ACPI_INIT_FUNCTION -AcpiEnableSubsystem ( - UINT32 Flags) -{ - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE (AcpiEnableSubsystem); - - - /* - * The early initialization phase is complete. The namespace is loaded, - * and we can now support address spaces other than Memory, I/O, and - * PCI_Config. - */ - AcpiGbl_EarlyInitialization = FALSE; - - /* - * Obtain a permanent mapping for the FACS. This is required for the - * Global Lock and the Firmware Waking Vector - */ - if (!(Flags & ACPI_NO_FACS_INIT)) - { - Status = AcpiTbInitializeFacs (); - if (ACPI_FAILURE (Status)) - { - ACPI_WARNING ((AE_INFO, "Could not map the FACS table")); - return_ACPI_STATUS (Status); - } - } - -#if (!ACPI_REDUCED_HARDWARE) - - /* Enable ACPI mode */ - - if (!(Flags & ACPI_NO_ACPI_ENABLE)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Going into ACPI mode\n")); - - AcpiGbl_OriginalMode = AcpiHwGetMode(); - - Status = AcpiEnable (); - if (ACPI_FAILURE (Status)) - { - ACPI_WARNING ((AE_INFO, "AcpiEnable failed")); - return_ACPI_STATUS (Status); - } - } - - /* - * Initialize ACPI Event handling (Fixed and General Purpose) - * - * Note1: We must have the hardware and events initialized before we can - * execute any control methods safely. Any control method can require - * ACPI hardware support, so the hardware must be fully initialized before - * any method execution! - * - * Note2: Fixed events are initialized and enabled here. GPEs are - * initialized, but cannot be enabled until after the hardware is - * completely initialized (SCI and GlobalLock activated) and the various - * initialization control methods are run (_REG, _STA, _INI) on the - * entire namespace. - */ - if (!(Flags & ACPI_NO_EVENT_INIT)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "[Init] Initializing ACPI events\n")); - - Status = AcpiEvInitializeEvents (); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - /* - * Install the SCI handler and Global Lock handler. This completes the - * hardware initialization. - */ - if (!(Flags & ACPI_NO_HANDLER_INIT)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "[Init] Installing SCI/GL handlers\n")); - - Status = AcpiEvInstallXruptHandlers (); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - -#endif /* !ACPI_REDUCED_HARDWARE */ - - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL_INIT (AcpiEnableSubsystem) - - -/******************************************************************************* - * - * FUNCTION: AcpiInitializeObjects - * - * PARAMETERS: Flags - Init/enable Options - * - * RETURN: Status - * - * DESCRIPTION: Completes namespace initialization by initializing device - * objects and executing AML code for Regions, buffers, etc. - * - ******************************************************************************/ - -ACPI_STATUS ACPI_INIT_FUNCTION -AcpiInitializeObjects ( - UINT32 Flags) -{ - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE (AcpiInitializeObjects); - - -#ifdef ACPI_OBSOLETE_BEHAVIOR - /* - * 05/2019: Removed, initialization now happens at both object - * creation and table load time - */ - - /* - * Initialize the objects that remain uninitialized. This - * runs the executable AML that may be part of the - * declaration of these objects: OperationRegions, BufferFields, - * BankFields, Buffers, and Packages. - */ - if (!(Flags & ACPI_NO_OBJECT_INIT)) - { - Status = AcpiNsInitializeObjects (); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } -#endif - - /* - * Initialize all device/region objects in the namespace. This runs - * the device _STA and _INI methods and region _REG methods. - */ - if (!(Flags & (ACPI_NO_DEVICE_INIT | ACPI_NO_ADDRESS_SPACE_INIT))) - { - Status = AcpiNsInitializeDevices (Flags); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - /* - * Empty the caches (delete the cached objects) on the assumption that - * the table load filled them up more than they will be at runtime -- - * thus wasting non-paged memory. - */ - Status = AcpiPurgeCachedObjects (); - - AcpiGbl_StartupFlags |= ACPI_INITIALIZED_OK; - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL_INIT (AcpiInitializeObjects) diff --git a/drivers/acpica/utxfmutex.c b/drivers/acpica/utxfmutex.c deleted file mode 100644 index b82a4a9..0000000 --- a/drivers/acpica/utxfmutex.c +++ /dev/null @@ -1,323 +0,0 @@ -/******************************************************************************* - * - * Module Name: utxfmutex - external AML mutex access functions - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" - - -#define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utxfmutex") - - -/* Local prototypes */ - -static ACPI_STATUS -AcpiUtGetMutexObject ( - ACPI_HANDLE Handle, - ACPI_STRING Pathname, - ACPI_OPERAND_OBJECT **RetObj); - - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetMutexObject - * - * PARAMETERS: Handle - Mutex or prefix handle (optional) - * Pathname - Mutex pathname (optional) - * RetObj - Where the mutex object is returned - * - * RETURN: Status - * - * DESCRIPTION: Get an AML mutex object. The mutex node is pointed to by - * Handle:Pathname. Either Handle or Pathname can be NULL, but - * not both. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiUtGetMutexObject ( - ACPI_HANDLE Handle, - ACPI_STRING Pathname, - ACPI_OPERAND_OBJECT **RetObj) -{ - ACPI_NAMESPACE_NODE *MutexNode; - ACPI_OPERAND_OBJECT *MutexObj; - ACPI_STATUS Status; - - - /* Parameter validation */ - - if (!RetObj || (!Handle && !Pathname)) - { - return (AE_BAD_PARAMETER); - } - - /* Get a the namespace node for the mutex */ - - MutexNode = Handle; - if (Pathname != NULL) - { - Status = AcpiGetHandle ( - Handle, Pathname, ACPI_CAST_PTR (ACPI_HANDLE, &MutexNode)); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - - /* Ensure that we actually have a Mutex object */ - - if (!MutexNode || - (MutexNode->Type != ACPI_TYPE_MUTEX)) - { - return (AE_TYPE); - } - - /* Get the low-level mutex object */ - - MutexObj = AcpiNsGetAttachedObject (MutexNode); - if (!MutexObj) - { - return (AE_NULL_OBJECT); - } - - *RetObj = MutexObj; - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiAcquireMutex - * - * PARAMETERS: Handle - Mutex or prefix handle (optional) - * Pathname - Mutex pathname (optional) - * Timeout - Max time to wait for the lock (millisec) - * - * RETURN: Status - * - * DESCRIPTION: Acquire an AML mutex. This is a device driver interface to - * AML mutex objects, and allows for transaction locking between - * drivers and AML code. The mutex node is pointed to by - * Handle:Pathname. Either Handle or Pathname can be NULL, but - * not both. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiAcquireMutex ( - ACPI_HANDLE Handle, - ACPI_STRING Pathname, - UINT16 Timeout) -{ - ACPI_STATUS Status; - ACPI_OPERAND_OBJECT *MutexObj; - - - /* Get the low-level mutex associated with Handle:Pathname */ - - Status = AcpiUtGetMutexObject (Handle, Pathname, &MutexObj); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Acquire the OS mutex */ - - Status = AcpiOsAcquireMutex (MutexObj->Mutex.OsMutex, Timeout); - return (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiAcquireMutex) - - -/******************************************************************************* - * - * FUNCTION: AcpiReleaseMutex - * - * PARAMETERS: Handle - Mutex or prefix handle (optional) - * Pathname - Mutex pathname (optional) - * - * RETURN: Status - * - * DESCRIPTION: Release an AML mutex. This is a device driver interface to - * AML mutex objects, and allows for transaction locking between - * drivers and AML code. The mutex node is pointed to by - * Handle:Pathname. Either Handle or Pathname can be NULL, but - * not both. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiReleaseMutex ( - ACPI_HANDLE Handle, - ACPI_STRING Pathname) -{ - ACPI_STATUS Status; - ACPI_OPERAND_OBJECT *MutexObj; - - - /* Get the low-level mutex associated with Handle:Pathname */ - - Status = AcpiUtGetMutexObject (Handle, Pathname, &MutexObj); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Release the OS mutex */ - - AcpiOsReleaseMutex (MutexObj->Mutex.OsMutex); - return (AE_OK); -} - -ACPI_EXPORT_SYMBOL (AcpiReleaseMutex) diff --git a/drivers/acpica_osl/init.c b/drivers/acpica_osl/init.c deleted file mode 100644 index 660175b..0000000 --- a/drivers/acpica_osl/init.c +++ /dev/null @@ -1,59 +0,0 @@ -/* init.c - acpica subsystem initialization interface */ -/* Copyright (C) 2025-2026 Ebrahim Aleem -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see -*/ - -#include - -#include -#include -#include - -#include -#include - -void acpica_init(void) { - ACPI_STATUS sts = AcpiInitializeSubsystem(); - - if (ACPI_FAILURE(sts)) { - logging_log_error("Failed to init ACPICA: 0x%lx", (uint64_t)sts); - panic(PANIC_ACPI); - } - - sts = AcpiInitializeTables(NULL, 16, FALSE); - - if (ACPI_FAILURE(sts)) { - logging_log_error("Failed to init ACPICA tables: 0x%lx", (uint64_t)sts); - panic(PANIC_ACPI); - } - - sts = AcpiLoadTables(); - - if (ACPI_FAILURE(sts)) { - logging_log_error("Failed to load ACPICA tables: 0x%lx", (uint64_t)sts); - panic(PANIC_ACPI); - } - - sts = AcpiInitializeObjects(ACPI_FULL_INITIALIZATION); - - if (ACPI_FAILURE(sts)) { - logging_log_error("Failed to init ACPICA namespace: 0x%lx", (uint64_t)sts); - panic(PANIC_ACPI); - } - - // TODO: init subsys - - acpica_index_all(); -} diff --git a/drivers/acpica_osl/namespace.c b/drivers/acpica_osl/namespace.c deleted file mode 100644 index 96d4730..0000000 --- a/drivers/acpica_osl/namespace.c +++ /dev/null @@ -1,284 +0,0 @@ -/* namespace.c - acpica subsystem namespace init */ -/* Copyright (C) 2025-2026 Ebrahim Aleem -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see -*/ - -#include - -#include -#include - -#include -#include -#include - -#define INDEX_PRT 0x1 - -#define NAME_TO_INT(a, b, c, d) (((uint64_t)a) | ((uint64_t)b << 8) | ((uint64_t)c << 16) | ((uint64_t)d << 24)) - -#define NAME__PRT NAME_TO_INT('_', 'P', 'R', 'T') -#define NAME__CRS NAME_TO_INT('_', 'C', 'R', 'S') - -#define CRS_TYPE_SIZE_MASK 0x80 -#define CRS_TYPE_SIZE_SMALL 0x00 -#define CRS_TYPE_SIZE_LARGE 0x80 - -#define CRS_SMALL_TYPE_MASK 0x78 -#define CRS_LARGE_TYPE_MASK 0x7F - -#define CRS_SMALL_LEN_MASK 0x7 - -#define CRS_TAG_END 0x78 - -static uint64_t index_res; - -struct pci_routing_t { - uint8_t pci_pin; - uint64_t gsi; - struct pci_routing_t* n; -}; - -union crs_elem_t { - uint8_t type; - struct { - uint8_t type; - uint8_t dat[]; - } __attribute__((packed)) small_res; - - struct { - uint8_t type; - uint8_t len_lo; - uint8_t len_hi; - uint8_t dat[]; - } __attribute__((packed)) large_res; -}; - -static struct pci_routing_t* pci_routing; - -static ACPI_STATUS callback_skip(ACPI_HANDLE obj, UINT32 lvl, void* cntx, void** ret) { - (void)obj; - (void)lvl; - (void)cntx; - (void)ret; - - return AE_OK; -} - -static ACPI_STATUS callback_walk_device(ACPI_HANDLE obj, UINT32 lvl, void* cntx, void** ret) { - (void)lvl; - (void)cntx; - (void)ret; - - ACPI_STATUS sts; - ACPI_BUFFER buf = {.Pointer = NULL}; - - ACPI_DEVICE_INFO* info; - sts = AcpiGetObjectInfo(obj, &info); - - if (ACPI_FAILURE(sts)) { - logging_log_error("Failed to get object info : 0x%lx", (uint64_t)sts); - return sts; - } - - switch (info->Name) { - case NAME__CRS: - buf.Length = ACPI_ALLOCATE_BUFFER; - buf.Pointer = NULL; - - sts = AcpiEvaluateObject(obj, NULL, NULL, &buf); - if (ACPI_FAILURE(sts)) { - logging_log_error("Failed to evaluate ACPI _CRS object: 0x%lx", (uint64_t)sts); - goto cleanup; - } - - if (((ACPI_OBJECT*)buf.Pointer)->Type != ACPI_TYPE_BUFFER) { - logging_log_error("ACPI _CRS has wrong type: 0x%lx", ((ACPI_OBJECT*)buf.Pointer)->Type); - sts = AE_TYPE; - goto cleanup; - } - - union crs_elem_t* elem = (union crs_elem_t*)((ACPI_OBJECT*)buf.Pointer)->Buffer.Pointer; - while (1) { - switch (elem->type & CRS_TYPE_SIZE_MASK) { - case (CRS_TYPE_SIZE_SMALL): - //logging_log_info("Found small CRS entry type: 0x%lx", elem->type & CRS_SMALL_TYPE_MASK); - switch (elem->type & CRS_SMALL_TYPE_MASK) { - case CRS_TAG_END: - sts = AE_OK; - goto cleanup; - default: - elem = (union crs_elem_t*)((uint64_t)elem + 1 + (elem->type & CRS_SMALL_LEN_MASK)); - break; - } - break; - case (CRS_TYPE_SIZE_LARGE): - //logging_log_info("Found large CRS entry type: 0x%lx", elem->type & CRS_LARGE_TYPE_MASK); - elem = (union crs_elem_t*)( - (uint64_t)elem + 3 + (uint64_t)(elem->large_res.len_lo) + ((uint64_t)elem->large_res.len_hi << 8)); - break; - } - } - - cleanup: - if (buf.Pointer) { - AcpiOsFree(buf.Pointer); - } - - //logging_log_info("Indexed ACPI namespace %4.4s", &info->Name); - return sts; - default: - return AcpiWalkNamespace(ACPI_TYPE_ANY, obj, 1, callback_walk_device, callback_skip, NULL, NULL); - } -} - -static ACPI_STATUS callback_walk_root(ACPI_HANDLE obj, UINT32 lvl, void* cntx, void** ret) { - (void)lvl; - (void)cntx; - (void)ret; - - ACPI_STATUS sts; - ACPI_DEVICE_INFO* info; - sts = AcpiGetObjectInfo(obj, &info); - - if (ACPI_FAILURE(sts)) { - logging_log_error("Failed to get object info : 0x%lx", (uint64_t)sts); - return sts; - } - - uint64_t i; - - struct pci_routing_t* tmp_routing; - - ACPI_BUFFER buf = {.Pointer = NULL}; - - switch (info->Name) { - case NAME__PRT: - /* _PRT */ - buf.Length = ACPI_ALLOCATE_BUFFER; - buf.Pointer = NULL; - - sts = AcpiEvaluateObject(obj, NULL, NULL, &buf); - if (ACPI_FAILURE(sts)) { - logging_log_error("Failed to evaluate ACPI _PRT object: 0x%lx", (uint64_t)sts); - goto cleanup; - } - - ACPI_OBJECT* prt = buf.Pointer; - if (prt->Type != ACPI_TYPE_PACKAGE) { - logging_log_error("_PRT has wrong type: 0x%lx", (uint64_t)prt->Type); - sts = AE_TYPE; - goto cleanup; - } - - for (i = 0; i < prt->Package.Count; i++) { - volatile ACPI_OBJECT* entry = &(prt->Package.Elements[i]); - - if (entry->Type != ACPI_TYPE_PACKAGE) { - logging_log_error("_PRT package entry has wrong type: 0x%lx", (uint64_t)entry->Type); - sts = AE_TYPE; - goto cleanup; - } - - if (entry->Package.Count != 4) { - logging_log_error("_PRT package entry has wrong count: 0x%lu", (uint64_t)entry->Package.Count); - sts = AE_TYPE; - goto cleanup; - } - - volatile ACPI_OBJECT* field = &entry->Package.Elements[1]; - - if (field->Type != ACPI_TYPE_INTEGER) { - logging_log_error("_PRT package entry has bad pin value"); - sts = AE_TYPE; - goto cleanup; - } - - const uint8_t pin = (uint8_t)field->Integer.Value; - - // find source - field = &entry->Package.Elements[2]; - if (field->Type == ACPI_TYPE_LOCAL_REFERENCE - && field->Reference.ActualType == ACPI_TYPE_DEVICE) { - AcpiWalkNamespace( - ACPI_TYPE_ANY, - field->Reference.Handle, - 1, - callback_walk_device, - callback_skip, - NULL, - NULL); - } - else if (field->Type == ACPI_TYPE_INTEGER && field->Integer.Value == 0) { - field = &entry->Package.Elements[3]; - - if (field->Type != ACPI_TYPE_INTEGER) { - logging_log_error("_PRT package entry has bad source index value"); - sts = AE_TYPE; - goto cleanup; - } - - tmp_routing = pci_routing; - pci_routing = kmalloc(sizeof(struct pci_routing_t)); - pci_routing->pci_pin = pin; - pci_routing->gsi = field->Integer.Value; - pci_routing->n = tmp_routing; - } - else { - logging_log_error("_PRT package entry has bad source type %lu", field->Type); - sts = AE_TYPE; - goto cleanup; - } - } - - sts = AE_OK; - index_res |= INDEX_PRT; - goto cleanup; - -cleanup: - if (buf.Pointer) { - AcpiOsFree(buf.Pointer); - } - - logging_log_info("Indexed ACPI namespace %4.4s", &info->Name); - return sts; - default: - return AcpiWalkNamespace(ACPI_TYPE_ANY, obj, 1, callback_walk_root, callback_skip, NULL, NULL); - } -} - -void acpica_index_all(void) { - index_res = 0; - pci_routing = 0; - - // manually subwalk for finer control - ACPI_STATUS sts = AcpiWalkNamespace( - ACPI_TYPE_ANY, - ACPI_ROOT_OBJECT, - 1, - callback_walk_root, - callback_skip, - NULL, - NULL); - - if (ACPI_FAILURE(sts)) { - logging_log_error("Failed to ACPICA walk the namespace: 0x%lx", (uint64_t)sts); - panic(PANIC_ACPI); - } - - if (index_res ^ (INDEX_PRT)) { - logging_log_error("Failed to index all required namespaces. index_res: 0x%lx", index_res); - } -} - diff --git a/drivers/acpica_osl/osl.c b/drivers/acpica_osl/osl.c deleted file mode 100644 index a5abacc..0000000 --- a/drivers/acpica_osl/osl.c +++ /dev/null @@ -1,386 +0,0 @@ -/* osl.c - ACPICA Modulos OSL */ -/* Copyright (C) 2025-2026 Ebrahim Aleem -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY without even the implied warranty of { -* } -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see -*/ - -#include -#include - -#include - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -ACPI_STATUS AcpiOsInitialize(void) { - return AE_OK; -} - -ACPI_THREAD_ID AcpiOsGetThreadId(void) { - return process_get_pid(); -} - -void ACPI_INTERNAL_XFACE AcpiOsPrintf(const char* fmt, ...) { - va_list args; - va_start(args, fmt); - serial_log(SEVERITY_NON, fmt, args); - va_end(args); -} - -void ACPI_INTERNAL_XFACE AcpiOsVprintf(const char* fmt, va_list args) { - serial_log(SEVERITY_NON, fmt, args); -} - -void* AcpiOsAllocate(ACPI_SIZE size) { - return kmalloc(size); -} - -void AcpiOsFree(void* ptr) { - kfree(ptr); -} - -ACPI_STATUS AcpiOsCreateSemaphore(UINT32 cap, UINT32 init, ACPI_SEMAPHORE* handle) { - //TODO: implement - //logging_log_warning("Call to unfinished AcpiOsCreateSemaphore"); - (void)cap; - (void)init; - *handle = (void*)1; - return AE_OK; -} - -ACPI_STATUS AcpiOsDeleteSemaphore(ACPI_SEMAPHORE handle) { - //TODO: implement - //logging_log_warning("Call to unfinished AcpiOsDeleteSemaphore"); - (void)handle; - return AE_OK; -} - -ACPI_STATUS AcpiOsWaitSemaphore(ACPI_SEMAPHORE handle, UINT32 units, UINT16 timeout) { - //TODO: implement - //logging_log_warning("Call to unfinished AcpiOsWaitSemaphore"); - (void)handle; - (void)units; - (void)timeout; - return AE_OK; -} - -ACPI_STATUS AcpiOsSignalSemaphore(ACPI_SEMAPHORE handle, UINT32 units) { - //TODO: implement - //logging_log_warning("Call to unfinished AcpiOsSignalSemaphore"); - (void)handle; - (void)units; - return AE_OK; -} - -ACPI_STATUS AcpiOsCreateLock(ACPI_SPINLOCK* handle) { - *handle = kmalloc(sizeof(uint8_t)); - if (*handle) { - lock_init(*handle); - return AE_OK; - } - return AE_ERROR; -} - -void AcpiOsDeleteLock(ACPI_SPINLOCK handle) { - kfree(handle); -} - -ACPI_CPU_FLAGS AcpiOsAcquireLock(ACPI_SPINLOCK handle) { - lock_acquire(handle); - return 0; -} - -void AcpiOsReleaseLock(ACPI_SPINLOCK handle, ACPI_CPU_FLAGS flg) { - (void)flg; - lock_release(handle); -} - -ACPI_STATUS AcpiOsReadMemory(ACPI_PHYSICAL_ADDRESS paddr, UINT64* val, UINT32 width) { - //TODO: implement - logging_log_warning("Call to unfinished AcpiOsReadMemory"); - (void)paddr; - (void)val; - (void)width; - return AE_SUPPORT; -} - -ACPI_STATUS AcpiOsWriteMemory(ACPI_PHYSICAL_ADDRESS paddr, UINT64 val, UINT32 width) { - //TODO: implement - logging_log_warning("Call to unfinished AcpiOsWriteMemory"); - (void)paddr; - (void)val; - (void)width; - return AE_SUPPORT; -} - -ACPI_STATUS AcpiOsReadPort(ACPI_IO_ADDRESS port, UINT32* val, UINT32 width) { - if ((uint16_t)port != port) { - logging_log_error("Truncating port to uint16_t changes value: 0x%lx", port); - return AE_SUPPORT; - } - - switch (width) { - case 8: - *val = inb((uint16_t)port); - return AE_OK; - case 16: - *val = inw((uint16_t)port); - return AE_OK; - case 32: - *val = ind((uint16_t)port); - return AE_OK; - default: - logging_log_error("Cannot read port @ 0x%lx with width %lu", (uint64_t)port, (uint64_t)width); - return AE_SUPPORT; - } -} - -ACPI_STATUS AcpiOsWritePort(ACPI_IO_ADDRESS port, UINT32 val, UINT32 width) { - if ((uint16_t)port != port) { - logging_log_error("Truncating port to uint16_t changes value: 0x%lx", port); - return AE_SUPPORT; - } - - switch (width) { - case 8: - outb((uint16_t)port, (uint8_t)val); - return AE_OK; - case 16: - outw((uint16_t)port, (uint16_t)val); - return AE_OK; - case 32: - outd((uint16_t)port, (uint32_t)val); - return AE_OK; - default: - logging_log_error("Cannot write port @ 0x%lx with width %lu", (uint64_t)port, (uint64_t)width); - return AE_SUPPORT; - } -} - -ACPI_STATUS AcpiOsInstallInterruptHandler(UINT32 level, ACPI_OSD_HANDLER handler, void* cntx) { - //TODO: implement - logging_log_warning("Call to unfinished AcpiOsInstallInterruptHandler"); - (void)level; - (void)handler; - (void)cntx; - return AE_SUPPORT; -} - -ACPI_STATUS AcpiOsRemoveInterruptHandler(UINT32 level, ACPI_OSD_HANDLER handler) { - //TODO: implement - logging_log_warning("Call to unfinished AcpiOsRemoveInterruptHandler"); - (void)level; - (void)handler; - return AE_SUPPORT; -} - -ACPI_STATUS AcpiOsExecute(ACPI_EXECUTE_TYPE type, ACPI_OSD_EXEC_CALLBACK callback, void* cntx) { - //TODO: implement - logging_log_warning("Call to unfinished AcpiOsExecute"); - (void)type; - (void)callback; - (void)cntx; - return AE_SUPPORT; -} - -void AcpiOsSleep(UINT64 ms) { - time_busy_wait(ms * TIME_CONV_MS_TO_NS); -} - -void AcpiOsStall(UINT32 us) { - time_busy_wait(us * TIME_CONV_US_TO_NS); -} - -ACPI_STATUS AcpiOsPredefinedOverride(const ACPI_PREDEFINED_NAMES* predefined, ACPI_STRING* new_value) { - (void)predefined; - *new_value = NULL; - return AE_OK; -} - -void AcpiOsWaitEventsComplete(void) { - //TODO: implement - logging_log_warning("Call to unfinished AcpiOsWaitEventsComplete"); -} - -void* AcpiOsMapMemory(ACPI_PHYSICAL_ADDRESS paddr, ACPI_SIZE len) { - const uint64_t page_base = paddr & PAGE_BASE_MASK; - const uint64_t adj = paddr - page_base; - len += adj; - const uint64_t vaddr = mm_alloc_v(len); - if (!vaddr) { - logging_log_error("Could not allocate contigious virtual block of 0x%lx", (uint64_t)len); - return 0; - } - - for (uint64_t i = 0; i < len; i += PAGE_SIZE_4K) { - if (!paging_map(vaddr + i, page_base + i, PAGE_PRESENT | PAGE_RW | PAT_MMIO_4K, PAGE_4K)) { - logging_log_error("Failed to map memory for ACPICA"); - return 0; - } - } - - return (void*)(vaddr + adj); -} - -void AcpiOsUnmapMemory(void* vaddr, ACPI_SIZE len) { - const uint64_t page_base = (uint64_t)vaddr & PAGE_BASE_MASK; - const uint64_t adj = (uint64_t)vaddr - page_base; - len += adj; - for (uint64_t i = 0; i < len; i += PAGE_SIZE_4K) { - paging_unmap(page_base + i, PAGE_4K); - } -} - -ACPI_STATUS AcpiOsTableOverride(ACPI_TABLE_HEADER* existing, ACPI_TABLE_HEADER** override) { - (void)existing; - *override = NULL; - return AE_OK; -} - -ACPI_STATUS AcpiOsPhysicalTableOverride( - ACPI_TABLE_HEADER* existing, - ACPI_PHYSICAL_ADDRESS* addr, - UINT32* len) { - (void)existing; - *addr = 0; - (void)len; - return AE_OK; -} - -UINT64 AcpiOsGetTimer(void) { - return time_since_init_ns(); -} - -ACPI_STATUS AcpiOsSignal(UINT32 func, void* info) { - logging_log_warning("Call to unfinished AcpiOsSignal"); - (void)func; - (void)info; - return AE_OK; -} - -ACPI_STATUS AcpiOsReadPciConfiguration(ACPI_PCI_ID* id, UINT32 reg, UINT64* val, UINT32 width) { - uint32_t reg_cur; - uint32_t reg_end; - uint32_t read; - uint64_t constr = 0; - uint8_t shft = 0; - switch (width) { - case 8: - reg_end = reg + 1; - break; - case 16: - reg_end = reg + 2; - break; - case 32: - reg_end = reg + 4; - break; - case 64: - reg_end = reg + 8; - break; - default: - return AE_SUPPORT; - } - - for (reg_cur = reg - (reg % 4); reg_cur < reg_end; reg_cur += 4) { - read = pcie_read(id->Segment, (uint8_t)id->Bus, (uint8_t)id->Device, (uint8_t)id->Function, (uint16_t)reg_cur); - if (reg_cur < reg) { - shft = (uint8_t)(8 * (reg - reg_cur)); - constr |= read << shft; - shft = 32 - shft; - } - else { - constr |= (uint64_t)read >> shft; - shft += 32; - } - } - - switch (width) { - case 8: - *val = constr & 0xFF; - break; - case 16: - *val = constr & 0xFFFF; - break; - case 32: - *val = constr & 0xFFFFFFFF; - break; - case 64: - *val = constr; - break; - } - - return AE_OK; -} - -ACPI_STATUS AcpiOsWritePciConfiguration(ACPI_PCI_ID* id, UINT32 reg, UINT64 val, UINT32 width) { - uint32_t reg_cur; - uint32_t reg_end; - uint32_t write; - uint8_t shft = 0; - switch (width) { - case 8: - reg_end = reg + 1; - break; - case 16: - reg_end = reg + 2; - break; - case 32: - reg_end = reg + 4; - break; - case 64: - reg_end = reg + 8; - break; - default: - return AE_SUPPORT; - } - - for (reg_cur = reg - (reg % 4); reg_cur < reg_end; reg_cur += 4) { - if (reg_cur < reg) { - shft = (uint8_t)(8 * (reg - reg_cur)); - write = (uint32_t)(val << shft); - shft = 32 - shft; - } - else { - write = (uint32_t)(val >> shft); - val += 32; - } - - pcie_write(id->Segment, (uint8_t)id->Bus, (uint8_t)id->Device, (uint8_t)id->Function, (uint16_t)reg_cur, write); - } - - return AE_OK; -} - -ACPI_STATUS AcpiOsTerminate(void) { - return AE_OK; -} - -ACPI_PHYSICAL_ADDRESS AcpiOsGetRootPointer(void) { - return (uint64_t)&boot_context.rsdp - KERNEL_VMA; -} diff --git a/drivers/hpet/hpet_init.c b/drivers/hpet/hpet_init.c index 1f5f0d6..d28bf02 100644 --- a/drivers/hpet/hpet_init.c +++ b/drivers/hpet/hpet_init.c @@ -16,7 +16,8 @@ */ #include -#include + +#include #include #include diff --git a/drivers/include/acpica/acapps.h b/drivers/include/acpica/acapps.h deleted file mode 100644 index ccaea12..0000000 --- a/drivers/include/acpica/acapps.h +++ /dev/null @@ -1,343 +0,0 @@ -/****************************************************************************** - * - * Module Name: acapps - common include for ACPI applications/tools - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef _ACAPPS -#define _ACAPPS - -#ifdef ACPI_USE_STANDARD_HEADERS -#include -#endif /* ACPI_USE_STANDARD_HEADERS */ - -/* Common info for tool signons */ - -#define ACPICA_NAME "Intel ACPI Component Architecture" -#define ACPICA_COPYRIGHT "Copyright (c) 2000 - 2025 Intel Corporation" - -#if ACPI_MACHINE_WIDTH == 64 -#define ACPI_WIDTH " (64-bit version)" - -#elif ACPI_MACHINE_WIDTH == 32 -#define ACPI_WIDTH " (32-bit version)" - -#else -#error unknown ACPI_MACHINE_WIDTH -#define ACPI_WIDTH " (unknown bit width, not 32 or 64)" - -#endif - -/* Macros for signons and file headers */ - -#define ACPI_COMMON_SIGNON(UtilityName) \ - "\n%s\n%s version %8.8X\n%s\n\n", \ - ACPICA_NAME, \ - UtilityName, ((UINT32) ACPI_CA_VERSION), \ - ACPICA_COPYRIGHT - -#define ACPI_COMMON_HEADER(UtilityName, Prefix) \ - "%s%s\n%s%s version %8.8X%s\n%s%s\n%s\n", \ - Prefix, ACPICA_NAME, \ - Prefix, UtilityName, ((UINT32) ACPI_CA_VERSION), ACPI_WIDTH, \ - Prefix, ACPICA_COPYRIGHT, \ - Prefix - -#define ACPI_COMMON_BUILD_TIME \ - "Build date/time: %s %s\n", __DATE__, __TIME__ - -/* Macros for usage messages */ - -#define ACPI_USAGE_HEADER(Usage) \ - printf ("Usage: %s\nOptions:\n", Usage); - -#define ACPI_USAGE_TEXT(Description) \ - printf (Description); - -#define ACPI_OPTION(Name, Description) \ - printf (" %-20s%s\n", Name, Description); - - -/* Check for unexpected exceptions */ - -#define ACPI_CHECK_STATUS(Name, Status, Expected) \ - if (Status != Expected) \ - { \ - AcpiOsPrintf ("Unexpected %s from %s (%s-%d)\n", \ - AcpiFormatException (Status), #Name, _AcpiModuleName, __LINE__); \ - } - -/* Check for unexpected non-AE_OK errors */ - - -#define ACPI_CHECK_OK(Name, Status) ACPI_CHECK_STATUS (Name, Status, AE_OK); - -#define FILE_SUFFIX_DISASSEMBLY "dsl" -#define FILE_SUFFIX_BINARY_TABLE ".dat" /* Needs the dot */ - - -/* acfileio */ - -ACPI_STATUS -AcGetAllTablesFromFile ( - char *Filename, - UINT8 GetOnlyAmlTables, - ACPI_NEW_TABLE_DESC **ReturnListHead); - -void -AcDeleteTableList ( - ACPI_NEW_TABLE_DESC *ListHead); - -BOOLEAN -AcIsFileBinary ( - FILE *File); - -ACPI_STATUS -AcValidateTableHeader ( - FILE *File, - long TableOffset); - - -/* Values for GetOnlyAmlTables */ - -#define ACPI_GET_ONLY_AML_TABLES TRUE -#define ACPI_GET_ALL_TABLES FALSE - - -/* - * getopt - */ -int -AcpiGetopt( - int argc, - char **argv, - char *opts); - -int -AcpiGetoptArgument ( - int argc, - char **argv); - -extern int AcpiGbl_Optind; -extern int AcpiGbl_Opterr; -extern int AcpiGbl_SubOptChar; -extern char *AcpiGbl_Optarg; - - -/* - * cmfsize - Common get file size function - */ -UINT32 -CmGetFileSize ( - ACPI_FILE File); - - -/* - * adwalk - */ -void -AcpiDmCrossReferenceNamespace ( - ACPI_PARSE_OBJECT *ParseTreeRoot, - ACPI_NAMESPACE_NODE *NamespaceRoot, - ACPI_OWNER_ID OwnerId); - -void -AcpiDmDumpTree ( - ACPI_PARSE_OBJECT *Origin); - -void -AcpiDmFindOrphanMethods ( - ACPI_PARSE_OBJECT *Origin); - -void -AcpiDmFinishNamespaceLoad ( - ACPI_PARSE_OBJECT *ParseTreeRoot, - ACPI_NAMESPACE_NODE *NamespaceRoot, - ACPI_OWNER_ID OwnerId); - -void -AcpiDmConvertParseObjects ( - ACPI_PARSE_OBJECT *ParseTreeRoot, - ACPI_NAMESPACE_NODE *NamespaceRoot); - - -/* - * adfile - */ -ACPI_STATUS -AdInitialize ( - void); - -char * -FlGenerateFilename ( - char *InputFilename, - char *Suffix); - -ACPI_STATUS -FlSplitInputPathname ( - char *InputPath, - char **OutDirectoryPath, - char **OutFilename); - -char * -FlGetFileBasename ( - char *FilePathname); - -char * -AdGenerateFilename ( - char *Prefix, - char *TableId); - -void -AdWriteTable ( - ACPI_TABLE_HEADER *Table, - UINT32 Length, - char *TableName, - char *OemTableId); - -#endif /* _ACAPPS */ diff --git a/drivers/include/acpica/acbuffer.h b/drivers/include/acpica/acbuffer.h deleted file mode 100644 index 682ddcd..0000000 --- a/drivers/include/acpica/acbuffer.h +++ /dev/null @@ -1,372 +0,0 @@ -/****************************************************************************** - * - * Name: acbuffer.h - Support for buffers returned by ACPI predefined names - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef __ACBUFFER_H__ -#define __ACBUFFER_H__ - -/* - * Contains buffer structures for these predefined names: - * _FDE, _GRT, _GTM, _PLD, _SRT - */ - -/* - * Note: C bitfields are not used for this reason: - * - * "Bitfields are great and easy to read, but unfortunately the C language - * does not specify the layout of bitfields in memory, which means they are - * essentially useless for dealing with packed data in on-disk formats or - * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me, - * this decision was a design error in C. Ritchie could have picked an order - * and stuck with it." Norman Ramsey. - * See http://stackoverflow.com/a/1053662/41661 - */ - - -/* _FDE return value */ - -typedef struct acpi_fde_info -{ - UINT32 Floppy0; - UINT32 Floppy1; - UINT32 Floppy2; - UINT32 Floppy3; - UINT32 Tape; - -} ACPI_FDE_INFO; - -/* - * _GRT return value - * _SRT input value - */ -typedef struct acpi_grt_info -{ - UINT16 Year; - UINT8 Month; - UINT8 Day; - UINT8 Hour; - UINT8 Minute; - UINT8 Second; - UINT8 Valid; - UINT16 Milliseconds; - UINT16 Timezone; - UINT8 Daylight; - UINT8 Reserved[3]; - -} ACPI_GRT_INFO; - -/* _GTM return value */ - -typedef struct acpi_gtm_info -{ - UINT32 PioSpeed0; - UINT32 DmaSpeed0; - UINT32 PioSpeed1; - UINT32 DmaSpeed1; - UINT32 Flags; - -} ACPI_GTM_INFO; - -/* - * Formatted _PLD return value. The minimum size is a package containing - * one buffer. - * Revision 1: Buffer is 16 bytes (128 bits) - * Revision 2: Buffer is 20 bytes (160 bits) - * - * Note: This structure is returned from the AcpiDecodePldBuffer - * interface. - */ -typedef struct acpi_pld_info -{ - UINT8 Revision; - UINT8 IgnoreColor; - UINT8 Red; - UINT8 Green; - UINT8 Blue; - UINT16 Width; - UINT16 Height; - UINT8 UserVisible; - UINT8 Dock; - UINT8 Lid; - UINT8 Panel; - UINT8 VerticalPosition; - UINT8 HorizontalPosition; - UINT8 Shape; - UINT8 GroupOrientation; - UINT8 GroupToken; - UINT8 GroupPosition; - UINT8 Bay; - UINT8 Ejectable; - UINT8 OspmEjectRequired; - UINT8 CabinetNumber; - UINT8 CardCageNumber; - UINT8 Reference; - UINT8 Rotation; - UINT8 Order; - UINT8 Reserved; - UINT16 VerticalOffset; - UINT16 HorizontalOffset; - -} ACPI_PLD_INFO; - - -/* - * Macros to: - * 1) Convert a _PLD buffer to internal ACPI_PLD_INFO format - ACPI_PLD_GET* - * (Used by AcpiDecodePldBuffer) - * 2) Construct a _PLD buffer - ACPI_PLD_SET* - * (Intended for BIOS use only) - */ -#define ACPI_PLD_REV1_BUFFER_SIZE 16 /* For Revision 1 of the buffer (From ACPI spec) */ -#define ACPI_PLD_REV2_BUFFER_SIZE 20 /* For Revision 2 of the buffer (From ACPI spec) */ -#define ACPI_PLD_BUFFER_SIZE 20 /* For Revision 2 of the buffer (From ACPI spec) */ - -/* First 32-bit dword, bits 0:32 */ - -#define ACPI_PLD_GET_REVISION(dword) ACPI_GET_BITS (dword, 0, ACPI_7BIT_MASK) -#define ACPI_PLD_SET_REVISION(dword,value) ACPI_SET_BITS (dword, 0, ACPI_7BIT_MASK, value) /* Offset 0, Len 7 */ - -#define ACPI_PLD_GET_IGNORE_COLOR(dword) ACPI_GET_BITS (dword, 7, ACPI_1BIT_MASK) -#define ACPI_PLD_SET_IGNORE_COLOR(dword,value) ACPI_SET_BITS (dword, 7, ACPI_1BIT_MASK, value) /* Offset 7, Len 1 */ - -#define ACPI_PLD_GET_RED(dword) ACPI_GET_BITS (dword, 8, ACPI_8BIT_MASK) -#define ACPI_PLD_SET_RED(dword,value) ACPI_SET_BITS (dword, 8, ACPI_8BIT_MASK, value) /* Offset 8, Len 8 */ - -#define ACPI_PLD_GET_GREEN(dword) ACPI_GET_BITS (dword, 16, ACPI_8BIT_MASK) -#define ACPI_PLD_SET_GREEN(dword,value) ACPI_SET_BITS (dword, 16, ACPI_8BIT_MASK, value) /* Offset 16, Len 8 */ - -#define ACPI_PLD_GET_BLUE(dword) ACPI_GET_BITS (dword, 24, ACPI_8BIT_MASK) -#define ACPI_PLD_SET_BLUE(dword,value) ACPI_SET_BITS (dword, 24, ACPI_8BIT_MASK, value) /* Offset 24, Len 8 */ - -/* Second 32-bit dword, bits 33:63 */ - -#define ACPI_PLD_GET_WIDTH(dword) ACPI_GET_BITS (dword, 0, ACPI_16BIT_MASK) -#define ACPI_PLD_SET_WIDTH(dword,value) ACPI_SET_BITS (dword, 0, ACPI_16BIT_MASK, value) /* Offset 32+0=32, Len 16 */ - -#define ACPI_PLD_GET_HEIGHT(dword) ACPI_GET_BITS (dword, 16, ACPI_16BIT_MASK) -#define ACPI_PLD_SET_HEIGHT(dword,value) ACPI_SET_BITS (dword, 16, ACPI_16BIT_MASK, value) /* Offset 32+16=48, Len 16 */ - -/* Third 32-bit dword, bits 64:95 */ - -#define ACPI_PLD_GET_USER_VISIBLE(dword) ACPI_GET_BITS (dword, 0, ACPI_1BIT_MASK) -#define ACPI_PLD_SET_USER_VISIBLE(dword,value) ACPI_SET_BITS (dword, 0, ACPI_1BIT_MASK, value) /* Offset 64+0=64, Len 1 */ - -#define ACPI_PLD_GET_DOCK(dword) ACPI_GET_BITS (dword, 1, ACPI_1BIT_MASK) -#define ACPI_PLD_SET_DOCK(dword,value) ACPI_SET_BITS (dword, 1, ACPI_1BIT_MASK, value) /* Offset 64+1=65, Len 1 */ - -#define ACPI_PLD_GET_LID(dword) ACPI_GET_BITS (dword, 2, ACPI_1BIT_MASK) -#define ACPI_PLD_SET_LID(dword,value) ACPI_SET_BITS (dword, 2, ACPI_1BIT_MASK, value) /* Offset 64+2=66, Len 1 */ - -#define ACPI_PLD_GET_PANEL(dword) ACPI_GET_BITS (dword, 3, ACPI_3BIT_MASK) -#define ACPI_PLD_SET_PANEL(dword,value) ACPI_SET_BITS (dword, 3, ACPI_3BIT_MASK, value) /* Offset 64+3=67, Len 3 */ - -#define ACPI_PLD_GET_VERTICAL(dword) ACPI_GET_BITS (dword, 6, ACPI_2BIT_MASK) -#define ACPI_PLD_SET_VERTICAL(dword,value) ACPI_SET_BITS (dword, 6, ACPI_2BIT_MASK, value) /* Offset 64+6=70, Len 2 */ - -#define ACPI_PLD_GET_HORIZONTAL(dword) ACPI_GET_BITS (dword, 8, ACPI_2BIT_MASK) -#define ACPI_PLD_SET_HORIZONTAL(dword,value) ACPI_SET_BITS (dword, 8, ACPI_2BIT_MASK, value) /* Offset 64+8=72, Len 2 */ - -#define ACPI_PLD_GET_SHAPE(dword) ACPI_GET_BITS (dword, 10, ACPI_4BIT_MASK) -#define ACPI_PLD_SET_SHAPE(dword,value) ACPI_SET_BITS (dword, 10, ACPI_4BIT_MASK, value) /* Offset 64+10=74, Len 4 */ - -#define ACPI_PLD_GET_ORIENTATION(dword) ACPI_GET_BITS (dword, 14, ACPI_1BIT_MASK) -#define ACPI_PLD_SET_ORIENTATION(dword,value) ACPI_SET_BITS (dword, 14, ACPI_1BIT_MASK, value) /* Offset 64+14=78, Len 1 */ - -#define ACPI_PLD_GET_TOKEN(dword) ACPI_GET_BITS (dword, 15, ACPI_8BIT_MASK) -#define ACPI_PLD_SET_TOKEN(dword,value) ACPI_SET_BITS (dword, 15, ACPI_8BIT_MASK, value) /* Offset 64+15=79, Len 8 */ - -#define ACPI_PLD_GET_POSITION(dword) ACPI_GET_BITS (dword, 23, ACPI_8BIT_MASK) -#define ACPI_PLD_SET_POSITION(dword,value) ACPI_SET_BITS (dword, 23, ACPI_8BIT_MASK, value) /* Offset 64+23=87, Len 8 */ - -#define ACPI_PLD_GET_BAY(dword) ACPI_GET_BITS (dword, 31, ACPI_1BIT_MASK) -#define ACPI_PLD_SET_BAY(dword,value) ACPI_SET_BITS (dword, 31, ACPI_1BIT_MASK, value) /* Offset 64+31=95, Len 1 */ - -/* Fourth 32-bit dword, bits 96:127 */ - -#define ACPI_PLD_GET_EJECTABLE(dword) ACPI_GET_BITS (dword, 0, ACPI_1BIT_MASK) -#define ACPI_PLD_SET_EJECTABLE(dword,value) ACPI_SET_BITS (dword, 0, ACPI_1BIT_MASK, value) /* Offset 96+0=96, Len 1 */ - -#define ACPI_PLD_GET_OSPM_EJECT(dword) ACPI_GET_BITS (dword, 1, ACPI_1BIT_MASK) -#define ACPI_PLD_SET_OSPM_EJECT(dword,value) ACPI_SET_BITS (dword, 1, ACPI_1BIT_MASK, value) /* Offset 96+1=97, Len 1 */ - -#define ACPI_PLD_GET_CABINET(dword) ACPI_GET_BITS (dword, 2, ACPI_8BIT_MASK) -#define ACPI_PLD_SET_CABINET(dword,value) ACPI_SET_BITS (dword, 2, ACPI_8BIT_MASK, value) /* Offset 96+2=98, Len 8 */ - -#define ACPI_PLD_GET_CARD_CAGE(dword) ACPI_GET_BITS (dword, 10, ACPI_8BIT_MASK) -#define ACPI_PLD_SET_CARD_CAGE(dword,value) ACPI_SET_BITS (dword, 10, ACPI_8BIT_MASK, value) /* Offset 96+10=106, Len 8 */ - -#define ACPI_PLD_GET_REFERENCE(dword) ACPI_GET_BITS (dword, 18, ACPI_1BIT_MASK) -#define ACPI_PLD_SET_REFERENCE(dword,value) ACPI_SET_BITS (dword, 18, ACPI_1BIT_MASK, value) /* Offset 96+18=114, Len 1 */ - -#define ACPI_PLD_GET_ROTATION(dword) ACPI_GET_BITS (dword, 19, ACPI_4BIT_MASK) -#define ACPI_PLD_SET_ROTATION(dword,value) ACPI_SET_BITS (dword, 19, ACPI_4BIT_MASK, value) /* Offset 96+19=115, Len 4 */ - -#define ACPI_PLD_GET_ORDER(dword) ACPI_GET_BITS (dword, 23, ACPI_5BIT_MASK) -#define ACPI_PLD_SET_ORDER(dword,value) ACPI_SET_BITS (dword, 23, ACPI_5BIT_MASK, value) /* Offset 96+23=119, Len 5 */ - -/* Fifth 32-bit dword, bits 128:159 (Revision 2 of _PLD only) */ - -#define ACPI_PLD_GET_VERT_OFFSET(dword) ACPI_GET_BITS (dword, 0, ACPI_16BIT_MASK) -#define ACPI_PLD_SET_VERT_OFFSET(dword,value) ACPI_SET_BITS (dword, 0, ACPI_16BIT_MASK, value) /* Offset 128+0=128, Len 16 */ - -#define ACPI_PLD_GET_HORIZ_OFFSET(dword) ACPI_GET_BITS (dword, 16, ACPI_16BIT_MASK) -#define ACPI_PLD_SET_HORIZ_OFFSET(dword,value) ACPI_SET_BITS (dword, 16, ACPI_16BIT_MASK, value) /* Offset 128+16=144, Len 16 */ - -/* Panel position defined in _PLD section of ACPI Specification 6.3 */ - -#define ACPI_PLD_PANEL_TOP 0 -#define ACPI_PLD_PANEL_BOTTOM 1 -#define ACPI_PLD_PANEL_LEFT 2 -#define ACPI_PLD_PANEL_RIGHT 3 -#define ACPI_PLD_PANEL_FRONT 4 -#define ACPI_PLD_PANEL_BACK 5 -#define ACPI_PLD_PANEL_UNKNOWN 6 - -#endif /* ACBUFFER_H */ diff --git a/drivers/include/acpica/acclib.h b/drivers/include/acpica/acclib.h deleted file mode 100644 index 3960ffd..0000000 --- a/drivers/include/acpica/acclib.h +++ /dev/null @@ -1,431 +0,0 @@ -/****************************************************************************** - * - * Name: acclib.h -- C library support. Prototypes for the (optional) local - * implementations of required C library functions. - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef _ACCLIB_H -#define _ACCLIB_H - - -/* - * Prototypes and macros for local implementations of C library functions - */ - -/* is* functions. The AcpiGbl_Ctypes array is defined in utclib.c */ - -extern const UINT8 AcpiGbl_Ctypes[]; - -#define _ACPI_XA 0x00 /* extra alphabetic - not supported */ -#define _ACPI_XS 0x40 /* extra space */ -#define _ACPI_BB 0x00 /* BEL, BS, etc. - not supported */ -#define _ACPI_CN 0x20 /* CR, FF, HT, NL, VT */ -#define _ACPI_DI 0x04 /* '0'-'9' */ -#define _ACPI_LO 0x02 /* 'a'-'z' */ -#define _ACPI_PU 0x10 /* punctuation */ -#define _ACPI_SP 0x08 /* space, tab, CR, LF, VT, FF */ -#define _ACPI_UP 0x01 /* 'A'-'Z' */ -#define _ACPI_XD 0x80 /* '0'-'9', 'A'-'F', 'a'-'f' */ - -#define isdigit(c) (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_DI)) -#define isspace(c) (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_SP)) -#define isxdigit(c) (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_XD)) -#define isupper(c) (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_UP)) -#define islower(c) (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_LO)) -#define isprint(c) (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_XS | _ACPI_PU)) -#define isalpha(c) (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP)) - -/* Error code */ - -#define EPERM 1 /* Operation not permitted */ -#define ENOENT 2 /* No such file or directory */ -#define EINTR 4 /* Interrupted system call */ -#define EIO 5 /* I/O error */ -#define EBADF 9 /* Bad file number */ -#define EAGAIN 11 /* Try again */ -#define ENOMEM 12 /* Out of memory */ -#define EACCES 13 /* Permission denied */ -#define EFAULT 14 /* Bad address */ -#define EBUSY 16 /* Device or resource busy */ -#define EEXIST 17 /* File exists */ -#define ENODEV 19 /* No such device */ -#define EINVAL 22 /* Invalid argument */ -#define EPIPE 32 /* Broken pipe */ -#define ERANGE 34 /* Math result not representable */ - -/* Strings */ - -char * -strcat ( - char *DstString, - const char *SrcString); - -char * -strchr ( - const char *String, - int ch); - -char * -strpbrk ( - const char *String, - const char *Delimiters); - -char * -strtok ( - char *String, - const char *Delimiters); - -char * -strcpy ( - char *DstString, - const char *SrcString); - -int -strcmp ( - const char *String1, - const char *String2); - -ACPI_SIZE -strlen ( - const char *String); - -char * -strncat ( - char *DstString, - const char *SrcString, - ACPI_SIZE Count); - -int -strncmp ( - const char *String1, - const char *String2, - ACPI_SIZE Count); - -char * -strncpy ( - char *DstString, - const char *SrcString, - ACPI_SIZE Count); - -char * -strstr ( - char *String1, - char *String2); - - -/* Conversion */ - -UINT32 -strtoul ( - const char *String, - char **Terminator, - UINT32 Base); - - -/* Memory */ - -int -memcmp ( - void *Buffer1, - void *Buffer2, - ACPI_SIZE Count); - -void * -memcpy ( - void *Dest, - const void *Src, - ACPI_SIZE Count); - -void * -memmove ( - void *Dest, - const void *Src, - ACPI_SIZE Count); - -void * -memset ( - void *Dest, - int Value, - ACPI_SIZE Count); - - -/* upper/lower case */ - -int -tolower ( - int c); - -int -toupper ( - int c); - -/* - * utprint - printf/vprintf output functions - */ -const char * -AcpiUtScanNumber ( - const char *String, - UINT64 *NumberPtr); - -const char * -AcpiUtPrintNumber ( - char *String, - UINT64 Number); - -int -vsnprintf ( - char *String, - ACPI_SIZE Size, - const char *Format, - va_list Args); - -int -snprintf ( - char *String, - ACPI_SIZE Size, - const char *Format, - ...); - -int -sprintf ( - char *String, - const char *Format, - ...); - -#ifdef ACPI_APPLICATION -#define SEEK_SET 0 -#define SEEK_CUR 1 -#define SEEK_END 2 - -/* - * NOTE: Currently we only need to update errno for file IOs. Other - * Clibrary invocations in ACPICA do not make decisions according to - * the errno. - */ -extern int errno; - -#ifndef EOF -#define EOF (-1) -#endif - -#define putchar(c) fputc(stdout, c) -#define getchar(c) fgetc(stdin) - -int -vprintf ( - const char *Format, - va_list Args); - -int -printf ( - const char *Format, - ...); - -int -vfprintf ( - FILE *File, - const char *Format, - va_list Args); - -int -fprintf ( - FILE *File, - const char *Format, - ...); - -FILE * -fopen ( - const char *Path, - const char *Modes); - -void -fclose ( - FILE *File); - -int -fread ( - void *Buffer, - ACPI_SIZE Size, - ACPI_SIZE Count, - FILE *File); - -int -fwrite ( - void *Buffer, - ACPI_SIZE Size, - ACPI_SIZE Count, - FILE *File); - -int -fseek ( - FILE *File, - long Offset, - int From); - -long -ftell ( - FILE *File); - -int -fgetc ( - FILE *File); - -int -fputc ( - FILE *File, - char c); - -char * -fgets ( - char *s, - ACPI_SIZE Size, - FILE *File); -#endif - -#endif /* _ACCLIB_H */ diff --git a/drivers/include/acpica/accommon.h b/drivers/include/acpica/accommon.h deleted file mode 100644 index 7da7cf7..0000000 --- a/drivers/include/acpica/accommon.h +++ /dev/null @@ -1,175 +0,0 @@ -/****************************************************************************** - * - * Name: accommon.h - Common include files for generation of ACPICA source - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef __ACCOMMON_H__ -#define __ACCOMMON_H__ - -/* - * Common set of includes for all ACPICA source files. - * We put them here because we don't want to duplicate them - * in the source code again and again. - * - * Note: The order of these include files is important. - */ -#include "acconfig.h" /* Global configuration constants */ -#include "acmacros.h" /* C macros */ -#include "aclocal.h" /* Internal data types */ -#include "acobject.h" /* ACPI internal object */ -#include "acstruct.h" /* Common structures */ -#include "acglobal.h" /* All global variables */ -#include "achware.h" /* Hardware defines and interfaces */ -#include "acutils.h" /* Utility interfaces */ -#ifndef ACPI_USE_SYSTEM_CLIBRARY -#include "acclib.h" /* C library interfaces */ -#endif /* !ACPI_USE_SYSTEM_CLIBRARY */ - - -#endif /* __ACCOMMON_H__ */ diff --git a/drivers/include/acpica/acconfig.h b/drivers/include/acpica/acconfig.h deleted file mode 100644 index 983dc30..0000000 --- a/drivers/include/acpica/acconfig.h +++ /dev/null @@ -1,377 +0,0 @@ -/****************************************************************************** - * - * Name: acconfig.h - Global configuration constants - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef _ACCONFIG_H -#define _ACCONFIG_H - - -/****************************************************************************** - * - * Configuration options - * - *****************************************************************************/ - -/* - * ACPI_DEBUG_OUTPUT - This switch enables all the debug facilities of the - * ACPI subsystem. This includes the DEBUG_PRINT output - * statements. When disabled, all DEBUG_PRINT - * statements are compiled out. - * - * ACPI_APPLICATION - Use this switch if the subsystem is going to be run - * at the application level. - * - */ - -/* - * OS name, used for the _OS object. The _OS object is essentially obsolete, - * but there is a large base of ASL/AML code in existing machines that check - * for the string below. The use of this string usually guarantees that - * the ASL will execute down the most tested code path. Also, there is some - * code that will not execute the _OSI method unless _OS matches the string - * below. Therefore, change this string at your own risk. - */ -#define ACPI_OS_NAME "Microsoft Windows NT" - -/* Maximum objects in the various object caches */ - -#define ACPI_MAX_STATE_CACHE_DEPTH 96 /* State objects */ -#define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */ -#define ACPI_MAX_EXTPARSE_CACHE_DEPTH 96 /* Parse tree objects */ -#define ACPI_MAX_OBJECT_CACHE_DEPTH 96 /* Interpreter operand objects */ -#define ACPI_MAX_NAMESPACE_CACHE_DEPTH 96 /* Namespace objects */ -#define ACPI_MAX_COMMENT_CACHE_DEPTH 96 /* Comments for the -ca option */ - -/* - * Should the subsystem abort the loading of an ACPI table if the - * table checksum is incorrect? - */ -#ifndef ACPI_CHECKSUM_ABORT -#define ACPI_CHECKSUM_ABORT FALSE -#endif - -/* - * Generate a version of ACPICA that only supports "reduced hardware" - * platforms (as defined in ACPI 5.0). Set to TRUE to generate a specialized - * version of ACPICA that ONLY supports the ACPI 5.0 "reduced hardware" - * model. In other words, no ACPI hardware is supported. - * - * If TRUE, this means no support for the following: - * PM Event and Control registers - * SCI interrupt (and handler) - * Fixed Events - * General Purpose Events (GPEs) - * Global Lock - * ACPI PM timer - */ -#ifndef ACPI_REDUCED_HARDWARE -#define ACPI_REDUCED_HARDWARE FALSE -#endif - - -/****************************************************************************** - * - * Subsystem Constants - * - *****************************************************************************/ - -/* Version of ACPI supported */ - -#define ACPI_CA_SUPPORT_LEVEL 5 - -/* Maximum count for a semaphore object */ - -#define ACPI_MAX_SEMAPHORE_COUNT 256 - -/* Maximum object reference count (detects object deletion issues) */ - -#define ACPI_MAX_REFERENCE_COUNT 0x4000 - -/* Default page size for use in mapping memory for operation regions */ - -#define ACPI_DEFAULT_PAGE_SIZE 4096 /* Must be power of 2 */ - -/* OwnerId tracking. 128 entries allows for 4095 OwnerIds */ - -#define ACPI_NUM_OWNERID_MASKS 128 - -/* Size of the root table array is increased by this increment */ - -#define ACPI_ROOT_TABLE_SIZE_INCREMENT 4 - -/* Maximum sleep allowed via Sleep() operator */ - -#define ACPI_MAX_SLEEP 2000 /* 2000 millisec == two seconds */ - -/* Address Range lists are per-SpaceId (Memory and I/O only) */ - -#define ACPI_ADDRESS_RANGE_MAX 2 - -/* Maximum time (default 30s) of While() loops before abort */ - -#define ACPI_MAX_LOOP_TIMEOUT 30 - - -/****************************************************************************** - * - * ACPI Specification constants (Do not change unless the specification changes) - * - *****************************************************************************/ - -/* Method info (in WALK_STATE), containing local variables and arguments */ - -#define ACPI_METHOD_NUM_LOCALS 8 -#define ACPI_METHOD_MAX_LOCAL 7 - -#define ACPI_METHOD_NUM_ARGS 7 -#define ACPI_METHOD_MAX_ARG 6 - -/* - * Operand Stack (in WALK_STATE), Must be large enough to contain METHOD_MAX_ARG - */ -#define ACPI_OBJ_NUM_OPERANDS 8 -#define ACPI_OBJ_MAX_OPERAND 7 - -/* Number of elements in the Result Stack frame, can be an arbitrary value */ - -#define ACPI_RESULTS_FRAME_OBJ_NUM 8 - -/* - * Maximal number of elements the Result Stack can contain, - * it may be an arbitrary value not exceeding the types of - * ResultSize and ResultCount (now UINT8). - */ -#define ACPI_RESULTS_OBJ_NUM_MAX 255 - -/* Constants used in searching for the RSDP in low memory */ - -#define ACPI_EBDA_PTR_LOCATION 0x0000040E /* Physical Address */ -#define ACPI_EBDA_PTR_LENGTH 2 -#define ACPI_EBDA_WINDOW_SIZE 1024 -#define ACPI_HI_RSDP_WINDOW_BASE 0x000E0000 /* Physical Address */ -#define ACPI_HI_RSDP_WINDOW_SIZE 0x00020000 -#define ACPI_RSDP_SCAN_STEP 16 - -/* Operation regions */ - -#define ACPI_USER_REGION_BEGIN 0x80 - -/* Maximum SpaceIds for Operation Regions */ - -#define ACPI_MAX_ADDRESS_SPACE 255 -#define ACPI_NUM_DEFAULT_SPACES 4 - -/* Array sizes. Used for range checking also */ - -#define ACPI_MAX_MATCH_OPCODE 5 - -/* RSDP checksums */ - -#define ACPI_RSDP_CHECKSUM_LENGTH 20 -#define ACPI_RSDP_XCHECKSUM_LENGTH 36 - -/* - * SMBus, GSBus and IPMI buffer sizes. All have a 2-byte header, - * containing both Status and Length. - */ -#define ACPI_SERIAL_HEADER_SIZE 2 /* Common for below. Status and Length fields */ - -#define ACPI_SMBUS_DATA_SIZE 32 -#define ACPI_SMBUS_BUFFER_SIZE ACPI_SERIAL_HEADER_SIZE + ACPI_SMBUS_DATA_SIZE - -#define ACPI_IPMI_DATA_SIZE 64 -#define ACPI_IPMI_BUFFER_SIZE ACPI_SERIAL_HEADER_SIZE + ACPI_IPMI_DATA_SIZE - -#define ACPI_MAX_GSBUS_DATA_SIZE 255 -#define ACPI_MAX_GSBUS_BUFFER_SIZE ACPI_SERIAL_HEADER_SIZE + ACPI_MAX_GSBUS_DATA_SIZE - -#define ACPI_PRM_INPUT_BUFFER_SIZE 26 - -#define ACPI_FFH_INPUT_BUFFER_SIZE 256 - -/* _SxD and _SxW control methods */ - -#define ACPI_NUM_SxD_METHODS 4 -#define ACPI_NUM_SxW_METHODS 5 - - -/****************************************************************************** - * - * Miscellaneous constants - * - *****************************************************************************/ - -/* UUID constants */ - -#define UUID_BUFFER_LENGTH 16 /* Length of UUID in memory */ -#define UUID_STRING_LENGTH 36 /* Total length of a UUID string */ - -/* Positions for required hyphens (dashes) in UUID strings */ - -#define UUID_HYPHEN1_OFFSET 8 -#define UUID_HYPHEN2_OFFSET 13 -#define UUID_HYPHEN3_OFFSET 18 -#define UUID_HYPHEN4_OFFSET 23 - - -/****************************************************************************** - * - * ACPI AML Debugger - * - *****************************************************************************/ - -#define ACPI_DEBUGGER_MAX_ARGS ACPI_METHOD_NUM_ARGS + 4 /* Max command line arguments */ -#define ACPI_DB_LINE_BUFFER_SIZE 512 - -#define ACPI_DEBUGGER_COMMAND_PROMPT '-' -#define ACPI_DEBUGGER_EXECUTE_PROMPT '%' - - -#endif /* _ACCONFIG_H */ diff --git a/drivers/include/acpica/acconvert.h b/drivers/include/acpica/acconvert.h deleted file mode 100644 index 9dedc51..0000000 --- a/drivers/include/acpica/acconvert.h +++ /dev/null @@ -1,311 +0,0 @@ -/****************************************************************************** - * - * Module Name: acapps - common include for ACPI applications/tools - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef _ACCONVERT -#define _ACCONVERT - -/* Definitions for comment state */ - -#define ASL_COMMENT_STANDARD 1 -#define ASLCOMMENT_INLINE 2 -#define ASL_COMMENT_OPEN_PAREN 3 -#define ASL_COMMENT_CLOSE_PAREN 4 -#define ASL_COMMENT_CLOSE_BRACE 5 - -/* Definitions for comment print function*/ - -#define AML_COMMENT_STANDARD 1 -#define AMLCOMMENT_INLINE 2 -#define AML_COMMENT_END_NODE 3 -#define AML_NAMECOMMENT 4 -#define AML_COMMENT_CLOSE_BRACE 5 -#define AML_COMMENT_ENDBLK 6 -#define AML_COMMENT_INCLUDE 7 - - -#ifdef ACPI_ASL_COMPILER -/* - * cvcompiler - */ -void -CvProcessComment ( - ASL_COMMENT_STATE CurrentState, - char *StringBuffer, - int c1); - -void -CvProcessCommentType2 ( - ASL_COMMENT_STATE CurrentState, - char *StringBuffer); - -UINT32 -CvCalculateCommentLengths( - ACPI_PARSE_OBJECT *Op); - -void -CvProcessCommentState ( - char input); - -char* -CvAppendInlineComment ( - char *InlineComment, - char *ToAdd); - -void -CvAddToCommentList ( - char* ToAdd); - -void -CvPlaceComment ( - UINT8 Type, - char *CommentString); - -UINT32 -CvParseOpBlockType ( - ACPI_PARSE_OBJECT *Op); - -ACPI_COMMENT_NODE* -CvCommentNodeCalloc ( - void); - -void -CgWriteAmlDefBlockComment ( - ACPI_PARSE_OBJECT *Op); - -void -CgWriteOneAmlComment ( - ACPI_PARSE_OBJECT *Op, - char* CommentToPrint, - UINT8 InputOption); - -void -CgWriteAmlComment ( - ACPI_PARSE_OBJECT *Op); - - -/* - * cvparser - */ -void -CvInitFileTree ( - ACPI_TABLE_HEADER *Table, - FILE *RootFile); - -void -CvClearOpComments ( - ACPI_PARSE_OBJECT *Op); - -ACPI_FILE_NODE* -CvFilenameExists ( - char *Filename, - ACPI_FILE_NODE *Head); - -void -CvLabelFileNode ( - ACPI_PARSE_OBJECT *Op); - -void -CvCaptureListComments ( - ACPI_PARSE_STATE *ParserState, - ACPI_COMMENT_NODE *ListHead, - ACPI_COMMENT_NODE *ListTail); - -void -CvCaptureCommentsOnly ( - ACPI_PARSE_STATE *ParserState); - -void -CvCaptureComments ( - ACPI_WALK_STATE *WalkState); - -void -CvTransferComments ( - ACPI_PARSE_OBJECT *Op); - -/* - * cvdisasm - */ -void -CvSwitchFiles ( - UINT32 level, - ACPI_PARSE_OBJECT *op); - -BOOLEAN -CvFileHasSwitched ( - ACPI_PARSE_OBJECT *Op); - - -void -CvCloseParenWriteComment ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level); - -void -CvCloseBraceWriteComment ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level); - -void -CvPrintOneCommentList ( - ACPI_COMMENT_NODE *CommentList, - UINT32 Level); - -void -CvPrintOneCommentType ( - ACPI_PARSE_OBJECT *Op, - UINT8 CommentType, - char* EndStr, - UINT32 Level); - - -#endif - -#endif /* _ACCONVERT */ diff --git a/drivers/include/acpica/acdebug.h b/drivers/include/acpica/acdebug.h deleted file mode 100644 index 05225ee..0000000 --- a/drivers/include/acpica/acdebug.h +++ /dev/null @@ -1,626 +0,0 @@ -/****************************************************************************** - * - * Name: acdebug.h - ACPI/AML debugger - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef __ACDEBUG_H__ -#define __ACDEBUG_H__ - -/* The debugger is used in conjunction with the disassembler most of time */ - -#ifdef ACPI_DISASSEMBLER -#include "acdisasm.h" -#endif - - -#define ACPI_DEBUG_BUFFER_SIZE 0x4000 /* 16K buffer for return objects */ -#define ACPI_DEBUG_LENGTH_FORMAT " (%.4X bits, %.3X bytes)" - -typedef struct acpi_db_command_info -{ - const char *Name; /* Command Name */ - UINT8 MinArgs; /* Minimum arguments required */ - -} ACPI_DB_COMMAND_INFO; - -typedef struct acpi_db_command_help -{ - UINT8 LineCount; /* Number of help lines */ - char *Invocation; /* Command Invocation */ - char *Description; /* Command Description */ - -} ACPI_DB_COMMAND_HELP; - -typedef struct acpi_db_argument_info -{ - const char *Name; /* Argument Name */ - -} ACPI_DB_ARGUMENT_INFO; - -typedef struct acpi_db_execute_walk -{ - UINT32 Count; - UINT32 MaxCount; - char NameSeg[ACPI_NAMESEG_SIZE + 1]; - -} ACPI_DB_EXECUTE_WALK; - - -#define PARAM_LIST(pl) pl - -#define EX_NO_SINGLE_STEP 1 -#define EX_SINGLE_STEP 2 -#define EX_ALL 4 - - -/* - * dbxface - external debugger interfaces - */ -ACPI_DBR_DEPENDENT_RETURN_OK ( -ACPI_STATUS -AcpiDbSingleStep ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op, - UINT32 OpType)) - -ACPI_DBR_DEPENDENT_RETURN_VOID ( -void -AcpiDbSignalBreakPoint ( - ACPI_WALK_STATE *WalkState)) - - -/* - * dbcmds - debug commands and output routines - */ -ACPI_NAMESPACE_NODE * -AcpiDbConvertToNode ( - char *InString); - -void -AcpiDbDisplayTableInfo ( - char *TableArg); - -void -AcpiDbDisplayTemplate ( - char *BufferArg); - -void -AcpiDbUnloadAcpiTable ( - char *Name); - -void -AcpiDbSendNotify ( - char *Name, - UINT32 Value); - -void -AcpiDbDisplayInterfaces ( - char *ActionArg, - char *InterfaceNameArg); - -ACPI_STATUS -AcpiDbSleep ( - char *ObjectArg); - -void -AcpiDbTrace ( - char *EnableArg, - char *MethodArg, - char *OnceArg); - -void -AcpiDbDisplayLocks ( - void); - -void -AcpiDbDisplayResources ( - char *ObjectArg); - -ACPI_HW_DEPENDENT_RETURN_VOID ( -void -AcpiDbDisplayGpes ( - void)) - -void -AcpiDbDisplayHandlers ( - void); - -ACPI_HW_DEPENDENT_RETURN_VOID ( -void -AcpiDbGenerateGpe ( - char *GpeArg, - char *BlockArg)) - -ACPI_HW_DEPENDENT_RETURN_VOID ( -void -AcpiDbGenerateSci ( - void)) - -void -AcpiDbExecuteTest ( - char *TypeArg); - - -/* - * dbconvert - miscellaneous conversion routines - */ -ACPI_STATUS -AcpiDbHexCharToValue ( - int HexChar, - UINT8 *ReturnValue); - -ACPI_STATUS -AcpiDbConvertToPackage ( - char *String, - ACPI_OBJECT *Object); - -ACPI_STATUS -AcpiDbConvertToObject ( - ACPI_OBJECT_TYPE Type, - char *String, - ACPI_OBJECT *Object); - -UINT8 * -AcpiDbEncodePldBuffer ( - ACPI_PLD_INFO *PldInfo); - -void -AcpiDbDumpPldBuffer ( - ACPI_OBJECT *ObjDesc); - - -/* - * dbmethod - control method commands - */ -void -AcpiDbSetMethodBreakpoint ( - char *Location, - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op); - -void -AcpiDbSetMethodCallBreakpoint ( - ACPI_PARSE_OBJECT *Op); - -void -AcpiDbSetMethodData ( - char *TypeArg, - char *IndexArg, - char *ValueArg); - -ACPI_STATUS -AcpiDbDisassembleMethod ( - char *Name); - -void -AcpiDbDisassembleAml ( - char *Statements, - ACPI_PARSE_OBJECT *Op); - -void -AcpiDbEvaluatePredefinedNames ( - void); - -void -AcpiDbEvaluateAll ( - char *NameSeg); - - -/* - * dbnames - namespace commands - */ -void -AcpiDbSetScope ( - char *Name); - -void -AcpiDbDumpNamespace ( - char *StartArg, - char *DepthArg); - -void -AcpiDbDumpNamespacePaths ( - void); - -void -AcpiDbDumpNamespaceByOwner ( - char *OwnerArg, - char *DepthArg); - -ACPI_STATUS -AcpiDbFindNameInNamespace ( - char *NameArg); - -void -AcpiDbCheckPredefinedNames ( - void); - -ACPI_STATUS -AcpiDbDisplayObjects ( - char *ObjTypeArg, - char *DisplayCountArg); - -void -AcpiDbCheckIntegrity ( - void); - -void -AcpiDbFindReferences ( - char *ObjectArg); - -void -AcpiDbGetBusInfo ( - void); - -ACPI_STATUS -AcpiDbDisplayFields ( - UINT32 AddressSpaceId); - - -/* - * dbdisply - debug display commands - */ -void -AcpiDbDisplayMethodInfo ( - ACPI_PARSE_OBJECT *Op); - -void -AcpiDbDecodeAndDisplayObject ( - char *Target, - char *OutputType); - -ACPI_DBR_DEPENDENT_RETURN_VOID ( -void -AcpiDbDisplayResultObject ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_WALK_STATE *WalkState)) - -ACPI_STATUS -AcpiDbDisplayAllMethods ( - char *DisplayCountArg); - -void -AcpiDbDisplayArguments ( - void); - -void -AcpiDbDisplayLocals ( - void); - -void -AcpiDbDisplayResults ( - void); - -void -AcpiDbDisplayCallingTree ( - void); - -void -AcpiDbDisplayObjectType ( - char *ObjectArg); - -ACPI_DBR_DEPENDENT_RETURN_VOID ( -void -AcpiDbDisplayArgumentObject ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_WALK_STATE *WalkState)) - - -/* - * dbexec - debugger control method execution - */ -void -AcpiDbExecute ( - char *Name, - char **Args, - ACPI_OBJECT_TYPE *Types, - UINT32 Flags); - -void -AcpiDbCreateExecutionThread ( - char *MethodNameArg, - char **Arguments, - ACPI_OBJECT_TYPE *Types); - -void -AcpiDbCreateExecutionThreads ( - char *NumThreadsArg, - char *NumLoopsArg, - char *MethodNameArg); - -void -AcpiDbDeleteObjects ( - UINT32 Count, - ACPI_OBJECT *Objects); - -#ifdef ACPI_DBG_TRACK_ALLOCATIONS -UINT32 -AcpiDbGetCacheInfo ( - ACPI_MEMORY_LIST *Cache); -#endif - - -/* - * dbfileio - Debugger file I/O commands - */ -ACPI_OBJECT_TYPE -AcpiDbMatchArgument ( - char *UserArgument, - ACPI_DB_ARGUMENT_INFO *Arguments); - -void -AcpiDbCloseDebugFile ( - void); - -void -AcpiDbOpenDebugFile ( - char *Name); - -ACPI_STATUS -AcpiDbLoadAcpiTable ( - char *Filename); - -ACPI_STATUS -AcpiDbLoadTables ( - ACPI_NEW_TABLE_DESC *ListHead); - - -/* - * dbhistry - debugger HISTORY command - */ -void -AcpiDbAddToHistory ( - char *CommandLine); - -void -AcpiDbDisplayHistory ( - void); - -char * -AcpiDbGetFromHistory ( - char *CommandNumArg); - -char * -AcpiDbGetHistoryByIndex ( - UINT32 CommanddNum); - - -/* - * dbinput - user front-end to the AML debugger - */ -ACPI_STATUS -AcpiDbCommandDispatch ( - char *InputBuffer, - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op); - -void ACPI_SYSTEM_XFACE -AcpiDbExecuteThread ( - void *Context); - -ACPI_STATUS -AcpiDbUserCommands ( - void); - -char * -AcpiDbGetNextToken ( - char *String, - char **Next, - ACPI_OBJECT_TYPE *ReturnType); - - -/* - * dbobject - */ -void -AcpiDbDecodeInternalObject ( - ACPI_OPERAND_OBJECT *ObjDesc); - -void -AcpiDbDisplayInternalObject ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_WALK_STATE *WalkState); - -void -AcpiDbDecodeArguments ( - ACPI_WALK_STATE *WalkState); - -void -AcpiDbDecodeLocals ( - ACPI_WALK_STATE *WalkState); - -void -AcpiDbDumpMethodInfo ( - ACPI_STATUS Status, - ACPI_WALK_STATE *WalkState); - - -/* - * dbstats - Generation and display of ACPI table statistics - */ -void -AcpiDbGenerateStatistics ( - ACPI_PARSE_OBJECT *Root, - BOOLEAN IsMethod); - -ACPI_STATUS -AcpiDbDisplayStatistics ( - char *TypeArg); - - -/* - * dbutils - AML debugger utilities - */ -void -AcpiDbSetOutputDestination ( - UINT32 Where); - -void -AcpiDbDumpExternalObject ( - ACPI_OBJECT *ObjDesc, - UINT32 Level); - -void -AcpiDbPrepNamestring ( - char *Name); - -ACPI_NAMESPACE_NODE * -AcpiDbLocalNsLookup ( - char *Name); - -void -AcpiDbUint32ToHexString ( - UINT32 Value, - char *Buffer); - -void -AcpiDbGenerateInterrupt ( - char *GsivArg); - -#endif /* __ACDEBUG_H__ */ diff --git a/drivers/include/acpica/acdisasm.h b/drivers/include/acpica/acdisasm.h deleted file mode 100644 index 5416d0b..0000000 --- a/drivers/include/acpica/acdisasm.h +++ /dev/null @@ -1,1612 +0,0 @@ -/****************************************************************************** - * - * Name: acdisasm.h - AML disassembler - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef __ACDISASM_H__ -#define __ACDISASM_H__ - -#include "amlresrc.h" - - -#define BLOCK_NONE 0 -#define BLOCK_PAREN 1 -#define BLOCK_BRACE 2 -#define BLOCK_COMMA_LIST 4 -#define ACPI_DEFAULT_RESNAME *(UINT32 *) "__RD" - -/* - * Raw table data header. Used by disassembler and data table compiler. - * Do not change. - */ -#define ACPI_RAW_TABLE_DATA_HEADER "Raw Table Data" - - -typedef struct acpi_dmtable_info -{ - UINT8 Opcode; - UINT16 Offset; - char *Name; - UINT8 Flags; - -} ACPI_DMTABLE_INFO; - -/* Values for Flags field above */ - -#define DT_LENGTH 0x01 /* Field is a subtable length */ -#define DT_FLAG 0x02 /* Field is a flag value */ -#define DT_NON_ZERO 0x04 /* Field must be non-zero */ -#define DT_OPTIONAL 0x08 /* Field is optional */ -#define DT_DESCRIBES_OPTIONAL 0x10 /* Field describes an optional field (length, etc.) */ -#define DT_COUNT 0x20 /* Currently not used */ - -/* - * Values for Opcode above. - * Note: 0-7 must not change, they are used as a flag shift value. Other - * than those, new values can be added wherever appropriate. - */ -typedef enum -{ - /* Simple Data Types */ - - ACPI_DMT_FLAG0 = 0, - ACPI_DMT_FLAG1 = 1, - ACPI_DMT_FLAG2 = 2, - ACPI_DMT_FLAG3 = 3, - ACPI_DMT_FLAG4 = 4, - ACPI_DMT_FLAG5 = 5, - ACPI_DMT_FLAG6 = 6, - ACPI_DMT_FLAG7 = 7, - ACPI_DMT_FLAGS0, - ACPI_DMT_FLAGS1, - ACPI_DMT_FLAGS2, - ACPI_DMT_FLAGS8_2, - ACPI_DMT_FLAGS4, - ACPI_DMT_FLAGS4_0, - ACPI_DMT_FLAGS4_4, - ACPI_DMT_FLAGS4_8, - ACPI_DMT_FLAGS4_12, - ACPI_DMT_FLAGS16_16, - ACPI_DMT_UINT8, - ACPI_DMT_UINT16, - ACPI_DMT_UINT24, - ACPI_DMT_UINT32, - ACPI_DMT_UINT40, - ACPI_DMT_UINT48, - ACPI_DMT_UINT56, - ACPI_DMT_UINT64, - ACPI_DMT_BUF7, - ACPI_DMT_BUF10, - ACPI_DMT_BUF11, - ACPI_DMT_BUF12, - ACPI_DMT_BUF16, - ACPI_DMT_BUF18, - ACPI_DMT_BUF24, - ACPI_DMT_BUF26, - ACPI_DMT_BUF32, - ACPI_DMT_BUF112, - ACPI_DMT_BUF128, - ACPI_DMT_SIG, - ACPI_DMT_STRING, - ACPI_DMT_NAME4, - ACPI_DMT_NAME6, - ACPI_DMT_NAME8, - - /* Types that are decoded to strings and miscellaneous */ - - ACPI_DMT_ACCWIDTH, - ACPI_DMT_CHKSUM, - ACPI_DMT_GAS, - ACPI_DMT_SPACEID, - ACPI_DMT_UNICODE, - ACPI_DMT_UUID, - - /* Types used only for the Data Table Compiler */ - - ACPI_DMT_BUFFER, - ACPI_DMT_RAW_BUFFER, /* Large, multiple line buffer */ - ACPI_DMT_DEVICE_PATH, - ACPI_DMT_LABEL, - ACPI_DMT_PCI_PATH, - - /* Types that are specific to particular ACPI tables */ - - ACPI_DMT_AEST, - ACPI_DMT_AEST_CACHE, - ACPI_DMT_AEST_GIC, - ACPI_DMT_AEST_RES, - ACPI_DMT_AEST_XFACE, - ACPI_DMT_AEST_XRUPT, - ACPI_DMT_AGDI, - ACPI_DMT_ASF, - ACPI_DMT_ASPT, - ACPI_DMT_CDAT, - ACPI_DMT_CEDT, - ACPI_DMT_DMAR, - ACPI_DMT_DMAR_SCOPE, - ACPI_DMT_EINJACT, - ACPI_DMT_EINJINST, - ACPI_DMT_ERDT, - ACPI_DMT_ERSTACT, - ACPI_DMT_ERSTINST, - ACPI_DMT_FADTPM, - ACPI_DMT_GTDT, - ACPI_DMT_HEST, - ACPI_DMT_HESTNTFY, - ACPI_DMT_HESTNTYP, - ACPI_DMT_HMAT, - ACPI_DMT_IORTMEM, - ACPI_DMT_IOVT, - ACPI_DMT_IOVTDEV, - ACPI_DMT_IVRS, - ACPI_DMT_IVRS_DE, - ACPI_DMT_IVRS_UNTERMINATED_STRING, - ACPI_DMT_LPIT, - ACPI_DMT_MADT, - ACPI_DMT_MPAM_LOCATOR, - ACPI_DMT_NFIT, - ACPI_DMT_PCCT, - ACPI_DMT_PHAT, - ACPI_DMT_PMTT, - ACPI_DMT_PMTT_VENDOR, - ACPI_DMT_PPTT, - ACPI_DMT_RGRT, - ACPI_DMT_RHCT, - ACPI_DMT_RIMT, - ACPI_DMT_SDEI, - ACPI_DMT_SDEV, - ACPI_DMT_SLIC, - ACPI_DMT_SRAT, - ACPI_DMT_SWFT, - ACPI_DMT_TPM2, - ACPI_DMT_VIOT, - ACPI_DMT_WPBT_UNICODE, - - /* Special opcodes */ - - ACPI_DMT_EXTRA_TEXT, - ACPI_DMT_EXIT - -} ACPI_ENTRY_TYPES; - -typedef -void (*ACPI_DMTABLE_HANDLER) ( - ACPI_TABLE_HEADER *Table); - -typedef -ACPI_STATUS (*ACPI_CMTABLE_HANDLER) ( - void **PFieldList); - -typedef struct acpi_dmtable_data -{ - char *Signature; - ACPI_DMTABLE_INFO *TableInfo; - ACPI_DMTABLE_HANDLER TableHandler; - ACPI_CMTABLE_HANDLER CmTableHandler; - const unsigned char *Template; - -} ACPI_DMTABLE_DATA; - - -typedef struct acpi_op_walk_info -{ - ACPI_WALK_STATE *WalkState; - ACPI_PARSE_OBJECT *MappingOp; - UINT8 *PreviousAml; - UINT8 *StartAml; - UINT32 Level; - UINT32 LastLevel; - UINT32 Count; - UINT32 BitOffset; - UINT32 Flags; - UINT32 AmlOffset; - -} ACPI_OP_WALK_INFO; - -/* - * TBD - another copy of this is in asltypes.h, fix - */ -#ifndef ASL_WALK_CALLBACK_DEFINED -typedef -ACPI_STATUS (*ASL_WALK_CALLBACK) ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); -#define ASL_WALK_CALLBACK_DEFINED -#endif - -typedef -void (*ACPI_RESOURCE_HANDLER) ( - ACPI_OP_WALK_INFO *Info, - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level); - -typedef struct acpi_resource_tag -{ - UINT32 BitIndex; - char *Tag; - -} ACPI_RESOURCE_TAG; - -/* Strings used for decoding flags to ASL keywords */ - -extern const char *AcpiGbl_WordDecode[]; -extern const char *AcpiGbl_IrqDecode[]; -extern const char *AcpiGbl_LockRule[]; -extern const char *AcpiGbl_AccessTypes[]; -extern const char *AcpiGbl_UpdateRules[]; -extern const char *AcpiGbl_MatchOps[]; - -extern ACPI_DMTABLE_INFO AcpiDmTableInfoAestHdr[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoAestProcError[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoAestCacheRsrc[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoAestTlbRsrc[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoAestGenRsrc[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoAestMemError[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoAestSmmuError[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoAestVendorError[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoAestVendorV2Error[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoAestGicError[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoAestPCIeError[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoAestProxyError[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoAestXface[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoAestXfaceHeader[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoAestXface4k[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoAestXface16k[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoAestXface64k[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoAestXrupt[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoAestXruptV2[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoAgdi[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoApmtNode[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoAsf0[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoAsf1[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoAsf1a[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoAsf2[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoAsf2a[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoAsf3[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoAsf4[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoAsfHdr[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoAspt[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoAsptHdr[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoAspt0[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoAspt1[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoAspt2[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoBdat[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoBoot[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoBert[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoBgrt[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoCcel[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoCdatTableHdr[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoCdatHeader[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoCdat0[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoCdat1[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoCdat2[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoCdat3[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoCdat4[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoCdat5[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoCdatEntries[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoCedtHdr[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoCedt0[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoCedt1[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoCedt1_te[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoCedt2[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoCedt2_te[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoCpep[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoCpep0[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt0[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt1[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt2[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt2a[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2Device[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2Addr[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2Size[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2Name[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2OemData[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoDbgp[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmarHdr[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmarScope[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar0[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar1[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar2[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar3[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar4[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar5[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar6[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoDrtm[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoDrtm0[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoDrtm0a[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoDrtm1[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoDrtm1a[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoDrtm2[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoEcdt[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoEinj[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoEinj0[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoErdt[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoErdtHdr[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoErdtCacd[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoErdtCacdX2apic[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoErdtCarc[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoErdtCard[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoErdtCmrc[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoErdtCmrd[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoErdtDacd[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoErdtDacdPath[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoErdtDacdScope[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoErdtIbad[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoErdtIbrd[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoErdtIbrdCorrFactor[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoErdtMarc[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoErdtMmrc[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoErdtMmrcCorrFactor[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoErdtRmdd[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoErst[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoErst0[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoFacs[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt1[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt2[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt3[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt5[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt6[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoFpdt[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoFpdtHdr[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoFpdt0[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoFpdt1[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoGas[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoGtdt[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoGtdtHdr[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoGtdtEl2[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoGtdt0[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoGtdt0a[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoGtdt1[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoHeader[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest0[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest1[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest2[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest6[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest7[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest8[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest9[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest10[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest11[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoHestNotify[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoHestBank[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoHpet[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoLpitHdr[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoLpit0[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoLpit1[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoHmat[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoHmat0[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoHmat1[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoHmat1a[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoHmat1b[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoHmat1c[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoHmat2[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoHmat2a[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoHmatHdr[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort0[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort0a[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort1[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort1a[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort2[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort3[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort3a[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort3b[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort3c[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort4[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort5[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort6[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort6a[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort7[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIortAcc[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIortHdr[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIortHdr3[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIortMap[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIortPad[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIovt[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIovt0[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIovtdev[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrsHware1[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrsHware23[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrsMemory[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs4[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs8a[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs8b[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs8c[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrsCidString[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrsCidInteger[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrsHid[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrsUidString[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrsUidInteger[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrsHidString[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrsHidInteger[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt0[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt1[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt2[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt3[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt4[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt5[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt6[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt7[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt8[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt9[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt10[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt11[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt11a[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt11b[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt12[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt13[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt14[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt14a[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt15[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt15a[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt16[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt17[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt18[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt19[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt20[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt21[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt22[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt23[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt24[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt25[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt26[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt27[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt28[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt29[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt30[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt128[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadtHdr[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg0[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMchi[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMpam0[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMpam1[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMpam1A[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMpam1B[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMpam1C[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMpam1D[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMpam1E[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMpam1F[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMpam1G[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMpam1Deps[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMpam2[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMpst[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMpst0[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMpst0A[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMpst0B[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMpst1[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMpst2[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMrrm[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMrrm0[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMsct[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoMsct0[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfitHdr[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit0[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit1[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit2[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit2a[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit3[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit3a[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit4[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit5[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit6[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit6a[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit7[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoPhatHdr[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoPhat0[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoPhat0a[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoPhat1[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoPhat1a[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoPhat1b[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt0[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt1[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt2[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoPmttVendor[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoPmttHdr[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcct[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcctHdr[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcct0[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcct1[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcct2[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcct3[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcct4[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcct5[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoPdtt[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoPdtt0[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoPptt0[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoPptt0a[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoPptt1[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoPptt1a[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoPptt2[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoPpttHdr[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoPrmtHdr[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoPrmtModule[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoPrmtHandler[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoRasf[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoRas2[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoRas2PccDesc[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoRgrt[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoRgrt0[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoRhct[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoRhctNodeHdr[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoRhctIsa1[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoRhctIsaPad[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoRhctCmo1[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoRhctMmu1[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoRhctHartInfo1[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoRhctHartInfo2[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoRimt[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoRimtNodeHdr[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoRimtIommu[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoRimtIommuWire[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoRimtPcieRc[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoRimtIdMapping[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoRimtPlatDev[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoRimtPlatDevPad[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp1[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp2[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoS3pt[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoS3ptHdr[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoS3pt0[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoS3pt1[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoSbst[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoSdei[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoSdev[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoSdevHdr[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoSdev0[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoSdev0a[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoSdev0b[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoSdevSecCompHdr[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoSdevSecCompId[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoSdevSecCompMem[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoSdev1[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoSdev1a[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoSdev1b[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoSlic[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoSlit[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoSpcr[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoSpmi[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoSratHdr[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat0[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat1[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat2[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat3[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat4[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat5[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat6[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat7[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoStao[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoStaoStr[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoSvkl[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoSvkl0[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoSwft[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoSwftFileHdr[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoSwftFileData[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoTcpaHdr[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoTcpaClient[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoTcpaServer[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoTdel[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoTpm2[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoTpm2a[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoTpm211[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoTpm23[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoTpm23a[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoUefi[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoViot[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoViotHeader[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoViot1[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoViot2[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoViot3[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoViot4[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoWaet[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoWdat[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoWdat0[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoWddt[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoWdrt[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoWpbt[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoWpbt0[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoWsmt[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoXenv[]; - -extern ACPI_DMTABLE_INFO AcpiDmTableInfoGeneric[][2]; - -/* - * dmtable and ahtable - */ -extern const ACPI_DMTABLE_DATA AcpiDmTableData[]; -extern const AH_TABLE AcpiGbl_SupportedTables[]; - -UINT8 -AcpiDmGenerateChecksum ( - void *Table, - UINT32 Length, - UINT8 OriginalChecksum); - -const ACPI_DMTABLE_DATA * -AcpiDmGetTableData ( - char *Signature); - -void -AcpiDmDumpDataTable ( - ACPI_TABLE_HEADER *Table); - -ACPI_STATUS -AcpiDmDumpTable ( - UINT32 TableLength, - UINT32 TableOffset, - void *Table, - UINT32 SubtableLength, - ACPI_DMTABLE_INFO *Info); - -void -AcpiDmLineHeader ( - UINT32 Offset, - UINT32 ByteLength, - char *Name); - -void -AcpiDmLineHeader2 ( - UINT32 Offset, - UINT32 ByteLength, - char *Name, - UINT32 Value); - - -/* - * dmtbdump - */ -void -AcpiDmDumpBuffer ( - void *Table, - UINT32 BufferOffset, - UINT32 Length, - UINT32 AbsoluteOffset, - char *Header); - -void -AcpiDmDumpUnicode ( - void *Table, - UINT32 BufferOffset, - UINT32 ByteLength); - -void -AcpiDmDumpAest ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpApmt ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpAsf ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpAspt ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpCcel ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpCdat ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpCedt ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpCpep ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpCsrt ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpDbg2 ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpDmar ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpDrtm ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpEinj ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpErdt ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpErst ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpFadt ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpFpdt ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpGtdt ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpHest ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpHmat ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpIort ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpIovt ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpIvrs ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpLpit ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpMadt ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpMcfg ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpMpam ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpMpst ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpMrrm ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpMsct ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpNfit ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpPcct ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpPdtt ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpPhat ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpPmtt ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpPptt ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpPrmt ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpRas2 ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpRgrt ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpRhct ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpRimt ( - ACPI_TABLE_HEADER *Table); - -UINT32 -AcpiDmDumpRsdp ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpRsdt ( - ACPI_TABLE_HEADER *Table); - -UINT32 -AcpiDmDumpS3pt ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpSdev ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpSlic ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpSlit ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpSrat ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpStao ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpSvkl ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpSwft ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpTcpa ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpTdel ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpTpm2 ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpViot ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpWdat ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpWpbt ( - ACPI_TABLE_HEADER *Table); - -void -AcpiDmDumpXsdt ( - ACPI_TABLE_HEADER *Table); - - -/* - * dmwalk - */ -void -AcpiDmDisassemble ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Origin, - UINT32 NumOpcodes); - -void -AcpiDmWalkParseTree ( - ACPI_PARSE_OBJECT *Op, - ASL_WALK_CALLBACK DescendingCallback, - ASL_WALK_CALLBACK AscendingCallback, - void *Context); - - -/* - * dmopcode - */ -void -AcpiDmDisassembleOneOp ( - ACPI_WALK_STATE *WalkState, - ACPI_OP_WALK_INFO *Info, - ACPI_PARSE_OBJECT *Op); - -UINT32 -AcpiDmListType ( - ACPI_PARSE_OBJECT *Op); - -void -AcpiDmMethodFlags ( - ACPI_PARSE_OBJECT *Op); - -void -AcpiDmDisplayTargetPathname ( - ACPI_PARSE_OBJECT *Op); - -void -AcpiDmNotifyDescription ( - ACPI_PARSE_OBJECT *Op); - -void -AcpiDmPredefinedDescription ( - ACPI_PARSE_OBJECT *Op); - -void -AcpiDmFieldPredefinedDescription ( - ACPI_PARSE_OBJECT *Op); - -void -AcpiDmFieldFlags ( - ACPI_PARSE_OBJECT *Op); - -void -AcpiDmAddressSpace ( - UINT8 SpaceId); - -void -AcpiDmRegionFlags ( - ACPI_PARSE_OBJECT *Op); - -void -AcpiDmMatchOp ( - ACPI_PARSE_OBJECT *Op); - - -/* - * dmnames - */ -UINT32 -AcpiDmDumpName ( - UINT32 Name); - -ACPI_STATUS -AcpiPsDisplayObjectPathname ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op); - -void -AcpiDmNamestring ( - char *Name); - - -/* - * dmbuffer - */ -void -AcpiDmDisasmByteList ( - UINT32 Level, - UINT8 *ByteData, - UINT32 ByteCount); - -void -AcpiDmByteList ( - ACPI_OP_WALK_INFO *Info, - ACPI_PARSE_OBJECT *Op); - -void -AcpiDmCheckForHardwareId ( - ACPI_PARSE_OBJECT *Op); - -void -AcpiDmDecompressEisaId ( - UINT32 EncodedId); - -BOOLEAN -AcpiDmIsUuidBuffer ( - ACPI_PARSE_OBJECT *Op); - -BOOLEAN -AcpiDmIsUnicodeBuffer ( - ACPI_PARSE_OBJECT *Op); - -BOOLEAN -AcpiDmIsStringBuffer ( - ACPI_PARSE_OBJECT *Op); - -BOOLEAN -AcpiDmIsPldBuffer ( - ACPI_PARSE_OBJECT *Op); - - -/* - * dmdeferred - */ -ACPI_STATUS -AcpiDmParseDeferredOps ( - ACPI_PARSE_OBJECT *Root); - - -/* - * dmextern - */ -ACPI_STATUS -AcpiDmAddToExternalFileList ( - char *PathList); - -void -AcpiDmClearExternalFileList ( - void); - -void -AcpiDmAddOpToExternalList ( - ACPI_PARSE_OBJECT *Op, - char *Path, - UINT8 Type, - UINT32 Value, - UINT16 Flags); - -void -AcpiDmCreateSubobjectForExternal ( - UINT8 Type, - ACPI_NAMESPACE_NODE **Node, - UINT32 Value); - -void -AcpiDmAddNodeToExternalList ( - ACPI_NAMESPACE_NODE *Node, - UINT8 Type, - UINT32 Value, - UINT16 Flags); - -void -AcpiDmAddExternalListToNamespace ( - void); - -void -AcpiDmAddOneExternalToNamespace ( - char *Path, - UINT8 Type, - UINT32 Value); - -UINT32 -AcpiDmGetUnresolvedExternalMethodCount ( - void); - -void -AcpiDmClearExternalList ( - void); - -void -AcpiDmEmitExternals ( - void); - -void -AcpiDmEmitExternal ( - ACPI_PARSE_OBJECT *NameOp, - ACPI_PARSE_OBJECT *TypeOp); - -void -AcpiDmUnresolvedWarning ( - UINT8 Type); - -void -AcpiDmGetExternalsFromFile ( - void); - -void -AcpiDmMarkExternalConflict ( - ACPI_NAMESPACE_NODE *Node); - - -/* - * dmresrc - */ -void -AcpiDmDumpInteger8 ( - UINT8 Value, - const char *Name); - -void -AcpiDmDumpInteger16 ( - UINT16 Value, - const char *Name); - -void -AcpiDmDumpInteger32 ( - UINT32 Value, - const char *Name); - -void -AcpiDmDumpInteger64 ( - UINT64 Value, - const char *Name); - -void -AcpiDmResourceTemplate ( - ACPI_OP_WALK_INFO *Info, - ACPI_PARSE_OBJECT *Op, - UINT8 *ByteData, - UINT32 ByteCount); - -ACPI_STATUS -AcpiDmIsResourceTemplate ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op); - -void -AcpiDmBitList ( - UINT16 Mask); - -void -AcpiDmDescriptorName ( - void); - - -/* - * dmresrcl - */ -void -AcpiDmWordDescriptor ( - ACPI_OP_WALK_INFO *Info, - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level); - -void -AcpiDmDwordDescriptor ( - ACPI_OP_WALK_INFO *Info, - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level); - -void -AcpiDmExtendedDescriptor ( - ACPI_OP_WALK_INFO *Info, - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level); - -void -AcpiDmQwordDescriptor ( - ACPI_OP_WALK_INFO *Info, - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level); - -void -AcpiDmMemory24Descriptor ( - ACPI_OP_WALK_INFO *Info, - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level); - -void -AcpiDmMemory32Descriptor ( - ACPI_OP_WALK_INFO *Info, - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level); - -void -AcpiDmFixedMemory32Descriptor ( - ACPI_OP_WALK_INFO *Info, - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level); - -void -AcpiDmGenericRegisterDescriptor ( - ACPI_OP_WALK_INFO *Info, - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level); - -void -AcpiDmInterruptDescriptor ( - ACPI_OP_WALK_INFO *Info, - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level); - -void -AcpiDmVendorLargeDescriptor ( - ACPI_OP_WALK_INFO *Info, - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level); - -void -AcpiDmGpioDescriptor ( - ACPI_OP_WALK_INFO *Info, - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level); - -void -AcpiDmPinFunctionDescriptor ( - ACPI_OP_WALK_INFO *Info, - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level); - -void -AcpiDmPinConfigDescriptor ( - ACPI_OP_WALK_INFO *Info, - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level); - -void -AcpiDmPinGroupDescriptor ( - ACPI_OP_WALK_INFO *Info, - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level); - -void -AcpiDmPinGroupFunctionDescriptor ( - ACPI_OP_WALK_INFO *Info, - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level); - -void -AcpiDmPinGroupConfigDescriptor ( - ACPI_OP_WALK_INFO *Info, - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level); - -void -AcpiDmSerialBusDescriptor ( - ACPI_OP_WALK_INFO *Info, - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level); - -void -AcpiDmVendorCommon ( - const char *Name, - UINT8 *ByteData, - UINT32 Length, - UINT32 Level); - -void -AcpiDmClockInputDescriptor ( - ACPI_OP_WALK_INFO *Info, - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level); - -/* - * dmresrcs - */ -void -AcpiDmIrqDescriptor ( - ACPI_OP_WALK_INFO *Info, - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level); - -void -AcpiDmDmaDescriptor ( - ACPI_OP_WALK_INFO *Info, - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level); - -void -AcpiDmFixedDmaDescriptor ( - ACPI_OP_WALK_INFO *Info, - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level); - -void -AcpiDmIoDescriptor ( - ACPI_OP_WALK_INFO *Info, - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level); - -void -AcpiDmFixedIoDescriptor ( - ACPI_OP_WALK_INFO *Info, - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level); - -void -AcpiDmStartDependentDescriptor ( - ACPI_OP_WALK_INFO *Info, - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level); - -void -AcpiDmEndDependentDescriptor ( - ACPI_OP_WALK_INFO *Info, - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level); - -void -AcpiDmVendorSmallDescriptor ( - ACPI_OP_WALK_INFO *Info, - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level); - - -/* - * dmutils - */ -void -AcpiDmDecodeAttribute ( - UINT8 Attribute); - -void -AcpiDmIndent ( - UINT32 Level); - -BOOLEAN -AcpiDmCommaIfListMember ( - ACPI_PARSE_OBJECT *Op); - -void -AcpiDmCommaIfFieldMember ( - ACPI_PARSE_OBJECT *Op); - - -/* - * dmrestag - */ -void -AcpiDmFindResources ( - ACPI_PARSE_OBJECT *Root); - -void -AcpiDmCheckResourceReference ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState); - - -/* - * dmcstyle - */ -BOOLEAN -AcpiDmCheckForSymbolicOpcode ( - ACPI_PARSE_OBJECT *Op, - ACPI_OP_WALK_INFO *Info); - -void -AcpiDmCloseOperator ( - ACPI_PARSE_OBJECT *Op); - - -/* - * dmtables - */ -ACPI_STATUS -AcpiDmProcessSwitch ( - ACPI_PARSE_OBJECT *Op); - -void -AcpiDmClearTempList( - void); - -/* - * dmtables - */ -void -AdDisassemblerHeader ( - char *Filename, - UINT8 TableType); - -#define ACPI_IS_AML_TABLE 0 -#define ACPI_IS_DATA_TABLE 1 - - -/* - * adisasm - */ -ACPI_STATUS -AdAmlDisassemble ( - BOOLEAN OutToFile, - char *Filename, - char *Prefix, - char **OutFilename); - -ACPI_STATUS -AdGetLocalTables ( - void); - -ACPI_STATUS -AdParseTable ( - ACPI_TABLE_HEADER *Table, - ACPI_OWNER_ID *OwnerId, - BOOLEAN LoadTable, - BOOLEAN External); - -ACPI_STATUS -AdDisplayTables ( - char *Filename, - ACPI_TABLE_HEADER *Table); - -ACPI_STATUS -AdDisplayStatistics ( - void); - - -/* - * dmwalk - */ -UINT32 -AcpiDmBlockType ( - ACPI_PARSE_OBJECT *Op); - - -#endif /* __ACDISASM_H__ */ diff --git a/drivers/include/acpica/acdispat.h b/drivers/include/acpica/acdispat.h deleted file mode 100644 index 0573e58..0000000 --- a/drivers/include/acpica/acdispat.h +++ /dev/null @@ -1,599 +0,0 @@ -/****************************************************************************** - * - * Name: acdispat.h - dispatcher (parser to interpreter interface) - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef _ACDISPAT_H_ -#define _ACDISPAT_H_ - - -#define NAMEOF_LOCAL_NTE "__L0" -#define NAMEOF_ARG_NTE "__A0" - - -/* - * dsargs - execution of dynamic arguments for static objects - */ -ACPI_STATUS -AcpiDsGetBufferFieldArguments ( - ACPI_OPERAND_OBJECT *ObjDesc); - -ACPI_STATUS -AcpiDsGetBankFieldArguments ( - ACPI_OPERAND_OBJECT *ObjDesc); - -ACPI_STATUS -AcpiDsGetRegionArguments ( - ACPI_OPERAND_OBJECT *RgnDesc); - -ACPI_STATUS -AcpiDsGetBufferArguments ( - ACPI_OPERAND_OBJECT *ObjDesc); - -ACPI_STATUS -AcpiDsGetPackageArguments ( - ACPI_OPERAND_OBJECT *ObjDesc); - - -/* - * dscontrol - support for execution control opcodes - */ -ACPI_STATUS -AcpiDsExecBeginControlOp ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op); - -ACPI_STATUS -AcpiDsExecEndControlOp ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op); - - -/* - * dsopcode - support for late operand evaluation - */ -ACPI_STATUS -AcpiDsEvalBufferFieldOperands ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op); - -ACPI_STATUS -AcpiDsEvalRegionOperands ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op); - -ACPI_STATUS -AcpiDsEvalTableRegionOperands ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op); - -ACPI_STATUS -AcpiDsEvalDataObjectOperands ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op, - ACPI_OPERAND_OBJECT *ObjDesc); - -ACPI_STATUS -AcpiDsEvalBankFieldOperands ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op); - -ACPI_STATUS -AcpiDsInitializeRegion ( - ACPI_HANDLE ObjHandle); - - -/* - * dsexec - Parser/Interpreter interface, method execution callbacks - */ -ACPI_STATUS -AcpiDsGetPredicateValue ( - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT *ResultObj); - -ACPI_STATUS -AcpiDsExecBeginOp ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT **OutOp); - -ACPI_STATUS -AcpiDsExecEndOp ( - ACPI_WALK_STATE *State); - - -/* - * dsfield - Parser/Interpreter interface for AML fields - */ -ACPI_STATUS -AcpiDsCreateField ( - ACPI_PARSE_OBJECT *Op, - ACPI_NAMESPACE_NODE *RegionNode, - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiDsCreateBankField ( - ACPI_PARSE_OBJECT *Op, - ACPI_NAMESPACE_NODE *RegionNode, - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiDsCreateIndexField ( - ACPI_PARSE_OBJECT *Op, - ACPI_NAMESPACE_NODE *RegionNode, - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiDsCreateBufferField ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiDsInitFieldObjects ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState); - - -/* - * dsload - Parser/Interpreter interface - */ -ACPI_STATUS -AcpiDsInitCallbacks ( - ACPI_WALK_STATE *WalkState, - UINT32 PassNumber); - -/* dsload - pass 1 namespace load callbacks */ - -ACPI_STATUS -AcpiDsLoad1BeginOp ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT **OutOp); - -ACPI_STATUS -AcpiDsLoad1EndOp ( - ACPI_WALK_STATE *WalkState); - - -/* dsload - pass 2 namespace load callbacks */ - -ACPI_STATUS -AcpiDsLoad2BeginOp ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT **OutOp); - -ACPI_STATUS -AcpiDsLoad2EndOp ( - ACPI_WALK_STATE *WalkState); - - -/* - * dsmthdat - method data (locals/args) - */ -ACPI_STATUS -AcpiDsStoreObjectToLocal ( - UINT8 Type, - UINT32 Index, - ACPI_OPERAND_OBJECT *SrcDesc, - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiDsMethodDataGetEntry ( - UINT16 Opcode, - UINT32 Index, - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT ***Node); - -void -AcpiDsMethodDataDeleteAll ( - ACPI_WALK_STATE *WalkState); - -BOOLEAN -AcpiDsIsMethodValue ( - ACPI_OPERAND_OBJECT *ObjDesc); - -ACPI_STATUS -AcpiDsMethodDataGetValue ( - UINT8 Type, - UINT32 Index, - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT **DestDesc); - -ACPI_STATUS -AcpiDsMethodDataInitArgs ( - ACPI_OPERAND_OBJECT **Params, - UINT32 MaxParamCount, - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiDsMethodDataGetNode ( - UINT8 Type, - UINT32 Index, - ACPI_WALK_STATE *WalkState, - ACPI_NAMESPACE_NODE **Node); - -void -AcpiDsMethodDataInit ( - ACPI_WALK_STATE *WalkState); - - -/* - * dsmethod - Parser/Interpreter interface - control method parsing - */ -ACPI_STATUS -AcpiDsAutoSerializeMethod ( - ACPI_NAMESPACE_NODE *Node, - ACPI_OPERAND_OBJECT *ObjDesc); - -ACPI_STATUS -AcpiDsCallControlMethod ( - ACPI_THREAD_STATE *Thread, - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op); - -ACPI_STATUS -AcpiDsRestartControlMethod ( - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT *ReturnDesc); - -void -AcpiDsTerminateControlMethod ( - ACPI_OPERAND_OBJECT *MethodDesc, - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiDsBeginMethodExecution ( - ACPI_NAMESPACE_NODE *MethodNode, - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiDsMethodError ( - ACPI_STATUS Status, - ACPI_WALK_STATE *WalkState); - -/* - * dsinit - */ -ACPI_STATUS -AcpiDsInitializeObjects ( - UINT32 TableIndex, - ACPI_NAMESPACE_NODE *StartNode); - - -/* - * dsobject - Parser/Interpreter interface - object initialization and conversion - */ -ACPI_STATUS -AcpiDsBuildInternalObject ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op, - ACPI_OPERAND_OBJECT **ObjDescPtr); - -ACPI_STATUS -AcpiDsBuildInternalBufferObj ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op, - UINT32 BufferLength, - ACPI_OPERAND_OBJECT **ObjDescPtr); - -ACPI_STATUS -AcpiDsBuildInternalPackageObj ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *op, - UINT32 PackageLength, - ACPI_OPERAND_OBJECT **ObjDesc); - -ACPI_STATUS -AcpiDsInitObjectFromOp ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op, - UINT16 Opcode, - ACPI_OPERAND_OBJECT **ObjDesc); - -ACPI_STATUS -AcpiDsCreateNode ( - ACPI_WALK_STATE *WalkState, - ACPI_NAMESPACE_NODE *Node, - ACPI_PARSE_OBJECT *Op); - - -/* - * dspkginit - Package object initialization - */ -ACPI_STATUS -AcpiDsInitPackageElement ( - UINT8 ObjectType, - ACPI_OPERAND_OBJECT *SourceObject, - ACPI_GENERIC_STATE *State, - void *Context); - - -/* - * dsutils - Parser/Interpreter interface utility routines - */ -void -AcpiDsClearImplicitReturn ( - ACPI_WALK_STATE *WalkState); - -BOOLEAN -AcpiDsDoImplicitReturn ( - ACPI_OPERAND_OBJECT *ReturnDesc, - ACPI_WALK_STATE *WalkState, - BOOLEAN AddReference); - -BOOLEAN -AcpiDsIsResultUsed ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState); - -void -AcpiDsDeleteResultIfNotUsed ( - ACPI_PARSE_OBJECT *Op, - ACPI_OPERAND_OBJECT *ResultObj, - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiDsCreateOperand ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Arg, - UINT32 ArgsRemaining); - -ACPI_STATUS -AcpiDsCreateOperands ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *FirstArg); - -ACPI_STATUS -AcpiDsResolveOperands ( - ACPI_WALK_STATE *WalkState); - -void -AcpiDsClearOperands ( - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiDsEvaluateNamePath ( - ACPI_WALK_STATE *WalkState); - - -/* - * dswscope - Scope Stack manipulation - */ -ACPI_STATUS -AcpiDsScopeStackPush ( - ACPI_NAMESPACE_NODE *Node, - ACPI_OBJECT_TYPE Type, - ACPI_WALK_STATE *WalkState); - - -ACPI_STATUS -AcpiDsScopeStackPop ( - ACPI_WALK_STATE *WalkState); - -void -AcpiDsScopeStackClear ( - ACPI_WALK_STATE *WalkState); - - -/* - * dswstate - parser WALK_STATE management routines - */ -ACPI_STATUS -AcpiDsObjStackPush ( - void *Object, - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiDsObjStackPop ( - UINT32 PopCount, - ACPI_WALK_STATE *WalkState); - -ACPI_WALK_STATE * -AcpiDsCreateWalkState ( - ACPI_OWNER_ID OwnerId, - ACPI_PARSE_OBJECT *Origin, - ACPI_OPERAND_OBJECT *MthDesc, - ACPI_THREAD_STATE *Thread); - -ACPI_STATUS -AcpiDsInitAmlWalk ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op, - ACPI_NAMESPACE_NODE *MethodNode, - UINT8 *AmlStart, - UINT32 AmlLength, - ACPI_EVALUATE_INFO *Info, - UINT8 PassNumber); - -void -AcpiDsObjStackPopAndDelete ( - UINT32 PopCount, - ACPI_WALK_STATE *WalkState); - -void -AcpiDsDeleteWalkState ( - ACPI_WALK_STATE *WalkState); - -ACPI_WALK_STATE * -AcpiDsPopWalkState ( - ACPI_THREAD_STATE *Thread); - -void -AcpiDsPushWalkState ( - ACPI_WALK_STATE *WalkState, - ACPI_THREAD_STATE *Thread); - -ACPI_STATUS -AcpiDsResultStackClear ( - ACPI_WALK_STATE *WalkState); - -ACPI_WALK_STATE * -AcpiDsGetCurrentWalkState ( - ACPI_THREAD_STATE *Thread); - -ACPI_STATUS -AcpiDsResultPop ( - ACPI_OPERAND_OBJECT **Object, - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiDsResultPush ( - ACPI_OPERAND_OBJECT *Object, - ACPI_WALK_STATE *WalkState); - - -/* - * dsdebug - parser debugging routines - */ -void -AcpiDsDumpMethodStack ( - ACPI_STATUS Status, - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op); - -#endif /* _ACDISPAT_H_ */ diff --git a/drivers/include/acpica/acevents.h b/drivers/include/acpica/acevents.h deleted file mode 100644 index 22eff36..0000000 --- a/drivers/include/acpica/acevents.h +++ /dev/null @@ -1,507 +0,0 @@ -/****************************************************************************** - * - * Name: acevents.h - Event subcomponent prototypes and defines - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef __ACEVENTS_H__ -#define __ACEVENTS_H__ - - -/* - * Conditions to trigger post enabling GPE polling: - * It is not sufficient to trigger edge-triggered GPE with specific GPE - * chips, software need to poll once after enabling. - */ -#ifdef ACPI_USE_GPE_POLLING -#define ACPI_GPE_IS_POLLING_NEEDED(__gpe__) \ - ((__gpe__)->RuntimeCount == 1 && \ - (__gpe__)->Flags & ACPI_GPE_INITIALIZED && \ - ((__gpe__)->Flags & ACPI_GPE_XRUPT_TYPE_MASK) == ACPI_GPE_EDGE_TRIGGERED) -#else -#define ACPI_GPE_IS_POLLING_NEEDED(__gpe__) FALSE -#endif - - -/* - * evevent - */ -ACPI_STATUS -AcpiEvInitializeEvents ( - void); - -ACPI_STATUS -AcpiEvInstallXruptHandlers ( - void); - -UINT32 -AcpiEvFixedEventDetect ( - void); - - -/* - * evmisc - */ -BOOLEAN -AcpiEvIsNotifyObject ( - ACPI_NAMESPACE_NODE *Node); - -UINT32 -AcpiEvGetGpeNumberIndex ( - UINT32 GpeNumber); - -ACPI_STATUS -AcpiEvQueueNotifyRequest ( - ACPI_NAMESPACE_NODE *Node, - UINT32 NotifyValue); - - -/* - * evglock - Global Lock support - */ -ACPI_STATUS -AcpiEvInitGlobalLockHandler ( - void); - -ACPI_HW_DEPENDENT_RETURN_OK ( -ACPI_STATUS -AcpiEvAcquireGlobalLock( - UINT16 Timeout)) - -ACPI_HW_DEPENDENT_RETURN_OK ( -ACPI_STATUS -AcpiEvReleaseGlobalLock( - void)) - -ACPI_STATUS -AcpiEvRemoveGlobalLockHandler ( - void); - - -/* - * evgpe - Low-level GPE support - */ -UINT32 -AcpiEvGpeDetect ( - ACPI_GPE_XRUPT_INFO *GpeXruptList); - -ACPI_STATUS -AcpiEvUpdateGpeEnableMask ( - ACPI_GPE_EVENT_INFO *GpeEventInfo); - -ACPI_STATUS -AcpiEvEnableGpe ( - ACPI_GPE_EVENT_INFO *GpeEventInfo); - -ACPI_STATUS -AcpiEvMaskGpe ( - ACPI_GPE_EVENT_INFO *GpeEventInfo, - BOOLEAN IsMasked); - -ACPI_STATUS -AcpiEvAddGpeReference ( - ACPI_GPE_EVENT_INFO *GpeEventInfo, - BOOLEAN ClearOnEnable); - -ACPI_STATUS -AcpiEvRemoveGpeReference ( - ACPI_GPE_EVENT_INFO *GpeEventInfo); - -ACPI_GPE_EVENT_INFO * -AcpiEvGetGpeEventInfo ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber); - -ACPI_GPE_EVENT_INFO * -AcpiEvLowGetGpeInfo ( - UINT32 GpeNumber, - ACPI_GPE_BLOCK_INFO *GpeBlock); - -ACPI_STATUS -AcpiEvFinishGpe ( - ACPI_GPE_EVENT_INFO *GpeEventInfo); - -UINT32 -AcpiEvDetectGpe ( - ACPI_NAMESPACE_NODE *GpeDevice, - ACPI_GPE_EVENT_INFO *GpeEventInfo, - UINT32 GpeNumber); - - -/* - * evgpeblk - Upper-level GPE block support - */ -ACPI_STATUS -AcpiEvCreateGpeBlock ( - ACPI_NAMESPACE_NODE *GpeDevice, - UINT64 Address, - UINT8 SpaceId, - UINT32 RegisterCount, - UINT16 GpeBlockBaseNumber, - UINT32 InterruptNumber, - ACPI_GPE_BLOCK_INFO **ReturnGpeBlock); - -ACPI_STATUS -AcpiEvInitializeGpeBlock ( - ACPI_GPE_XRUPT_INFO *GpeXruptInfo, - ACPI_GPE_BLOCK_INFO *GpeBlock, - void *Context); - -ACPI_HW_DEPENDENT_RETURN_OK ( -ACPI_STATUS -AcpiEvDeleteGpeBlock ( - ACPI_GPE_BLOCK_INFO *GpeBlock)) - -UINT32 -AcpiEvGpeDispatch ( - ACPI_NAMESPACE_NODE *GpeDevice, - ACPI_GPE_EVENT_INFO *GpeEventInfo, - UINT32 GpeNumber); - - -/* - * evgpeinit - GPE initialization and update - */ -ACPI_STATUS -AcpiEvGpeInitialize ( - void); - -ACPI_HW_DEPENDENT_RETURN_VOID ( -void -AcpiEvUpdateGpes ( - ACPI_OWNER_ID TableOwnerId)) - -ACPI_STATUS -AcpiEvMatchGpeMethod ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue); - - -/* - * evgpeutil - GPE utilities - */ -ACPI_STATUS -AcpiEvWalkGpeList ( - ACPI_GPE_CALLBACK GpeWalkCallback, - void *Context); - -ACPI_STATUS -AcpiEvGetGpeDevice ( - ACPI_GPE_XRUPT_INFO *GpeXruptInfo, - ACPI_GPE_BLOCK_INFO *GpeBlock, - void *Context); - -ACPI_STATUS -AcpiEvGetGpeXruptBlock ( - UINT32 InterruptNumber, - ACPI_GPE_XRUPT_INFO **GpeXruptBlock); - -ACPI_STATUS -AcpiEvDeleteGpeXrupt ( - ACPI_GPE_XRUPT_INFO *GpeXrupt); - -ACPI_STATUS -AcpiEvDeleteGpeHandlers ( - ACPI_GPE_XRUPT_INFO *GpeXruptInfo, - ACPI_GPE_BLOCK_INFO *GpeBlock, - void *Context); - - -/* - * evhandler - Address space handling - */ -ACPI_OPERAND_OBJECT * -AcpiEvFindRegionHandler ( - ACPI_ADR_SPACE_TYPE SpaceId, - ACPI_OPERAND_OBJECT *HandlerObj); - -BOOLEAN -AcpiEvHasDefaultHandler ( - ACPI_NAMESPACE_NODE *Node, - ACPI_ADR_SPACE_TYPE SpaceId); - -ACPI_STATUS -AcpiEvInstallRegionHandlers ( - void); - -ACPI_STATUS -AcpiEvInstallSpaceHandler ( - ACPI_NAMESPACE_NODE *Node, - ACPI_ADR_SPACE_TYPE SpaceId, - ACPI_ADR_SPACE_HANDLER Handler, - ACPI_ADR_SPACE_SETUP Setup, - void *Context); - - -/* - * evregion - Operation region support - */ -ACPI_STATUS -AcpiEvInitializeOpRegions ( - void); - -ACPI_STATUS -AcpiEvAddressSpaceDispatch ( - ACPI_OPERAND_OBJECT *RegionObj, - ACPI_OPERAND_OBJECT *FieldObj, - UINT32 Function, - UINT32 RegionOffset, - UINT32 BitWidth, - UINT64 *Value); - -ACPI_STATUS -AcpiEvAttachRegion ( - ACPI_OPERAND_OBJECT *HandlerObj, - ACPI_OPERAND_OBJECT *RegionObj, - BOOLEAN AcpiNsIsLocked); - -void -AcpiEvDetachRegion ( - ACPI_OPERAND_OBJECT *RegionObj, - BOOLEAN AcpiNsIsLocked); - -void -AcpiEvExecuteRegMethods ( - ACPI_NAMESPACE_NODE *Node, - ACPI_ADR_SPACE_TYPE SpaceId, - UINT32 Function); - -ACPI_STATUS -AcpiEvExecuteRegMethod ( - ACPI_OPERAND_OBJECT *RegionObj, - UINT32 Function); - - -/* - * evregini - Region initialization and setup - */ -ACPI_STATUS -AcpiEvSystemMemoryRegionSetup ( - ACPI_HANDLE Handle, - UINT32 Function, - void *HandlerContext, - void **RegionContext); - -ACPI_STATUS -AcpiEvIoSpaceRegionSetup ( - ACPI_HANDLE Handle, - UINT32 Function, - void *HandlerContext, - void **RegionContext); - -ACPI_STATUS -AcpiEvPciConfigRegionSetup ( - ACPI_HANDLE Handle, - UINT32 Function, - void *HandlerContext, - void **RegionContext); - -ACPI_STATUS -AcpiEvCmosRegionSetup ( - ACPI_HANDLE Handle, - UINT32 Function, - void *HandlerContext, - void **RegionContext); - -ACPI_STATUS -AcpiEvPciBarRegionSetup ( - ACPI_HANDLE Handle, - UINT32 Function, - void *HandlerContext, - void **RegionContext); - -ACPI_STATUS -AcpiEvDataTableRegionSetup ( - ACPI_HANDLE Handle, - UINT32 Function, - void *HandlerContext, - void **RegionContext); - -ACPI_STATUS -AcpiEvDefaultRegionSetup ( - ACPI_HANDLE Handle, - UINT32 Function, - void *HandlerContext, - void **RegionContext); - -ACPI_STATUS -AcpiEvInitializeRegion ( - ACPI_OPERAND_OBJECT *RegionObj); - -BOOLEAN -AcpiEvIsPciRootBridge ( - ACPI_NAMESPACE_NODE *Node); - - -/* - * evsci - SCI (System Control Interrupt) handling/dispatch - */ -UINT32 ACPI_SYSTEM_XFACE -AcpiEvGpeXruptHandler ( - void *Context); - -UINT32 -AcpiEvSciDispatch ( - void); - -UINT32 -AcpiEvInstallSciHandler ( - void); - -ACPI_STATUS -AcpiEvRemoveAllSciHandlers ( - void); - -ACPI_HW_DEPENDENT_RETURN_VOID ( -void -AcpiEvTerminate ( - void)) - -#endif /* __ACEVENTS_H__ */ diff --git a/drivers/include/acpica/acexcep.h b/drivers/include/acpica/acexcep.h deleted file mode 100644 index 7216e0d..0000000 --- a/drivers/include/acpica/acexcep.h +++ /dev/null @@ -1,486 +0,0 @@ -/****************************************************************************** - * - * Name: acexcep.h - Exception codes returned by the ACPI subsystem - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef __ACEXCEP_H__ -#define __ACEXCEP_H__ - - -/* This module contains all possible exception codes for ACPI_STATUS */ - -/* - * Exception code classes - */ -#define AE_CODE_ENVIRONMENTAL 0x0000 /* General ACPICA environment */ -#define AE_CODE_PROGRAMMER 0x1000 /* External ACPICA interface caller */ -#define AE_CODE_ACPI_TABLES 0x2000 /* ACPI tables */ -#define AE_CODE_AML 0x3000 /* From executing AML code */ -#define AE_CODE_CONTROL 0x4000 /* Internal control codes */ - -#define AE_CODE_MAX 0x4000 -#define AE_CODE_MASK 0xF000 - -/* - * Macros to insert the exception code classes - */ -#define EXCEP_ENV(code) ((ACPI_STATUS) (code | AE_CODE_ENVIRONMENTAL)) -#define EXCEP_PGM(code) ((ACPI_STATUS) (code | AE_CODE_PROGRAMMER)) -#define EXCEP_TBL(code) ((ACPI_STATUS) (code | AE_CODE_ACPI_TABLES)) -#define EXCEP_AML(code) ((ACPI_STATUS) (code | AE_CODE_AML)) -#define EXCEP_CTL(code) ((ACPI_STATUS) (code | AE_CODE_CONTROL)) - -/* - * Exception info table. The "Description" field is used only by the - * ACPICA help application (acpihelp). - */ -typedef struct acpi_exception_info -{ - char *Name; - -#if defined (ACPI_HELP_APP) || defined (ACPI_ASL_COMPILER) - char *Description; -#endif -} ACPI_EXCEPTION_INFO; - -#if defined (ACPI_HELP_APP) || defined (ACPI_ASL_COMPILER) -#define EXCEP_TXT(Name,Description) {Name, Description} -#else -#define EXCEP_TXT(Name,Description) {Name} -#endif - - -/* - * Success is always zero, failure is non-zero - */ -#define ACPI_SUCCESS(a) (!(a)) -#define ACPI_FAILURE(a) (a) - -#define AE_OK (ACPI_STATUS) 0x0000 - -#define ACPI_ENV_EXCEPTION(Status) (((Status) & AE_CODE_MASK) == AE_CODE_ENVIRONMENTAL) -#define ACPI_AML_EXCEPTION(Status) (((Status) & AE_CODE_MASK) == AE_CODE_AML) -#define ACPI_PROG_EXCEPTION(Status) (((Status) & AE_CODE_MASK) == AE_CODE_PROGRAMMER) -#define ACPI_TABLE_EXCEPTION(Status) (((Status) & AE_CODE_MASK) == AE_CODE_ACPI_TABLES) -#define ACPI_CNTL_EXCEPTION(Status) (((Status) & AE_CODE_MASK) == AE_CODE_CONTROL) - - -/* - * Environmental exceptions - */ -#define AE_ERROR EXCEP_ENV (0x0001) -#define AE_NO_ACPI_TABLES EXCEP_ENV (0x0002) -#define AE_NO_NAMESPACE EXCEP_ENV (0x0003) -#define AE_NO_MEMORY EXCEP_ENV (0x0004) -#define AE_NOT_FOUND EXCEP_ENV (0x0005) -#define AE_NOT_EXIST EXCEP_ENV (0x0006) -#define AE_ALREADY_EXISTS EXCEP_ENV (0x0007) -#define AE_TYPE EXCEP_ENV (0x0008) -#define AE_NULL_OBJECT EXCEP_ENV (0x0009) -#define AE_NULL_ENTRY EXCEP_ENV (0x000A) -#define AE_BUFFER_OVERFLOW EXCEP_ENV (0x000B) -#define AE_STACK_OVERFLOW EXCEP_ENV (0x000C) -#define AE_STACK_UNDERFLOW EXCEP_ENV (0x000D) -#define AE_NOT_IMPLEMENTED EXCEP_ENV (0x000E) -#define AE_SUPPORT EXCEP_ENV (0x000F) -#define AE_LIMIT EXCEP_ENV (0x0010) -#define AE_TIME EXCEP_ENV (0x0011) -#define AE_ACQUIRE_DEADLOCK EXCEP_ENV (0x0012) -#define AE_RELEASE_DEADLOCK EXCEP_ENV (0x0013) -#define AE_NOT_ACQUIRED EXCEP_ENV (0x0014) -#define AE_ALREADY_ACQUIRED EXCEP_ENV (0x0015) -#define AE_NO_HARDWARE_RESPONSE EXCEP_ENV (0x0016) -#define AE_NO_GLOBAL_LOCK EXCEP_ENV (0x0017) -#define AE_ABORT_METHOD EXCEP_ENV (0x0018) -#define AE_SAME_HANDLER EXCEP_ENV (0x0019) -#define AE_NO_HANDLER EXCEP_ENV (0x001A) -#define AE_OWNER_ID_LIMIT EXCEP_ENV (0x001B) -#define AE_NOT_CONFIGURED EXCEP_ENV (0x001C) -#define AE_ACCESS EXCEP_ENV (0x001D) -#define AE_IO_ERROR EXCEP_ENV (0x001E) -#define AE_NUMERIC_OVERFLOW EXCEP_ENV (0x001F) -#define AE_HEX_OVERFLOW EXCEP_ENV (0x0020) -#define AE_DECIMAL_OVERFLOW EXCEP_ENV (0x0021) -#define AE_OCTAL_OVERFLOW EXCEP_ENV (0x0022) -#define AE_END_OF_TABLE EXCEP_ENV (0x0023) - -#define AE_CODE_ENV_MAX 0x0023 - - -/* - * Programmer exceptions - */ -#define AE_BAD_PARAMETER EXCEP_PGM (0x0001) -#define AE_BAD_CHARACTER EXCEP_PGM (0x0002) -#define AE_BAD_PATHNAME EXCEP_PGM (0x0003) -#define AE_BAD_DATA EXCEP_PGM (0x0004) -#define AE_BAD_HEX_CONSTANT EXCEP_PGM (0x0005) -#define AE_BAD_OCTAL_CONSTANT EXCEP_PGM (0x0006) -#define AE_BAD_DECIMAL_CONSTANT EXCEP_PGM (0x0007) -#define AE_MISSING_ARGUMENTS EXCEP_PGM (0x0008) -#define AE_BAD_ADDRESS EXCEP_PGM (0x0009) - -#define AE_CODE_PGM_MAX 0x0009 - - -/* - * Acpi table exceptions - */ -#define AE_BAD_SIGNATURE EXCEP_TBL (0x0001) -#define AE_BAD_HEADER EXCEP_TBL (0x0002) -#define AE_BAD_CHECKSUM EXCEP_TBL (0x0003) -#define AE_BAD_VALUE EXCEP_TBL (0x0004) -#define AE_INVALID_TABLE_LENGTH EXCEP_TBL (0x0005) - -#define AE_CODE_TBL_MAX 0x0005 - - -/* - * AML exceptions. These are caused by problems with - * the actual AML byte stream - */ -#define AE_AML_BAD_OPCODE EXCEP_AML (0x0001) -#define AE_AML_NO_OPERAND EXCEP_AML (0x0002) -#define AE_AML_OPERAND_TYPE EXCEP_AML (0x0003) -#define AE_AML_OPERAND_VALUE EXCEP_AML (0x0004) -#define AE_AML_UNINITIALIZED_LOCAL EXCEP_AML (0x0005) -#define AE_AML_UNINITIALIZED_ARG EXCEP_AML (0x0006) -#define AE_AML_UNINITIALIZED_ELEMENT EXCEP_AML (0x0007) -#define AE_AML_NUMERIC_OVERFLOW EXCEP_AML (0x0008) -#define AE_AML_REGION_LIMIT EXCEP_AML (0x0009) -#define AE_AML_BUFFER_LIMIT EXCEP_AML (0x000A) -#define AE_AML_PACKAGE_LIMIT EXCEP_AML (0x000B) -#define AE_AML_DIVIDE_BY_ZERO EXCEP_AML (0x000C) -#define AE_AML_BAD_NAME EXCEP_AML (0x000D) -#define AE_AML_NAME_NOT_FOUND EXCEP_AML (0x000E) -#define AE_AML_INTERNAL EXCEP_AML (0x000F) -#define AE_AML_INVALID_SPACE_ID EXCEP_AML (0x0010) -#define AE_AML_STRING_LIMIT EXCEP_AML (0x0011) -#define AE_AML_NO_RETURN_VALUE EXCEP_AML (0x0012) -#define AE_AML_METHOD_LIMIT EXCEP_AML (0x0013) -#define AE_AML_NOT_OWNER EXCEP_AML (0x0014) -#define AE_AML_MUTEX_ORDER EXCEP_AML (0x0015) -#define AE_AML_MUTEX_NOT_ACQUIRED EXCEP_AML (0x0016) -#define AE_AML_INVALID_RESOURCE_TYPE EXCEP_AML (0x0017) -#define AE_AML_INVALID_INDEX EXCEP_AML (0x0018) -#define AE_AML_REGISTER_LIMIT EXCEP_AML (0x0019) -#define AE_AML_NO_WHILE EXCEP_AML (0x001A) -#define AE_AML_ALIGNMENT EXCEP_AML (0x001B) -#define AE_AML_NO_RESOURCE_END_TAG EXCEP_AML (0x001C) -#define AE_AML_BAD_RESOURCE_VALUE EXCEP_AML (0x001D) -#define AE_AML_CIRCULAR_REFERENCE EXCEP_AML (0x001E) -#define AE_AML_BAD_RESOURCE_LENGTH EXCEP_AML (0x001F) -#define AE_AML_ILLEGAL_ADDRESS EXCEP_AML (0x0020) -#define AE_AML_LOOP_TIMEOUT EXCEP_AML (0x0021) -#define AE_AML_UNINITIALIZED_NODE EXCEP_AML (0x0022) -#define AE_AML_TARGET_TYPE EXCEP_AML (0x0023) -#define AE_AML_PROTOCOL EXCEP_AML (0x0024) -#define AE_AML_BUFFER_LENGTH EXCEP_AML (0x0025) -#define AE_AML_TOO_FEW_ARGUMENTS EXCEP_AML (0x0026) -#define AE_AML_TOO_MANY_ARGUMENTS EXCEP_AML (0x0027) - - -#define AE_CODE_AML_MAX 0x0027 - - -/* - * Internal exceptions used for control - */ -#define AE_CTRL_RETURN_VALUE EXCEP_CTL (0x0001) -#define AE_CTRL_PENDING EXCEP_CTL (0x0002) -#define AE_CTRL_TERMINATE EXCEP_CTL (0x0003) -#define AE_CTRL_TRUE EXCEP_CTL (0x0004) -#define AE_CTRL_FALSE EXCEP_CTL (0x0005) -#define AE_CTRL_DEPTH EXCEP_CTL (0x0006) -#define AE_CTRL_END EXCEP_CTL (0x0007) -#define AE_CTRL_TRANSFER EXCEP_CTL (0x0008) -#define AE_CTRL_BREAK EXCEP_CTL (0x0009) -#define AE_CTRL_CONTINUE EXCEP_CTL (0x000A) -#define AE_CTRL_PARSE_CONTINUE EXCEP_CTL (0x000B) -#define AE_CTRL_PARSE_PENDING EXCEP_CTL (0x000C) - -#define AE_CODE_CTRL_MAX 0x000C - - -/* Exception strings for AcpiFormatException */ - -#ifdef ACPI_DEFINE_EXCEPTION_TABLE - -/* - * String versions of the exception codes above - * These strings must match the corresponding defines exactly - */ -static const ACPI_EXCEPTION_INFO AcpiGbl_ExceptionNames_Env[] = -{ - EXCEP_TXT ("AE_OK", "No error"), - EXCEP_TXT ("AE_ERROR", "Unspecified error"), - EXCEP_TXT ("AE_NO_ACPI_TABLES", "ACPI tables could not be found"), - EXCEP_TXT ("AE_NO_NAMESPACE", "A namespace has not been loaded"), - EXCEP_TXT ("AE_NO_MEMORY", "Insufficient dynamic memory"), - EXCEP_TXT ("AE_NOT_FOUND", "A requested entity is not found"), - EXCEP_TXT ("AE_NOT_EXIST", "A required entity does not exist"), - EXCEP_TXT ("AE_ALREADY_EXISTS", "An entity already exists"), - EXCEP_TXT ("AE_TYPE", "The object type is incorrect"), - EXCEP_TXT ("AE_NULL_OBJECT", "A required object was missing"), - EXCEP_TXT ("AE_NULL_ENTRY", "The requested object does not exist"), - EXCEP_TXT ("AE_BUFFER_OVERFLOW", "The buffer provided is too small"), - EXCEP_TXT ("AE_STACK_OVERFLOW", "An internal stack overflowed"), - EXCEP_TXT ("AE_STACK_UNDERFLOW", "An internal stack underflowed"), - EXCEP_TXT ("AE_NOT_IMPLEMENTED", "The feature is not implemented"), - EXCEP_TXT ("AE_SUPPORT", "The feature is not supported"), - EXCEP_TXT ("AE_LIMIT", "A predefined limit was exceeded"), - EXCEP_TXT ("AE_TIME", "A time limit or timeout expired"), - EXCEP_TXT ("AE_ACQUIRE_DEADLOCK", "Internal error, attempt was made to acquire a mutex in improper order"), - EXCEP_TXT ("AE_RELEASE_DEADLOCK", "Internal error, attempt was made to release a mutex in improper order"), - EXCEP_TXT ("AE_NOT_ACQUIRED", "An attempt to release a mutex or Global Lock without a previous acquire"), - EXCEP_TXT ("AE_ALREADY_ACQUIRED", "Internal error, attempt was made to acquire a mutex twice"), - EXCEP_TXT ("AE_NO_HARDWARE_RESPONSE", "Hardware did not respond after an I/O operation"), - EXCEP_TXT ("AE_NO_GLOBAL_LOCK", "There is no FACS Global Lock"), - EXCEP_TXT ("AE_ABORT_METHOD", "A control method was aborted"), - EXCEP_TXT ("AE_SAME_HANDLER", "Attempt was made to install the same handler that is already installed"), - EXCEP_TXT ("AE_NO_HANDLER", "A handler for the operation is not installed"), - EXCEP_TXT ("AE_OWNER_ID_LIMIT", "There are no more Owner IDs available for ACPI tables or control methods"), - EXCEP_TXT ("AE_NOT_CONFIGURED", "The interface is not part of the current subsystem configuration"), - EXCEP_TXT ("AE_ACCESS", "Permission denied for the requested operation"), - EXCEP_TXT ("AE_IO_ERROR", "An I/O error occurred"), - EXCEP_TXT ("AE_NUMERIC_OVERFLOW", "Overflow during string-to-integer conversion"), - EXCEP_TXT ("AE_HEX_OVERFLOW", "Overflow during ASCII hex-to-binary conversion"), - EXCEP_TXT ("AE_DECIMAL_OVERFLOW", "Overflow during ASCII decimal-to-binary conversion"), - EXCEP_TXT ("AE_OCTAL_OVERFLOW", "Overflow during ASCII octal-to-binary conversion"), - EXCEP_TXT ("AE_END_OF_TABLE", "Reached the end of table") -}; - -static const ACPI_EXCEPTION_INFO AcpiGbl_ExceptionNames_Pgm[] = -{ - EXCEP_TXT (NULL, NULL), - EXCEP_TXT ("AE_BAD_PARAMETER", "A parameter is out of range or invalid"), - EXCEP_TXT ("AE_BAD_CHARACTER", "An invalid character was found in a name"), - EXCEP_TXT ("AE_BAD_PATHNAME", "An invalid character was found in a pathname"), - EXCEP_TXT ("AE_BAD_DATA", "A package or buffer contained incorrect data"), - EXCEP_TXT ("AE_BAD_HEX_CONSTANT", "Invalid character in a Hex constant"), - EXCEP_TXT ("AE_BAD_OCTAL_CONSTANT", "Invalid character in an Octal constant"), - EXCEP_TXT ("AE_BAD_DECIMAL_CONSTANT", "Invalid character in a Decimal constant"), - EXCEP_TXT ("AE_MISSING_ARGUMENTS", "Too few arguments were passed to a control method"), - EXCEP_TXT ("AE_BAD_ADDRESS", "An illegal null I/O address") -}; - -static const ACPI_EXCEPTION_INFO AcpiGbl_ExceptionNames_Tbl[] = -{ - EXCEP_TXT (NULL, NULL), - EXCEP_TXT ("AE_BAD_SIGNATURE", "An ACPI table has an invalid signature"), - EXCEP_TXT ("AE_BAD_HEADER", "Invalid field in an ACPI table header"), - EXCEP_TXT ("AE_BAD_CHECKSUM", "An ACPI table checksum is not correct"), - EXCEP_TXT ("AE_BAD_VALUE", "An invalid value was found in a table"), - EXCEP_TXT ("AE_INVALID_TABLE_LENGTH", "The FADT or FACS has improper length") -}; - -static const ACPI_EXCEPTION_INFO AcpiGbl_ExceptionNames_Aml[] = -{ - EXCEP_TXT (NULL, NULL), - EXCEP_TXT ("AE_AML_BAD_OPCODE", "Invalid AML opcode encountered"), - EXCEP_TXT ("AE_AML_NO_OPERAND", "A required operand is missing"), - EXCEP_TXT ("AE_AML_OPERAND_TYPE", "An operand of an incorrect type was encountered"), - EXCEP_TXT ("AE_AML_OPERAND_VALUE", "The operand had an inappropriate or invalid value"), - EXCEP_TXT ("AE_AML_UNINITIALIZED_LOCAL", "Method tried to use an uninitialized local variable"), - EXCEP_TXT ("AE_AML_UNINITIALIZED_ARG", "Method tried to use an uninitialized argument"), - EXCEP_TXT ("AE_AML_UNINITIALIZED_ELEMENT", "Method tried to use an empty package element"), - EXCEP_TXT ("AE_AML_NUMERIC_OVERFLOW", "Overflow during BCD conversion or other"), - EXCEP_TXT ("AE_AML_REGION_LIMIT", "Tried to access beyond the end of an Operation Region"), - EXCEP_TXT ("AE_AML_BUFFER_LIMIT", "Tried to access beyond the end of a buffer"), - EXCEP_TXT ("AE_AML_PACKAGE_LIMIT", "Tried to access beyond the end of a package"), - EXCEP_TXT ("AE_AML_DIVIDE_BY_ZERO", "During execution of AML Divide operator"), - EXCEP_TXT ("AE_AML_BAD_NAME", "An ACPI name contains invalid character(s)"), - EXCEP_TXT ("AE_AML_NAME_NOT_FOUND", "Could not resolve a named reference"), - EXCEP_TXT ("AE_AML_INTERNAL", "An internal error within the interpreter"), - EXCEP_TXT ("AE_AML_INVALID_SPACE_ID", "An Operation Region SpaceID is invalid"), - EXCEP_TXT ("AE_AML_STRING_LIMIT", "String is longer than 200 characters"), - EXCEP_TXT ("AE_AML_NO_RETURN_VALUE", "A method did not return a required value"), - EXCEP_TXT ("AE_AML_METHOD_LIMIT", "A control method reached the maximum reentrancy limit of 255"), - EXCEP_TXT ("AE_AML_NOT_OWNER", "A thread tried to release a mutex that it does not own"), - EXCEP_TXT ("AE_AML_MUTEX_ORDER", "Mutex SyncLevel release mismatch"), - EXCEP_TXT ("AE_AML_MUTEX_NOT_ACQUIRED", "Attempt to release a mutex that was not previously acquired"), - EXCEP_TXT ("AE_AML_INVALID_RESOURCE_TYPE", "Invalid resource type in resource list"), - EXCEP_TXT ("AE_AML_INVALID_INDEX", "Invalid Argx or Localx (x too large)"), - EXCEP_TXT ("AE_AML_REGISTER_LIMIT", "Bank value or Index value beyond range of register"), - EXCEP_TXT ("AE_AML_NO_WHILE", "Break or Continue without a While"), - EXCEP_TXT ("AE_AML_ALIGNMENT", "Non-aligned memory transfer on platform that does not support this"), - EXCEP_TXT ("AE_AML_NO_RESOURCE_END_TAG", "No End Tag in a resource list"), - EXCEP_TXT ("AE_AML_BAD_RESOURCE_VALUE", "Invalid value of a resource element"), - EXCEP_TXT ("AE_AML_CIRCULAR_REFERENCE", "Two references refer to each other"), - EXCEP_TXT ("AE_AML_BAD_RESOURCE_LENGTH", "The length of a Resource Descriptor in the AML is incorrect"), - EXCEP_TXT ("AE_AML_ILLEGAL_ADDRESS", "A memory, I/O, or PCI configuration address is invalid"), - EXCEP_TXT ("AE_AML_LOOP_TIMEOUT", "An AML While loop exceeded the maximum execution time"), - EXCEP_TXT ("AE_AML_UNINITIALIZED_NODE", "A namespace node is uninitialized or unresolved"), - EXCEP_TXT ("AE_AML_TARGET_TYPE", "A target operand of an incorrect type was encountered"), - EXCEP_TXT ("AE_AML_PROTOCOL", "Violation of a fixed ACPI protocol"), - EXCEP_TXT ("AE_AML_BUFFER_LENGTH", "The length of the buffer is invalid/incorrect"), - EXCEP_TXT ("AE_AML_TOO_FEW_ARGUMENTS", "There are fewer than expected method arguments"), - EXCEP_TXT ("AE_AML_TOO_MANY_ARGUMENTS", "There are too many arguments for this method") -}; - -static const ACPI_EXCEPTION_INFO AcpiGbl_ExceptionNames_Ctrl[] = -{ - EXCEP_TXT (NULL, NULL), - EXCEP_TXT ("AE_CTRL_RETURN_VALUE", "A Method returned a value"), - EXCEP_TXT ("AE_CTRL_PENDING", "Method is calling another method"), - EXCEP_TXT ("AE_CTRL_TERMINATE", "Terminate the executing method"), - EXCEP_TXT ("AE_CTRL_TRUE", "An If or While predicate result"), - EXCEP_TXT ("AE_CTRL_FALSE", "An If or While predicate result"), - EXCEP_TXT ("AE_CTRL_DEPTH", "Maximum search depth has been reached"), - EXCEP_TXT ("AE_CTRL_END", "An If or While predicate is false"), - EXCEP_TXT ("AE_CTRL_TRANSFER", "Transfer control to called method"), - EXCEP_TXT ("AE_CTRL_BREAK", "A Break has been executed"), - EXCEP_TXT ("AE_CTRL_CONTINUE", "A Continue has been executed"), - EXCEP_TXT ("AE_CTRL_PARSE_CONTINUE", "Used to skip over bad opcodes"), - EXCEP_TXT ("AE_CTRL_PARSE_PENDING", "Used to implement AML While loops") -}; - -#endif /* EXCEPTION_TABLE */ - -#endif /* __ACEXCEP_H__ */ diff --git a/drivers/include/acpica/acglobal.h b/drivers/include/acpica/acglobal.h deleted file mode 100644 index 02167c3..0000000 --- a/drivers/include/acpica/acglobal.h +++ /dev/null @@ -1,530 +0,0 @@ -/****************************************************************************** - * - * Name: acglobal.h - Declarations for global variables - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef __ACGLOBAL_H__ -#define __ACGLOBAL_H__ - - -/***************************************************************************** - * - * Globals related to the incoming ACPI tables - * - ****************************************************************************/ - -/* Master list of all ACPI tables that were found in the RSDT/XSDT */ - -ACPI_GLOBAL (ACPI_TABLE_LIST, AcpiGbl_RootTableList); - -/* DSDT information. Used to check for DSDT corruption */ - -ACPI_GLOBAL (ACPI_TABLE_HEADER *, AcpiGbl_DSDT); -ACPI_GLOBAL (ACPI_TABLE_HEADER, AcpiGbl_OriginalDsdtHeader); -ACPI_INIT_GLOBAL (char *, AcpiGbl_CDAT, NULL); -ACPI_INIT_GLOBAL (UINT32, AcpiGbl_DsdtIndex, ACPI_INVALID_TABLE_INDEX); -ACPI_INIT_GLOBAL (UINT32, AcpiGbl_FacsIndex, ACPI_INVALID_TABLE_INDEX); -ACPI_INIT_GLOBAL (UINT32, AcpiGbl_XFacsIndex, ACPI_INVALID_TABLE_INDEX); -ACPI_INIT_GLOBAL (UINT32, AcpiGbl_FadtIndex, ACPI_INVALID_TABLE_INDEX); -ACPI_INIT_GLOBAL (ACPI_TABLE_FACS *, AcpiGbl_FACS, NULL); - -/* These addresses are calculated from the FADT Event Block addresses */ - -ACPI_GLOBAL (ACPI_GENERIC_ADDRESS, AcpiGbl_XPm1aStatus); -ACPI_GLOBAL (ACPI_GENERIC_ADDRESS, AcpiGbl_XPm1aEnable); - -ACPI_GLOBAL (ACPI_GENERIC_ADDRESS, AcpiGbl_XPm1bStatus); -ACPI_GLOBAL (ACPI_GENERIC_ADDRESS, AcpiGbl_XPm1bEnable); - -/* - * Handle both ACPI 1.0 and ACPI 2.0+ Integer widths. The integer width is - * determined by the revision of the DSDT: If the DSDT revision is less than - * 2, use only the lower 32 bits of the internal 64-bit Integer. - */ -ACPI_GLOBAL (UINT8, AcpiGbl_IntegerBitWidth); -ACPI_GLOBAL (UINT8, AcpiGbl_IntegerByteWidth); -ACPI_GLOBAL (UINT8, AcpiGbl_IntegerNybbleWidth); - - -/***************************************************************************** - * - * Mutual exclusion within the ACPICA subsystem - * - ****************************************************************************/ - -/* - * Predefined mutex objects. This array contains the - * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs. - * (The table maps local handles to the real OS handles) - */ -ACPI_GLOBAL (ACPI_MUTEX_INFO, AcpiGbl_MutexInfo[ACPI_NUM_MUTEX]); - -/* - * Global lock mutex is an actual AML mutex object - * Global lock semaphore works in conjunction with the actual global lock - * Global lock spinlock is used for "pending" handshake - */ -ACPI_GLOBAL (ACPI_OPERAND_OBJECT *, AcpiGbl_GlobalLockMutex); -ACPI_GLOBAL (ACPI_SEMAPHORE, AcpiGbl_GlobalLockSemaphore); -ACPI_GLOBAL (ACPI_SPINLOCK, AcpiGbl_GlobalLockPendingLock); -ACPI_GLOBAL (UINT16, AcpiGbl_GlobalLockHandle); -ACPI_GLOBAL (BOOLEAN, AcpiGbl_GlobalLockAcquired); -ACPI_GLOBAL (BOOLEAN, AcpiGbl_GlobalLockPresent); -ACPI_GLOBAL (BOOLEAN, AcpiGbl_GlobalLockPending); - -/* - * Spinlocks are used for interfaces that can be possibly called at - * interrupt level - */ -ACPI_GLOBAL (ACPI_SPINLOCK, AcpiGbl_GpeLock); /* For GPE data structs and registers */ -ACPI_GLOBAL (ACPI_SPINLOCK, AcpiGbl_HardwareLock); /* For ACPI H/W except GPE registers */ -ACPI_GLOBAL (ACPI_SPINLOCK, AcpiGbl_ReferenceCountLock); - -/* Mutex for _OSI support */ - -ACPI_GLOBAL (ACPI_MUTEX, AcpiGbl_OsiMutex); - -/* Reader/Writer lock is used for namespace walk and dynamic table unload */ - -ACPI_GLOBAL (ACPI_RW_LOCK, AcpiGbl_NamespaceRwLock); - - -/***************************************************************************** - * - * Miscellaneous globals - * - ****************************************************************************/ - -/* Object caches */ - -ACPI_GLOBAL (ACPI_CACHE_T *, AcpiGbl_NamespaceCache); -ACPI_GLOBAL (ACPI_CACHE_T *, AcpiGbl_StateCache); -ACPI_GLOBAL (ACPI_CACHE_T *, AcpiGbl_PsNodeCache); -ACPI_GLOBAL (ACPI_CACHE_T *, AcpiGbl_PsNodeExtCache); -ACPI_GLOBAL (ACPI_CACHE_T *, AcpiGbl_OperandCache); - -/* System */ - -ACPI_INIT_GLOBAL (UINT32, AcpiGbl_StartupFlags, 0); -ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_Shutdown, TRUE); -ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_EarlyInitialization, TRUE); - -/* Global handlers */ - -ACPI_GLOBAL (ACPI_GLOBAL_NOTIFY_HANDLER,AcpiGbl_GlobalNotify[2]); -ACPI_GLOBAL (ACPI_EXCEPTION_HANDLER, AcpiGbl_ExceptionHandler); -ACPI_GLOBAL (ACPI_INIT_HANDLER, AcpiGbl_InitHandler); -ACPI_GLOBAL (ACPI_TABLE_HANDLER, AcpiGbl_TableHandler); -ACPI_GLOBAL (void *, AcpiGbl_TableHandlerContext); -ACPI_GLOBAL (ACPI_INTERFACE_HANDLER, AcpiGbl_InterfaceHandler); -ACPI_GLOBAL (ACPI_SCI_HANDLER_INFO *, AcpiGbl_SciHandlerList); -ACPI_GLOBAL (ACPI_GED_HANDLER_INFO *, AcpiGbl_GedHandlerList); - -/* Owner ID support */ - -ACPI_GLOBAL (UINT32, AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MASKS]); -ACPI_GLOBAL (UINT8, AcpiGbl_LastOwnerIdIndex); -ACPI_GLOBAL (UINT8, AcpiGbl_NextOwnerIdOffset); - -/* Initialization sequencing */ - -ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_NamespaceInitialized, FALSE); - -/* Miscellaneous */ - -ACPI_GLOBAL (UINT32, AcpiGbl_OriginalMode); -ACPI_GLOBAL (UINT32, AcpiGbl_NsLookupCount); -ACPI_GLOBAL (UINT32, AcpiGbl_PsFindCount); -ACPI_GLOBAL (UINT16, AcpiGbl_Pm1EnableRegisterSave); -ACPI_GLOBAL (UINT8, AcpiGbl_DebuggerConfiguration); -ACPI_GLOBAL (BOOLEAN, AcpiGbl_StepToNextCall); -ACPI_GLOBAL (BOOLEAN, AcpiGbl_AcpiHardwarePresent); -ACPI_GLOBAL (BOOLEAN, AcpiGbl_EventsInitialized); -ACPI_GLOBAL (ACPI_INTERFACE_INFO *, AcpiGbl_SupportedInterfaces); -ACPI_GLOBAL (ACPI_ADDRESS_RANGE *, AcpiGbl_AddressRangeList[ACPI_ADDRESS_RANGE_MAX]); - -/* Other miscellaneous, declared and initialized in utglobal */ - -extern const char *AcpiGbl_SleepStateNames[ACPI_S_STATE_COUNT]; -extern const char *AcpiGbl_LowestDstateNames[ACPI_NUM_SxW_METHODS]; -extern const char *AcpiGbl_HighestDstateNames[ACPI_NUM_SxD_METHODS]; -extern const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS]; -extern const char AcpiGbl_LowerHexDigits[]; -extern const char AcpiGbl_UpperHexDigits[]; -extern const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES]; - -/* Lists for tracking memory allocations (debug only) */ - -#ifdef ACPI_DBG_TRACK_ALLOCATIONS -ACPI_GLOBAL (ACPI_MEMORY_LIST *, AcpiGbl_GlobalList); -ACPI_GLOBAL (ACPI_MEMORY_LIST *, AcpiGbl_NsNodeList); -ACPI_GLOBAL (BOOLEAN, AcpiGbl_DisplayFinalMemStats); -ACPI_GLOBAL (BOOLEAN, AcpiGbl_DisableMemTracking); -ACPI_GLOBAL (BOOLEAN, AcpiGbl_VerboseLeakDump); -#endif - - -/***************************************************************************** - * - * ACPI Namespace - * - ****************************************************************************/ - -#define NUM_PREDEFINED_NAMES 10 - -ACPI_GLOBAL (ACPI_NAMESPACE_NODE, AcpiGbl_RootNodeStruct); -ACPI_GLOBAL (ACPI_NAMESPACE_NODE *, AcpiGbl_RootNode); -ACPI_GLOBAL (ACPI_NAMESPACE_NODE *, AcpiGbl_FadtGpeDevice); - -extern const UINT8 AcpiGbl_NsProperties [ACPI_NUM_NS_TYPES]; -extern const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames [NUM_PREDEFINED_NAMES]; - -#ifdef ACPI_DEBUG_OUTPUT -ACPI_GLOBAL (UINT32, AcpiGbl_CurrentNodeCount); -ACPI_GLOBAL (UINT32, AcpiGbl_CurrentNodeSize); -ACPI_GLOBAL (UINT32, AcpiGbl_MaxConcurrentNodeCount); -ACPI_GLOBAL (ACPI_SIZE *, AcpiGbl_EntryStackPointer); -ACPI_GLOBAL (ACPI_SIZE *, AcpiGbl_LowestStackPointer); -ACPI_GLOBAL (UINT32, AcpiGbl_DeepestNesting); -ACPI_INIT_GLOBAL (UINT32, AcpiGbl_NestingLevel, 0); -#endif - - -/***************************************************************************** - * - * Interpreter/Parser globals - * - ****************************************************************************/ - -/* Control method single step flag */ - -ACPI_GLOBAL (UINT8, AcpiGbl_CmSingleStep); -ACPI_GLOBAL (ACPI_THREAD_STATE *, AcpiGbl_CurrentWalkList); -ACPI_INIT_GLOBAL (ACPI_PARSE_OBJECT, *AcpiGbl_CurrentScope, NULL); - -/* ASL/ASL+ converter */ - -ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_CaptureComments, FALSE); -ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_LastListHead, NULL); - - -/***************************************************************************** - * - * Hardware globals - * - ****************************************************************************/ - -extern ACPI_BIT_REGISTER_INFO AcpiGbl_BitRegisterInfo[ACPI_NUM_BITREG]; -ACPI_GLOBAL (UINT8, AcpiGbl_SleepTypeA); -ACPI_GLOBAL (UINT8, AcpiGbl_SleepTypeB); -ACPI_GLOBAL (UINT8, AcpiGbl_SleepTypeAS0); -ACPI_GLOBAL (UINT8, AcpiGbl_SleepTypeBS0); - - -/***************************************************************************** - * - * Event and GPE globals - * - ****************************************************************************/ - -#if (!ACPI_REDUCED_HARDWARE) -ACPI_GLOBAL (UINT8, AcpiGbl_AllGpesInitialized); -ACPI_GLOBAL (ACPI_GPE_XRUPT_INFO *, AcpiGbl_GpeXruptListHead); -ACPI_GLOBAL (ACPI_GPE_BLOCK_INFO *, AcpiGbl_GpeFadtBlocks[ACPI_MAX_GPE_BLOCKS]); -ACPI_GLOBAL (ACPI_GBL_EVENT_HANDLER, AcpiGbl_GlobalEventHandler); -ACPI_GLOBAL (void *, AcpiGbl_GlobalEventHandlerContext); -ACPI_GLOBAL (ACPI_FIXED_EVENT_HANDLER, AcpiGbl_FixedEventHandlers[ACPI_NUM_FIXED_EVENTS]); -extern ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS]; -#endif /* !ACPI_REDUCED_HARDWARE */ - - -/***************************************************************************** - * - * Debug support - * - ****************************************************************************/ - -/* Event counters */ - -ACPI_GLOBAL (UINT32, AcpiMethodCount); -ACPI_GLOBAL (UINT32, AcpiGpeCount); -ACPI_GLOBAL (UINT32, AcpiSciCount); -ACPI_GLOBAL (UINT32, AcpiFixedEventCount[ACPI_NUM_FIXED_EVENTS]); - -/* Dynamic control method tracing mechanism */ - -ACPI_GLOBAL (UINT32, AcpiGbl_OriginalDbgLevel); -ACPI_GLOBAL (UINT32, AcpiGbl_OriginalDbgLayer); - - -/***************************************************************************** - * - * Debugger and Disassembler - * - ****************************************************************************/ - -ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DbOutputFlags, ACPI_DB_CONSOLE_OUTPUT); - - -#ifdef ACPI_DISASSEMBLER - -/* Do not disassemble buffers to resource descriptors */ - -ACPI_INIT_GLOBAL (UINT8, AcpiGbl_NoResourceDisassembly, FALSE); -ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_IgnoreNoopOperator, FALSE); -ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_CstyleDisassembly, TRUE); -ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_ForceAmlDisassembly, FALSE); -ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_DmOpt_Verbose, TRUE); -ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_DmEmitExternalOpcodes, FALSE); -ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_DoDisassemblerOptimizations, TRUE); -ACPI_INIT_GLOBAL (ACPI_PARSE_OBJECT_LIST, *AcpiGbl_TempListHead, NULL); - -ACPI_GLOBAL (BOOLEAN, AcpiGbl_DmOpt_Disasm); -ACPI_GLOBAL (BOOLEAN, AcpiGbl_DmOpt_Listing); -ACPI_GLOBAL (BOOLEAN, AcpiGbl_NumExternalMethods); -ACPI_GLOBAL (UINT32, AcpiGbl_ResolvedExternalMethods); -ACPI_GLOBAL (ACPI_EXTERNAL_LIST *, AcpiGbl_ExternalList); -ACPI_GLOBAL (ACPI_EXTERNAL_FILE *, AcpiGbl_ExternalFileList); -#endif - -#ifdef ACPI_DEBUGGER -ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_AbortMethod, FALSE); -ACPI_INIT_GLOBAL (ACPI_THREAD_ID, AcpiGbl_DbThreadId, ACPI_INVALID_THREAD_ID); -ACPI_INIT_GLOBAL (UINT32, AcpiGbl_NextCmdNum, 1); - -ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_NoIniMethods); -ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_NoRegionSupport); -ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOutputToFile); -ACPI_GLOBAL (char *, AcpiGbl_DbBuffer); -ACPI_GLOBAL (char *, AcpiGbl_DbFilename); -ACPI_GLOBAL (UINT32, AcpiGbl_DbDebugLevel); -ACPI_GLOBAL (UINT32, AcpiGbl_DbConsoleDebugLevel); -ACPI_GLOBAL (ACPI_NAMESPACE_NODE *, AcpiGbl_DbScopeNode); -ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbTerminateLoop); -ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbThreadsTerminated); -ACPI_GLOBAL (char *, AcpiGbl_DbArgs[ACPI_DEBUGGER_MAX_ARGS]); -ACPI_GLOBAL (ACPI_OBJECT_TYPE, AcpiGbl_DbArgTypes[ACPI_DEBUGGER_MAX_ARGS]); - -/* These buffers should all be the same size */ - -ACPI_GLOBAL (char, AcpiGbl_DbParsedBuf[ACPI_DB_LINE_BUFFER_SIZE]); -ACPI_GLOBAL (char, AcpiGbl_DbScopeBuf[ACPI_DB_LINE_BUFFER_SIZE]); -ACPI_GLOBAL (char, AcpiGbl_DbDebugFilename[ACPI_DB_LINE_BUFFER_SIZE]); - -/* Statistics globals */ - -ACPI_GLOBAL (UINT16, AcpiGbl_ObjTypeCount[ACPI_TOTAL_TYPES]); -ACPI_GLOBAL (UINT16, AcpiGbl_NodeTypeCount[ACPI_TOTAL_TYPES]); -ACPI_GLOBAL (UINT16, AcpiGbl_ObjTypeCountMisc); -ACPI_GLOBAL (UINT16, AcpiGbl_NodeTypeCountMisc); -ACPI_GLOBAL (UINT32, AcpiGbl_NumNodes); -ACPI_GLOBAL (UINT32, AcpiGbl_NumObjects); -#endif /* ACPI_DEBUGGER */ - -#if defined (ACPI_DISASSEMBLER) || defined (ACPI_ASL_COMPILER) -ACPI_GLOBAL (const char, *AcpiGbl_PldPanelList[]); -ACPI_GLOBAL (const char, *AcpiGbl_PldVerticalPositionList[]); -ACPI_GLOBAL (const char, *AcpiGbl_PldHorizontalPositionList[]); -ACPI_GLOBAL (const char, *AcpiGbl_PldShapeList[]); -ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_DisasmFlag, FALSE); -#endif - - -/***************************************************************************** - * - * ACPICA application-specific globals - * - ****************************************************************************/ - -/* ASL-to-ASL+ conversion utility (implemented within the iASL compiler) */ - -#ifdef ACPI_ASL_COMPILER -ACPI_INIT_GLOBAL (char *, AcpiGbl_CurrentInlineComment, NULL); -ACPI_INIT_GLOBAL (char *, AcpiGbl_CurrentEndNodeComment, NULL); -ACPI_INIT_GLOBAL (char *, AcpiGbl_CurrentOpenBraceComment, NULL); -ACPI_INIT_GLOBAL (char *, AcpiGbl_CurrentCloseBraceComment, NULL); - -ACPI_INIT_GLOBAL (char *, AcpiGbl_RootFilename, NULL); -ACPI_INIT_GLOBAL (char *, AcpiGbl_CurrentFilename, NULL); -ACPI_INIT_GLOBAL (char *, AcpiGbl_CurrentParentFilename, NULL); -ACPI_INIT_GLOBAL (char *, AcpiGbl_CurrentIncludeFilename, NULL); - -ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_DefBlkCommentListHead, NULL); -ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_DefBlkCommentListTail, NULL); -ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_RegCommentListHead, NULL); -ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_RegCommentListTail, NULL); -ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_IncCommentListHead, NULL); -ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_IncCommentListTail, NULL); -ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_EndBlkCommentListHead, NULL); -ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_EndBlkCommentListTail, NULL); - -ACPI_INIT_GLOBAL (ACPI_COMMENT_ADDR_NODE, *AcpiGbl_CommentAddrListHead, NULL); -ACPI_INIT_GLOBAL (ACPI_FILE_NODE, *AcpiGbl_FileTreeRoot, NULL); - -ACPI_GLOBAL (ACPI_CACHE_T *, AcpiGbl_RegCommentCache); -ACPI_GLOBAL (ACPI_CACHE_T *, AcpiGbl_CommentAddrCache); -ACPI_GLOBAL (ACPI_CACHE_T *, AcpiGbl_FileCache); - -ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_DebugAslConversion, FALSE); -ACPI_INIT_GLOBAL (ACPI_FILE, AcpiGbl_ConvDebugFile, NULL); -ACPI_GLOBAL (char, AcpiGbl_TableSig[4]); -#endif - -#ifdef ACPI_APPLICATION -ACPI_INIT_GLOBAL (ACPI_FILE, AcpiGbl_DebugFile, NULL); -ACPI_INIT_GLOBAL (ACPI_FILE, AcpiGbl_OutputFile, NULL); -ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_DebugTimeout, FALSE); - -/* Print buffer */ - -ACPI_GLOBAL (ACPI_SPINLOCK, AcpiGbl_PrintLock); /* For print buffer */ -ACPI_GLOBAL (char, AcpiGbl_PrintBuffer[1024]); -#endif /* ACPI_APPLICATION */ - -#endif /* __ACGLOBAL_H__ */ diff --git a/drivers/include/acpica/achware.h b/drivers/include/acpica/achware.h deleted file mode 100644 index 46efffb..0000000 --- a/drivers/include/acpica/achware.h +++ /dev/null @@ -1,339 +0,0 @@ -/****************************************************************************** - * - * Name: achware.h -- hardware specific interfaces - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef __ACHWARE_H__ -#define __ACHWARE_H__ - - -/* Values for the _SST predefined method */ - -#define ACPI_SST_INDICATOR_OFF 0 -#define ACPI_SST_WORKING 1 -#define ACPI_SST_WAKING 2 -#define ACPI_SST_SLEEPING 3 -#define ACPI_SST_SLEEP_CONTEXT 4 - - -/* - * hwacpi - high level functions - */ -ACPI_STATUS -AcpiHwSetMode ( - UINT32 Mode); - -UINT32 -AcpiHwGetMode ( - void); - - -/* - * hwregs - ACPI Register I/O - */ -ACPI_STATUS -AcpiHwValidateRegister ( - ACPI_GENERIC_ADDRESS *Reg, - UINT8 MaxBitWidth, - UINT64 *Address); - -ACPI_STATUS -AcpiHwRead ( - UINT64 *Value, - ACPI_GENERIC_ADDRESS *Reg); - -ACPI_STATUS -AcpiHwWrite ( - UINT64 Value, - ACPI_GENERIC_ADDRESS *Reg); - -ACPI_BIT_REGISTER_INFO * -AcpiHwGetBitRegisterInfo ( - UINT32 RegisterId); - -ACPI_STATUS -AcpiHwWritePm1Control ( - UINT32 Pm1aControl, - UINT32 Pm1bControl); - -ACPI_STATUS -AcpiHwRegisterRead ( - UINT32 RegisterId, - UINT32 *ReturnValue); - -ACPI_STATUS -AcpiHwRegisterWrite ( - UINT32 RegisterId, - UINT32 Value); - -ACPI_STATUS -AcpiHwClearAcpiStatus ( - void); - - -/* - * hwsleep - sleep/wake support (Legacy sleep registers) - */ -ACPI_STATUS -AcpiHwLegacySleep ( - UINT8 SleepState); - -ACPI_STATUS -AcpiHwLegacyWakePrep ( - UINT8 SleepState); - -ACPI_STATUS -AcpiHwLegacyWake ( - UINT8 SleepState); - - -/* - * hwesleep - sleep/wake support (Extended FADT-V5 sleep registers) - */ -void -AcpiHwExecuteSleepMethod ( - char *MethodName, - UINT32 IntegerArgument); - -ACPI_STATUS -AcpiHwExtendedSleep ( - UINT8 SleepState); - -ACPI_STATUS -AcpiHwExtendedWakePrep ( - UINT8 SleepState); - -ACPI_STATUS -AcpiHwExtendedWake ( - UINT8 SleepState); - - -/* - * hwvalid - Port I/O with validation - */ -ACPI_STATUS -AcpiHwReadPort ( - ACPI_IO_ADDRESS Address, - UINT32 *Value, - UINT32 Width); - -ACPI_STATUS -AcpiHwWritePort ( - ACPI_IO_ADDRESS Address, - UINT32 Value, - UINT32 Width); - - -/* - * hwgpe - GPE support - */ -UINT32 -AcpiHwGetGpeRegisterBit ( - ACPI_GPE_EVENT_INFO *GpeEventInfo); - -ACPI_STATUS -AcpiHwLowSetGpe ( - ACPI_GPE_EVENT_INFO *GpeEventInfo, - UINT32 Action); - -ACPI_STATUS -AcpiHwDisableGpeBlock ( - ACPI_GPE_XRUPT_INFO *GpeXruptInfo, - ACPI_GPE_BLOCK_INFO *GpeBlock, - void *Context); - -ACPI_STATUS -AcpiHwClearGpe ( - ACPI_GPE_EVENT_INFO *GpeEventInfo); - -ACPI_STATUS -AcpiHwClearGpeBlock ( - ACPI_GPE_XRUPT_INFO *GpeXruptInfo, - ACPI_GPE_BLOCK_INFO *GpeBlock, - void *Context); - -ACPI_STATUS -AcpiHwGetGpeStatus ( - ACPI_GPE_EVENT_INFO *GpeEventInfo, - ACPI_EVENT_STATUS *EventStatus); - -ACPI_STATUS -AcpiHwDisableAllGpes ( - void); - -ACPI_STATUS -AcpiHwEnableAllRuntimeGpes ( - void); - -ACPI_STATUS -AcpiHwEnableAllWakeupGpes ( - void); - -UINT8 -AcpiHwCheckAllGpes ( - void); - -ACPI_STATUS -AcpiHwEnableRuntimeGpeBlock ( - ACPI_GPE_XRUPT_INFO *GpeXruptInfo, - ACPI_GPE_BLOCK_INFO *GpeBlock, - void *Context); - - -/* - * hwpci - PCI configuration support - */ -ACPI_STATUS -AcpiHwDerivePciId ( - ACPI_PCI_ID *PciId, - ACPI_HANDLE RootPciDevice, - ACPI_HANDLE PciRegion); - - -#endif /* __ACHWARE_H__ */ diff --git a/drivers/include/acpica/acinterp.h b/drivers/include/acpica/acinterp.h deleted file mode 100644 index b7f9e8f..0000000 --- a/drivers/include/acpica/acinterp.h +++ /dev/null @@ -1,896 +0,0 @@ -/****************************************************************************** - * - * Name: acinterp.h - Interpreter subcomponent prototypes and defines - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef __ACINTERP_H__ -#define __ACINTERP_H__ - - -#define ACPI_WALK_OPERANDS (&(WalkState->Operands [WalkState->NumOperands -1])) - -/* Macros for tables used for debug output */ - -#define ACPI_EXD_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_OPERAND_OBJECT,f) -#define ACPI_EXD_NSOFFSET(f) (UINT8) ACPI_OFFSET (ACPI_NAMESPACE_NODE,f) -#define ACPI_EXD_TABLE_SIZE(name) (sizeof(name) / sizeof (ACPI_EXDUMP_INFO)) - -/* - * If possible, pack the following structures to byte alignment, since we - * don't care about performance for debug output. Two cases where we cannot - * pack the structures: - * - * 1) Hardware does not support misaligned memory transfers - * 2) Compiler does not support pointers within packed structures - */ -#if (!defined(ACPI_MISALIGNMENT_NOT_SUPPORTED) && !defined(ACPI_PACKED_POINTERS_NOT_SUPPORTED)) -#pragma pack(1) -#endif - -typedef const struct acpi_exdump_info -{ - UINT8 Opcode; - UINT8 Offset; - const char *Name; - -} ACPI_EXDUMP_INFO; - -/* Values for the Opcode field above */ - -#define ACPI_EXD_INIT 0 -#define ACPI_EXD_TYPE 1 -#define ACPI_EXD_UINT8 2 -#define ACPI_EXD_UINT16 3 -#define ACPI_EXD_UINT32 4 -#define ACPI_EXD_UINT64 5 -#define ACPI_EXD_LITERAL 6 -#define ACPI_EXD_POINTER 7 -#define ACPI_EXD_ADDRESS 8 -#define ACPI_EXD_STRING 9 -#define ACPI_EXD_BUFFER 10 -#define ACPI_EXD_PACKAGE 11 -#define ACPI_EXD_FIELD 12 -#define ACPI_EXD_REFERENCE 13 -#define ACPI_EXD_LIST 14 /* Operand object list */ -#define ACPI_EXD_HDLR_LIST 15 /* Address Handler list */ -#define ACPI_EXD_RGN_LIST 16 /* Region list */ -#define ACPI_EXD_NODE 17 /* Namespace Node */ - -/* restore default alignment */ - -#pragma pack() - - -/* - * exconvrt - object conversion - */ -ACPI_STATUS -AcpiExConvertToInteger ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT **ResultDesc, - UINT32 ImplicitConversion); - -ACPI_STATUS -AcpiExConvertToBuffer ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT **ResultDesc); - -ACPI_STATUS -AcpiExConvertToString ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT **ResultDesc, - UINT32 Type); - -/* Types for ->String conversion */ - -#define ACPI_EXPLICIT_BYTE_COPY 0x00000000 -#define ACPI_EXPLICIT_CONVERT_HEX 0x00000001 -#define ACPI_IMPLICIT_CONVERT_HEX 0x00000002 -#define ACPI_EXPLICIT_CONVERT_DECIMAL 0x00000003 - -ACPI_STATUS -AcpiExConvertToTargetType ( - ACPI_OBJECT_TYPE DestinationType, - ACPI_OPERAND_OBJECT *SourceDesc, - ACPI_OPERAND_OBJECT **ResultDesc, - ACPI_WALK_STATE *WalkState); - - -/* - * exdebug - AML debug object - */ -void -AcpiExDoDebugObject ( - ACPI_OPERAND_OBJECT *SourceDesc, - UINT32 Level, - UINT32 Index); - -void -AcpiExStartTraceMethod ( - ACPI_NAMESPACE_NODE *MethodNode, - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_WALK_STATE *WalkState); - -void -AcpiExStopTraceMethod ( - ACPI_NAMESPACE_NODE *MethodNode, - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_WALK_STATE *WalkState); - -void -AcpiExStartTraceOpcode ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState); - -void -AcpiExStopTraceOpcode ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState); - -void -AcpiExTracePoint ( - ACPI_TRACE_EVENT_TYPE Type, - BOOLEAN Begin, - UINT8 *Aml, - char *Pathname); - -void -AcpiExTraceArgs( - ACPI_OPERAND_OBJECT **Params, - UINT32 Count); - -/* - * exfield - ACPI AML (p-code) execution - field manipulation - */ -ACPI_STATUS -AcpiExGetProtocolBufferLength ( - UINT32 ProtocolId, - UINT32 *ReturnLength); - -ACPI_STATUS -AcpiExCommonBufferSetup ( - ACPI_OPERAND_OBJECT *ObjDesc, - UINT32 BufferLength, - UINT32 *DatumCount); - -ACPI_STATUS -AcpiExWriteWithUpdateRule ( - ACPI_OPERAND_OBJECT *ObjDesc, - UINT64 Mask, - UINT64 FieldValue, - UINT32 FieldDatumByteOffset); - -void -AcpiExGetBufferDatum( - UINT64 *Datum, - void *Buffer, - UINT32 BufferLength, - UINT32 ByteGranularity, - UINT32 BufferOffset); - -void -AcpiExSetBufferDatum ( - UINT64 MergedDatum, - void *Buffer, - UINT32 BufferLength, - UINT32 ByteGranularity, - UINT32 BufferOffset); - -ACPI_STATUS -AcpiExReadDataFromField ( - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT **RetBufferDesc); - -ACPI_STATUS -AcpiExWriteDataToField ( - ACPI_OPERAND_OBJECT *SourceDesc, - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT **ResultDesc); - - -/* - * exfldio - low level field I/O - */ -ACPI_STATUS -AcpiExExtractFromField ( - ACPI_OPERAND_OBJECT *ObjDesc, - void *Buffer, - UINT32 BufferLength); - -ACPI_STATUS -AcpiExInsertIntoField ( - ACPI_OPERAND_OBJECT *ObjDesc, - void *Buffer, - UINT32 BufferLength); - -ACPI_STATUS -AcpiExAccessRegion ( - ACPI_OPERAND_OBJECT *ObjDesc, - UINT32 FieldDatumByteOffset, - UINT64 *Value, - UINT32 ReadWrite); - - -/* - * exmisc - misc support routines - */ -ACPI_STATUS -AcpiExGetObjectReference ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT **ReturnDesc, - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiExConcatTemplate ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT *ObjDesc2, - ACPI_OPERAND_OBJECT **ActualReturnDesc, - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiExDoConcatenate ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT *ObjDesc2, - ACPI_OPERAND_OBJECT **ActualReturnDesc, - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiExDoLogicalNumericOp ( - UINT16 Opcode, - UINT64 Integer0, - UINT64 Integer1, - BOOLEAN *LogicalResult); - -ACPI_STATUS -AcpiExDoLogicalOp ( - UINT16 Opcode, - ACPI_OPERAND_OBJECT *Operand0, - ACPI_OPERAND_OBJECT *Operand1, - BOOLEAN *LogicalResult); - -UINT64 -AcpiExDoMathOp ( - UINT16 Opcode, - UINT64 Operand0, - UINT64 Operand1); - -ACPI_STATUS -AcpiExCreateMutex ( - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiExCreateProcessor ( - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiExCreatePowerResource ( - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiExCreateRegion ( - UINT8 *AmlStart, - UINT32 AmlLength, - UINT8 RegionSpace, - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiExCreateEvent ( - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiExCreateAlias ( - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiExCreateMethod ( - UINT8 *AmlStart, - UINT32 AmlLength, - ACPI_WALK_STATE *WalkState); - - -/* - * exconfig - dynamic table load/unload - */ -ACPI_STATUS -AcpiExLoadOp ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT *Target, - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiExLoadTableOp ( - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT **ReturnDesc); - -ACPI_STATUS -AcpiExUnloadTable ( - ACPI_OPERAND_OBJECT *DdbHandle); - - -/* - * exmutex - mutex support - */ -ACPI_STATUS -AcpiExAcquireMutex ( - ACPI_OPERAND_OBJECT *TimeDesc, - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiExAcquireMutexObject ( - UINT16 Timeout, - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_THREAD_ID ThreadId); - -ACPI_STATUS -AcpiExReleaseMutex ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiExReleaseMutexObject ( - ACPI_OPERAND_OBJECT *ObjDesc); - -void -AcpiExReleaseAllMutexes ( - ACPI_THREAD_STATE *Thread); - -void -AcpiExUnlinkMutex ( - ACPI_OPERAND_OBJECT *ObjDesc); - - -/* - * exprep - ACPI AML execution - prep utilities - */ -ACPI_STATUS -AcpiExPrepCommonFieldObject ( - ACPI_OPERAND_OBJECT *ObjDesc, - UINT8 FieldFlags, - UINT8 FieldAttribute, - UINT32 FieldBitPosition, - UINT32 FieldBitLength); - -ACPI_STATUS -AcpiExPrepFieldValue ( - ACPI_CREATE_FIELD_INFO *Info); - - -/* - * exserial - FieldUnit support for serial address spaces - */ -ACPI_STATUS -AcpiExReadSerialBus ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT **ReturnBuffer); - -ACPI_STATUS -AcpiExWriteSerialBus ( - ACPI_OPERAND_OBJECT *SourceDesc, - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT **ReturnBuffer); - -ACPI_STATUS -AcpiExReadGpio ( - ACPI_OPERAND_OBJECT *ObjDesc, - void *Buffer); - -ACPI_STATUS -AcpiExWriteGpio ( - ACPI_OPERAND_OBJECT *SourceDesc, - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT **ReturnBuffer); - - -/* - * exsystem - Interface to OS services - */ -ACPI_STATUS -AcpiExSystemDoNotifyOp ( - ACPI_OPERAND_OBJECT *Value, - ACPI_OPERAND_OBJECT *ObjDesc); - -ACPI_STATUS -AcpiExSystemDoSleep( - UINT64 Time); - -ACPI_STATUS -AcpiExSystemDoStall ( - UINT32 Time); - -ACPI_STATUS -AcpiExSystemSignalEvent( - ACPI_OPERAND_OBJECT *ObjDesc); - -ACPI_STATUS -AcpiExSystemWaitEvent( - ACPI_OPERAND_OBJECT *Time, - ACPI_OPERAND_OBJECT *ObjDesc); - -ACPI_STATUS -AcpiExSystemResetEvent( - ACPI_OPERAND_OBJECT *ObjDesc); - -ACPI_STATUS -AcpiExSystemWaitSemaphore ( - ACPI_SEMAPHORE Semaphore, - UINT16 Timeout); - -ACPI_STATUS -AcpiExSystemWaitMutex ( - ACPI_MUTEX Mutex, - UINT16 Timeout); - -/* - * exoparg1 - ACPI AML execution, 1 operand - */ -ACPI_STATUS -AcpiExOpcode_0A_0T_1R ( - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiExOpcode_1A_0T_0R ( - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiExOpcode_1A_0T_1R ( - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiExOpcode_1A_1T_1R ( - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiExOpcode_1A_1T_0R ( - ACPI_WALK_STATE *WalkState); - -/* - * exoparg2 - ACPI AML execution, 2 operands - */ -ACPI_STATUS -AcpiExOpcode_2A_0T_0R ( - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiExOpcode_2A_0T_1R ( - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiExOpcode_2A_1T_1R ( - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiExOpcode_2A_2T_1R ( - ACPI_WALK_STATE *WalkState); - - -/* - * exoparg3 - ACPI AML execution, 3 operands - */ -ACPI_STATUS -AcpiExOpcode_3A_0T_0R ( - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiExOpcode_3A_1T_1R ( - ACPI_WALK_STATE *WalkState); - - -/* - * exoparg6 - ACPI AML execution, 6 operands - */ -ACPI_STATUS -AcpiExOpcode_6A_0T_1R ( - ACPI_WALK_STATE *WalkState); - - -/* - * exresolv - Object resolution and get value functions - */ -ACPI_STATUS -AcpiExResolveToValue ( - ACPI_OPERAND_OBJECT **StackPtr, - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiExResolveMultiple ( - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT *Operand, - ACPI_OBJECT_TYPE *ReturnType, - ACPI_OPERAND_OBJECT **ReturnDesc); - - -/* - * exresnte - resolve namespace node - */ -ACPI_STATUS -AcpiExResolveNodeToValue ( - ACPI_NAMESPACE_NODE **StackPtr, - ACPI_WALK_STATE *WalkState); - - -/* - * exresop - resolve operand to value - */ -ACPI_STATUS -AcpiExResolveOperands ( - UINT16 Opcode, - ACPI_OPERAND_OBJECT **StackPtr, - ACPI_WALK_STATE *WalkState); - - -/* - * exdump - Interpreter debug output routines - */ -void -AcpiExDumpOperand ( - ACPI_OPERAND_OBJECT *ObjDesc, - UINT32 Depth); - -void -AcpiExDumpOperands ( - ACPI_OPERAND_OBJECT **Operands, - const char *OpcodeName, - UINT32 NumOpcodes); - -void -AcpiExDumpObjectDescriptor ( - ACPI_OPERAND_OBJECT *Object, - UINT32 Flags); - -void -AcpiExDumpNamespaceNode ( - ACPI_NAMESPACE_NODE *Node, - UINT32 Flags); - - -/* - * exnames - AML namestring support - */ -ACPI_STATUS -AcpiExGetNameString ( - ACPI_OBJECT_TYPE DataType, - UINT8 *InAmlAddress, - char **OutNameString, - UINT32 *OutNameLength); - - -/* - * exstore - Object store support - */ -ACPI_STATUS -AcpiExStore ( - ACPI_OPERAND_OBJECT *ValDesc, - ACPI_OPERAND_OBJECT *DestDesc, - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiExStoreObjectToNode ( - ACPI_OPERAND_OBJECT *SourceDesc, - ACPI_NAMESPACE_NODE *Node, - ACPI_WALK_STATE *WalkState, - UINT8 ImplicitConversion); - - -/* - * exstoren - resolve/store object - */ -ACPI_STATUS -AcpiExResolveObject ( - ACPI_OPERAND_OBJECT **SourceDescPtr, - ACPI_OBJECT_TYPE TargetType, - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiExStoreObjectToObject ( - ACPI_OPERAND_OBJECT *SourceDesc, - ACPI_OPERAND_OBJECT *DestDesc, - ACPI_OPERAND_OBJECT **NewDesc, - ACPI_WALK_STATE *WalkState); - - -/* - * exstorob - store object - buffer/string - */ -ACPI_STATUS -AcpiExStoreBufferToBuffer ( - ACPI_OPERAND_OBJECT *SourceDesc, - ACPI_OPERAND_OBJECT *TargetDesc); - -ACPI_STATUS -AcpiExStoreStringToString ( - ACPI_OPERAND_OBJECT *SourceDesc, - ACPI_OPERAND_OBJECT *TargetDesc); - - -/* - * excopy - object copy - */ -ACPI_STATUS -AcpiExCopyIntegerToIndexField ( - ACPI_OPERAND_OBJECT *SourceDesc, - ACPI_OPERAND_OBJECT *TargetDesc); - -ACPI_STATUS -AcpiExCopyIntegerToBankField ( - ACPI_OPERAND_OBJECT *SourceDesc, - ACPI_OPERAND_OBJECT *TargetDesc); - -ACPI_STATUS -AcpiExCopyDataToNamedField ( - ACPI_OPERAND_OBJECT *SourceDesc, - ACPI_NAMESPACE_NODE *Node); - -ACPI_STATUS -AcpiExCopyIntegerToBufferField ( - ACPI_OPERAND_OBJECT *SourceDesc, - ACPI_OPERAND_OBJECT *TargetDesc); - - -/* - * exutils - interpreter/scanner utilities - */ -void -AcpiExEnterInterpreter ( - void); - -void -AcpiExExitInterpreter ( - void); - -BOOLEAN -AcpiExTruncateFor32bitTable ( - ACPI_OPERAND_OBJECT *ObjDesc); - -void -AcpiExAcquireGlobalLock ( - UINT32 Rule); - -void -AcpiExReleaseGlobalLock ( - UINT32 Rule); - -void -AcpiExEisaIdToString ( - char *Dest, - UINT64 CompressedId); - -void -AcpiExIntegerToString ( - char *Dest, - UINT64 Value); - -void -AcpiExPciClsToString ( - char *Dest, - UINT8 ClassCode[3]); - -BOOLEAN -AcpiIsValidSpaceId ( - UINT8 SpaceId); - - -/* - * exregion - default OpRegion handlers - */ -ACPI_STATUS -AcpiExSystemMemorySpaceHandler ( - UINT32 Function, - ACPI_PHYSICAL_ADDRESS Address, - UINT32 BitWidth, - UINT64 *Value, - void *HandlerContext, - void *RegionContext); - -ACPI_STATUS -AcpiExSystemIoSpaceHandler ( - UINT32 Function, - ACPI_PHYSICAL_ADDRESS Address, - UINT32 BitWidth, - UINT64 *Value, - void *HandlerContext, - void *RegionContext); - -ACPI_STATUS -AcpiExPciConfigSpaceHandler ( - UINT32 Function, - ACPI_PHYSICAL_ADDRESS Address, - UINT32 BitWidth, - UINT64 *Value, - void *HandlerContext, - void *RegionContext); - -ACPI_STATUS -AcpiExCmosSpaceHandler ( - UINT32 Function, - ACPI_PHYSICAL_ADDRESS Address, - UINT32 BitWidth, - UINT64 *Value, - void *HandlerContext, - void *RegionContext); - -ACPI_STATUS -AcpiExPciBarSpaceHandler ( - UINT32 Function, - ACPI_PHYSICAL_ADDRESS Address, - UINT32 BitWidth, - UINT64 *Value, - void *HandlerContext, - void *RegionContext); - -ACPI_STATUS -AcpiExEmbeddedControllerSpaceHandler ( - UINT32 Function, - ACPI_PHYSICAL_ADDRESS Address, - UINT32 BitWidth, - UINT64 *Value, - void *HandlerContext, - void *RegionContext); - -ACPI_STATUS -AcpiExSmBusSpaceHandler ( - UINT32 Function, - ACPI_PHYSICAL_ADDRESS Address, - UINT32 BitWidth, - UINT64 *Value, - void *HandlerContext, - void *RegionContext); - - -ACPI_STATUS -AcpiExDataTableSpaceHandler ( - UINT32 Function, - ACPI_PHYSICAL_ADDRESS Address, - UINT32 BitWidth, - UINT64 *Value, - void *HandlerContext, - void *RegionContext); - -#endif /* __INTERP_H__ */ diff --git a/drivers/include/acpica/aclocal.h b/drivers/include/acpica/aclocal.h deleted file mode 100644 index ff18d61..0000000 --- a/drivers/include/acpica/aclocal.h +++ /dev/null @@ -1,1663 +0,0 @@ -/****************************************************************************** - * - * Name: aclocal.h - Internal data types used across the ACPI subsystem - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef __ACLOCAL_H__ -#define __ACLOCAL_H__ - - -/* acpisrc:StructDefs -- for acpisrc conversion */ - -#define ACPI_SERIALIZED 0xFF - -typedef UINT32 ACPI_MUTEX_HANDLE; -#define ACPI_GLOBAL_LOCK (ACPI_SEMAPHORE) (-1) - -/* Total number of aml opcodes defined */ - -#define AML_NUM_OPCODES 0x83 - - -/* Forward declarations */ - -struct acpi_walk_state; -struct acpi_obj_mutex; -union acpi_parse_object; - - -/***************************************************************************** - * - * Mutex typedefs and structs - * - ****************************************************************************/ - - -/* - * Predefined handles for the mutex objects used within the subsystem - * All mutex objects are automatically created by AcpiUtMutexInitialize. - * - * The acquire/release ordering protocol is implied via this list. Mutexes - * with a lower value must be acquired before mutexes with a higher value. - * - * NOTE: any changes here must be reflected in the AcpiGbl_MutexNames - * table below also! - */ -#define ACPI_MTX_INTERPRETER 0 /* AML Interpreter, main lock */ -#define ACPI_MTX_NAMESPACE 1 /* ACPI Namespace */ -#define ACPI_MTX_TABLES 2 /* Data for ACPI tables */ -#define ACPI_MTX_EVENTS 3 /* Data for ACPI events */ -#define ACPI_MTX_CACHES 4 /* Internal caches, general purposes */ -#define ACPI_MTX_MEMORY 5 /* Debug memory tracking lists */ - -#define ACPI_MAX_MUTEX 5 -#define ACPI_NUM_MUTEX (ACPI_MAX_MUTEX+1) - - -/* Lock structure for reader/writer interfaces */ - -typedef struct acpi_rw_lock -{ - ACPI_MUTEX WriterMutex; - ACPI_MUTEX ReaderMutex; - UINT32 NumReaders; - -} ACPI_RW_LOCK; - - -/* - * Predefined handles for spinlocks used within the subsystem. - * These spinlocks are created by AcpiUtMutexInitialize - */ -#define ACPI_LOCK_GPES 0 -#define ACPI_LOCK_HARDWARE 1 - -#define ACPI_MAX_LOCK 1 -#define ACPI_NUM_LOCK (ACPI_MAX_LOCK+1) - - -/* This Thread ID means that the mutex is not in use (unlocked) */ - -#define ACPI_MUTEX_NOT_ACQUIRED ((ACPI_THREAD_ID) -1) - -/* This Thread ID means an invalid thread ID */ - -#ifdef ACPI_OS_INVALID_THREAD_ID -#define ACPI_INVALID_THREAD_ID ACPI_OS_INVALID_THREAD_ID -#else -#define ACPI_INVALID_THREAD_ID ((ACPI_THREAD_ID) 0xFFFFFFFF) -#endif - -/* Table for the global mutexes */ - -typedef struct acpi_mutex_info -{ - ACPI_MUTEX Mutex; - UINT32 UseCount; - ACPI_THREAD_ID ThreadId; - -} ACPI_MUTEX_INFO; - - -/* Lock flag parameter for various interfaces */ - -#define ACPI_MTX_DO_NOT_LOCK 0 -#define ACPI_MTX_LOCK 1 - - -/* Field access granularities */ - -#define ACPI_FIELD_BYTE_GRANULARITY 1 -#define ACPI_FIELD_WORD_GRANULARITY 2 -#define ACPI_FIELD_DWORD_GRANULARITY 4 -#define ACPI_FIELD_QWORD_GRANULARITY 8 - - -#define ACPI_ENTRY_NOT_FOUND NULL - - -/***************************************************************************** - * - * Namespace typedefs and structs - * - ****************************************************************************/ - -/* Operational modes of the AML interpreter/scanner */ - -typedef enum -{ - ACPI_IMODE_LOAD_PASS1 = 0x01, - ACPI_IMODE_LOAD_PASS2 = 0x02, - ACPI_IMODE_EXECUTE = 0x03 - -} ACPI_INTERPRETER_MODE; - - -/* - * The Namespace Node describes a named object that appears in the AML. - * DescriptorType is used to differentiate between internal descriptors. - * - * The node is optimized for both 32-bit and 64-bit platforms: - * 20 bytes for the 32-bit case, 32 bytes for the 64-bit case. - * - * Note: The DescriptorType and Type fields must appear in the identical - * position in both the ACPI_NAMESPACE_NODE and ACPI_OPERAND_OBJECT - * structures. - */ -typedef struct acpi_namespace_node -{ - union acpi_operand_object *Object; /* Interpreter object */ - UINT8 DescriptorType; /* Differentiate object descriptor types */ - UINT8 Type; /* ACPI Type associated with this name */ - UINT16 Flags; /* Miscellaneous flags */ - ACPI_NAME_UNION Name; /* ACPI Name, always 4 chars per ACPI spec */ - struct acpi_namespace_node *Parent; /* Parent node */ - struct acpi_namespace_node *Child; /* First child */ - struct acpi_namespace_node *Peer; /* First peer */ - ACPI_OWNER_ID OwnerId; /* Node creator */ - - /* - * The following fields are used by the ASL compiler and disassembler only - */ -#ifdef ACPI_LARGE_NAMESPACE_NODE - union acpi_parse_object *Op; - void *MethodLocals; - void *MethodArgs; - UINT32 Value; - UINT32 Length; - UINT8 ArgCount; - -#endif - -} ACPI_NAMESPACE_NODE; - - -/* Namespace Node flags */ - -#define ANOBJ_RESERVED 0x01 /* Available for use */ -#define ANOBJ_TEMPORARY 0x02 /* Node is create by a method and is temporary */ -#define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */ -#define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */ -#define ANOBJ_SUBTREE_HAS_INI 0x10 /* Used to optimize device initialization */ -#define ANOBJ_EVALUATED 0x20 /* Set on first evaluation of node */ -#define ANOBJ_ALLOCATED_BUFFER 0x40 /* Method AML buffer is dynamic (InstallMethod) */ -#define ANOBJ_NODE_EARLY_INIT 0x80 /* AcpiExec only: Node was create via init file (-fi) */ - -#define ANOBJ_IS_EXTERNAL 0x08 /* iASL only: This object created via External() */ -#define ANOBJ_METHOD_NO_RETVAL 0x10 /* iASL only: Method has no return value */ -#define ANOBJ_METHOD_SOME_NO_RETVAL 0x20 /* iASL only: Method has at least one return value */ -#define ANOBJ_IS_REFERENCED 0x80 /* iASL only: Object was referenced */ - - -/* Internal ACPI table management - master table list */ - -typedef struct acpi_table_list -{ - ACPI_TABLE_DESC *Tables; /* Table descriptor array */ - UINT32 CurrentTableCount; /* Tables currently in the array */ - UINT32 MaxTableCount; /* Max tables array will hold */ - UINT8 Flags; - -} ACPI_TABLE_LIST; - -/* Flags for above */ - -#define ACPI_ROOT_ORIGIN_UNKNOWN (0) /* ~ORIGIN_ALLOCATED */ -#define ACPI_ROOT_ORIGIN_ALLOCATED (1) -#define ACPI_ROOT_ALLOW_RESIZE (2) - - -/* List to manage incoming ACPI tables */ - -typedef struct acpi_new_table_desc -{ - ACPI_TABLE_HEADER *Table; - struct acpi_new_table_desc *Next; - -} ACPI_NEW_TABLE_DESC; - - -/* Predefined table indexes */ - -#define ACPI_INVALID_TABLE_INDEX (0xFFFFFFFF) - - -typedef struct acpi_find_context -{ - char *SearchFor; - ACPI_HANDLE *List; - UINT32 *Count; - -} ACPI_FIND_CONTEXT; - - -typedef struct acpi_ns_search_data -{ - ACPI_NAMESPACE_NODE *Node; - -} ACPI_NS_SEARCH_DATA; - - -/* Object types used during package copies */ - -#define ACPI_COPY_TYPE_SIMPLE 0 -#define ACPI_COPY_TYPE_PACKAGE 1 - - -/* Info structure used to convert external<->internal namestrings */ - -typedef struct acpi_namestring_info -{ - const char *ExternalName; - const char *NextExternalChar; - char *InternalName; - UINT32 Length; - UINT32 NumSegments; - UINT32 NumCarats; - BOOLEAN FullyQualified; - -} ACPI_NAMESTRING_INFO; - - -/* Field creation info */ - -typedef struct acpi_create_field_info -{ - ACPI_NAMESPACE_NODE *RegionNode; - ACPI_NAMESPACE_NODE *FieldNode; - ACPI_NAMESPACE_NODE *RegisterNode; - ACPI_NAMESPACE_NODE *DataRegisterNode; - ACPI_NAMESPACE_NODE *ConnectionNode; - UINT8 *ResourceBuffer; - UINT32 BankValue; - UINT32 FieldBitPosition; - UINT32 FieldBitLength; - UINT16 ResourceLength; - UINT16 PinNumberIndex; - UINT8 FieldFlags; - UINT8 Attribute; - UINT8 FieldType; - UINT8 AccessLength; - -} ACPI_CREATE_FIELD_INFO; - - -typedef -ACPI_STATUS (*ACPI_INTERNAL_METHOD) ( - struct acpi_walk_state *WalkState); - - -/* - * Bitmapped ACPI types. Used internally only - */ -#define ACPI_BTYPE_ANY 0x00000000 -#define ACPI_BTYPE_INTEGER 0x00000001 -#define ACPI_BTYPE_STRING 0x00000002 -#define ACPI_BTYPE_BUFFER 0x00000004 -#define ACPI_BTYPE_PACKAGE 0x00000008 -#define ACPI_BTYPE_FIELD_UNIT 0x00000010 -#define ACPI_BTYPE_DEVICE 0x00000020 -#define ACPI_BTYPE_EVENT 0x00000040 -#define ACPI_BTYPE_METHOD 0x00000080 -#define ACPI_BTYPE_MUTEX 0x00000100 -#define ACPI_BTYPE_REGION 0x00000200 -#define ACPI_BTYPE_POWER 0x00000400 -#define ACPI_BTYPE_PROCESSOR 0x00000800 -#define ACPI_BTYPE_THERMAL 0x00001000 -#define ACPI_BTYPE_BUFFER_FIELD 0x00002000 -#define ACPI_BTYPE_DDB_HANDLE 0x00004000 -#define ACPI_BTYPE_DEBUG_OBJECT 0x00008000 -#define ACPI_BTYPE_REFERENCE_OBJECT 0x00010000 /* From Index(), RefOf(), etc (Type6Opcodes) */ -#define ACPI_BTYPE_RESOURCE 0x00020000 -#define ACPI_BTYPE_NAMED_REFERENCE 0x00040000 /* Generic unresolved Name or Namepath */ - -#define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER) - -#define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE) - - /* Used by Copy, DeRefOf, Store, Printf, Fprintf */ - -#define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE_OBJECT | ACPI_BTYPE_DDB_HANDLE) -#define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR) -#define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */ -#define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF - -#pragma pack(1) - -/* - * Information structure for ACPI predefined names. - * Each entry in the table contains the following items: - * - * Name - The ACPI reserved name - * ParamCount - Number of arguments to the method - * ExpectedReturnBtypes - Allowed type(s) for the return value - */ -typedef struct acpi_name_info -{ - char Name[ACPI_NAMESEG_SIZE] ACPI_NONSTRING; - UINT16 ArgumentList; - UINT8 ExpectedBtypes; - -} ACPI_NAME_INFO; - -/* - * Secondary information structures for ACPI predefined objects that return - * package objects. This structure appears as the next entry in the table - * after the NAME_INFO structure above. - * - * The reason for this is to minimize the size of the predefined name table. - */ - -/* - * Used for ACPI_PTYPE1_FIXED, ACPI_PTYPE1_VAR, ACPI_PTYPE2, - * ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT, - * ACPI_PTYPE2_FIX_VAR - */ -typedef struct acpi_package_info -{ - UINT8 Type; - UINT8 ObjectType1; - UINT8 Count1; - UINT8 ObjectType2; - UINT8 Count2; - UINT16 Reserved; - -} ACPI_PACKAGE_INFO; - -/* Used for ACPI_PTYPE2_FIXED */ - -typedef struct acpi_package_info2 -{ - UINT8 Type; - UINT8 Count; - UINT8 ObjectType[4]; - UINT8 Reserved; - -} ACPI_PACKAGE_INFO2; - -/* Used for ACPI_PTYPE1_OPTION */ - -typedef struct acpi_package_info3 -{ - UINT8 Type; - UINT8 Count; - UINT8 ObjectType[2]; - UINT8 TailObjectType; - UINT16 Reserved; - -} ACPI_PACKAGE_INFO3; - -typedef struct acpi_package_info4 -{ - UINT8 Type; - UINT8 ObjectType1; - UINT8 Count1; - UINT8 SubObjectTypes; - UINT8 PkgCount; - UINT16 Reserved; - -} ACPI_PACKAGE_INFO4; - -typedef union acpi_predefined_info -{ - ACPI_NAME_INFO Info; - ACPI_PACKAGE_INFO RetInfo; - ACPI_PACKAGE_INFO2 RetInfo2; - ACPI_PACKAGE_INFO3 RetInfo3; - ACPI_PACKAGE_INFO4 RetInfo4; - -} ACPI_PREDEFINED_INFO; - -/* Reset to default packing */ - -#pragma pack() - - -/* Return object auto-repair info */ - -typedef ACPI_STATUS (*ACPI_OBJECT_CONVERTER) ( - struct acpi_namespace_node *Scope, - union acpi_operand_object *OriginalObject, - union acpi_operand_object **ConvertedObject); - -typedef struct acpi_simple_repair_info -{ - char Name[ACPI_NAMESEG_SIZE] ACPI_NONSTRING; - UINT32 UnexpectedBtypes; - UINT32 PackageIndex; - ACPI_OBJECT_CONVERTER ObjectConverter; - -} ACPI_SIMPLE_REPAIR_INFO; - - -/* - * Bitmapped return value types - * Note: the actual data types must be contiguous, a loop in nspredef.c - * depends on this. - */ -#define ACPI_RTYPE_ANY 0x00 -#define ACPI_RTYPE_NONE 0x01 -#define ACPI_RTYPE_INTEGER 0x02 -#define ACPI_RTYPE_STRING 0x04 -#define ACPI_RTYPE_BUFFER 0x08 -#define ACPI_RTYPE_PACKAGE 0x10 -#define ACPI_RTYPE_REFERENCE 0x20 -#define ACPI_RTYPE_ALL 0x3F - -#define ACPI_NUM_RTYPES 5 /* Number of actual object types */ - - -/* Info for running the _REG methods */ - -typedef struct acpi_reg_walk_info -{ - UINT32 Function; - UINT32 RegRunCount; - ACPI_ADR_SPACE_TYPE SpaceId; - -} ACPI_REG_WALK_INFO; - - -/***************************************************************************** - * - * Event typedefs and structs - * - ****************************************************************************/ - -/* Dispatch info for each host-installed SCI handler */ - -typedef struct acpi_sci_handler_info -{ - struct acpi_sci_handler_info *Next; - ACPI_SCI_HANDLER Address; /* Address of handler */ - void *Context; /* Context to be passed to handler */ - -} ACPI_SCI_HANDLER_INFO; - -/* Dispatch info for each GPE -- either a method or handler, cannot be both */ - -typedef struct acpi_gpe_handler_info -{ - ACPI_GPE_HANDLER Address; /* Address of handler, if any */ - void *Context; /* Context to be passed to handler */ - ACPI_NAMESPACE_NODE *MethodNode; /* Method node for this GPE level (saved) */ - UINT8 OriginalFlags; /* Original (pre-handler) GPE info */ - BOOLEAN OriginallyEnabled; /* True if GPE was originally enabled */ - -} ACPI_GPE_HANDLER_INFO; - -/* Notify info for implicit notify, multiple device objects */ - -typedef struct acpi_gpe_notify_info -{ - ACPI_NAMESPACE_NODE *DeviceNode; /* Device to be notified */ - struct acpi_gpe_notify_info *Next; - -} ACPI_GPE_NOTIFY_INFO; - -/* - * GPE dispatch info. At any time, the GPE can have at most one type - * of dispatch - Method, Handler, or Implicit Notify. - */ -typedef union acpi_gpe_dispatch_info -{ - ACPI_NAMESPACE_NODE *MethodNode; /* Method node for this GPE level */ - ACPI_GPE_HANDLER_INFO *Handler; /* Installed GPE handler */ - ACPI_GPE_NOTIFY_INFO *NotifyList; /* List of _PRW devices for implicit notifies */ - -} ACPI_GPE_DISPATCH_INFO; - -/* - * Information about a GPE, one per each GPE in an array. - * NOTE: Important to keep this struct as small as possible. - */ -typedef struct acpi_gpe_event_info -{ - union acpi_gpe_dispatch_info Dispatch; /* Either Method, Handler, or NotifyList */ - struct acpi_gpe_register_info *RegisterInfo; /* Backpointer to register info */ - UINT8 Flags; /* Misc info about this GPE */ - UINT8 GpeNumber; /* This GPE */ - UINT8 RuntimeCount; /* References to a run GPE */ - BOOLEAN DisableForDispatch; /* Masked during dispatching */ - -} ACPI_GPE_EVENT_INFO; - -/* Information about a GPE register pair, one per each status/enable pair in an array */ - -typedef struct acpi_gpe_register_info -{ - ACPI_GENERIC_ADDRESS StatusAddress; /* Address of status reg */ - ACPI_GENERIC_ADDRESS EnableAddress; /* Address of enable reg */ - UINT16 BaseGpeNumber; /* Base GPE number for this register */ - UINT8 EnableForWake; /* GPEs to keep enabled when sleeping */ - UINT8 EnableForRun; /* GPEs to keep enabled when running */ - UINT8 MaskForRun; /* GPEs to keep masked when running */ - UINT8 EnableMask; /* Current mask of enabled GPEs */ - -} ACPI_GPE_REGISTER_INFO; - -/* - * Information about a GPE register block, one per each installed block -- - * GPE0, GPE1, and one per each installed GPE Block Device. - */ -typedef struct acpi_gpe_block_info -{ - ACPI_NAMESPACE_NODE *Node; - struct acpi_gpe_block_info *Previous; - struct acpi_gpe_block_info *Next; - struct acpi_gpe_xrupt_info *XruptBlock; /* Backpointer to interrupt block */ - ACPI_GPE_REGISTER_INFO *RegisterInfo; /* One per GPE register pair */ - ACPI_GPE_EVENT_INFO *EventInfo; /* One for each GPE */ - UINT64 Address; /* Base address of the block */ - UINT32 RegisterCount; /* Number of register pairs in block */ - UINT16 GpeCount; /* Number of individual GPEs in block */ - UINT16 BlockBaseNumber;/* Base GPE number for this block */ - UINT8 SpaceId; - BOOLEAN Initialized; /* TRUE if this block is initialized */ - -} ACPI_GPE_BLOCK_INFO; - -/* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */ - -typedef struct acpi_gpe_xrupt_info -{ - struct acpi_gpe_xrupt_info *Previous; - struct acpi_gpe_xrupt_info *Next; - ACPI_GPE_BLOCK_INFO *GpeBlockListHead; /* List of GPE blocks for this xrupt */ - UINT32 InterruptNumber; /* System interrupt number */ - -} ACPI_GPE_XRUPT_INFO; - -typedef struct acpi_gpe_walk_info -{ - ACPI_NAMESPACE_NODE *GpeDevice; - ACPI_GPE_BLOCK_INFO *GpeBlock; - UINT16 Count; - ACPI_OWNER_ID OwnerId; - BOOLEAN ExecuteByOwnerId; - -} ACPI_GPE_WALK_INFO; - -typedef struct acpi_gpe_device_info -{ - UINT32 Index; - UINT32 NextBlockBaseIndex; - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *GpeDevice; - -} ACPI_GPE_DEVICE_INFO; - -typedef ACPI_STATUS (*ACPI_GPE_CALLBACK) ( - ACPI_GPE_XRUPT_INFO *GpeXruptInfo, - ACPI_GPE_BLOCK_INFO *GpeBlock, - void *Context); - - -/* Information about each particular fixed event */ - -typedef struct acpi_fixed_event_handler -{ - ACPI_EVENT_HANDLER Handler; /* Address of handler. */ - void *Context; /* Context to be passed to handler */ - -} ACPI_FIXED_EVENT_HANDLER; - -typedef struct acpi_fixed_event_info -{ - UINT8 StatusRegisterId; - UINT8 EnableRegisterId; - UINT16 StatusBitMask; - UINT16 EnableBitMask; - -} ACPI_FIXED_EVENT_INFO; - -/* Information used during field processing */ - -typedef struct acpi_field_info -{ - UINT8 SkipField; - UINT8 FieldFlag; - UINT32 PkgLength; - -} ACPI_FIELD_INFO; - -/* Information about the interrupt ID and _EVT of a GED device */ - -typedef struct acpi_ged_handler_info -{ - struct acpi_ged_handler_info *Next; - UINT32 IntId; /* The interrupt ID that triggers the execution of the EvtMethod. */ - ACPI_NAMESPACE_NODE *EvtMethod; /* The _EVT method to be executed when an interrupt with ID = IntID is received */ - -} ACPI_GED_HANDLER_INFO; - -/***************************************************************************** - * - * Generic "state" object for stacks - * - ****************************************************************************/ - -#define ACPI_CONTROL_NORMAL 0xC0 -#define ACPI_CONTROL_CONDITIONAL_EXECUTING 0xC1 -#define ACPI_CONTROL_PREDICATE_EXECUTING 0xC2 -#define ACPI_CONTROL_PREDICATE_FALSE 0xC3 -#define ACPI_CONTROL_PREDICATE_TRUE 0xC4 - - -#define ACPI_STATE_COMMON \ - void *Next; \ - UINT8 DescriptorType; /* To differentiate various internal objs */\ - UINT8 Flags; \ - UINT16 Value; \ - UINT16 State - - /* There are 2 bytes available here until the next natural alignment boundary */ - -typedef struct acpi_common_state -{ - ACPI_STATE_COMMON; -} ACPI_COMMON_STATE; - - -/* - * Update state - used to traverse complex objects such as packages - */ -typedef struct acpi_update_state -{ - ACPI_STATE_COMMON; - union acpi_operand_object *Object; - -} ACPI_UPDATE_STATE; - - -/* - * Pkg state - used to traverse nested package structures - */ -typedef struct acpi_pkg_state -{ - ACPI_STATE_COMMON; - UINT32 Index; - union acpi_operand_object *SourceObject; - union acpi_operand_object *DestObject; - struct acpi_walk_state *WalkState; - void *ThisTargetObj; - UINT32 NumPackages; - -} ACPI_PKG_STATE; - - -/* - * Control state - one per if/else and while constructs. - * Allows nesting of these constructs - */ -typedef struct acpi_control_state -{ - ACPI_STATE_COMMON; - UINT16 Opcode; - union acpi_parse_object *PredicateOp; - UINT8 *AmlPredicateStart; /* Start of if/while predicate */ - UINT8 *PackageEnd; /* End of if/while block */ - UINT64 LoopTimeout; /* While() loop timeout */ - -} ACPI_CONTROL_STATE; - - -/* - * Scope state - current scope during namespace lookups - */ -typedef struct acpi_scope_state -{ - ACPI_STATE_COMMON; - ACPI_NAMESPACE_NODE *Node; - -} ACPI_SCOPE_STATE; - - -typedef struct acpi_pscope_state -{ - ACPI_STATE_COMMON; - UINT32 ArgCount; /* Number of fixed arguments */ - union acpi_parse_object *Op; /* Current op being parsed */ - UINT8 *ArgEnd; /* Current argument end */ - UINT8 *PkgEnd; /* Current package end */ - UINT32 ArgList; /* Next argument to parse */ - -} ACPI_PSCOPE_STATE; - - -/* - * Thread state - one per thread across multiple walk states. Multiple walk - * states are created when there are nested control methods executing. - */ -typedef struct acpi_thread_state -{ - ACPI_STATE_COMMON; - UINT8 CurrentSyncLevel; /* Mutex Sync (nested acquire) level */ - struct acpi_walk_state *WalkStateList; /* Head of list of WalkStates for this thread */ - union acpi_operand_object *AcquiredMutexList; /* List of all currently acquired mutexes */ - ACPI_THREAD_ID ThreadId; /* Running thread ID */ - -} ACPI_THREAD_STATE; - - -/* - * Result values - used to accumulate the results of nested - * AML arguments - */ -typedef struct acpi_result_values -{ - ACPI_STATE_COMMON; - union acpi_operand_object *ObjDesc [ACPI_RESULTS_FRAME_OBJ_NUM]; - -} ACPI_RESULT_VALUES; - - -typedef -ACPI_STATUS (*ACPI_PARSE_DOWNWARDS) ( - struct acpi_walk_state *WalkState, - union acpi_parse_object **OutOp); - -typedef -ACPI_STATUS (*ACPI_PARSE_UPWARDS) ( - struct acpi_walk_state *WalkState); - - -/* Global handlers for AML Notifies */ - -typedef struct acpi_global_notify_handler -{ - ACPI_NOTIFY_HANDLER Handler; - void *Context; - -} ACPI_GLOBAL_NOTIFY_HANDLER; - -/* - * Notify info - used to pass info to the deferred notify - * handler/dispatcher. - */ -typedef struct acpi_notify_info -{ - ACPI_STATE_COMMON; - UINT8 HandlerListId; - ACPI_NAMESPACE_NODE *Node; - union acpi_operand_object *HandlerListHead; - ACPI_GLOBAL_NOTIFY_HANDLER *Global; - -} ACPI_NOTIFY_INFO; - - -/* Generic state is union of structs above */ - -typedef union acpi_generic_state -{ - ACPI_COMMON_STATE Common; - ACPI_CONTROL_STATE Control; - ACPI_UPDATE_STATE Update; - ACPI_SCOPE_STATE Scope; - ACPI_PSCOPE_STATE ParseScope; - ACPI_PKG_STATE Pkg; - ACPI_THREAD_STATE Thread; - ACPI_RESULT_VALUES Results; - ACPI_NOTIFY_INFO Notify; - -} ACPI_GENERIC_STATE; - - -/***************************************************************************** - * - * Interpreter typedefs and structs - * - ****************************************************************************/ - -typedef -ACPI_STATUS (*ACPI_EXECUTE_OP) ( - struct acpi_walk_state *WalkState); - -/* Address Range info block */ - -typedef struct acpi_address_range -{ - struct acpi_address_range *Next; - ACPI_NAMESPACE_NODE *RegionNode; - ACPI_PHYSICAL_ADDRESS StartAddress; - ACPI_PHYSICAL_ADDRESS EndAddress; - -} ACPI_ADDRESS_RANGE; - - -/***************************************************************************** - * - * Parser typedefs and structs - * - ****************************************************************************/ - -/* - * AML opcode, name, and argument layout - */ -typedef struct acpi_opcode_info -{ -#if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT) - char *Name; /* Opcode name (disassembler/debug only) */ -#endif - UINT32 ParseArgs; /* Grammar/Parse time arguments */ - UINT32 RuntimeArgs; /* Interpret time arguments */ - UINT16 Flags; /* Misc flags */ - UINT8 ObjectType; /* Corresponding internal object type */ - UINT8 Class; /* Opcode class */ - UINT8 Type; /* Opcode type */ - -} ACPI_OPCODE_INFO; - -/* Structure for Resource Tag information */ - -typedef struct acpi_tag_info -{ - UINT32 BitOffset; - UINT32 BitLength; - -} ACPI_TAG_INFO; - -/* Value associated with the parse object */ - -typedef union acpi_parse_value -{ - UINT64 Integer; /* Integer constant (Up to 64 bits) */ - UINT32 Size; /* bytelist or field size */ - char *String; /* NULL terminated string */ - UINT8 *Buffer; /* buffer or string */ - char *Name; /* NULL terminated string */ - union acpi_parse_object *Arg; /* arguments and contained ops */ - ACPI_TAG_INFO Tag; /* Resource descriptor tag info */ - -} ACPI_PARSE_VALUE; - - -#if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT) -#define ACPI_DISASM_ONLY_MEMBERS(a) a; -#else -#define ACPI_DISASM_ONLY_MEMBERS(a) -#endif - -#if defined(ACPI_ASL_COMPILER) -#define ACPI_CONVERTER_ONLY_MEMBERS(a) a; -#else -#define ACPI_CONVERTER_ONLY_MEMBERS(a) -#endif - -#define ACPI_PARSE_COMMON \ - union acpi_parse_object *Parent; /* Parent op */\ - UINT8 DescriptorType; /* To differentiate various internal objs */\ - UINT8 Flags; /* Type of Op */\ - UINT16 AmlOpcode; /* AML opcode */\ - UINT8 *Aml; /* Address of declaration in AML */\ - union acpi_parse_object *Next; /* Next op */\ - ACPI_NAMESPACE_NODE *Node; /* For use by interpreter */\ - ACPI_PARSE_VALUE Value; /* Value or args associated with the opcode */\ - UINT8 ArgListLength; /* Number of elements in the arg list */\ - ACPI_DISASM_ONLY_MEMBERS (\ - UINT16 DisasmFlags; /* Used during AML disassembly */\ - UINT8 DisasmOpcode; /* Subtype used for disassembly */\ - char *OperatorSymbol; /* Used for C-style operator name strings */\ - char AmlOpName[16]) /* Op name (debug only) */\ - ACPI_CONVERTER_ONLY_MEMBERS (\ - char *InlineComment; /* Inline comment */\ - char *EndNodeComment; /* End of node comment */\ - char *NameComment; /* Comment associated with the first parameter of the name node */\ - char *CloseBraceComment; /* Comments that come after } on the same as } */\ - ACPI_COMMENT_NODE *CommentList; /* comments that appears before this node */\ - ACPI_COMMENT_NODE *EndBlkComment; /* comments that at the end of a block but before ) or } */\ - char *CvFilename; /* Filename associated with this node. Used for ASL/ASL+ converter */\ - char *CvParentFilename) /* Parent filename associated with this node. Used for ASL/ASL+ converter */ - - -/* categories of comments */ - -typedef enum -{ - STANDARD_COMMENT = 1, - INLINE_COMMENT, - ENDNODE_COMMENT, - OPENBRACE_COMMENT, - CLOSE_BRACE_COMMENT, - STD_DEFBLK_COMMENT, - END_DEFBLK_COMMENT, - FILENAME_COMMENT, - PARENTFILENAME_COMMENT, - ENDBLK_COMMENT, - INCLUDE_COMMENT - -} ASL_COMMENT_TYPES; - - -/* Internal opcodes for DisasmOpcode field above */ - -#define ACPI_DASM_BUFFER 0x00 /* Buffer is a simple data buffer */ -#define ACPI_DASM_RESOURCE 0x01 /* Buffer is a Resource Descriptor */ -#define ACPI_DASM_STRING 0x02 /* Buffer is a ASCII string */ -#define ACPI_DASM_UNICODE 0x03 /* Buffer is a Unicode string */ -#define ACPI_DASM_PLD_METHOD 0x04 /* Buffer is a _PLD method bit-packed buffer */ -#define ACPI_DASM_UUID 0x05 /* Buffer is a UUID/GUID */ -#define ACPI_DASM_EISAID 0x06 /* Integer is an EISAID */ -#define ACPI_DASM_MATCHOP 0x07 /* Parent opcode is a Match() operator */ -#define ACPI_DASM_LNOT_PREFIX 0x08 /* Start of a LNotEqual (etc.) pair of opcodes */ -#define ACPI_DASM_LNOT_SUFFIX 0x09 /* End of a LNotEqual (etc.) pair of opcodes */ -#define ACPI_DASM_HID_STRING 0x0A /* String is a _HID or _CID */ -#define ACPI_DASM_IGNORE_SINGLE 0x0B /* Ignore the opcode but not it's children */ -#define ACPI_DASM_SWITCH 0x0C /* While is a Switch */ -#define ACPI_DASM_SWITCH_PREDICATE 0x0D /* Object is a predicate for a Switch or Case block */ -#define ACPI_DASM_CASE 0x0E /* If/Else is a Case in a Switch/Case block */ -#define ACPI_DASM_DEFAULT 0x0F /* Else is a Default in a Switch/Case block */ - - -/* - * List struct used in the -ca option - */ -typedef struct acpi_comment_node -{ - char *Comment; - struct acpi_comment_node *Next; - -} ACPI_COMMENT_NODE; - - -typedef struct acpi_comment_addr_node -{ - UINT8 *Addr; - struct acpi_comment_addr_node *Next; -} ACPI_COMMENT_ADDR_NODE; - -/* - * File node - used for "Include" operator file stack and - * dependency tree for the -ca option - */ -typedef struct acpi_file_node -{ - void *File; - char *Filename; - char *FileStart; /* Points to AML and indicates when the AML for this particular file starts. */ - char *FileEnd; /* Points to AML and indicates when the AML for this particular file ends. */ - struct acpi_file_node *Next; - struct acpi_file_node *Parent; - BOOLEAN IncludeWritten; - ACPI_COMMENT_NODE *IncludeComment; - -} ACPI_FILE_NODE; - - -/* - * Generic operation (for example: If, While, Store) - */ -typedef struct acpi_parse_obj_common -{ - ACPI_PARSE_COMMON -} ACPI_PARSE_OBJ_COMMON; - - -/* - * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and OpRegions), - * and bytelists. - */ -typedef struct acpi_parse_obj_named -{ - ACPI_PARSE_COMMON - char *Path; - UINT8 *Data; /* AML body or bytelist data */ - UINT32 Length; /* AML length */ - UINT32 Name; /* 4-byte name or zero if no name */ - -} ACPI_PARSE_OBJ_NAMED; - - -/* This version is used by the iASL compiler only */ - -#define ACPI_MAX_PARSEOP_NAME 20 - -typedef struct acpi_parse_obj_asl -{ - ACPI_PARSE_COMMON - union acpi_parse_object *Child; - union acpi_parse_object *ParentMethod; - char *Filename; - BOOLEAN FileChanged; - char *ParentFilename; - char *ExternalName; - char *Namepath; - char NameSeg[4]; - UINT32 ExtraValue; - UINT32 Column; - UINT32 LineNumber; - UINT32 LogicalLineNumber; - UINT32 LogicalByteOffset; - UINT32 EndLine; - UINT32 EndLogicalLine; - UINT32 AcpiBtype; - UINT32 AmlLength; - UINT32 AmlSubtreeLength; - UINT32 FinalAmlLength; - UINT32 FinalAmlOffset; - UINT32 CompileFlags; - UINT16 ParseOpcode; - UINT8 AmlOpcodeLength; - UINT8 AmlPkgLenBytes; - UINT8 Extra; - char ParseOpName[ACPI_MAX_PARSEOP_NAME]; - -} ACPI_PARSE_OBJ_ASL; - -typedef union acpi_parse_object -{ - ACPI_PARSE_OBJ_COMMON Common; - ACPI_PARSE_OBJ_NAMED Named; - ACPI_PARSE_OBJ_ASL Asl; - -} ACPI_PARSE_OBJECT; - -typedef struct asl_comment_state -{ - UINT8 CommentType; - UINT32 SpacesBefore; - ACPI_PARSE_OBJECT *LatestParseOp; - ACPI_PARSE_OBJECT *ParsingParenBraceNode; - BOOLEAN CaptureComments; - -} ASL_COMMENT_STATE; - - -/* - * Parse state - one state per parser invocation and each control - * method. - */ -typedef struct acpi_parse_state -{ - UINT8 *AmlStart; /* First AML byte */ - UINT8 *Aml; /* Next AML byte */ - UINT8 *AmlEnd; /* (last + 1) AML byte */ - UINT8 *PkgStart; /* Current package begin */ - UINT8 *PkgEnd; /* Current package end */ - union acpi_parse_object *StartOp; /* Root of parse tree */ - struct acpi_namespace_node *StartNode; - union acpi_generic_state *Scope; /* Current scope */ - union acpi_parse_object *StartScope; - UINT32 AmlSize; - -} ACPI_PARSE_STATE; - - -/* Parse object flags */ - -#define ACPI_PARSEOP_GENERIC 0x01 -#define ACPI_PARSEOP_NAMED_OBJECT 0x02 -#define ACPI_PARSEOP_DEFERRED 0x04 -#define ACPI_PARSEOP_BYTELIST 0x08 -#define ACPI_PARSEOP_IN_STACK 0x10 -#define ACPI_PARSEOP_TARGET 0x20 -#define ACPI_PARSEOP_IN_CACHE 0x80 - -/* Parse object DisasmFlags */ - -#define ACPI_PARSEOP_IGNORE 0x0001 -#define ACPI_PARSEOP_PARAMETER_LIST 0x0002 -#define ACPI_PARSEOP_EMPTY_TERMLIST 0x0004 -#define ACPI_PARSEOP_PREDEFINED_CHECKED 0x0008 -#define ACPI_PARSEOP_CLOSING_PAREN 0x0010 -#define ACPI_PARSEOP_COMPOUND_ASSIGNMENT 0x0020 -#define ACPI_PARSEOP_ASSIGNMENT 0x0040 -#define ACPI_PARSEOP_ELSEIF 0x0080 -#define ACPI_PARSEOP_LEGACY_ASL_ONLY 0x0100 - - -/***************************************************************************** - * - * Hardware (ACPI registers) and PNP - * - ****************************************************************************/ - -typedef struct acpi_bit_register_info -{ - UINT8 ParentRegister; - UINT8 BitPosition; - UINT16 AccessBitMask; - -} ACPI_BIT_REGISTER_INFO; - - -/* - * Some ACPI registers have bits that must be ignored -- meaning that they - * must be preserved. - */ -#define ACPI_PM1_STATUS_PRESERVED_BITS 0x0800 /* Bit 11 */ - -/* Write-only bits must be zeroed by software */ - -#define ACPI_PM1_CONTROL_WRITEONLY_BITS 0x2004 /* Bits 13, 2 */ - -/* For control registers, both ignored and reserved bits must be preserved */ - -/* - * For PM1 control, the SCI enable bit (bit 0, SCI_EN) is defined by the - * ACPI specification to be a "preserved" bit - "OSPM always preserves this - * bit position", section 4.7.3.2.1. However, on some machines the OS must - * write a one to this bit after resume for the machine to work properly. - * To enable this, we no longer attempt to preserve this bit. No machines - * are known to fail if the bit is not preserved. (May 2009) - */ -#define ACPI_PM1_CONTROL_IGNORED_BITS 0x0200 /* Bit 9 */ -#define ACPI_PM1_CONTROL_RESERVED_BITS 0xC1F8 /* Bits 14-15, 3-8 */ -#define ACPI_PM1_CONTROL_PRESERVED_BITS \ - (ACPI_PM1_CONTROL_IGNORED_BITS | ACPI_PM1_CONTROL_RESERVED_BITS) - -#define ACPI_PM2_CONTROL_PRESERVED_BITS 0xFFFFFFFE /* All except bit 0 */ - -/* - * Register IDs - * These are the full ACPI registers - */ -#define ACPI_REGISTER_PM1_STATUS 0x01 -#define ACPI_REGISTER_PM1_ENABLE 0x02 -#define ACPI_REGISTER_PM1_CONTROL 0x03 -#define ACPI_REGISTER_PM2_CONTROL 0x04 -#define ACPI_REGISTER_PM_TIMER 0x05 -#define ACPI_REGISTER_PROCESSOR_BLOCK 0x06 -#define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x07 - - -/* Masks used to access the BitRegisters */ - -#define ACPI_BITMASK_TIMER_STATUS 0x0001 -#define ACPI_BITMASK_BUS_MASTER_STATUS 0x0010 -#define ACPI_BITMASK_GLOBAL_LOCK_STATUS 0x0020 -#define ACPI_BITMASK_POWER_BUTTON_STATUS 0x0100 -#define ACPI_BITMASK_SLEEP_BUTTON_STATUS 0x0200 -#define ACPI_BITMASK_RT_CLOCK_STATUS 0x0400 -#define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */ -#define ACPI_BITMASK_WAKE_STATUS 0x8000 - -#define ACPI_BITMASK_ALL_FIXED_STATUS (\ - ACPI_BITMASK_TIMER_STATUS | \ - ACPI_BITMASK_BUS_MASTER_STATUS | \ - ACPI_BITMASK_GLOBAL_LOCK_STATUS | \ - ACPI_BITMASK_POWER_BUTTON_STATUS | \ - ACPI_BITMASK_SLEEP_BUTTON_STATUS | \ - ACPI_BITMASK_RT_CLOCK_STATUS | \ - ACPI_BITMASK_PCIEXP_WAKE_STATUS | \ - ACPI_BITMASK_WAKE_STATUS) - -#define ACPI_BITMASK_TIMER_ENABLE 0x0001 -#define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020 -#define ACPI_BITMASK_POWER_BUTTON_ENABLE 0x0100 -#define ACPI_BITMASK_SLEEP_BUTTON_ENABLE 0x0200 -#define ACPI_BITMASK_RT_CLOCK_ENABLE 0x0400 -#define ACPI_BITMASK_PCIEXP_WAKE_DISABLE 0x4000 /* ACPI 3.0 */ - -#define ACPI_BITMASK_SCI_ENABLE 0x0001 -#define ACPI_BITMASK_BUS_MASTER_RLD 0x0002 -#define ACPI_BITMASK_GLOBAL_LOCK_RELEASE 0x0004 -#define ACPI_BITMASK_SLEEP_TYPE 0x1C00 -#define ACPI_BITMASK_SLEEP_ENABLE 0x2000 - -#define ACPI_BITMASK_ARB_DISABLE 0x0001 - - -/* Raw bit position of each BitRegister */ - -#define ACPI_BITPOSITION_TIMER_STATUS 0x00 -#define ACPI_BITPOSITION_BUS_MASTER_STATUS 0x04 -#define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS 0x05 -#define ACPI_BITPOSITION_POWER_BUTTON_STATUS 0x08 -#define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS 0x09 -#define ACPI_BITPOSITION_RT_CLOCK_STATUS 0x0A -#define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS 0x0E /* ACPI 3.0 */ -#define ACPI_BITPOSITION_WAKE_STATUS 0x0F - -#define ACPI_BITPOSITION_TIMER_ENABLE 0x00 -#define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE 0x05 -#define ACPI_BITPOSITION_POWER_BUTTON_ENABLE 0x08 -#define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE 0x09 -#define ACPI_BITPOSITION_RT_CLOCK_ENABLE 0x0A -#define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE 0x0E /* ACPI 3.0 */ - -#define ACPI_BITPOSITION_SCI_ENABLE 0x00 -#define ACPI_BITPOSITION_BUS_MASTER_RLD 0x01 -#define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE 0x02 -#define ACPI_BITPOSITION_SLEEP_TYPE 0x0A -#define ACPI_BITPOSITION_SLEEP_ENABLE 0x0D - -#define ACPI_BITPOSITION_ARB_DISABLE 0x00 - - -/* Structs and definitions for _OSI support and I/O port validation */ - -#define ACPI_ALWAYS_ILLEGAL 0x00 - -typedef struct acpi_interface_info -{ - char *Name; - struct acpi_interface_info *Next; - UINT8 Flags; - UINT8 Value; - -} ACPI_INTERFACE_INFO; - -#define ACPI_OSI_INVALID 0x01 -#define ACPI_OSI_DYNAMIC 0x02 -#define ACPI_OSI_FEATURE 0x04 -#define ACPI_OSI_DEFAULT_INVALID 0x08 -#define ACPI_OSI_OPTIONAL_FEATURE (ACPI_OSI_FEATURE | ACPI_OSI_DEFAULT_INVALID | ACPI_OSI_INVALID) - -typedef struct acpi_port_info -{ - char *Name; - UINT16 Start; - UINT16 End; - UINT8 OsiDependency; - -} ACPI_PORT_INFO; - - -/***************************************************************************** - * - * Resource descriptors - * - ****************************************************************************/ - -/* ResourceType values */ - -#define ACPI_ADDRESS_TYPE_MEMORY_RANGE 0 -#define ACPI_ADDRESS_TYPE_IO_RANGE 1 -#define ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE 2 - -#define ACPI_ADDRESS_TYPE_PCC_NUMBER 0xA - -/* Resource descriptor types and masks */ - -#define ACPI_RESOURCE_NAME_LARGE 0x80 -#define ACPI_RESOURCE_NAME_SMALL 0x00 - -#define ACPI_RESOURCE_NAME_SMALL_MASK 0x78 /* Bits 6:3 contain the type */ -#define ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK 0x07 /* Bits 2:0 contain the length */ -#define ACPI_RESOURCE_NAME_LARGE_MASK 0x7F /* Bits 6:0 contain the type */ - - -/* - * Small resource descriptor "names" as defined by the ACPI specification. - * Note: Bits 2:0 are used for the descriptor length - */ -#define ACPI_RESOURCE_NAME_IRQ 0x20 -#define ACPI_RESOURCE_NAME_DMA 0x28 -#define ACPI_RESOURCE_NAME_START_DEPENDENT 0x30 -#define ACPI_RESOURCE_NAME_END_DEPENDENT 0x38 -#define ACPI_RESOURCE_NAME_IO 0x40 -#define ACPI_RESOURCE_NAME_FIXED_IO 0x48 -#define ACPI_RESOURCE_NAME_FIXED_DMA 0x50 -#define ACPI_RESOURCE_NAME_RESERVED_S2 0x58 -#define ACPI_RESOURCE_NAME_RESERVED_S3 0x60 -#define ACPI_RESOURCE_NAME_RESERVED_S4 0x68 -#define ACPI_RESOURCE_NAME_VENDOR_SMALL 0x70 -#define ACPI_RESOURCE_NAME_END_TAG 0x78 - -/* - * Large resource descriptor "names" as defined by the ACPI specification. - * Note: includes the Large Descriptor bit in bit[7] - */ -#define ACPI_RESOURCE_NAME_MEMORY24 0x81 -#define ACPI_RESOURCE_NAME_GENERIC_REGISTER 0x82 -#define ACPI_RESOURCE_NAME_RESERVED_L1 0x83 -#define ACPI_RESOURCE_NAME_VENDOR_LARGE 0x84 -#define ACPI_RESOURCE_NAME_MEMORY32 0x85 -#define ACPI_RESOURCE_NAME_FIXED_MEMORY32 0x86 -#define ACPI_RESOURCE_NAME_ADDRESS32 0x87 -#define ACPI_RESOURCE_NAME_ADDRESS16 0x88 -#define ACPI_RESOURCE_NAME_EXTENDED_IRQ 0x89 -#define ACPI_RESOURCE_NAME_ADDRESS64 0x8A -#define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 0x8B -#define ACPI_RESOURCE_NAME_GPIO 0x8C -#define ACPI_RESOURCE_NAME_PIN_FUNCTION 0x8D -#define ACPI_RESOURCE_NAME_SERIAL_BUS 0x8E -#define ACPI_RESOURCE_NAME_PIN_CONFIG 0x8F -#define ACPI_RESOURCE_NAME_PIN_GROUP 0x90 -#define ACPI_RESOURCE_NAME_PIN_GROUP_FUNCTION 0x91 -#define ACPI_RESOURCE_NAME_PIN_GROUP_CONFIG 0x92 -#define ACPI_RESOURCE_NAME_CLOCK_INPUT 0x93 -#define ACPI_RESOURCE_NAME_LARGE_MAX 0x93 - - -/***************************************************************************** - * - * Miscellaneous - * - ****************************************************************************/ - -#define ACPI_ASCII_ZERO 0x30 - - -/***************************************************************************** - * - * Disassembler - * - ****************************************************************************/ - -typedef struct acpi_external_list -{ - char *Path; - char *InternalPath; - struct acpi_external_list *Next; - UINT32 Value; - UINT16 Length; - UINT16 Flags; - UINT8 Type; - -} ACPI_EXTERNAL_LIST; - -/* Values for Flags field above */ - -#define ACPI_EXT_RESOLVED_REFERENCE 0x01 /* Object was resolved during cross ref */ -#define ACPI_EXT_ORIGIN_FROM_FILE 0x02 /* External came from a file */ -#define ACPI_EXT_INTERNAL_PATH_ALLOCATED 0x04 /* Deallocate internal path on completion */ -#define ACPI_EXT_EXTERNAL_EMITTED 0x08 /* External() statement has been emitted */ -#define ACPI_EXT_ORIGIN_FROM_OPCODE 0x10 /* External came from a External() opcode */ -#define ACPI_EXT_CONFLICTING_DECLARATION 0x20 /* External has a conflicting declaration within AML */ - - -typedef struct acpi_external_file -{ - char *Path; - struct acpi_external_file *Next; - -} ACPI_EXTERNAL_FILE; - - -typedef struct acpi_parse_object_list -{ - ACPI_PARSE_OBJECT *Op; - struct acpi_parse_object_list *Next; - -} ACPI_PARSE_OBJECT_LIST; - -/***************************************************************************** - * - * Debugger - * - ****************************************************************************/ - -typedef struct acpi_db_method_info -{ - ACPI_HANDLE Method; - ACPI_HANDLE MainThreadGate; - ACPI_HANDLE ThreadCompleteGate; - ACPI_HANDLE InfoGate; - ACPI_THREAD_ID *Threads; - UINT32 NumThreads; - UINT32 NumCreated; - UINT32 NumCompleted; - - char *Name; - UINT32 Flags; - UINT32 NumLoops; - char Pathname[ACPI_DB_LINE_BUFFER_SIZE]; - char **Args; - ACPI_OBJECT_TYPE *Types; - - /* - * Arguments to be passed to method for the commands Threads and - * Background. Note, ACPI specifies a maximum of 7 arguments (0 - 6). - * - * For the Threads command, the Number of threads, ID of current - * thread and Index of current thread inside all them created. - */ - char InitArgs; -#ifdef ACPI_DEBUGGER - ACPI_OBJECT_TYPE ArgTypes[ACPI_METHOD_NUM_ARGS]; -#endif - char *Arguments[ACPI_METHOD_NUM_ARGS]; - char NumThreadsStr[11]; - char IdOfThreadStr[11]; - char IndexOfThreadStr[11]; - -} ACPI_DB_METHOD_INFO; - -typedef struct acpi_integrity_info -{ - UINT32 Nodes; - UINT32 Objects; - -} ACPI_INTEGRITY_INFO; - - -#define ACPI_DB_DISABLE_OUTPUT 0x00 -#define ACPI_DB_REDIRECTABLE_OUTPUT 0x01 -#define ACPI_DB_CONSOLE_OUTPUT 0x02 -#define ACPI_DB_DUPLICATE_OUTPUT 0x03 - - -typedef struct acpi_object_info -{ - UINT32 Types[ACPI_TOTAL_TYPES]; - -} ACPI_OBJECT_INFO; - - -/***************************************************************************** - * - * Debug - * - ****************************************************************************/ - -/* Entry for a memory allocation (debug only) */ - -#define ACPI_MEM_MALLOC 0 -#define ACPI_MEM_CALLOC 1 -#define ACPI_MAX_MODULE_NAME 16 - -#define ACPI_COMMON_DEBUG_MEM_HEADER \ - struct acpi_debug_mem_block *Previous; \ - struct acpi_debug_mem_block *Next; \ - UINT32 Size; \ - UINT32 Component; \ - UINT32 Line; \ - char Module[ACPI_MAX_MODULE_NAME]; \ - UINT8 AllocType; - -typedef struct acpi_debug_mem_header -{ - ACPI_COMMON_DEBUG_MEM_HEADER - -} ACPI_DEBUG_MEM_HEADER; - -typedef struct acpi_debug_mem_block -{ - ACPI_COMMON_DEBUG_MEM_HEADER - UINT64 UserSpace; - -} ACPI_DEBUG_MEM_BLOCK; - - -#define ACPI_MEM_LIST_GLOBAL 0 -#define ACPI_MEM_LIST_NSNODE 1 -#define ACPI_MEM_LIST_MAX 1 -#define ACPI_NUM_MEM_LISTS 2 - - -/***************************************************************************** - * - * Info/help support - * - ****************************************************************************/ - -typedef struct ah_predefined_name -{ - char *Name; - char *Description; -#ifndef ACPI_ASL_COMPILER - char *Action; -#endif - -} AH_PREDEFINED_NAME; - -typedef struct ah_device_id -{ - char *Name; - char *Description; - -} AH_DEVICE_ID; - -typedef struct ah_uuid -{ - char *Description; - char *String; - -} AH_UUID; - -typedef struct ah_table -{ - char *Signature; - char *Description; - -} AH_TABLE; - -#endif /* __ACLOCAL_H__ */ diff --git a/drivers/include/acpica/acmacros.h b/drivers/include/acpica/acmacros.h deleted file mode 100644 index eabe403..0000000 --- a/drivers/include/acpica/acmacros.h +++ /dev/null @@ -1,647 +0,0 @@ -/****************************************************************************** - * - * Name: acmacros.h - C macros for the entire subsystem. - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef __ACMACROS_H__ -#define __ACMACROS_H__ - - -/* - * Extract data using a pointer. Any more than a byte and we - * get into potential alignment issues -- see the STORE macros below. - * Use with care. - */ -#define ACPI_CAST8(ptr) ACPI_CAST_PTR (UINT8, (ptr)) -#define ACPI_CAST16(ptr) ACPI_CAST_PTR (UINT16, (ptr)) -#define ACPI_CAST32(ptr) ACPI_CAST_PTR (UINT32, (ptr)) -#define ACPI_CAST64(ptr) ACPI_CAST_PTR (UINT64, (ptr)) -#define ACPI_GET8(ptr) (*ACPI_CAST8 (ptr)) -#define ACPI_GET16(ptr) (*ACPI_CAST16 (ptr)) -#define ACPI_GET32(ptr) (*ACPI_CAST32 (ptr)) -#define ACPI_GET64(ptr) (*ACPI_CAST64 (ptr)) -#define ACPI_SET8(ptr, val) (*ACPI_CAST8 (ptr) = (UINT8) (val)) -#define ACPI_SET16(ptr, val) (*ACPI_CAST16 (ptr) = (UINT16) (val)) -#define ACPI_SET32(ptr, val) (*ACPI_CAST32 (ptr) = (UINT32) (val)) -#define ACPI_SET64(ptr, val) (*ACPI_CAST64 (ptr) = (UINT64) (val)) - -/* - * printf() format helper. This macro is a workaround for the difficulties - * with emitting 64-bit integers and 64-bit pointers with the same code - * for both 32-bit and 64-bit hosts. - */ -#define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i), ACPI_LODWORD(i) - - -/* - * Macros for moving data around to/from buffers that are possibly unaligned. - * If the hardware supports the transfer of unaligned data, just do the store. - * Otherwise, we have to move one byte at a time. - */ -#ifdef ACPI_BIG_ENDIAN -/* - * Macros for big-endian machines - */ - -/* These macros reverse the bytes during the move, converting little-endian to big endian */ - - /* Big Endian <== Little Endian */ - /* Hi...Lo Lo...Hi */ -/* 16-bit source, 16/32/64 destination */ - -#define ACPI_MOVE_16_TO_16(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[1];\ - (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[0];} - -#define ACPI_MOVE_16_TO_32(d, s) {(*(UINT32 *)(void *)(d))=0;\ - ((UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[1];\ - ((UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[0];} - -#define ACPI_MOVE_16_TO_64(d, s) {(*(UINT64 *)(void *)(d))=0;\ - ((UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[1];\ - ((UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[0];} - -/* 32-bit source, 16/32/64 destination */ - -#define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */ - -#define ACPI_MOVE_32_TO_32(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[3];\ - (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[2];\ - (( UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[1];\ - (( UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[0];} - -#define ACPI_MOVE_32_TO_64(d, s) {(*(UINT64 *)(void *)(d))=0;\ - ((UINT8 *)(void *)(d))[4] = ((UINT8 *)(void *)(s))[3];\ - ((UINT8 *)(void *)(d))[5] = ((UINT8 *)(void *)(s))[2];\ - ((UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[1];\ - ((UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[0];} - -/* 64-bit source, 16/32/64 destination */ - -#define ACPI_MOVE_64_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */ - -#define ACPI_MOVE_64_TO_32(d, s) ACPI_MOVE_32_TO_32(d, s) /* Truncate to 32 */ - -#define ACPI_MOVE_64_TO_64(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[7];\ - (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[6];\ - (( UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[5];\ - (( UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[4];\ - (( UINT8 *)(void *)(d))[4] = ((UINT8 *)(void *)(s))[3];\ - (( UINT8 *)(void *)(d))[5] = ((UINT8 *)(void *)(s))[2];\ - (( UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[1];\ - (( UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[0];} -#else -/* - * Macros for little-endian machines - */ - -#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED - -/* The hardware supports unaligned transfers, just do the little-endian move */ - -/* 16-bit source, 16/32/64 destination */ - -#define ACPI_MOVE_16_TO_16(d, s) *(UINT16 *)(void *)(d) = *(UINT16 *)(void *)(s) -#define ACPI_MOVE_16_TO_32(d, s) *(UINT32 *)(void *)(d) = *(UINT16 *)(void *)(s) -#define ACPI_MOVE_16_TO_64(d, s) *(UINT64 *)(void *)(d) = *(UINT16 *)(void *)(s) - -/* 32-bit source, 16/32/64 destination */ - -#define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */ -#define ACPI_MOVE_32_TO_32(d, s) *(UINT32 *)(void *)(d) = *(UINT32 *)(void *)(s) -#define ACPI_MOVE_32_TO_64(d, s) *(UINT64 *)(void *)(d) = *(UINT32 *)(void *)(s) - -/* 64-bit source, 16/32/64 destination */ - -#define ACPI_MOVE_64_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */ -#define ACPI_MOVE_64_TO_32(d, s) ACPI_MOVE_32_TO_32(d, s) /* Truncate to 32 */ -#define ACPI_MOVE_64_TO_64(d, s) *(UINT64 *)(void *)(d) = *(UINT64 *)(void *)(s) - -#else -/* - * The hardware does not support unaligned transfers. We must move the - * data one byte at a time. These macros work whether the source or - * the destination (or both) is/are unaligned. (Little-endian move) - */ - -/* 16-bit source, 16/32/64 destination */ - -#define ACPI_MOVE_16_TO_16(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\ - (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];} - -#define ACPI_MOVE_16_TO_32(d, s) {(*(UINT32 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d, s);} -#define ACPI_MOVE_16_TO_64(d, s) {(*(UINT64 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d, s);} - -/* 32-bit source, 16/32/64 destination */ - -#define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */ - -#define ACPI_MOVE_32_TO_32(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\ - (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];\ - (( UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[2];\ - (( UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[3];} - -#define ACPI_MOVE_32_TO_64(d, s) {(*(UINT64 *)(void *)(d)) = 0; ACPI_MOVE_32_TO_32(d, s);} - -/* 64-bit source, 16/32/64 destination */ - -#define ACPI_MOVE_64_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */ -#define ACPI_MOVE_64_TO_32(d, s) ACPI_MOVE_32_TO_32(d, s) /* Truncate to 32 */ -#define ACPI_MOVE_64_TO_64(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\ - (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];\ - (( UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[2];\ - (( UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[3];\ - (( UINT8 *)(void *)(d))[4] = ((UINT8 *)(void *)(s))[4];\ - (( UINT8 *)(void *)(d))[5] = ((UINT8 *)(void *)(s))[5];\ - (( UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[6];\ - (( UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[7];} -#endif -#endif - - -/* - * Fast power-of-two math macros for non-optimized compilers - */ -#define _ACPI_DIV(value, PowerOf2) ((UINT32) ((value) >> (PowerOf2))) -#define _ACPI_MUL(value, PowerOf2) ((UINT32) ((value) << (PowerOf2))) -#define _ACPI_MOD(value, Divisor) ((UINT32) ((value) & ((Divisor) -1))) - -#define ACPI_DIV_2(a) _ACPI_DIV(a, 1) -#define ACPI_MUL_2(a) _ACPI_MUL(a, 1) -#define ACPI_MOD_2(a) _ACPI_MOD(a, 2) - -#define ACPI_DIV_4(a) _ACPI_DIV(a, 2) -#define ACPI_MUL_4(a) _ACPI_MUL(a, 2) -#define ACPI_MOD_4(a) _ACPI_MOD(a, 4) - -#define ACPI_DIV_8(a) _ACPI_DIV(a, 3) -#define ACPI_MUL_8(a) _ACPI_MUL(a, 3) -#define ACPI_MOD_8(a) _ACPI_MOD(a, 8) - -#define ACPI_DIV_16(a) _ACPI_DIV(a, 4) -#define ACPI_MUL_16(a) _ACPI_MUL(a, 4) -#define ACPI_MOD_16(a) _ACPI_MOD(a, 16) - -#define ACPI_DIV_32(a) _ACPI_DIV(a, 5) -#define ACPI_MUL_32(a) _ACPI_MUL(a, 5) -#define ACPI_MOD_32(a) _ACPI_MOD(a, 32) - -/* Test for ASCII character */ - -#define ACPI_IS_ASCII(c) ((c) < 0x80) - -/* Signed integers */ - -#define ACPI_SIGN_POSITIVE 0 -#define ACPI_SIGN_NEGATIVE 1 - - -/* - * Rounding macros (Power of two boundaries only) - */ -#define ACPI_ROUND_DOWN(value, boundary) (((ACPI_SIZE)(value)) & \ - (~(((ACPI_SIZE) boundary)-1))) - -#define ACPI_ROUND_UP(value, boundary) ((((ACPI_SIZE)(value)) + \ - (((ACPI_SIZE) boundary)-1)) & \ - (~(((ACPI_SIZE) boundary)-1))) - -/* Note: sizeof(ACPI_SIZE) evaluates to either 4 or 8 (32- vs 64-bit mode) */ - -#define ACPI_ROUND_DOWN_TO_32BIT(a) ACPI_ROUND_DOWN(a, 4) -#define ACPI_ROUND_DOWN_TO_64BIT(a) ACPI_ROUND_DOWN(a, 8) -#define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a) ACPI_ROUND_DOWN(a, sizeof(ACPI_SIZE)) - -#define ACPI_ROUND_UP_TO_32BIT(a) ACPI_ROUND_UP(a, 4) -#define ACPI_ROUND_UP_TO_64BIT(a) ACPI_ROUND_UP(a, 8) -#define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a, sizeof(ACPI_SIZE)) - -#define ACPI_ROUND_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7) -#define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a)) - -#define ACPI_ROUND_UP_TO_1K(a) (((a) + 1023) >> 10) - -/* Generic (non-power-of-two) rounding */ - -#define ACPI_ROUND_UP_TO(value, boundary) (((value) + ((boundary)-1)) / (boundary)) - -#define ACPI_IS_MISALIGNED(value) (((ACPI_SIZE) value) & (sizeof(ACPI_SIZE)-1)) - -/* Generic bit manipulation */ - -#ifndef ACPI_USE_NATIVE_BIT_FINDER - -#define __ACPI_FIND_LAST_BIT_2(a, r) ((((UINT8) (a)) & 0x02) ? (r)+1 : (r)) -#define __ACPI_FIND_LAST_BIT_4(a, r) ((((UINT8) (a)) & 0x0C) ? \ - __ACPI_FIND_LAST_BIT_2 ((a)>>2, (r)+2) : \ - __ACPI_FIND_LAST_BIT_2 ((a), (r))) -#define __ACPI_FIND_LAST_BIT_8(a, r) ((((UINT8) (a)) & 0xF0) ? \ - __ACPI_FIND_LAST_BIT_4 ((a)>>4, (r)+4) : \ - __ACPI_FIND_LAST_BIT_4 ((a), (r))) -#define __ACPI_FIND_LAST_BIT_16(a, r) ((((UINT16) (a)) & 0xFF00) ? \ - __ACPI_FIND_LAST_BIT_8 ((a)>>8, (r)+8) : \ - __ACPI_FIND_LAST_BIT_8 ((a), (r))) -#define __ACPI_FIND_LAST_BIT_32(a, r) ((((UINT32) (a)) & 0xFFFF0000) ? \ - __ACPI_FIND_LAST_BIT_16 ((a)>>16, (r)+16) : \ - __ACPI_FIND_LAST_BIT_16 ((a), (r))) -#define __ACPI_FIND_LAST_BIT_64(a, r) ((((UINT64) (a)) & 0xFFFFFFFF00000000) ? \ - __ACPI_FIND_LAST_BIT_32 ((a)>>32, (r)+32) : \ - __ACPI_FIND_LAST_BIT_32 ((a), (r))) - -#define ACPI_FIND_LAST_BIT_8(a) ((a) ? __ACPI_FIND_LAST_BIT_8 (a, 1) : 0) -#define ACPI_FIND_LAST_BIT_16(a) ((a) ? __ACPI_FIND_LAST_BIT_16 (a, 1) : 0) -#define ACPI_FIND_LAST_BIT_32(a) ((a) ? __ACPI_FIND_LAST_BIT_32 (a, 1) : 0) -#define ACPI_FIND_LAST_BIT_64(a) ((a) ? __ACPI_FIND_LAST_BIT_64 (a, 1) : 0) - -#define __ACPI_FIND_FIRST_BIT_2(a, r) ((((UINT8) (a)) & 0x01) ? (r) : (r)+1) -#define __ACPI_FIND_FIRST_BIT_4(a, r) ((((UINT8) (a)) & 0x03) ? \ - __ACPI_FIND_FIRST_BIT_2 ((a), (r)) : \ - __ACPI_FIND_FIRST_BIT_2 ((a)>>2, (r)+2)) -#define __ACPI_FIND_FIRST_BIT_8(a, r) ((((UINT8) (a)) & 0x0F) ? \ - __ACPI_FIND_FIRST_BIT_4 ((a), (r)) : \ - __ACPI_FIND_FIRST_BIT_4 ((a)>>4, (r)+4)) -#define __ACPI_FIND_FIRST_BIT_16(a, r) ((((UINT16) (a)) & 0x00FF) ? \ - __ACPI_FIND_FIRST_BIT_8 ((a), (r)) : \ - __ACPI_FIND_FIRST_BIT_8 ((a)>>8, (r)+8)) -#define __ACPI_FIND_FIRST_BIT_32(a, r) ((((UINT32) (a)) & 0x0000FFFF) ? \ - __ACPI_FIND_FIRST_BIT_16 ((a), (r)) : \ - __ACPI_FIND_FIRST_BIT_16 ((a)>>16, (r)+16)) -#define __ACPI_FIND_FIRST_BIT_64(a, r) ((((UINT64) (a)) & 0x00000000FFFFFFFF) ? \ - __ACPI_FIND_FIRST_BIT_32 ((a), (r)) : \ - __ACPI_FIND_FIRST_BIT_32 ((a)>>32, (r)+32)) - -#define ACPI_FIND_FIRST_BIT_8(a) ((a) ? __ACPI_FIND_FIRST_BIT_8 (a, 1) : 0) -#define ACPI_FIND_FIRST_BIT_16(a) ((a) ? __ACPI_FIND_FIRST_BIT_16 (a, 1) : 0) -#define ACPI_FIND_FIRST_BIT_32(a) ((a) ? __ACPI_FIND_FIRST_BIT_32 (a, 1) : 0) -#define ACPI_FIND_FIRST_BIT_64(a) ((a) ? __ACPI_FIND_FIRST_BIT_64 (a, 1) : 0) - -#endif /* ACPI_USE_NATIVE_BIT_FINDER */ - -/* Generic (power-of-two) rounding */ - -#define ACPI_ROUND_UP_POWER_OF_TWO_8(a) ((UINT8) \ - (((UINT16) 1) << ACPI_FIND_LAST_BIT_8 ((a) - 1))) -#define ACPI_ROUND_DOWN_POWER_OF_TWO_8(a) ((UINT8) \ - (((UINT16) 1) << (ACPI_FIND_LAST_BIT_8 ((a)) - 1))) -#define ACPI_ROUND_UP_POWER_OF_TWO_16(a) ((UINT16) \ - (((UINT32) 1) << ACPI_FIND_LAST_BIT_16 ((a) - 1))) -#define ACPI_ROUND_DOWN_POWER_OF_TWO_16(a) ((UINT16) \ - (((UINT32) 1) << (ACPI_FIND_LAST_BIT_16 ((a)) - 1))) -#define ACPI_ROUND_UP_POWER_OF_TWO_32(a) ((UINT32) \ - (((UINT64) 1) << ACPI_FIND_LAST_BIT_32 ((a) - 1))) -#define ACPI_ROUND_DOWN_POWER_OF_TWO_32(a) ((UINT32) \ - (((UINT64) 1) << (ACPI_FIND_LAST_BIT_32 ((a)) - 1))) -#define ACPI_IS_ALIGNED(a, s) (((a) & ((s) - 1)) == 0) -#define ACPI_IS_POWER_OF_TWO(a) ACPI_IS_ALIGNED(a, a) - -/* - * Bitmask creation - * Bit positions start at zero. - * MASK_BITS_ABOVE creates a mask starting AT the position and above - * MASK_BITS_BELOW creates a mask starting one bit BELOW the position - * MASK_BITS_ABOVE/BELOW accepts a bit offset to create a mask - * MASK_BITS_ABOVE/BELOW_32/64 accepts a bit width to create a mask - * Note: The ACPI_INTEGER_BIT_SIZE check is used to bypass compiler - * differences with the shift operator - */ -#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_UINT64_MAX) << ((UINT32) (position)))) -#define ACPI_MASK_BITS_BELOW(position) ((ACPI_UINT64_MAX) << ((UINT32) (position))) -#define ACPI_MASK_BITS_ABOVE_32(width) ((UINT32) ACPI_MASK_BITS_ABOVE(width)) -#define ACPI_MASK_BITS_BELOW_32(width) ((UINT32) ACPI_MASK_BITS_BELOW(width)) -#define ACPI_MASK_BITS_ABOVE_64(width) ((width) == ACPI_INTEGER_BIT_SIZE ? \ - ACPI_UINT64_MAX : \ - ACPI_MASK_BITS_ABOVE(width)) -#define ACPI_MASK_BITS_BELOW_64(width) ((width) == ACPI_INTEGER_BIT_SIZE ? \ - (UINT64) 0 : \ - ACPI_MASK_BITS_BELOW(width)) - -/* Bitfields within ACPI registers */ - -#define ACPI_REGISTER_PREPARE_BITS(Val, Pos, Mask) \ - ((Val << Pos) & Mask) - -#define ACPI_REGISTER_INSERT_VALUE(Reg, Pos, Mask, Val) \ - Reg = (Reg & (~(Mask))) | ACPI_REGISTER_PREPARE_BITS(Val, Pos, Mask) - -#define ACPI_INSERT_BITS(Target, Mask, Source) \ - Target = ((Target & (~(Mask))) | (Source & Mask)) - -/* Generic bitfield macros and masks */ - -#define ACPI_GET_BITS(SourcePtr, Position, Mask) \ - ((*(SourcePtr) >> (Position)) & (Mask)) - -#define ACPI_SET_BITS(TargetPtr, Position, Mask, Value) \ - (*(TargetPtr) |= (((Value) & (Mask)) << (Position))) - -#define ACPI_1BIT_MASK 0x00000001 -#define ACPI_2BIT_MASK 0x00000003 -#define ACPI_3BIT_MASK 0x00000007 -#define ACPI_4BIT_MASK 0x0000000F -#define ACPI_5BIT_MASK 0x0000001F -#define ACPI_6BIT_MASK 0x0000003F -#define ACPI_7BIT_MASK 0x0000007F -#define ACPI_8BIT_MASK 0x000000FF -#define ACPI_16BIT_MASK 0x0000FFFF -#define ACPI_24BIT_MASK 0x00FFFFFF - -/* Macros to extract flag bits from position zero */ - -#define ACPI_GET_1BIT_FLAG(Value) ((Value) & ACPI_1BIT_MASK) -#define ACPI_GET_2BIT_FLAG(Value) ((Value) & ACPI_2BIT_MASK) -#define ACPI_GET_3BIT_FLAG(Value) ((Value) & ACPI_3BIT_MASK) -#define ACPI_GET_4BIT_FLAG(Value) ((Value) & ACPI_4BIT_MASK) - -/* Macros to extract flag bits from position one and above */ - -#define ACPI_EXTRACT_1BIT_FLAG(Field, Position) (ACPI_GET_1BIT_FLAG ((Field) >> Position)) -#define ACPI_EXTRACT_2BIT_FLAG(Field, Position) (ACPI_GET_2BIT_FLAG ((Field) >> Position)) -#define ACPI_EXTRACT_3BIT_FLAG(Field, Position) (ACPI_GET_3BIT_FLAG ((Field) >> Position)) -#define ACPI_EXTRACT_4BIT_FLAG(Field, Position) (ACPI_GET_4BIT_FLAG ((Field) >> Position)) - -/* ACPI Pathname helpers */ - -#define ACPI_IS_ROOT_PREFIX(c) ((c) == (UINT8) 0x5C) /* Backslash */ -#define ACPI_IS_PARENT_PREFIX(c) ((c) == (UINT8) 0x5E) /* Carat */ -#define ACPI_IS_PATH_SEPARATOR(c) ((c) == (UINT8) 0x2E) /* Period (dot) */ - -/* - * An object of type ACPI_NAMESPACE_NODE can appear in some contexts - * where a pointer to an object of type ACPI_OPERAND_OBJECT can also - * appear. This macro is used to distinguish them. - * - * The "DescriptorType" field is the second field in both structures. - */ -#define ACPI_GET_DESCRIPTOR_PTR(d) (((ACPI_DESCRIPTOR *)(void *)(d))->Common.CommonPointer) -#define ACPI_SET_DESCRIPTOR_PTR(d, p) (((ACPI_DESCRIPTOR *)(void *)(d))->Common.CommonPointer = (p)) -#define ACPI_GET_DESCRIPTOR_TYPE(d) (((ACPI_DESCRIPTOR *)(void *)(d))->Common.DescriptorType) -#define ACPI_SET_DESCRIPTOR_TYPE(d, t) (((ACPI_DESCRIPTOR *)(void *)(d))->Common.DescriptorType = (t)) - -/* - * Macros for the master AML opcode table - */ -#if defined (ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT) -#define ACPI_OP(Name, PArgs, IArgs, ObjType, Class, Type, Flags) \ - {Name, (UINT32)(PArgs), (UINT32)(IArgs), (UINT32)(Flags), ObjType, Class, Type} -#else -#define ACPI_OP(Name, PArgs, IArgs, ObjType, Class, Type, Flags) \ - {(UINT32)(PArgs), (UINT32)(IArgs), (UINT32)(Flags), ObjType, Class, Type} -#endif - -#define ARG_TYPE_WIDTH 5 -#define ARG_1(x) ((UINT32)(x)) -#define ARG_2(x) ((UINT32)(x) << (1 * ARG_TYPE_WIDTH)) -#define ARG_3(x) ((UINT32)(x) << (2 * ARG_TYPE_WIDTH)) -#define ARG_4(x) ((UINT32)(x) << (3 * ARG_TYPE_WIDTH)) -#define ARG_5(x) ((UINT32)(x) << (4 * ARG_TYPE_WIDTH)) -#define ARG_6(x) ((UINT32)(x) << (5 * ARG_TYPE_WIDTH)) - -#define ARGI_LIST1(a) (ARG_1(a)) -#define ARGI_LIST2(a, b) (ARG_1(b)|ARG_2(a)) -#define ARGI_LIST3(a, b, c) (ARG_1(c)|ARG_2(b)|ARG_3(a)) -#define ARGI_LIST4(a, b, c, d) (ARG_1(d)|ARG_2(c)|ARG_3(b)|ARG_4(a)) -#define ARGI_LIST5(a, b, c, d, e) (ARG_1(e)|ARG_2(d)|ARG_3(c)|ARG_4(b)|ARG_5(a)) -#define ARGI_LIST6(a, b, c, d, e, f) (ARG_1(f)|ARG_2(e)|ARG_3(d)|ARG_4(c)|ARG_5(b)|ARG_6(a)) - -#define ARGP_LIST1(a) (ARG_1(a)) -#define ARGP_LIST2(a, b) (ARG_1(a)|ARG_2(b)) -#define ARGP_LIST3(a, b, c) (ARG_1(a)|ARG_2(b)|ARG_3(c)) -#define ARGP_LIST4(a, b, c, d) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)) -#define ARGP_LIST5(a, b, c, d, e) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)) -#define ARGP_LIST6(a, b, c, d, e, f) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)|ARG_6(f)) - -#define GET_CURRENT_ARG_TYPE(List) (List & ((UINT32) 0x1F)) -#define INCREMENT_ARG_LIST(List) (List >>= ((UINT32) ARG_TYPE_WIDTH)) - -/* - * Ascii error messages can be configured out - */ -#ifndef ACPI_NO_ERROR_MESSAGES -/* - * Error reporting. The callers module and line number are inserted by AE_INFO, - * the plist contains a set of parens to allow variable-length lists. - * These macros are used for both the debug and non-debug versions of the code. - */ -#define ACPI_ERROR_NAMESPACE(s, p, e) AcpiUtPrefixedNamespaceError (AE_INFO, s, p, e); -#define ACPI_ERROR_METHOD(s, n, p, e) AcpiUtMethodError (AE_INFO, s, n, p, e); -#define ACPI_WARN_PREDEFINED(plist) AcpiUtPredefinedWarning plist -#define ACPI_INFO_PREDEFINED(plist) AcpiUtPredefinedInfo plist -#define ACPI_BIOS_ERROR_PREDEFINED(plist) AcpiUtPredefinedBiosError plist -#define ACPI_ERROR_ONLY(s) s - -#else - -/* No error messages */ - -#define ACPI_ERROR_NAMESPACE(s, p, e) -#define ACPI_ERROR_METHOD(s, n, p, e) -#define ACPI_WARN_PREDEFINED(plist) -#define ACPI_INFO_PREDEFINED(plist) -#define ACPI_BIOS_ERROR_PREDEFINED(plist) -#define ACPI_ERROR_ONLY(s) - -#endif /* ACPI_NO_ERROR_MESSAGES */ - -#if (!ACPI_REDUCED_HARDWARE) -#define ACPI_HW_OPTIONAL_FUNCTION(addr) addr -#else -#define ACPI_HW_OPTIONAL_FUNCTION(addr) NULL -#endif - - -/* - * Macros used for ACPICA utilities only - */ - -/* Generate a UUID */ - -#define ACPI_INIT_UUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \ - (a) & 0xFF, ((a) >> 8) & 0xFF, ((a) >> 16) & 0xFF, ((a) >> 24) & 0xFF, \ - (b) & 0xFF, ((b) >> 8) & 0xFF, \ - (c) & 0xFF, ((c) >> 8) & 0xFF, \ - (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) - -#define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7')) - - -/* - * Macros used for the ASL-/ASL+ converter utility - */ -#ifdef ACPI_ASL_COMPILER - -#define ASL_CV_LABEL_FILENODE(a) CvLabelFileNode(a); -#define ASL_CV_CAPTURE_COMMENTS_ONLY(a) CvCaptureCommentsOnly (a); -#define ASL_CV_CAPTURE_COMMENTS(a) CvCaptureComments (a); -#define ASL_CV_TRANSFER_COMMENTS(a) CvTransferComments (a); -#define ASL_CV_CLOSE_PAREN(a,b) CvCloseParenWriteComment(a,b); -#define ASL_CV_CLOSE_BRACE(a,b) CvCloseBraceWriteComment(a,b); -#define ASL_CV_SWITCH_FILES(a,b) CvSwitchFiles(a,b); -#define ASL_CV_CLEAR_OP_COMMENTS(a) CvClearOpComments(a); -#define ASL_CV_PRINT_ONE_COMMENT(a,b,c,d) CvPrintOneCommentType (a,b,c,d); -#define ASL_CV_PRINT_ONE_COMMENT_LIST(a,b) CvPrintOneCommentList (a,b); -#define ASL_CV_FILE_HAS_SWITCHED(a) CvFileHasSwitched(a) -#define ASL_CV_INIT_FILETREE(a,b) CvInitFileTree(a,b); - -#else - -#define ASL_CV_LABEL_FILENODE(a) -#define ASL_CV_CAPTURE_COMMENTS_ONLY(a) -#define ASL_CV_CAPTURE_COMMENTS(a) -#define ASL_CV_TRANSFER_COMMENTS(a) -#define ASL_CV_CLOSE_PAREN(a,b) AcpiOsPrintf (")"); -#define ASL_CV_CLOSE_BRACE(a,b) AcpiOsPrintf ("}"); -#define ASL_CV_SWITCH_FILES(a,b) -#define ASL_CV_CLEAR_OP_COMMENTS(a) -#define ASL_CV_PRINT_ONE_COMMENT(a,b,c,d) -#define ASL_CV_PRINT_ONE_COMMENT_LIST(a,b) -#define ASL_CV_FILE_HAS_SWITCHED(a) 0 -#define ASL_CV_INIT_FILETREE(a,b) - -#endif - -#endif /* ACMACROS_H */ diff --git a/drivers/include/acpica/acnames.h b/drivers/include/acpica/acnames.h deleted file mode 100644 index 070e318..0000000 --- a/drivers/include/acpica/acnames.h +++ /dev/null @@ -1,206 +0,0 @@ -/****************************************************************************** - * - * Name: acnames.h - Global names and strings - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef __ACNAMES_H__ -#define __ACNAMES_H__ - -/* Method names - these methods can appear anywhere in the namespace */ - -#define METHOD_NAME__ADR "_ADR" -#define METHOD_NAME__AEI "_AEI" -#define METHOD_NAME__BBN "_BBN" -#define METHOD_NAME__CBA "_CBA" -#define METHOD_NAME__CID "_CID" -#define METHOD_NAME__CLS "_CLS" -#define METHOD_NAME__CRS "_CRS" -#define METHOD_NAME__DDN "_DDN" -#define METHOD_NAME__DIS "_DIS" -#define METHOD_NAME__DMA "_DMA" -#define METHOD_NAME__EVT "_EVT" -#define METHOD_NAME__HID "_HID" -#define METHOD_NAME__INI "_INI" -#define METHOD_NAME__PLD "_PLD" -#define METHOD_NAME__DSD "_DSD" -#define METHOD_NAME__PRS "_PRS" -#define METHOD_NAME__PRT "_PRT" -#define METHOD_NAME__PRW "_PRW" -#define METHOD_NAME__PS0 "_PS0" -#define METHOD_NAME__PS1 "_PS1" -#define METHOD_NAME__PS2 "_PS2" -#define METHOD_NAME__PS3 "_PS3" -#define METHOD_NAME__REG "_REG" -#define METHOD_NAME__SB_ "_SB_" -#define METHOD_NAME__SEG "_SEG" -#define METHOD_NAME__SRS "_SRS" -#define METHOD_NAME__STA "_STA" -#define METHOD_NAME__SUB "_SUB" -#define METHOD_NAME__UID "_UID" - -/* Method names - these methods must appear at the namespace root */ - -#define METHOD_PATHNAME__PTS "\\_PTS" -#define METHOD_PATHNAME__SST "\\_SI._SST" -#define METHOD_PATHNAME__WAK "\\_WAK" - -/* Definitions of the predefined namespace names */ - -#define ACPI_UNKNOWN_NAME (UINT32) 0x3F3F3F3F /* Unknown name is "????" */ -#define ACPI_PREFIX_MIXED (UINT32) 0x69706341 /* "Acpi" */ -#define ACPI_PREFIX_LOWER (UINT32) 0x69706361 /* "acpi" */ - -/* Root name stuff */ - -#define ACPI_ROOT_NAME (UINT32) 0x5F5F5F5C /* Root name is "\___" */ -#define ACPI_ROOT_PATHNAME "\\___" -#define ACPI_NAMESPACE_ROOT "Namespace Root" -#define ACPI_NS_ROOT_PATH "\\" - -#endif /* __ACNAMES_H__ */ diff --git a/drivers/include/acpica/acnamesp.h b/drivers/include/acpica/acnamesp.h deleted file mode 100644 index 41f704b..0000000 --- a/drivers/include/acpica/acnamesp.h +++ /dev/null @@ -1,693 +0,0 @@ -/****************************************************************************** - * - * Name: acnamesp.h - Namespace subcomponent prototypes and defines - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef __ACNAMESP_H__ -#define __ACNAMESP_H__ - - -/* To search the entire name space, pass this as SearchBase */ - -#define ACPI_NS_ALL ((ACPI_HANDLE)0) - -/* - * Elements of AcpiNsProperties are bit significant - * and should be one-to-one with values of ACPI_OBJECT_TYPE - */ -#define ACPI_NS_NORMAL 0 -#define ACPI_NS_NEWSCOPE 1 /* a definition of this type opens a name scope */ -#define ACPI_NS_LOCAL 2 /* suppress search of enclosing scopes */ - -/* Flags for AcpiNsLookup, AcpiNsSearchAndEnter */ - -#define ACPI_NS_NO_UPSEARCH 0 -#define ACPI_NS_SEARCH_PARENT 0x0001 -#define ACPI_NS_DONT_OPEN_SCOPE 0x0002 -#define ACPI_NS_NO_PEER_SEARCH 0x0004 -#define ACPI_NS_ERROR_IF_FOUND 0x0008 -#define ACPI_NS_PREFIX_IS_SCOPE 0x0010 -#define ACPI_NS_EXTERNAL 0x0020 -#define ACPI_NS_TEMPORARY 0x0040 -#define ACPI_NS_OVERRIDE_IF_FOUND 0x0080 -#define ACPI_NS_EARLY_INIT 0x0100 -#define ACPI_NS_PREFIX_MUST_EXIST 0x0200 - -/* Flags for AcpiNsWalkNamespace */ - -#define ACPI_NS_WALK_NO_UNLOCK 0 -#define ACPI_NS_WALK_UNLOCK 0x01 -#define ACPI_NS_WALK_TEMP_NODES 0x02 - -/* Object is not a package element */ - -#define ACPI_NOT_PACKAGE_ELEMENT ACPI_UINT32_MAX -#define ACPI_ALL_PACKAGE_ELEMENTS (ACPI_UINT32_MAX-1) - -/* Always emit warning message, not dependent on node flags */ - -#define ACPI_WARN_ALWAYS 0 - - -/* - * nsinit - Namespace initialization - */ -ACPI_STATUS -AcpiNsInitializeObjects ( - void); - -ACPI_STATUS -AcpiNsInitializeDevices ( - UINT32 Flags); - -ACPI_STATUS -AcpiNsInitOnePackage ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue); - -/* - * nsload - Namespace loading - */ -ACPI_STATUS -AcpiNsLoadNamespace ( - void); - -ACPI_STATUS -AcpiNsLoadTable ( - UINT32 TableIndex, - ACPI_NAMESPACE_NODE *Node); - - -/* - * nswalk - walk the namespace - */ -ACPI_STATUS -AcpiNsWalkNamespace ( - ACPI_OBJECT_TYPE Type, - ACPI_HANDLE StartObject, - UINT32 MaxDepth, - UINT32 Flags, - ACPI_WALK_CALLBACK DescendingCallback, - ACPI_WALK_CALLBACK AscendingCallback, - void *Context, - void **ReturnValue); - -ACPI_NAMESPACE_NODE * -AcpiNsGetNextNode ( - ACPI_NAMESPACE_NODE *Parent, - ACPI_NAMESPACE_NODE *Child); - -ACPI_NAMESPACE_NODE * -AcpiNsGetNextNodeTyped ( - ACPI_OBJECT_TYPE Type, - ACPI_NAMESPACE_NODE *Parent, - ACPI_NAMESPACE_NODE *Child); - -/* - * nsparse - table parsing - */ -ACPI_STATUS -AcpiNsParseTable ( - UINT32 TableIndex, - ACPI_NAMESPACE_NODE *StartNode); - -ACPI_STATUS -AcpiNsExecuteTable ( - UINT32 TableIndex, - ACPI_NAMESPACE_NODE *StartNode); - -ACPI_STATUS -AcpiNsOneCompleteParse ( - UINT32 PassNumber, - UINT32 TableIndex, - ACPI_NAMESPACE_NODE *StartNode); - - -/* - * nsaccess - Top-level namespace access - */ -ACPI_STATUS -AcpiNsRootInitialize ( - void); - -ACPI_STATUS -AcpiNsLookup ( - ACPI_GENERIC_STATE *ScopeInfo, - char *Name, - ACPI_OBJECT_TYPE Type, - ACPI_INTERPRETER_MODE InterpreterMode, - UINT32 Flags, - ACPI_WALK_STATE *WalkState, - ACPI_NAMESPACE_NODE **RetNode); - - -/* - * nsalloc - Named object allocation/deallocation - */ -ACPI_NAMESPACE_NODE * -AcpiNsCreateNode ( - UINT32 Name); - -void -AcpiNsDeleteNode ( - ACPI_NAMESPACE_NODE *Node); - -void -AcpiNsRemoveNode ( - ACPI_NAMESPACE_NODE *Node); - -void -AcpiNsDeleteNamespaceSubtree ( - ACPI_NAMESPACE_NODE *ParentHandle); - -void -AcpiNsDeleteNamespaceByOwner ( - ACPI_OWNER_ID OwnerId); - -void -AcpiNsDetachObject ( - ACPI_NAMESPACE_NODE *Node); - -void -AcpiNsDeleteChildren ( - ACPI_NAMESPACE_NODE *Parent); - -int -AcpiNsCompareNames ( - char *Name1, - char *Name2); - - -/* - * nsconvert - Dynamic object conversion routines - */ -ACPI_STATUS -AcpiNsConvertToInteger ( - ACPI_OPERAND_OBJECT *OriginalObject, - ACPI_OPERAND_OBJECT **ReturnObject); - -ACPI_STATUS -AcpiNsConvertToString ( - ACPI_OPERAND_OBJECT *OriginalObject, - ACPI_OPERAND_OBJECT **ReturnObject); - -ACPI_STATUS -AcpiNsConvertToBuffer ( - ACPI_OPERAND_OBJECT *OriginalObject, - ACPI_OPERAND_OBJECT **ReturnObject); - -ACPI_STATUS -AcpiNsConvertToUnicode ( - ACPI_NAMESPACE_NODE *Scope, - ACPI_OPERAND_OBJECT *OriginalObject, - ACPI_OPERAND_OBJECT **ReturnObject); - -ACPI_STATUS -AcpiNsConvertToResource ( - ACPI_NAMESPACE_NODE *Scope, - ACPI_OPERAND_OBJECT *OriginalObject, - ACPI_OPERAND_OBJECT **ReturnObject); - -ACPI_STATUS -AcpiNsConvertToReference ( - ACPI_NAMESPACE_NODE *Scope, - ACPI_OPERAND_OBJECT *OriginalObject, - ACPI_OPERAND_OBJECT **ReturnObject); - - -/* - * nsdump - Namespace dump/print utilities - */ -void -AcpiNsDumpTables ( - ACPI_HANDLE SearchBase, - UINT32 MaxDepth); - -void -AcpiNsDumpEntry ( - ACPI_HANDLE Handle, - UINT32 DebugLevel); - -void -AcpiNsDumpPathname ( - ACPI_HANDLE Handle, - const char *Msg, - UINT32 Level, - UINT32 Component); - -void -AcpiNsPrintPathname ( - UINT32 NumSegments, - const char *Pathname); - -ACPI_STATUS -AcpiNsDumpOneObject ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue); - -void -AcpiNsDumpObjects ( - ACPI_OBJECT_TYPE Type, - UINT8 DisplayType, - UINT32 MaxDepth, - ACPI_OWNER_ID OwnerId, - ACPI_HANDLE StartHandle); - -void -AcpiNsDumpObjectPaths ( - ACPI_OBJECT_TYPE Type, - UINT8 DisplayType, - UINT32 MaxDepth, - ACPI_OWNER_ID OwnerId, - ACPI_HANDLE StartHandle); - - -/* - * nseval - Namespace evaluation functions - */ -ACPI_STATUS -AcpiNsEvaluate ( - ACPI_EVALUATE_INFO *Info); - - -/* - * nsarguments - Argument count/type checking for predefined/reserved names - */ -void -AcpiNsCheckArgumentCount ( - char *Pathname, - ACPI_NAMESPACE_NODE *Node, - UINT32 UserParamCount, - const ACPI_PREDEFINED_INFO *Info); - -void -AcpiNsCheckAcpiCompliance ( - char *Pathname, - ACPI_NAMESPACE_NODE *Node, - const ACPI_PREDEFINED_INFO *Predefined); - -void -AcpiNsCheckArgumentTypes ( - ACPI_EVALUATE_INFO *Info); - - -/* - * nspredef - Return value checking for predefined/reserved names - */ -ACPI_STATUS -AcpiNsCheckReturnValue ( - ACPI_NAMESPACE_NODE *Node, - ACPI_EVALUATE_INFO *Info, - UINT32 UserParamCount, - ACPI_STATUS ReturnStatus, - ACPI_OPERAND_OBJECT **ReturnObject); - -ACPI_STATUS -AcpiNsCheckObjectType ( - ACPI_EVALUATE_INFO *Info, - ACPI_OPERAND_OBJECT **ReturnObjectPtr, - UINT32 ExpectedBtypes, - UINT32 PackageIndex); - - -/* - * nsprepkg - Validation of predefined name packages - */ -ACPI_STATUS -AcpiNsCheckPackage ( - ACPI_EVALUATE_INFO *Info, - ACPI_OPERAND_OBJECT **ReturnObjectPtr); - - -/* - * nsnames - Name and Scope manipulation - */ -UINT32 -AcpiNsOpensScope ( - ACPI_OBJECT_TYPE Type); - -char * -AcpiNsGetExternalPathname ( - ACPI_NAMESPACE_NODE *Node); - -UINT32 -AcpiNsBuildNormalizedPath ( - ACPI_NAMESPACE_NODE *Node, - char *FullPath, - UINT32 PathSize, - BOOLEAN NoTrailing); - -void -AcpiNsNormalizePathname ( - char *OriginalPath); - -char * -AcpiNsGetNormalizedPathname ( - ACPI_NAMESPACE_NODE *Node, - BOOLEAN NoTrailing); - -char * -AcpiNsBuildPrefixedPathname ( - ACPI_GENERIC_STATE *PrefixScope, - const char *InternalPath); - -char * -AcpiNsNameOfCurrentScope ( - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiNsHandleToName ( - ACPI_HANDLE TargetHandle, - ACPI_BUFFER *Buffer); - -ACPI_STATUS -AcpiNsHandleToPathname ( - ACPI_HANDLE TargetHandle, - ACPI_BUFFER *Buffer, - BOOLEAN NoTrailing); - -BOOLEAN -AcpiNsPatternMatch ( - ACPI_NAMESPACE_NODE *ObjNode, - char *SearchFor); - -ACPI_STATUS -AcpiNsGetNodeUnlocked ( - ACPI_NAMESPACE_NODE *PrefixNode, - const char *ExternalPathname, - UINT32 Flags, - ACPI_NAMESPACE_NODE **OutNode); - -ACPI_STATUS -AcpiNsGetNode ( - ACPI_NAMESPACE_NODE *PrefixNode, - const char *ExternalPathname, - UINT32 Flags, - ACPI_NAMESPACE_NODE **OutNode); - -ACPI_SIZE -AcpiNsGetPathnameLength ( - ACPI_NAMESPACE_NODE *Node); - - -/* - * nsobject - Object management for namespace nodes - */ -ACPI_STATUS -AcpiNsAttachObject ( - ACPI_NAMESPACE_NODE *Node, - ACPI_OPERAND_OBJECT *Object, - ACPI_OBJECT_TYPE Type); - -ACPI_OPERAND_OBJECT * -AcpiNsGetAttachedObject ( - ACPI_NAMESPACE_NODE *Node); - -ACPI_OPERAND_OBJECT * -AcpiNsGetSecondaryObject ( - ACPI_OPERAND_OBJECT *ObjDesc); - -ACPI_STATUS -AcpiNsAttachData ( - ACPI_NAMESPACE_NODE *Node, - ACPI_OBJECT_HANDLER Handler, - void *Data); - -ACPI_STATUS -AcpiNsDetachData ( - ACPI_NAMESPACE_NODE *Node, - ACPI_OBJECT_HANDLER Handler); - -ACPI_STATUS -AcpiNsGetAttachedData ( - ACPI_NAMESPACE_NODE *Node, - ACPI_OBJECT_HANDLER Handler, - void **Data); - - -/* - * nsrepair - General return object repair for all - * predefined methods/objects - */ -ACPI_STATUS -AcpiNsSimpleRepair ( - ACPI_EVALUATE_INFO *Info, - UINT32 ExpectedBtypes, - UINT32 PackageIndex, - ACPI_OPERAND_OBJECT **ReturnObjectPtr); - -ACPI_STATUS -AcpiNsWrapWithPackage ( - ACPI_EVALUATE_INFO *Info, - ACPI_OPERAND_OBJECT *OriginalObject, - ACPI_OPERAND_OBJECT **ObjDescPtr); - -ACPI_STATUS -AcpiNsRepairNullElement ( - ACPI_EVALUATE_INFO *Info, - UINT32 ExpectedBtypes, - UINT32 PackageIndex, - ACPI_OPERAND_OBJECT **ReturnObjectPtr); - -void -AcpiNsRemoveNullElements ( - ACPI_EVALUATE_INFO *Info, - UINT8 PackageType, - ACPI_OPERAND_OBJECT *ObjDesc); - - -/* - * nsrepair2 - Return object repair for specific - * predefined methods/objects - */ -ACPI_STATUS -AcpiNsComplexRepairs ( - ACPI_EVALUATE_INFO *Info, - ACPI_NAMESPACE_NODE *Node, - ACPI_STATUS ValidateStatus, - ACPI_OPERAND_OBJECT **ReturnObjectPtr); - - -/* - * nssearch - Namespace searching and entry - */ -ACPI_STATUS -AcpiNsSearchAndEnter ( - UINT32 EntryName, - ACPI_WALK_STATE *WalkState, - ACPI_NAMESPACE_NODE *Node, - ACPI_INTERPRETER_MODE InterpreterMode, - ACPI_OBJECT_TYPE Type, - UINT32 Flags, - ACPI_NAMESPACE_NODE **RetNode); - -ACPI_STATUS -AcpiNsSearchOneScope ( - UINT32 EntryName, - ACPI_NAMESPACE_NODE *Node, - ACPI_OBJECT_TYPE Type, - ACPI_NAMESPACE_NODE **RetNode); - -void -AcpiNsInstallNode ( - ACPI_WALK_STATE *WalkState, - ACPI_NAMESPACE_NODE *ParentNode, - ACPI_NAMESPACE_NODE *Node, - ACPI_OBJECT_TYPE Type); - - -/* - * nsutils - Utility functions - */ -ACPI_OBJECT_TYPE -AcpiNsGetType ( - ACPI_NAMESPACE_NODE *Node); - -UINT32 -AcpiNsLocal ( - ACPI_OBJECT_TYPE Type); - -void -AcpiNsPrintNodePathname ( - ACPI_NAMESPACE_NODE *Node, - const char *Msg); - -ACPI_STATUS -AcpiNsBuildInternalName ( - ACPI_NAMESTRING_INFO *Info); - -void -AcpiNsGetInternalNameLength ( - ACPI_NAMESTRING_INFO *Info); - -ACPI_STATUS -AcpiNsInternalizeName ( - const char *DottedName, - char **ConvertedName); - -ACPI_STATUS -AcpiNsExternalizeName ( - UINT32 InternalNameLength, - const char *InternalName, - UINT32 *ConvertedNameLength, - char **ConvertedName); - -ACPI_NAMESPACE_NODE * -AcpiNsValidateHandle ( - ACPI_HANDLE Handle); - -void -AcpiNsTerminate ( - void); - -#endif /* __ACNAMESP_H__ */ diff --git a/drivers/include/acpica/acobject.h b/drivers/include/acpica/acobject.h deleted file mode 100644 index 95be1a9..0000000 --- a/drivers/include/acpica/acobject.h +++ /dev/null @@ -1,707 +0,0 @@ -/****************************************************************************** - * - * Name: acobject.h - Definition of ACPI_OPERAND_OBJECT (Internal object only) - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef _ACOBJECT_H -#define _ACOBJECT_H - -/* acpisrc:StructDefs -- for acpisrc conversion */ - - -/* - * The ACPI_OPERAND_OBJECT is used to pass AML operands from the dispatcher - * to the interpreter, and to keep track of the various handlers such as - * address space handlers and notify handlers. The object is a constant - * size in order to allow it to be cached and reused. - * - * Note: The object is optimized to be aligned and will not work if it is - * byte-packed. - */ -#if ACPI_MACHINE_WIDTH == 64 -#pragma pack(8) -#else -#pragma pack(4) -#endif - -/******************************************************************************* - * - * Common Descriptors - * - ******************************************************************************/ - -/* - * Common area for all objects. - * - * DescriptorType is used to differentiate between internal descriptors, and - * must be in the same place across all descriptors - * - * Note: The DescriptorType and Type fields must appear in the identical - * position in both the ACPI_NAMESPACE_NODE and ACPI_OPERAND_OBJECT - * structures. - */ -#define ACPI_OBJECT_COMMON_HEADER \ - union acpi_operand_object *NextObject; /* Objects linked to parent NS node */\ - UINT8 DescriptorType; /* To differentiate various internal objs */\ - UINT8 Type; /* ACPI_OBJECT_TYPE */\ - UINT16 ReferenceCount; /* For object deletion management */\ - UINT8 Flags - /* - * Note: There are 3 bytes available here before the - * next natural alignment boundary (for both 32/64 cases) - */ - -/* Values for Flag byte above */ - -#define AOPOBJ_AML_CONSTANT 0x01 /* Integer is an AML constant */ -#define AOPOBJ_STATIC_POINTER 0x02 /* Data is part of an ACPI table, don't delete */ -#define AOPOBJ_DATA_VALID 0x04 /* Object is initialized and data is valid */ -#define AOPOBJ_OBJECT_INITIALIZED 0x08 /* Region is initialized */ -#define AOPOBJ_REG_CONNECTED 0x10 /* _REG was run */ -#define AOPOBJ_SETUP_COMPLETE 0x20 /* Region setup is complete */ -#define AOPOBJ_INVALID 0x40 /* Host OS won't allow a Region address */ - - -/****************************************************************************** - * - * Basic data types - * - *****************************************************************************/ - -typedef struct acpi_object_common -{ - ACPI_OBJECT_COMMON_HEADER; - -} ACPI_OBJECT_COMMON; - - -typedef struct acpi_object_integer -{ - ACPI_OBJECT_COMMON_HEADER; - UINT8 Fill[3]; /* Prevent warning on some compilers */ - UINT64 Value; - -} ACPI_OBJECT_INTEGER; - - -/* - * Note: The String and Buffer object must be identical through the - * pointer and length elements. There is code that depends on this. - * - * Fields common to both Strings and Buffers - */ -#define ACPI_COMMON_BUFFER_INFO(_Type) \ - _Type *Pointer; \ - UINT32 Length - - -/* Null terminated, ASCII characters only */ - -typedef struct acpi_object_string -{ - ACPI_OBJECT_COMMON_HEADER; - ACPI_COMMON_BUFFER_INFO(char); /* String in AML stream or allocated string */ - -} ACPI_OBJECT_STRING; - - -typedef struct acpi_object_buffer -{ - ACPI_OBJECT_COMMON_HEADER; - ACPI_COMMON_BUFFER_INFO(UINT8); /* Buffer in AML stream or allocated buffer */ - UINT32 AmlLength; - UINT8 *AmlStart; - ACPI_NAMESPACE_NODE *Node; /* Link back to parent node */ - -} ACPI_OBJECT_BUFFER; - - -typedef struct acpi_object_package -{ - ACPI_OBJECT_COMMON_HEADER; - ACPI_NAMESPACE_NODE *Node; /* Link back to parent node */ - union acpi_operand_object **Elements; /* Array of pointers to AcpiObjects */ - UINT8 *AmlStart; - UINT32 AmlLength; - UINT32 Count; /* # of elements in package */ - -} ACPI_OBJECT_PACKAGE; - - -/****************************************************************************** - * - * Complex data types - * - *****************************************************************************/ - -typedef struct acpi_object_event -{ - ACPI_OBJECT_COMMON_HEADER; - ACPI_SEMAPHORE OsSemaphore; /* Actual OS synchronization object */ - -} ACPI_OBJECT_EVENT; - - -typedef struct acpi_object_mutex -{ - ACPI_OBJECT_COMMON_HEADER; - UINT8 SyncLevel; /* 0-15, specified in Mutex() call */ - UINT16 AcquisitionDepth; /* Allow multiple Acquires, same thread */ - ACPI_MUTEX OsMutex; /* Actual OS synchronization object */ - ACPI_THREAD_ID ThreadId; /* Current owner of the mutex */ - struct acpi_thread_state *OwnerThread; /* Current owner of the mutex */ - union acpi_operand_object *Prev; /* Link for list of acquired mutexes */ - union acpi_operand_object *Next; /* Link for list of acquired mutexes */ - ACPI_NAMESPACE_NODE *Node; /* Containing namespace node */ - UINT8 OriginalSyncLevel; /* Owner's original sync level (0-15) */ - -} ACPI_OBJECT_MUTEX; - - -typedef struct acpi_object_region -{ - ACPI_OBJECT_COMMON_HEADER; - UINT8 SpaceId; - ACPI_NAMESPACE_NODE *Node; /* Containing namespace node */ - union acpi_operand_object *Handler; /* Handler for region access */ - union acpi_operand_object *Next; - ACPI_PHYSICAL_ADDRESS Address; - UINT32 Length; - void *Pointer; /* Only for data table regions */ - -} ACPI_OBJECT_REGION; - - -typedef struct acpi_object_method -{ - ACPI_OBJECT_COMMON_HEADER; - UINT8 InfoFlags; - UINT8 ParamCount; - UINT8 SyncLevel; - union acpi_operand_object *Mutex; - union acpi_operand_object *Node; - UINT8 *AmlStart; - union - { - ACPI_INTERNAL_METHOD Implementation; - union acpi_operand_object *Handler; - } Dispatch; - - UINT32 AmlLength; - ACPI_OWNER_ID OwnerId; - UINT8 ThreadCount; - -} ACPI_OBJECT_METHOD; - -/* Flags for InfoFlags field above */ - -#define ACPI_METHOD_MODULE_LEVEL 0x01 /* Method is actually module-level code */ -#define ACPI_METHOD_INTERNAL_ONLY 0x02 /* Method is implemented internally (_OSI) */ -#define ACPI_METHOD_SERIALIZED 0x04 /* Method is serialized */ -#define ACPI_METHOD_SERIALIZED_PENDING 0x08 /* Method is to be marked serialized */ -#define ACPI_METHOD_IGNORE_SYNC_LEVEL 0x10 /* Method was auto-serialized at table load time */ -#define ACPI_METHOD_MODIFIED_NAMESPACE 0x20 /* Method modified the namespace */ - - -/****************************************************************************** - * - * Objects that can be notified. All share a common NotifyInfo area. - * - *****************************************************************************/ - -/* - * Common fields for objects that support ASL notifications - */ -#define ACPI_COMMON_NOTIFY_INFO \ - union acpi_operand_object *NotifyList[2]; /* Handlers for system/device notifies */\ - union acpi_operand_object *Handler /* Handler for Address space */ - -/* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */ - -typedef struct acpi_object_notify_common -{ - ACPI_OBJECT_COMMON_HEADER; - ACPI_COMMON_NOTIFY_INFO; - -} ACPI_OBJECT_NOTIFY_COMMON; - - -typedef struct acpi_object_device -{ - ACPI_OBJECT_COMMON_HEADER; - ACPI_COMMON_NOTIFY_INFO; - ACPI_GPE_BLOCK_INFO *GpeBlock; - -} ACPI_OBJECT_DEVICE; - - -typedef struct acpi_object_power_resource -{ - ACPI_OBJECT_COMMON_HEADER; - ACPI_COMMON_NOTIFY_INFO; - UINT32 SystemLevel; - UINT32 ResourceOrder; - -} ACPI_OBJECT_POWER_RESOURCE; - - -typedef struct acpi_object_processor -{ - ACPI_OBJECT_COMMON_HEADER; - - /* The next two fields take advantage of the 3-byte space before NOTIFY_INFO */ - - UINT8 ProcId; - UINT8 Length; - ACPI_COMMON_NOTIFY_INFO; - ACPI_IO_ADDRESS Address; - -} ACPI_OBJECT_PROCESSOR; - - -typedef struct acpi_object_thermal_zone -{ - ACPI_OBJECT_COMMON_HEADER; - ACPI_COMMON_NOTIFY_INFO; - -} ACPI_OBJECT_THERMAL_ZONE; - - -/****************************************************************************** - * - * Fields. All share a common header/info field. - * - *****************************************************************************/ - -/* - * Common bitfield for the field objects - * "Field Datum" -- a datum from the actual field object - * "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field - */ -#define ACPI_COMMON_FIELD_INFO \ - UINT8 FieldFlags; /* Access, update, and lock bits */\ - UINT8 Attribute; /* From AccessAs keyword */\ - UINT8 AccessByteWidth; /* Read/Write size in bytes */\ - ACPI_NAMESPACE_NODE *Node; /* Link back to parent node */\ - UINT32 BitLength; /* Length of field in bits */\ - UINT32 BaseByteOffset; /* Byte offset within containing object */\ - UINT32 Value; /* Value to store into the Bank or Index register */\ - UINT8 StartFieldBitOffset;/* Bit offset within first field datum (0-63) */\ - UINT8 AccessLength /* For serial regions/fields */ - -/* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */ - -typedef struct acpi_object_field_common -{ - ACPI_OBJECT_COMMON_HEADER; - ACPI_COMMON_FIELD_INFO; - union acpi_operand_object *RegionObj; /* Parent Operation Region object (REGION/BANK fields only) */ - -} ACPI_OBJECT_FIELD_COMMON; - - -typedef struct acpi_object_region_field -{ - ACPI_OBJECT_COMMON_HEADER; - ACPI_COMMON_FIELD_INFO; - UINT16 ResourceLength; - union acpi_operand_object *RegionObj; /* Containing OpRegion object */ - UINT8 *ResourceBuffer; /* ResourceTemplate for serial regions/fields */ - UINT16 PinNumberIndex; /* Index relative to previous Connection/Template */ - UINT8 *InternalPccBuffer; /* Internal buffer for fields associated with PCC */ - -} ACPI_OBJECT_REGION_FIELD; - - -typedef struct acpi_object_bank_field -{ - ACPI_OBJECT_COMMON_HEADER; - ACPI_COMMON_FIELD_INFO; - union acpi_operand_object *RegionObj; /* Containing OpRegion object */ - union acpi_operand_object *BankObj; /* BankSelect Register object */ - -} ACPI_OBJECT_BANK_FIELD; - - -typedef struct acpi_object_index_field -{ - ACPI_OBJECT_COMMON_HEADER; - ACPI_COMMON_FIELD_INFO; - - /* - * No "RegionObj" pointer needed since the Index and Data registers - * are each field definitions unto themselves. - */ - union acpi_operand_object *IndexObj; /* Index register */ - union acpi_operand_object *DataObj; /* Data register */ - -} ACPI_OBJECT_INDEX_FIELD; - - -/* The BufferField is different in that it is part of a Buffer, not an OpRegion */ - -typedef struct acpi_object_buffer_field -{ - ACPI_OBJECT_COMMON_HEADER; - ACPI_COMMON_FIELD_INFO; - BOOLEAN IsCreateField; /* Special case for objects created by CreateField() */ - union acpi_operand_object *BufferObj; /* Containing Buffer object */ - -} ACPI_OBJECT_BUFFER_FIELD; - - -/****************************************************************************** - * - * Objects for handlers - * - *****************************************************************************/ - -typedef struct acpi_object_notify_handler -{ - ACPI_OBJECT_COMMON_HEADER; - ACPI_NAMESPACE_NODE *Node; /* Parent device */ - UINT32 HandlerType; /* Type: Device/System/Both */ - ACPI_NOTIFY_HANDLER Handler; /* Handler address */ - void *Context; - union acpi_operand_object *Next[2]; /* Device and System handler lists */ - -} ACPI_OBJECT_NOTIFY_HANDLER; - - -typedef struct acpi_object_addr_handler -{ - ACPI_OBJECT_COMMON_HEADER; - UINT8 SpaceId; - UINT8 HandlerFlags; - ACPI_ADR_SPACE_HANDLER Handler; - ACPI_NAMESPACE_NODE *Node; /* Parent device */ - void *Context; - ACPI_MUTEX ContextMutex; - ACPI_ADR_SPACE_SETUP Setup; - union acpi_operand_object *RegionList; /* Regions using this handler */ - union acpi_operand_object *Next; - -} ACPI_OBJECT_ADDR_HANDLER; - -/* Flags for address handler (HandlerFlags) */ - -#define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED 0x01 - - -/****************************************************************************** - * - * Special internal objects - * - *****************************************************************************/ - -/* - * The Reference object is used for these opcodes: - * Arg[0-6], Local[0-7], IndexOp, NameOp, RefOfOp, LoadOp, LoadTableOp, DebugOp - * The Reference.Class differentiates these types. - */ -typedef struct acpi_object_reference -{ - ACPI_OBJECT_COMMON_HEADER; - UINT8 Class; /* Reference Class */ - UINT8 TargetType; /* Used for Index Op */ - UINT8 Resolved; /* Reference has been resolved to a value */ - void *Object; /* NameOp=>HANDLE to obj, IndexOp=>ACPI_OPERAND_OBJECT */ - ACPI_NAMESPACE_NODE *Node; /* RefOf or Namepath */ - union acpi_operand_object **Where; /* Target of Index */ - UINT8 *IndexPointer; /* Used for Buffers and Strings */ - UINT8 *Aml; /* Used for deferred resolution of the ref */ - UINT32 Value; /* Used for Local/Arg/Index/DdbHandle */ - -} ACPI_OBJECT_REFERENCE; - -/* Values for Reference.Class above */ - -typedef enum -{ - ACPI_REFCLASS_LOCAL = 0, /* Method local */ - ACPI_REFCLASS_ARG = 1, /* Method argument */ - ACPI_REFCLASS_REFOF = 2, /* Result of RefOf() TBD: Split to Ref/Node and Ref/OperandObj? */ - ACPI_REFCLASS_INDEX = 3, /* Result of Index() */ - ACPI_REFCLASS_TABLE = 4, /* DdbHandle - Load(), LoadTable() */ - ACPI_REFCLASS_NAME = 5, /* Reference to a named object */ - ACPI_REFCLASS_DEBUG = 6, /* Debug object */ - - ACPI_REFCLASS_MAX = 6 - -} ACPI_REFERENCE_CLASSES; - -/* - * Extra object is used as additional storage for types that - * have AML code in their declarations (TermArgs) that must be - * evaluated at run time. - * - * Currently: Region and FieldUnit types - */ -typedef struct acpi_object_extra -{ - ACPI_OBJECT_COMMON_HEADER; - ACPI_NAMESPACE_NODE *Method_REG; /* _REG method for this region (if any) */ - ACPI_NAMESPACE_NODE *ScopeNode; - void *RegionContext; /* Region-specific data */ - UINT8 *AmlStart; - UINT32 AmlLength; - -} ACPI_OBJECT_EXTRA; - - -/* Additional data that can be attached to namespace nodes */ - -typedef struct acpi_object_data -{ - ACPI_OBJECT_COMMON_HEADER; - ACPI_OBJECT_HANDLER Handler; - void *Pointer; - -} ACPI_OBJECT_DATA; - - -/* Structure used when objects are cached for reuse */ - -typedef struct acpi_object_cache_list -{ - ACPI_OBJECT_COMMON_HEADER; - union acpi_operand_object *Next; /* Link for object cache and internal lists*/ - -} ACPI_OBJECT_CACHE_LIST; - - -/****************************************************************************** - * - * ACPI_OPERAND_OBJECT Descriptor - a giant union of all of the above - * - *****************************************************************************/ - -typedef union acpi_operand_object -{ - ACPI_OBJECT_COMMON Common; - ACPI_OBJECT_INTEGER Integer; - ACPI_OBJECT_STRING String; - ACPI_OBJECT_BUFFER Buffer; - ACPI_OBJECT_PACKAGE Package; - ACPI_OBJECT_EVENT Event; - ACPI_OBJECT_METHOD Method; - ACPI_OBJECT_MUTEX Mutex; - ACPI_OBJECT_REGION Region; - ACPI_OBJECT_NOTIFY_COMMON CommonNotify; - ACPI_OBJECT_DEVICE Device; - ACPI_OBJECT_POWER_RESOURCE PowerResource; - ACPI_OBJECT_PROCESSOR Processor; - ACPI_OBJECT_THERMAL_ZONE ThermalZone; - ACPI_OBJECT_FIELD_COMMON CommonField; - ACPI_OBJECT_REGION_FIELD Field; - ACPI_OBJECT_BUFFER_FIELD BufferField; - ACPI_OBJECT_BANK_FIELD BankField; - ACPI_OBJECT_INDEX_FIELD IndexField; - ACPI_OBJECT_NOTIFY_HANDLER Notify; - ACPI_OBJECT_ADDR_HANDLER AddressSpace; - ACPI_OBJECT_REFERENCE Reference; - ACPI_OBJECT_EXTRA Extra; - ACPI_OBJECT_DATA Data; - ACPI_OBJECT_CACHE_LIST Cache; - - /* - * Add namespace node to union in order to simplify code that accepts both - * ACPI_OPERAND_OBJECTs and ACPI_NAMESPACE_NODEs. The structures share - * a common DescriptorType field in order to differentiate them. - */ - ACPI_NAMESPACE_NODE Node; - -} ACPI_OPERAND_OBJECT; - - -/****************************************************************************** - * - * ACPI_DESCRIPTOR - objects that share a common descriptor identifier - * - *****************************************************************************/ - -/* Object descriptor types */ - -#define ACPI_DESC_TYPE_CACHED 0x01 /* Used only when object is cached */ -#define ACPI_DESC_TYPE_STATE 0x02 -#define ACPI_DESC_TYPE_STATE_UPDATE 0x03 -#define ACPI_DESC_TYPE_STATE_PACKAGE 0x04 -#define ACPI_DESC_TYPE_STATE_CONTROL 0x05 -#define ACPI_DESC_TYPE_STATE_RPSCOPE 0x06 -#define ACPI_DESC_TYPE_STATE_PSCOPE 0x07 -#define ACPI_DESC_TYPE_STATE_WSCOPE 0x08 -#define ACPI_DESC_TYPE_STATE_RESULT 0x09 -#define ACPI_DESC_TYPE_STATE_NOTIFY 0x0A -#define ACPI_DESC_TYPE_STATE_THREAD 0x0B -#define ACPI_DESC_TYPE_WALK 0x0C -#define ACPI_DESC_TYPE_PARSER 0x0D -#define ACPI_DESC_TYPE_OPERAND 0x0E -#define ACPI_DESC_TYPE_NAMED 0x0F -#define ACPI_DESC_TYPE_MAX 0x0F - - -typedef struct acpi_common_descriptor -{ - void *CommonPointer; - UINT8 DescriptorType; /* To differentiate various internal objs */ - -} ACPI_COMMON_DESCRIPTOR; - -typedef union acpi_descriptor -{ - ACPI_COMMON_DESCRIPTOR Common; - ACPI_OPERAND_OBJECT Object; - ACPI_NAMESPACE_NODE Node; - ACPI_PARSE_OBJECT Op; - -} ACPI_DESCRIPTOR; - -#pragma pack() - -#endif /* _ACOBJECT_H */ diff --git a/drivers/include/acpica/acopcode.h b/drivers/include/acpica/acopcode.h deleted file mode 100644 index c8d17c3..0000000 --- a/drivers/include/acpica/acopcode.h +++ /dev/null @@ -1,441 +0,0 @@ -/****************************************************************************** - * - * Name: acopcode.h - AML opcode information for the AML parser and interpreter - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef __ACOPCODE_H__ -#define __ACOPCODE_H__ - -#define MAX_EXTENDED_OPCODE 0x88 -#define NUM_EXTENDED_OPCODE (MAX_EXTENDED_OPCODE + 1) -#define MAX_INTERNAL_OPCODE -#define NUM_INTERNAL_OPCODE (MAX_INTERNAL_OPCODE + 1) - -/* Used for non-assigned opcodes */ - -#define _UNK 0x6B - -/* - * Reserved ASCII characters. Do not use any of these for - * internal opcodes, since they are used to differentiate - * name strings from AML opcodes - */ -#define _ASC 0x6C -#define _NAM 0x6C -#define _PFX 0x6D - - -/* - * All AML opcodes and the parse-time arguments for each. Used by the AML - * parser Each list is compressed into a 32-bit number and stored in the - * master opcode table (in psopcode.c). - */ -#define ARGP_ACCESSFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING) -#define ARGP_ACQUIRE_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_WORDDATA) -#define ARGP_ADD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) -#define ARGP_ALIAS_OP ARGP_LIST2 (ARGP_NAMESTRING, ARGP_NAME) -#define ARGP_ARG0 ARG_NONE -#define ARGP_ARG1 ARG_NONE -#define ARGP_ARG2 ARG_NONE -#define ARGP_ARG3 ARG_NONE -#define ARGP_ARG4 ARG_NONE -#define ARGP_ARG5 ARG_NONE -#define ARGP_ARG6 ARG_NONE -#define ARGP_BANK_FIELD_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_NAMESTRING,ARGP_TERMARG, ARGP_BYTEDATA, ARGP_FIELDLIST) -#define ARGP_BIT_AND_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) -#define ARGP_BIT_NAND_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) -#define ARGP_BIT_NOR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) -#define ARGP_BIT_NOT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) -#define ARGP_BIT_OR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) -#define ARGP_BIT_XOR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) -#define ARGP_BREAK_OP ARG_NONE -#define ARGP_BREAK_POINT_OP ARG_NONE -#define ARGP_BUFFER_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_BYTELIST) -#define ARGP_BYTE_OP ARGP_LIST1 (ARGP_BYTEDATA) -#define ARGP_BYTELIST_OP ARGP_LIST1 (ARGP_NAMESTRING) -#define ARGP_COMMENT_OP ARGP_LIST2 (ARGP_BYTEDATA, ARGP_COMMENT) -#define ARGP_CONCAT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) -#define ARGP_CONCAT_RES_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) -#define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_SIMPLENAME, ARGP_TARGET) -#define ARGP_CONNECTFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING) -#define ARGP_CONTINUE_OP ARG_NONE -#define ARGP_COPY_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_SIMPLENAME) -#define ARGP_CREATE_BIT_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) -#define ARGP_CREATE_BYTE_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) -#define ARGP_CREATE_DWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) -#define ARGP_CREATE_FIELD_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) -#define ARGP_CREATE_QWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) -#define ARGP_CREATE_WORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) -#define ARGP_DATA_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG) -#define ARGP_DEBUG_OP ARG_NONE -#define ARGP_DECREMENT_OP ARGP_LIST1 (ARGP_SUPERNAME) -#define ARGP_DEREF_OF_OP ARGP_LIST1 (ARGP_SUPERNAME) -#define ARGP_DEVICE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST) -#define ARGP_DIVIDE_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET, ARGP_TARGET) -#define ARGP_DWORD_OP ARGP_LIST1 (ARGP_DWORDDATA) -#define ARGP_ELSE_OP ARGP_LIST2 (ARGP_PKGLENGTH, ARGP_TERMLIST) -#define ARGP_EVENT_OP ARGP_LIST1 (ARGP_NAME) -#define ARGP_EXTERNAL_OP ARGP_LIST3 (ARGP_NAME, ARGP_BYTEDATA, ARGP_BYTEDATA) -#define ARGP_FATAL_OP ARGP_LIST3 (ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_TERMARG) -#define ARGP_FIELD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_BYTEDATA, ARGP_FIELDLIST) -#define ARGP_FIND_SET_LEFT_BIT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) -#define ARGP_FIND_SET_RIGHT_BIT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) -#define ARGP_FROM_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) -#define ARGP_IF_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST) -#define ARGP_INCREMENT_OP ARGP_LIST1 (ARGP_SUPERNAME) -#define ARGP_INDEX_FIELD_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_NAMESTRING,ARGP_BYTEDATA, ARGP_FIELDLIST) -#define ARGP_INDEX_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) -#define ARGP_LAND_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) -#define ARGP_LEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) -#define ARGP_LGREATER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) -#define ARGP_LGREATEREQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) -#define ARGP_LLESS_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) -#define ARGP_LLESSEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) -#define ARGP_LNOT_OP ARGP_LIST1 (ARGP_TERMARG) -#define ARGP_LNOTEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) -#define ARGP_LOAD_OP ARGP_LIST2 (ARGP_NAMESTRING, ARGP_SUPERNAME) -#define ARGP_LOAD_TABLE_OP ARGP_LIST6 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG) -#define ARGP_LOCAL0 ARG_NONE -#define ARGP_LOCAL1 ARG_NONE -#define ARGP_LOCAL2 ARG_NONE -#define ARGP_LOCAL3 ARG_NONE -#define ARGP_LOCAL4 ARG_NONE -#define ARGP_LOCAL5 ARG_NONE -#define ARGP_LOCAL6 ARG_NONE -#define ARGP_LOCAL7 ARG_NONE -#define ARGP_LOR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) -#define ARGP_MATCH_OP ARGP_LIST6 (ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG) -#define ARGP_METHOD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMLIST) -#define ARGP_METHODCALL_OP ARGP_LIST1 (ARGP_NAMESTRING) -#define ARGP_MID_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) -#define ARGP_MOD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) -#define ARGP_MULTIPLY_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) -#define ARGP_MUTEX_OP ARGP_LIST2 (ARGP_NAME, ARGP_BYTEDATA) -#define ARGP_NAME_OP ARGP_LIST2 (ARGP_NAME, ARGP_DATAOBJ) -#define ARGP_NAMEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING) -#define ARGP_NAMEPATH_OP ARGP_LIST1 (ARGP_NAMESTRING) -#define ARGP_NOOP_OP ARG_NONE -#define ARGP_NOTIFY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG) -#define ARGP_OBJECT_TYPE_OP ARGP_LIST1 (ARGP_SIMPLENAME) -#define ARGP_ONE_OP ARG_NONE -#define ARGP_ONES_OP ARG_NONE -#define ARGP_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_BYTEDATA, ARGP_DATAOBJLIST) -#define ARGP_POWER_RES_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_WORDDATA, ARGP_OBJLIST) -#define ARGP_PROCESSOR_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_BYTEDATA, ARGP_OBJLIST) -#define ARGP_QWORD_OP ARGP_LIST1 (ARGP_QWORDDATA) -#define ARGP_REF_OF_OP ARGP_LIST1 (ARGP_SIMPLENAME) -#define ARGP_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG) -#define ARGP_RELEASE_OP ARGP_LIST1 (ARGP_SUPERNAME) -#define ARGP_RESERVEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING) -#define ARGP_RESET_OP ARGP_LIST1 (ARGP_SUPERNAME) -#define ARGP_RETURN_OP ARGP_LIST1 (ARGP_TERMARG) -#define ARGP_REVISION_OP ARG_NONE -#define ARGP_SCOPE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_TERMLIST) -#define ARGP_SERIALFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING) -#define ARGP_SHIFT_LEFT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) -#define ARGP_SHIFT_RIGHT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) -#define ARGP_SIGNAL_OP ARGP_LIST1 (ARGP_SUPERNAME) -#define ARGP_SIZE_OF_OP ARGP_LIST1 (ARGP_SUPERNAME) -#define ARGP_SLEEP_OP ARGP_LIST1 (ARGP_TERMARG) -#define ARGP_STALL_OP ARGP_LIST1 (ARGP_TERMARG) -#define ARGP_STATICSTRING_OP ARGP_LIST1 (ARGP_NAMESTRING) -#define ARGP_STORE_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_SUPERNAME) -#define ARGP_STRING_OP ARGP_LIST1 (ARGP_CHARLIST) -#define ARGP_SUBTRACT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) -#define ARGP_THERMAL_ZONE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST) -#define ARGP_TIMER_OP ARG_NONE -#define ARGP_TO_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) -#define ARGP_TO_BUFFER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) -#define ARGP_TO_DEC_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) -#define ARGP_TO_HEX_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) -#define ARGP_TO_INTEGER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) -#define ARGP_TO_STRING_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) -#define ARGP_UNLOAD_OP ARGP_LIST1 (ARGP_SUPERNAME) -#define ARGP_VAR_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_DATAOBJLIST) -#define ARGP_WAIT_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG) -#define ARGP_WHILE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST) -#define ARGP_WORD_OP ARGP_LIST1 (ARGP_WORDDATA) -#define ARGP_ZERO_OP ARG_NONE - - -/* - * All AML opcodes and the runtime arguments for each. Used by the AML - * interpreter Each list is compressed into a 32-bit number and stored - * in the master opcode table (in psopcode.c). - * - * (Used by PrepOperands procedure and the ASL Compiler) - */ -#define ARGI_ACCESSFIELD_OP ARGI_INVALID_OPCODE -#define ARGI_ACQUIRE_OP ARGI_LIST2 (ARGI_MUTEX, ARGI_INTEGER) -#define ARGI_ADD_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) -#define ARGI_ALIAS_OP ARGI_INVALID_OPCODE -#define ARGI_ARG0 ARG_NONE -#define ARGI_ARG1 ARG_NONE -#define ARGI_ARG2 ARG_NONE -#define ARGI_ARG3 ARG_NONE -#define ARGI_ARG4 ARG_NONE -#define ARGI_ARG5 ARG_NONE -#define ARGI_ARG6 ARG_NONE -#define ARGI_BANK_FIELD_OP ARGI_LIST1 (ARGI_INTEGER) -#define ARGI_BIT_AND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) -#define ARGI_BIT_NAND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) -#define ARGI_BIT_NOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) -#define ARGI_BIT_NOT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) -#define ARGI_BIT_OR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) -#define ARGI_BIT_XOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) -#define ARGI_BREAK_OP ARG_NONE -#define ARGI_BREAK_POINT_OP ARG_NONE -#define ARGI_BUFFER_OP ARGI_LIST1 (ARGI_INTEGER) -#define ARGI_BYTE_OP ARGI_INVALID_OPCODE -#define ARGI_BYTELIST_OP ARGI_INVALID_OPCODE -#define ARGI_COMMENT_OP ARGI_INVALID_OPCODE -#define ARGI_CONCAT_OP ARGI_LIST3 (ARGI_ANYTYPE, ARGI_ANYTYPE, ARGI_TARGETREF) -#define ARGI_CONCAT_RES_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_BUFFER, ARGI_TARGETREF) -#define ARGI_COND_REF_OF_OP ARGI_LIST2 (ARGI_OBJECT_REF, ARGI_TARGETREF) -#define ARGI_CONNECTFIELD_OP ARGI_INVALID_OPCODE -#define ARGI_CONTINUE_OP ARGI_INVALID_OPCODE -#define ARGI_COPY_OP ARGI_LIST2 (ARGI_ANYTYPE, ARGI_SIMPLE_TARGET) -#define ARGI_CREATE_BIT_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) -#define ARGI_CREATE_BYTE_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) -#define ARGI_CREATE_DWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) -#define ARGI_CREATE_FIELD_OP ARGI_LIST4 (ARGI_BUFFER, ARGI_INTEGER, ARGI_INTEGER, ARGI_REFERENCE) -#define ARGI_CREATE_QWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) -#define ARGI_CREATE_WORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) -#define ARGI_DATA_REGION_OP ARGI_LIST3 (ARGI_STRING, ARGI_STRING, ARGI_STRING) -#define ARGI_DEBUG_OP ARG_NONE -#define ARGI_DECREMENT_OP ARGI_LIST1 (ARGI_TARGETREF) -#define ARGI_DEREF_OF_OP ARGI_LIST1 (ARGI_REF_OR_STRING) -#define ARGI_DEVICE_OP ARGI_INVALID_OPCODE -#define ARGI_DIVIDE_OP ARGI_LIST4 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF, ARGI_TARGETREF) -#define ARGI_DWORD_OP ARGI_INVALID_OPCODE -#define ARGI_ELSE_OP ARGI_INVALID_OPCODE -#define ARGI_EVENT_OP ARGI_INVALID_OPCODE -#define ARGI_EXTERNAL_OP ARGI_LIST3 (ARGI_STRING, ARGI_INTEGER, ARGI_INTEGER) -#define ARGI_FATAL_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER) -#define ARGI_FIELD_OP ARGI_INVALID_OPCODE -#define ARGI_FIND_SET_LEFT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) -#define ARGI_FIND_SET_RIGHT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) -#define ARGI_FROM_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_FIXED_TARGET) -#define ARGI_IF_OP ARGI_INVALID_OPCODE -#define ARGI_INCREMENT_OP ARGI_LIST1 (ARGI_TARGETREF) -#define ARGI_INDEX_FIELD_OP ARGI_INVALID_OPCODE -#define ARGI_INDEX_OP ARGI_LIST3 (ARGI_COMPLEXOBJ, ARGI_INTEGER, ARGI_TARGETREF) -#define ARGI_LAND_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) -#define ARGI_LEQUAL_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA) -#define ARGI_LGREATER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA) -#define ARGI_LGREATEREQUAL_OP ARGI_INVALID_OPCODE -#define ARGI_LLESS_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA) -#define ARGI_LLESSEQUAL_OP ARGI_INVALID_OPCODE -#define ARGI_LNOT_OP ARGI_LIST1 (ARGI_INTEGER) -#define ARGI_LNOTEQUAL_OP ARGI_INVALID_OPCODE -#define ARGI_LOAD_OP ARGI_LIST2 (ARGI_REGION_OR_BUFFER,ARGI_TARGETREF) -#define ARGI_LOAD_TABLE_OP ARGI_LIST6 (ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_ANYTYPE) -#define ARGI_LOCAL0 ARG_NONE -#define ARGI_LOCAL1 ARG_NONE -#define ARGI_LOCAL2 ARG_NONE -#define ARGI_LOCAL3 ARG_NONE -#define ARGI_LOCAL4 ARG_NONE -#define ARGI_LOCAL5 ARG_NONE -#define ARGI_LOCAL6 ARG_NONE -#define ARGI_LOCAL7 ARG_NONE -#define ARGI_LOR_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) -#define ARGI_MATCH_OP ARGI_LIST6 (ARGI_PACKAGE, ARGI_INTEGER, ARGI_COMPUTEDATA, ARGI_INTEGER,ARGI_COMPUTEDATA,ARGI_INTEGER) -#define ARGI_METHOD_OP ARGI_INVALID_OPCODE -#define ARGI_METHODCALL_OP ARGI_INVALID_OPCODE -#define ARGI_MID_OP ARGI_LIST4 (ARGI_BUFFER_OR_STRING,ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) -#define ARGI_MOD_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) -#define ARGI_MULTIPLY_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) -#define ARGI_MUTEX_OP ARGI_INVALID_OPCODE -#define ARGI_NAME_OP ARGI_INVALID_OPCODE -#define ARGI_NAMEDFIELD_OP ARGI_INVALID_OPCODE -#define ARGI_NAMEPATH_OP ARGI_INVALID_OPCODE -#define ARGI_NOOP_OP ARG_NONE -#define ARGI_NOTIFY_OP ARGI_LIST2 (ARGI_DEVICE_REF, ARGI_INTEGER) -#define ARGI_OBJECT_TYPE_OP ARGI_LIST1 (ARGI_ANYTYPE) -#define ARGI_ONE_OP ARG_NONE -#define ARGI_ONES_OP ARG_NONE -#define ARGI_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER) -#define ARGI_POWER_RES_OP ARGI_INVALID_OPCODE -#define ARGI_PROCESSOR_OP ARGI_INVALID_OPCODE -#define ARGI_QWORD_OP ARGI_INVALID_OPCODE -#define ARGI_REF_OF_OP ARGI_LIST1 (ARGI_OBJECT_REF) -#define ARGI_REGION_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) -#define ARGI_RELEASE_OP ARGI_LIST1 (ARGI_MUTEX) -#define ARGI_RESERVEDFIELD_OP ARGI_INVALID_OPCODE -#define ARGI_RESET_OP ARGI_LIST1 (ARGI_EVENT) -#define ARGI_RETURN_OP ARGI_INVALID_OPCODE -#define ARGI_REVISION_OP ARG_NONE -#define ARGI_SCOPE_OP ARGI_INVALID_OPCODE -#define ARGI_SERIALFIELD_OP ARGI_INVALID_OPCODE -#define ARGI_SHIFT_LEFT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) -#define ARGI_SHIFT_RIGHT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) -#define ARGI_SIGNAL_OP ARGI_LIST1 (ARGI_EVENT) -#define ARGI_SIZE_OF_OP ARGI_LIST1 (ARGI_DATAOBJECT) -#define ARGI_SLEEP_OP ARGI_LIST1 (ARGI_INTEGER) -#define ARGI_STALL_OP ARGI_LIST1 (ARGI_INTEGER) -#define ARGI_STATICSTRING_OP ARGI_INVALID_OPCODE -#define ARGI_STORE_OP ARGI_LIST2 (ARGI_DATAREFOBJ, ARGI_STORE_TARGET) -#define ARGI_STRING_OP ARGI_INVALID_OPCODE -#define ARGI_SUBTRACT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) -#define ARGI_THERMAL_ZONE_OP ARGI_INVALID_OPCODE -#define ARGI_TIMER_OP ARG_NONE -#define ARGI_TO_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_FIXED_TARGET) -#define ARGI_TO_BUFFER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET) -#define ARGI_TO_DEC_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET) -#define ARGI_TO_HEX_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET) -#define ARGI_TO_INTEGER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET) -#define ARGI_TO_STRING_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_FIXED_TARGET) -#define ARGI_UNLOAD_OP ARGI_LIST1 (ARGI_DDBHANDLE) -#define ARGI_VAR_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER) -#define ARGI_WAIT_OP ARGI_LIST2 (ARGI_EVENT, ARGI_INTEGER) -#define ARGI_WHILE_OP ARGI_INVALID_OPCODE -#define ARGI_WORD_OP ARGI_INVALID_OPCODE -#define ARGI_ZERO_OP ARG_NONE - -#endif /* __ACOPCODE_H__ */ diff --git a/drivers/include/acpica/acoutput.h b/drivers/include/acpica/acoutput.h deleted file mode 100644 index 49a466d..0000000 --- a/drivers/include/acpica/acoutput.h +++ /dev/null @@ -1,619 +0,0 @@ -/****************************************************************************** - * - * Name: acoutput.h -- debug output - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef __ACOUTPUT_H__ -#define __ACOUTPUT_H__ - -/* - * Debug levels and component IDs. These are used to control the - * granularity of the output of the ACPI_DEBUG_PRINT macro -- on a - * per-component basis and a per-exception-type basis. - */ - -/* Component IDs are used in the global "DebugLayer" */ - -#define ACPI_UTILITIES 0x00000001 -#define ACPI_HARDWARE 0x00000002 -#define ACPI_EVENTS 0x00000004 -#define ACPI_TABLES 0x00000008 -#define ACPI_NAMESPACE 0x00000010 -#define ACPI_PARSER 0x00000020 -#define ACPI_DISPATCHER 0x00000040 -#define ACPI_EXECUTER 0x00000080 -#define ACPI_RESOURCES 0x00000100 -#define ACPI_CA_DEBUGGER 0x00000200 -#define ACPI_OS_SERVICES 0x00000400 -#define ACPI_CA_DISASSEMBLER 0x00000800 - -/* Component IDs for ACPI tools and utilities */ - -#define ACPI_COMPILER 0x00001000 -#define ACPI_TOOLS 0x00002000 -#define ACPI_EXAMPLE 0x00004000 -#define ACPI_DRIVER 0x00008000 -#define DT_COMPILER 0x00010000 -#define ASL_PREPROCESSOR 0x00020000 - -#define ACPI_ALL_COMPONENTS 0x0001FFFF -#define ACPI_COMPONENT_DEFAULT (ACPI_ALL_COMPONENTS) - -/* Component IDs reserved for ACPI drivers */ - -#define ACPI_ALL_DRIVERS 0xFFFF0000 - - -/* - * Raw debug output levels, do not use these in the ACPI_DEBUG_PRINT macros - */ -#define ACPI_LV_INIT 0x00000001 -#define ACPI_LV_DEBUG_OBJECT 0x00000002 -#define ACPI_LV_INFO 0x00000004 -#define ACPI_LV_REPAIR 0x00000008 -#define ACPI_LV_TRACE_POINT 0x00000010 -#define ACPI_LV_ALL_EXCEPTIONS 0x0000001F - -/* Trace verbosity level 1 [Standard Trace Level] */ - -#define ACPI_LV_INIT_NAMES 0x00000020 -#define ACPI_LV_PARSE 0x00000040 -#define ACPI_LV_LOAD 0x00000080 -#define ACPI_LV_DISPATCH 0x00000100 -#define ACPI_LV_EXEC 0x00000200 -#define ACPI_LV_NAMES 0x00000400 -#define ACPI_LV_OPREGION 0x00000800 -#define ACPI_LV_BFIELD 0x00001000 -#define ACPI_LV_TABLES 0x00002000 -#define ACPI_LV_VALUES 0x00004000 -#define ACPI_LV_OBJECTS 0x00008000 -#define ACPI_LV_RESOURCES 0x00010000 -#define ACPI_LV_USER_REQUESTS 0x00020000 -#define ACPI_LV_PACKAGE 0x00040000 -#define ACPI_LV_EVALUATION 0x00080000 -#define ACPI_LV_VERBOSITY1 0x000FFF40 | ACPI_LV_ALL_EXCEPTIONS - -/* Trace verbosity level 2 [Function tracing and memory allocation] */ - -#define ACPI_LV_ALLOCATIONS 0x00100000 -#define ACPI_LV_FUNCTIONS 0x00200000 -#define ACPI_LV_OPTIMIZATIONS 0x00400000 -#define ACPI_LV_PARSE_TREES 0x00800000 -#define ACPI_LV_VERBOSITY2 0x00F00000 | ACPI_LV_VERBOSITY1 -#define ACPI_LV_ALL ACPI_LV_VERBOSITY2 - -/* Trace verbosity level 3 [Threading, I/O, and Interrupts] */ - -#define ACPI_LV_MUTEX 0x01000000 -#define ACPI_LV_THREADS 0x02000000 -#define ACPI_LV_IO 0x04000000 -#define ACPI_LV_INTERRUPTS 0x08000000 -#define ACPI_LV_VERBOSITY3 0x0F000000 | ACPI_LV_VERBOSITY2 - -/* Exceptionally verbose output -- also used in the global "DebugLevel" */ - -#define ACPI_LV_AML_DISASSEMBLE 0x10000000 -#define ACPI_LV_VERBOSE_INFO 0x20000000 -#define ACPI_LV_FULL_TABLES 0x40000000 -#define ACPI_LV_EVENTS 0x80000000 -#define ACPI_LV_VERBOSE 0xF0000000 - - -/* - * Debug level macros that are used in the DEBUG_PRINT macros - */ -#define ACPI_DEBUG_LEVEL(dl) (UINT32) dl,ACPI_DEBUG_PARAMETERS - -/* - * Exception level -- used in the global "DebugLevel" - * - * Note: For errors, use the ACPI_ERROR or ACPI_EXCEPTION interfaces. - * For warnings, use ACPI_WARNING. - */ -#define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT) -#define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT) -#define ACPI_DB_INFO ACPI_DEBUG_LEVEL (ACPI_LV_INFO) -#define ACPI_DB_REPAIR ACPI_DEBUG_LEVEL (ACPI_LV_REPAIR) -#define ACPI_DB_TRACE_POINT ACPI_DEBUG_LEVEL (ACPI_LV_TRACE_POINT) -#define ACPI_DB_ALL_EXCEPTIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS) - -/* Trace level -- also used in the global "DebugLevel" */ - -#define ACPI_DB_INIT_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_INIT_NAMES) -#define ACPI_DB_THREADS ACPI_DEBUG_LEVEL (ACPI_LV_THREADS) -#define ACPI_DB_PARSE ACPI_DEBUG_LEVEL (ACPI_LV_PARSE) -#define ACPI_DB_DISPATCH ACPI_DEBUG_LEVEL (ACPI_LV_DISPATCH) -#define ACPI_DB_LOAD ACPI_DEBUG_LEVEL (ACPI_LV_LOAD) -#define ACPI_DB_EXEC ACPI_DEBUG_LEVEL (ACPI_LV_EXEC) -#define ACPI_DB_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_NAMES) -#define ACPI_DB_OPREGION ACPI_DEBUG_LEVEL (ACPI_LV_OPREGION) -#define ACPI_DB_BFIELD ACPI_DEBUG_LEVEL (ACPI_LV_BFIELD) -#define ACPI_DB_TABLES ACPI_DEBUG_LEVEL (ACPI_LV_TABLES) -#define ACPI_DB_FUNCTIONS ACPI_DEBUG_LEVEL (ACPI_LV_FUNCTIONS) -#define ACPI_DB_OPTIMIZATIONS ACPI_DEBUG_LEVEL (ACPI_LV_OPTIMIZATIONS) -#define ACPI_DB_PARSE_TREES ACPI_DEBUG_LEVEL (ACPI_LV_PARSE_TREES) -#define ACPI_DB_VALUES ACPI_DEBUG_LEVEL (ACPI_LV_VALUES) -#define ACPI_DB_OBJECTS ACPI_DEBUG_LEVEL (ACPI_LV_OBJECTS) -#define ACPI_DB_ALLOCATIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALLOCATIONS) -#define ACPI_DB_RESOURCES ACPI_DEBUG_LEVEL (ACPI_LV_RESOURCES) -#define ACPI_DB_IO ACPI_DEBUG_LEVEL (ACPI_LV_IO) -#define ACPI_DB_INTERRUPTS ACPI_DEBUG_LEVEL (ACPI_LV_INTERRUPTS) -#define ACPI_DB_USER_REQUESTS ACPI_DEBUG_LEVEL (ACPI_LV_USER_REQUESTS) -#define ACPI_DB_PACKAGE ACPI_DEBUG_LEVEL (ACPI_LV_PACKAGE) -#define ACPI_DB_EVALUATION ACPI_DEBUG_LEVEL (ACPI_LV_EVALUATION) -#define ACPI_DB_MUTEX ACPI_DEBUG_LEVEL (ACPI_LV_MUTEX) -#define ACPI_DB_EVENTS ACPI_DEBUG_LEVEL (ACPI_LV_EVENTS) - -#define ACPI_DB_ALL ACPI_DEBUG_LEVEL (ACPI_LV_ALL) - -/* Defaults for DebugLevel, debug and normal */ - -#define ACPI_DEBUG_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT | ACPI_LV_EVALUATION | ACPI_LV_REPAIR) -#define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT | ACPI_LV_REPAIR) -#define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL) - - -/* - * Global trace flags - */ -#define ACPI_TRACE_ENABLED ((UINT32) 4) -#define ACPI_TRACE_ONESHOT ((UINT32) 2) -#define ACPI_TRACE_OPCODE ((UINT32) 1) - -/* Defaults for trace debugging level/layer */ - -#define ACPI_TRACE_LEVEL_ALL ACPI_LV_ALL -#define ACPI_TRACE_LAYER_ALL 0x000001FF -#define ACPI_TRACE_LEVEL_DEFAULT ACPI_LV_TRACE_POINT -#define ACPI_TRACE_LAYER_DEFAULT ACPI_EXECUTER - - -#if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES) -/* - * The module name is used primarily for error and debug messages. - * The __FILE__ macro is not very useful for this, because it - * usually includes the entire pathname to the module making the - * debug output difficult to read. - */ -#define ACPI_MODULE_NAME(Name) static const char ACPI_UNUSED_VAR _AcpiModuleName[] = Name; -#else -/* - * For the no-debug and no-error-msg cases, we must at least define - * a null module name. - */ -#define ACPI_MODULE_NAME(Name) -#define _AcpiModuleName "" -#endif - -/* - * Ascii error messages can be configured out - */ -#ifndef ACPI_NO_ERROR_MESSAGES -#define AE_INFO _AcpiModuleName, __LINE__ -#define ACPI_ONCE(_fn, _plist) { static char _done; if (!_done) { _done = 1; _fn _plist; } } - -/* - * Error reporting. Callers module and line number are inserted by AE_INFO, - * the plist contains a set of parens to allow variable-length lists. - * These macros are used for both the debug and non-debug versions of the code. - */ -#define ACPI_INFO(plist) AcpiInfo plist -#define ACPI_WARNING(plist) AcpiWarning plist -#define ACPI_WARNING_ONCE(plist) ACPI_ONCE(AcpiWarning, plist) -#define ACPI_EXCEPTION(plist) AcpiException plist -#define ACPI_ERROR(plist) AcpiError plist -#define ACPI_ERROR_ONCE(plist) ACPI_ONCE(AcpiError, plist) -#define ACPI_BIOS_WARNING(plist) AcpiBiosWarning plist -#define ACPI_BIOS_EXCEPTION(plist) AcpiBiosException plist -#define ACPI_BIOS_ERROR(plist) AcpiBiosError plist -#define ACPI_DEBUG_OBJECT(obj,l,i) AcpiExDoDebugObject(obj,l,i) - -#else - -/* No error messages */ - -#define ACPI_INFO(plist) -#define ACPI_WARNING(plist) -#define ACPI_WARNING_ONCE(plist) -#define ACPI_EXCEPTION(plist) -#define ACPI_ERROR(plist) -#define ACPI_ERROR_ONCE(plist) -#define ACPI_BIOS_WARNING(plist) -#define ACPI_BIOS_EXCEPTION(plist) -#define ACPI_BIOS_ERROR(plist) -#define ACPI_DEBUG_OBJECT(obj,l,i) - -#endif /* ACPI_NO_ERROR_MESSAGES */ - - -/* - * Debug macros that are conditionally compiled - */ -#ifdef ACPI_DEBUG_OUTPUT - -/* - * If ACPI_GET_FUNCTION_NAME was not defined in the compiler-dependent header, - * define it now. This is the case where there the compiler does not support - * a __FUNCTION__ macro or equivalent. - */ -#ifndef ACPI_GET_FUNCTION_NAME -#define ACPI_GET_FUNCTION_NAME _AcpiFunctionName - -/* - * The Name parameter should be the procedure name as a non-quoted string. - * The function name is also used by the function exit macros below. - * Note: (const char) is used to be compatible with the debug interfaces - * and macros such as __FUNCTION__. - */ -#define ACPI_FUNCTION_NAME(Name) static const char _AcpiFunctionName[] = #Name; - -#else -/* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */ - -#define ACPI_FUNCTION_NAME(Name) -#endif /* ACPI_GET_FUNCTION_NAME */ - -/* - * Common parameters used for debug output functions: - * line number, function name, module(file) name, component ID - */ -#define ACPI_DEBUG_PARAMETERS \ - __LINE__, ACPI_GET_FUNCTION_NAME, _AcpiModuleName, _COMPONENT - -/* Check if debug output is currently dynamically enabled */ - -#define ACPI_IS_DEBUG_ENABLED(Level, Component) \ - ((Level & AcpiDbgLevel) && (Component & AcpiDbgLayer)) - -/* - * Master debug print macros - * Print message if and only if: - * 1) Debug print for the current component is enabled - * 2) Debug error level or trace level for the print statement is enabled - * - * November 2012: Moved the runtime check for whether to actually emit the - * debug message outside of the print function itself. This improves overall - * performance at a relatively small code cost. Implementation involves the - * use of variadic macros supported by C99. - * - * Note: the ACPI_DO_WHILE0 macro is used to prevent some compilers from - * complaining about these constructs. On other compilers the do...while - * adds some extra code, so this feature is optional. - */ -#ifdef ACPI_USE_DO_WHILE_0 -#define ACPI_DO_WHILE0(a) do a while(0) -#else -#define ACPI_DO_WHILE0(a) a -#endif - -/* DEBUG_PRINT functions */ - -#ifndef COMPILER_VA_MACRO - -#define ACPI_DEBUG_PRINT(plist) AcpiDebugPrint plist -#define ACPI_DEBUG_PRINT_RAW(plist) AcpiDebugPrintRaw plist - -#else - -/* Helper macros for DEBUG_PRINT */ - -#define ACPI_DO_DEBUG_PRINT(Function, Level, Line, Filename, Modulename, Component, ...) \ - ACPI_DO_WHILE0 ({ \ - if (ACPI_IS_DEBUG_ENABLED (Level, Component)) \ - { \ - Function (Level, Line, Filename, Modulename, Component, __VA_ARGS__); \ - } \ - }) - -#define ACPI_ACTUAL_DEBUG(Level, Line, Filename, Modulename, Component, ...) \ - ACPI_DO_DEBUG_PRINT (AcpiDebugPrint, Level, Line, \ - Filename, Modulename, Component, __VA_ARGS__) - -#define ACPI_ACTUAL_DEBUG_RAW(Level, Line, Filename, Modulename, Component, ...) \ - ACPI_DO_DEBUG_PRINT (AcpiDebugPrintRaw, Level, Line, \ - Filename, Modulename, Component, __VA_ARGS__) - -#define ACPI_DEBUG_PRINT(plist) ACPI_ACTUAL_DEBUG plist -#define ACPI_DEBUG_PRINT_RAW(plist) ACPI_ACTUAL_DEBUG_RAW plist - -#endif - - -/* - * Function entry tracing - * - * The name of the function is emitted as a local variable that is - * intended to be used by both the entry trace and the exit trace. - */ - -/* Helper macro */ - -#define ACPI_TRACE_ENTRY(Name, Function, Type, Param) \ - ACPI_FUNCTION_NAME (Name) \ - Function (ACPI_DEBUG_PARAMETERS, (Type) (Param)) - -/* The actual entry trace macros */ - -#define ACPI_FUNCTION_TRACE(Name) \ - ACPI_FUNCTION_NAME(Name) \ - AcpiUtTrace (ACPI_DEBUG_PARAMETERS) - -#define ACPI_FUNCTION_TRACE_PTR(Name, Pointer) \ - ACPI_TRACE_ENTRY (Name, AcpiUtTracePtr, void *, Pointer) - -#define ACPI_FUNCTION_TRACE_U32(Name, Value) \ - ACPI_TRACE_ENTRY (Name, AcpiUtTraceU32, UINT32, Value) - -#define ACPI_FUNCTION_TRACE_STR(Name, String) \ - ACPI_TRACE_ENTRY (Name, AcpiUtTraceStr, const char *, String) - -#define ACPI_FUNCTION_ENTRY() \ - AcpiUtTrackStackPtr() - - -/* - * Function exit tracing - * - * These macros include a return statement. This is usually considered - * bad form, but having a separate exit macro before the actual return - * is very ugly and difficult to maintain. - * - * One of the FUNCTION_TRACE macros above must be used in conjunction - * with these macros so that "_AcpiFunctionName" is defined. - * - * There are two versions of most of the return macros. The default version is - * safer, since it avoids side-effects by guaranteeing that the argument will - * not be evaluated twice. - * - * A less-safe version of the macros is provided for optional use if the - * compiler uses excessive CPU stack (for example, this may happen in the - * debug case if code optimization is disabled.) - */ - -/* Exit trace helper macro */ - -#ifndef ACPI_SIMPLE_RETURN_MACROS - -#define ACPI_TRACE_EXIT(Function, Type, Param) \ - ACPI_DO_WHILE0 ({ \ - register Type _Param = (Type) (Param); \ - Function (ACPI_DEBUG_PARAMETERS, _Param); \ - return (_Param); \ - }) - -#else /* Use original less-safe macros */ - -#define ACPI_TRACE_EXIT(Function, Type, Param) \ - ACPI_DO_WHILE0 ({ \ - Function (ACPI_DEBUG_PARAMETERS, (Type) (Param)); \ - return (Param); \ - }) - -#endif /* ACPI_SIMPLE_RETURN_MACROS */ - -/* The actual exit macros */ - -#define return_VOID \ - ACPI_DO_WHILE0 ({ \ - AcpiUtExit (ACPI_DEBUG_PARAMETERS); \ - return; \ - }) - -#define return_ACPI_STATUS(Status) \ - ACPI_TRACE_EXIT (AcpiUtStatusExit, ACPI_STATUS, Status) - -#define return_PTR(Pointer) \ - ACPI_TRACE_EXIT (AcpiUtPtrExit, void *, Pointer) - -#define return_STR(String) \ - ACPI_TRACE_EXIT (AcpiUtStrExit, const char *, String) - -#define return_VALUE(Value) \ - ACPI_TRACE_EXIT (AcpiUtValueExit, UINT64, Value) - -#define return_UINT32(Value) \ - ACPI_TRACE_EXIT (AcpiUtValueExit, UINT32, Value) - -#define return_UINT8(Value) \ - ACPI_TRACE_EXIT (AcpiUtValueExit, UINT8, Value) - -/* Conditional execution */ - -#define ACPI_DEBUG_EXEC(a) a -#define ACPI_DEBUG_ONLY_MEMBERS(a) a -#define _VERBOSE_STRUCTURES - - -/* Various object display routines for debug */ - -#define ACPI_DUMP_STACK_ENTRY(a) AcpiExDumpOperand((a), 0) -#define ACPI_DUMP_OPERANDS(a, b ,c) AcpiExDumpOperands(a, b, c) -#define ACPI_DUMP_ENTRY(a, b) AcpiNsDumpEntry (a, b) -#define ACPI_DUMP_PATHNAME(a, b, c, d) AcpiNsDumpPathname(a, b, c, d) -#define ACPI_DUMP_BUFFER(a, b) AcpiUtDebugDumpBuffer((UINT8 *) a, b, DB_BYTE_DISPLAY, _COMPONENT) - -#define ACPI_TRACE_POINT(a, b, c, d) AcpiTracePoint (a, b, c, d) - -#else /* ACPI_DEBUG_OUTPUT */ -/* - * This is the non-debug case -- make everything go away, - * leaving no executable debug code! - */ -#define ACPI_DEBUG_PRINT(pl) -#define ACPI_DEBUG_PRINT_RAW(pl) -#define ACPI_DEBUG_EXEC(a) -#define ACPI_DEBUG_ONLY_MEMBERS(a) -#define ACPI_FUNCTION_NAME(a) -#define ACPI_FUNCTION_TRACE(a) -#define ACPI_FUNCTION_TRACE_PTR(a, b) -#define ACPI_FUNCTION_TRACE_U32(a, b) -#define ACPI_FUNCTION_TRACE_STR(a, b) -#define ACPI_FUNCTION_ENTRY() -#define ACPI_DUMP_STACK_ENTRY(a) -#define ACPI_DUMP_OPERANDS(a, b, c) -#define ACPI_DUMP_ENTRY(a, b) -#define ACPI_DUMP_PATHNAME(a, b, c, d) -#define ACPI_DUMP_BUFFER(a, b) -#define ACPI_IS_DEBUG_ENABLED(Level, Component) 0 -#define ACPI_TRACE_POINT(a, b, c, d) - -/* Return macros must have a return statement at the minimum */ - -#define return_VOID return -#define return_ACPI_STATUS(s) return(s) -#define return_PTR(s) return(s) -#define return_STR(s) return(s) -#define return_VALUE(s) return(s) -#define return_UINT8(s) return(s) -#define return_UINT32(s) return(s) - -#endif /* ACPI_DEBUG_OUTPUT */ - - -#endif /* __ACOUTPUT_H__ */ diff --git a/drivers/include/acpica/acparser.h b/drivers/include/acpica/acparser.h deleted file mode 100644 index 8b3d370..0000000 --- a/drivers/include/acpica/acparser.h +++ /dev/null @@ -1,476 +0,0 @@ -/****************************************************************************** - * - * Module Name: acparser.h - AML Parser subcomponent prototypes and defines - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef __ACPARSER_H__ -#define __ACPARSER_H__ - - -#define OP_HAS_RETURN_VALUE 1 - -/* Variable number of arguments. This field must be 32 bits */ - -#define ACPI_VAR_ARGS ACPI_UINT32_MAX - - -#define ACPI_PARSE_DELETE_TREE 0x0001 -#define ACPI_PARSE_NO_TREE_DELETE 0x0000 -#define ACPI_PARSE_TREE_MASK 0x0001 - -#define ACPI_PARSE_LOAD_PASS1 0x0010 -#define ACPI_PARSE_LOAD_PASS2 0x0020 -#define ACPI_PARSE_EXECUTE 0x0030 -#define ACPI_PARSE_MODE_MASK 0x0030 - -#define ACPI_PARSE_DEFERRED_OP 0x0100 -#define ACPI_PARSE_DISASSEMBLE 0x0200 - -#define ACPI_PARSE_MODULE_LEVEL 0x0400 - -/****************************************************************************** - * - * Parser interfaces - * - *****************************************************************************/ - -extern const UINT8 AcpiGbl_ShortOpIndex[]; -extern const UINT8 AcpiGbl_LongOpIndex[]; - - -/* - * psxface - Parser external interfaces - */ -ACPI_STATUS -AcpiPsExecuteMethod ( - ACPI_EVALUATE_INFO *Info); - -ACPI_STATUS -AcpiPsExecuteTable ( - ACPI_EVALUATE_INFO *Info); - - -/* - * psargs - Parse AML opcode arguments - */ -UINT8 * -AcpiPsGetNextPackageEnd ( - ACPI_PARSE_STATE *ParserState); - -char * -AcpiPsGetNextNamestring ( - ACPI_PARSE_STATE *ParserState); - -void -AcpiPsGetNextSimpleArg ( - ACPI_PARSE_STATE *ParserState, - UINT32 ArgType, - ACPI_PARSE_OBJECT *Arg); - -ACPI_STATUS -AcpiPsGetNextNamepath ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_STATE *ParserState, - ACPI_PARSE_OBJECT *Arg, - BOOLEAN PossibleMethodCall); - -/* Values for BOOLEAN above */ - -#define ACPI_NOT_METHOD_CALL FALSE -#define ACPI_POSSIBLE_METHOD_CALL TRUE - -ACPI_STATUS -AcpiPsGetNextArg ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_STATE *ParserState, - UINT32 ArgType, - ACPI_PARSE_OBJECT **ReturnArg); - - -/* - * psfind - */ -ACPI_PARSE_OBJECT * -AcpiPsFindName ( - ACPI_PARSE_OBJECT *Scope, - UINT32 Name, - UINT32 Opcode); - -ACPI_PARSE_OBJECT* -AcpiPsGetParent ( - ACPI_PARSE_OBJECT *Op); - - -/* - * psobject - support for parse object processing - */ -ACPI_STATUS -AcpiPsBuildNamedOp ( - ACPI_WALK_STATE *WalkState, - UINT8 *AmlOpStart, - ACPI_PARSE_OBJECT *UnnamedOp, - ACPI_PARSE_OBJECT **Op); - -ACPI_STATUS -AcpiPsCreateOp ( - ACPI_WALK_STATE *WalkState, - UINT8 *AmlOpStart, - ACPI_PARSE_OBJECT **NewOp); - -ACPI_STATUS -AcpiPsCompleteOp ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT **Op, - ACPI_STATUS Status); - -ACPI_STATUS -AcpiPsCompleteFinalOp ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op, - ACPI_STATUS Status); - - -/* - * psopinfo - AML Opcode information - */ -const ACPI_OPCODE_INFO * -AcpiPsGetOpcodeInfo ( - UINT16 Opcode); - -const char * -AcpiPsGetOpcodeName ( - UINT16 Opcode); - -UINT8 -AcpiPsGetArgumentCount ( - UINT32 OpType); - - -/* - * psparse - top level parsing routines - */ -ACPI_STATUS -AcpiPsParseAml ( - ACPI_WALK_STATE *WalkState); - -UINT32 -AcpiPsGetOpcodeSize ( - UINT32 Opcode); - -UINT16 -AcpiPsPeekOpcode ( - ACPI_PARSE_STATE *state); - -ACPI_STATUS -AcpiPsCompleteThisOp ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op); - -ACPI_STATUS -AcpiPsNextParseState ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op, - ACPI_STATUS CallbackStatus); - - -/* - * psloop - main parse loop - */ -ACPI_STATUS -AcpiPsParseLoop ( - ACPI_WALK_STATE *WalkState); - - -/* - * psscope - Scope stack management routines - */ -ACPI_STATUS -AcpiPsInitScope ( - ACPI_PARSE_STATE *ParserState, - ACPI_PARSE_OBJECT *Root); - -ACPI_PARSE_OBJECT * -AcpiPsGetParentScope ( - ACPI_PARSE_STATE *state); - -BOOLEAN -AcpiPsHasCompletedScope ( - ACPI_PARSE_STATE *ParserState); - -void -AcpiPsPopScope ( - ACPI_PARSE_STATE *ParserState, - ACPI_PARSE_OBJECT **Op, - UINT32 *ArgList, - UINT32 *ArgCount); - -ACPI_STATUS -AcpiPsPushScope ( - ACPI_PARSE_STATE *ParserState, - ACPI_PARSE_OBJECT *Op, - UINT32 RemainingArgs, - UINT32 ArgCount); - -void -AcpiPsCleanupScope ( - ACPI_PARSE_STATE *state); - - -/* - * pstree - parse tree manipulation routines - */ -void -AcpiPsAppendArg( - ACPI_PARSE_OBJECT *op, - ACPI_PARSE_OBJECT *arg); - -ACPI_PARSE_OBJECT* -AcpiPsFind ( - ACPI_PARSE_OBJECT *Scope, - char *Path, - UINT16 Opcode, - UINT32 Create); - -ACPI_PARSE_OBJECT * -AcpiPsGetArg( - ACPI_PARSE_OBJECT *op, - UINT32 argn); - -ACPI_PARSE_OBJECT * -AcpiPsGetDepthNext ( - ACPI_PARSE_OBJECT *Origin, - ACPI_PARSE_OBJECT *Op); - - -/* - * pswalk - parse tree walk routines - */ -ACPI_STATUS -AcpiPsWalkParsedAml ( - ACPI_PARSE_OBJECT *StartOp, - ACPI_PARSE_OBJECT *EndOp, - ACPI_OPERAND_OBJECT *MthDesc, - ACPI_NAMESPACE_NODE *StartNode, - ACPI_OPERAND_OBJECT **Params, - ACPI_OPERAND_OBJECT **CallerReturnDesc, - ACPI_OWNER_ID OwnerId, - ACPI_PARSE_DOWNWARDS DescendingCallback, - ACPI_PARSE_UPWARDS AscendingCallback); - -ACPI_STATUS -AcpiPsGetNextWalkOp ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op, - ACPI_PARSE_UPWARDS AscendingCallback); - -ACPI_STATUS -AcpiPsDeleteCompletedOp ( - ACPI_WALK_STATE *WalkState); - -void -AcpiPsDeleteParseTree ( - ACPI_PARSE_OBJECT *root); - - -/* - * psutils - parser utilities - */ -ACPI_PARSE_OBJECT * -AcpiPsCreateScopeOp ( - UINT8 *Aml); - -void -AcpiPsInitOp ( - ACPI_PARSE_OBJECT *op, - UINT16 opcode); - -ACPI_PARSE_OBJECT * -AcpiPsAllocOp ( - UINT16 Opcode, - UINT8 *Aml); - -void -AcpiPsFreeOp ( - ACPI_PARSE_OBJECT *Op); - -BOOLEAN -AcpiPsIsLeadingChar ( - UINT32 c); - -UINT32 -AcpiPsGetName( - ACPI_PARSE_OBJECT *op); - -void -AcpiPsSetName( - ACPI_PARSE_OBJECT *op, - UINT32 name); - - -/* - * psdump - display parser tree - */ -UINT32 -AcpiPsSprintPath ( - char *BufferStart, - UINT32 BufferSize, - ACPI_PARSE_OBJECT *Op); - -UINT32 -AcpiPsSprintOp ( - char *BufferStart, - UINT32 BufferSize, - ACPI_PARSE_OBJECT *Op); - -void -AcpiPsShow ( - ACPI_PARSE_OBJECT *op); - - -#endif /* __ACPARSER_H__ */ diff --git a/drivers/include/acpica/acpi.h b/drivers/include/acpica/acpi.h deleted file mode 100644 index 53120c9..0000000 --- a/drivers/include/acpica/acpi.h +++ /dev/null @@ -1,175 +0,0 @@ -/****************************************************************************** - * - * Name: acpi.h - Master public include file used to interface to ACPICA - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef __ACPI_H__ -#define __ACPI_H__ - -/* - * Public include files for use by code that will interface to ACPICA. - * - * Information includes the ACPICA data types, names, exceptions, and - * external interface prototypes. Also included are the definitions for - * all ACPI tables (FADT, MADT, etc.) - * - * Note: The order of these include files is important. - */ -#include "platform/acenv.h" /* Environment-specific items */ -#include "actypes.h" /* ACPICA data types and structures */ -#include "platform/acenvex.h" /* Extra environment-specific items */ -#include "acnames.h" /* Common ACPI names and strings */ -#include "acexcep.h" /* ACPICA exceptions */ -#include "actbl.h" /* ACPI table definitions */ -#include "acoutput.h" /* Error output and Debug macros */ -#include "acrestyp.h" /* Resource Descriptor structs */ -#include "acpiosxf.h" /* OSL interfaces (ACPICA-to-OS) */ -#include "acpixf.h" /* ACPI core subsystem external interfaces */ - -#endif /* __ACPI_H__ */ diff --git a/drivers/include/acpica/acpiosxf.h b/drivers/include/acpica/acpiosxf.h deleted file mode 100644 index e16a51a..0000000 --- a/drivers/include/acpica/acpiosxf.h +++ /dev/null @@ -1,705 +0,0 @@ -/****************************************************************************** - * - * Name: acpiosxf.h - All interfaces to the OS Services Layer (OSL). These - * interfaces must be implemented by OSL to interface the - * ACPI components to the host operating system. - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef __ACPIOSXF_H__ -#define __ACPIOSXF_H__ - -#include "platform/acenv.h" -#include "actypes.h" - - -/* Types for AcpiOsExecute */ - -typedef enum -{ - OSL_GLOBAL_LOCK_HANDLER, - OSL_NOTIFY_HANDLER, - OSL_GPE_HANDLER, - OSL_DEBUGGER_MAIN_THREAD, - OSL_DEBUGGER_EXEC_THREAD, - OSL_EC_POLL_HANDLER, - OSL_EC_BURST_HANDLER - -} ACPI_EXECUTE_TYPE; - -#define ACPI_NO_UNIT_LIMIT ((UINT32) -1) -#define ACPI_MUTEX_SEM 1 - - -/* Functions for AcpiOsSignal */ - -#define ACPI_SIGNAL_FATAL 0 -#define ACPI_SIGNAL_BREAKPOINT 1 - -typedef struct acpi_signal_fatal_info -{ - UINT32 Type; - UINT32 Code; - UINT32 Argument; - -} ACPI_SIGNAL_FATAL_INFO; - - -/* - * OSL Initialization and shutdown primitives - */ -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsInitialize -ACPI_STATUS -AcpiOsInitialize ( - void); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTerminate -ACPI_STATUS -AcpiOsTerminate ( - void); -#endif - - -/* - * ACPI Table interfaces - */ -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetRootPointer -ACPI_PHYSICAL_ADDRESS -AcpiOsGetRootPointer ( - void); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsPredefinedOverride -ACPI_STATUS -AcpiOsPredefinedOverride ( - const ACPI_PREDEFINED_NAMES *InitVal, - ACPI_STRING *NewVal); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTableOverride -ACPI_STATUS -AcpiOsTableOverride ( - ACPI_TABLE_HEADER *ExistingTable, - ACPI_TABLE_HEADER **NewTable); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsPhysicalTableOverride -ACPI_STATUS -AcpiOsPhysicalTableOverride ( - ACPI_TABLE_HEADER *ExistingTable, - ACPI_PHYSICAL_ADDRESS *NewAddress, - UINT32 *NewTableLength); -#endif - - -/* - * Spinlock primitives - */ -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCreateLock -ACPI_STATUS -AcpiOsCreateLock ( - ACPI_SPINLOCK *OutHandle); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsDeleteLock -void -AcpiOsDeleteLock ( - ACPI_SPINLOCK Handle); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAcquireLock -ACPI_CPU_FLAGS -AcpiOsAcquireLock ( - ACPI_SPINLOCK Handle); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReleaseLock -void -AcpiOsReleaseLock ( - ACPI_SPINLOCK Handle, - ACPI_CPU_FLAGS Flags); -#endif - - -/* - * Semaphore primitives - */ -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCreateSemaphore -ACPI_STATUS -AcpiOsCreateSemaphore ( - UINT32 MaxUnits, - UINT32 InitialUnits, - ACPI_SEMAPHORE *OutHandle); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsDeleteSemaphore -ACPI_STATUS -AcpiOsDeleteSemaphore ( - ACPI_SEMAPHORE Handle); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWaitSemaphore -ACPI_STATUS -AcpiOsWaitSemaphore ( - ACPI_SEMAPHORE Handle, - UINT32 Units, - UINT16 Timeout); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsSignalSemaphore -ACPI_STATUS -AcpiOsSignalSemaphore ( - ACPI_SEMAPHORE Handle, - UINT32 Units); -#endif - - -/* - * Mutex primitives. May be configured to use semaphores instead via - * ACPI_MUTEX_TYPE (see platform/acenv.h) - */ -#if (ACPI_MUTEX_TYPE != ACPI_BINARY_SEMAPHORE) - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCreateMutex -ACPI_STATUS -AcpiOsCreateMutex ( - ACPI_MUTEX *OutHandle); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsDeleteMutex -void -AcpiOsDeleteMutex ( - ACPI_MUTEX Handle); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAcquireMutex -ACPI_STATUS -AcpiOsAcquireMutex ( - ACPI_MUTEX Handle, - UINT16 Timeout); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReleaseMutex -void -AcpiOsReleaseMutex ( - ACPI_MUTEX Handle); -#endif - -#endif - - -/* - * Memory allocation and mapping - */ -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAllocate -void * -AcpiOsAllocate ( - ACPI_SIZE Size); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAllocateZeroed -void * -AcpiOsAllocateZeroed ( - ACPI_SIZE Size); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsFree -void -AcpiOsFree ( - void * Memory); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsMapMemory -void * -AcpiOsMapMemory ( - ACPI_PHYSICAL_ADDRESS Where, - ACPI_SIZE Length); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsUnmapMemory -void -AcpiOsUnmapMemory ( - void *LogicalAddress, - ACPI_SIZE Size); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetPhysicalAddress -ACPI_STATUS -AcpiOsGetPhysicalAddress ( - void *LogicalAddress, - ACPI_PHYSICAL_ADDRESS *PhysicalAddress); -#endif - - -/* - * Memory/Object Cache - */ -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCreateCache -ACPI_STATUS -AcpiOsCreateCache ( - char *CacheName, - UINT16 ObjectSize, - UINT16 MaxDepth, - ACPI_CACHE_T **ReturnCache); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsDeleteCache -ACPI_STATUS -AcpiOsDeleteCache ( - ACPI_CACHE_T *Cache); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsPurgeCache -ACPI_STATUS -AcpiOsPurgeCache ( - ACPI_CACHE_T *Cache); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAcquireObject -void * -AcpiOsAcquireObject ( - ACPI_CACHE_T *Cache); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReleaseObject -ACPI_STATUS -AcpiOsReleaseObject ( - ACPI_CACHE_T *Cache, - void *Object); -#endif - - -/* - * Interrupt handlers - */ -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsInstallInterruptHandler -ACPI_STATUS -AcpiOsInstallInterruptHandler ( - UINT32 InterruptNumber, - ACPI_OSD_HANDLER ServiceRoutine, - void *Context); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsRemoveInterruptHandler -ACPI_STATUS -AcpiOsRemoveInterruptHandler ( - UINT32 InterruptNumber, - ACPI_OSD_HANDLER ServiceRoutine); -#endif - - -/* - * Threads and Scheduling - */ -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetThreadId -ACPI_THREAD_ID -AcpiOsGetThreadId ( - void); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsExecute -ACPI_STATUS -AcpiOsExecute ( - ACPI_EXECUTE_TYPE Type, - ACPI_OSD_EXEC_CALLBACK Function, - void *Context); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWaitEventsComplete -void -AcpiOsWaitEventsComplete ( - void); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsSleep -void -AcpiOsSleep ( - UINT64 Milliseconds); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsStall -void -AcpiOsStall ( - UINT32 Microseconds); -#endif - - -/* - * Platform and hardware-independent I/O interfaces - */ -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadPort -ACPI_STATUS -AcpiOsReadPort ( - ACPI_IO_ADDRESS Address, - UINT32 *Value, - UINT32 Width); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWritePort -ACPI_STATUS -AcpiOsWritePort ( - ACPI_IO_ADDRESS Address, - UINT32 Value, - UINT32 Width); -#endif - - -/* - * Platform and hardware-independent physical memory interfaces - */ -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadMemory -ACPI_STATUS -AcpiOsReadMemory ( - ACPI_PHYSICAL_ADDRESS Address, - UINT64 *Value, - UINT32 Width); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWriteMemory -ACPI_STATUS -AcpiOsWriteMemory ( - ACPI_PHYSICAL_ADDRESS Address, - UINT64 Value, - UINT32 Width); -#endif - - -/* - * Platform and hardware-independent PCI configuration space access - * Note: Can't use "Register" as a parameter, changed to "Reg" -- - * certain compilers complain. - */ -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadPciConfiguration -ACPI_STATUS -AcpiOsReadPciConfiguration ( - ACPI_PCI_ID *PciId, - UINT32 Reg, - UINT64 *Value, - UINT32 Width); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWritePciConfiguration -ACPI_STATUS -AcpiOsWritePciConfiguration ( - ACPI_PCI_ID *PciId, - UINT32 Reg, - UINT64 Value, - UINT32 Width); -#endif - - -/* - * Miscellaneous - */ -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadable -BOOLEAN -AcpiOsReadable ( - void *Pointer, - ACPI_SIZE Length); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWritable -BOOLEAN -AcpiOsWritable ( - void *Pointer, - ACPI_SIZE Length); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTimer -UINT64 -AcpiOsGetTimer ( - void); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsSignal -ACPI_STATUS -AcpiOsSignal ( - UINT32 Function, - void *Info); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsEnterSleep -ACPI_STATUS -AcpiOsEnterSleep ( - UINT8 SleepState, - UINT32 RegaValue, - UINT32 RegbValue); -#endif - - -/* - * Debug print routines - */ -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsPrintf -ACPI_PRINTF_LIKE (1) -void ACPI_INTERNAL_VAR_XFACE -AcpiOsPrintf ( - const char *Format, - ...); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsVprintf -void -AcpiOsVprintf ( - const char *Format, - va_list Args); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsRedirectOutput -void -AcpiOsRedirectOutput ( - void *Destination); -#endif - - -/* - * Debug IO - */ -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetLine -ACPI_STATUS -AcpiOsGetLine ( - char *Buffer, - UINT32 BufferLength, - UINT32 *BytesRead); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsInitializeDebugger -ACPI_STATUS -AcpiOsInitializeDebugger ( - void); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTerminateDebugger -void -AcpiOsTerminateDebugger ( - void); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWaitCommandReady -ACPI_STATUS -AcpiOsWaitCommandReady ( - void); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsNotifyCommandComplete -ACPI_STATUS -AcpiOsNotifyCommandComplete ( - void); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTracePoint -void -AcpiOsTracePoint ( - ACPI_TRACE_EVENT_TYPE Type, - BOOLEAN Begin, - UINT8 *Aml, - char *Pathname); -#endif - - -/* - * Obtain ACPI table(s) - */ -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByName -ACPI_STATUS -AcpiOsGetTableByName ( - char *Signature, - UINT32 Instance, - ACPI_TABLE_HEADER **Table, - ACPI_PHYSICAL_ADDRESS *Address); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByIndex -ACPI_STATUS -AcpiOsGetTableByIndex ( - UINT32 Index, - ACPI_TABLE_HEADER **Table, - UINT32 *Instance, - ACPI_PHYSICAL_ADDRESS *Address); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByAddress -ACPI_STATUS -AcpiOsGetTableByAddress ( - ACPI_PHYSICAL_ADDRESS Address, - ACPI_TABLE_HEADER **Table); -#endif - - -/* - * Directory manipulation - */ -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsOpenDirectory -void * -AcpiOsOpenDirectory ( - char *Pathname, - char *WildcardSpec, - char RequestedFileType); -#endif - -/* RequesteFileType values */ - -#define REQUEST_FILE_ONLY 0 -#define REQUEST_DIR_ONLY 1 - - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetNextFilename -char * -AcpiOsGetNextFilename ( - void *DirHandle); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCloseDirectory -void -AcpiOsCloseDirectory ( - void *DirHandle); -#endif - - -#endif /* __ACPIOSXF_H__ */ diff --git a/drivers/include/acpica/acpixf.h b/drivers/include/acpica/acpixf.h deleted file mode 100644 index 67d60c6..0000000 --- a/drivers/include/acpica/acpixf.h +++ /dev/null @@ -1,1450 +0,0 @@ -/****************************************************************************** - * - * Name: acpixf.h - External interfaces to the ACPI subsystem - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef __ACXFACE_H__ -#define __ACXFACE_H__ - -/* Current ACPICA subsystem version in YYYYMMDD format */ - -#define ACPI_CA_VERSION 0x20251212 - -#include "acconfig.h" -#include "actypes.h" -#include "actbl.h" -#include "acbuffer.h" - - -/***************************************************************************** - * - * Macros used for ACPICA globals and configuration - * - ****************************************************************************/ - -/* - * Ensure that global variables are defined and initialized only once. - * - * The use of these macros allows for a single list of globals (here) - * in order to simplify maintenance of the code. - */ -#ifdef DEFINE_ACPI_GLOBALS -#define ACPI_GLOBAL(type,name) \ - extern type name; \ - type name - -#define ACPI_INIT_GLOBAL(type,name,value) \ - type name=value - -#else -#ifndef ACPI_GLOBAL -#define ACPI_GLOBAL(type,name) \ - extern type name -#endif - -#ifndef ACPI_INIT_GLOBAL -#define ACPI_INIT_GLOBAL(type,name,value) \ - extern type name -#endif -#endif - -/* - * These macros configure the various ACPICA interfaces. They are - * useful for generating stub inline functions for features that are - * configured out of the current kernel or ACPICA application. - */ -#ifndef ACPI_EXTERNAL_RETURN_STATUS -#define ACPI_EXTERNAL_RETURN_STATUS(Prototype) \ - Prototype; -#endif - -#ifndef ACPI_EXTERNAL_RETURN_OK -#define ACPI_EXTERNAL_RETURN_OK(Prototype) \ - Prototype; -#endif - -#ifndef ACPI_EXTERNAL_RETURN_VOID -#define ACPI_EXTERNAL_RETURN_VOID(Prototype) \ - Prototype; -#endif - -#ifndef ACPI_EXTERNAL_RETURN_UINT32 -#define ACPI_EXTERNAL_RETURN_UINT32(Prototype) \ - Prototype; -#endif - -#ifndef ACPI_EXTERNAL_RETURN_PTR -#define ACPI_EXTERNAL_RETURN_PTR(Prototype) \ - Prototype; -#endif - - -/***************************************************************************** - * - * Public globals and runtime configuration options - * - ****************************************************************************/ - -/* - * Enable "slack mode" of the AML interpreter? Default is FALSE, and the - * interpreter strictly follows the ACPI specification. Setting to TRUE - * allows the interpreter to ignore certain errors and/or bad AML constructs. - * - * Currently, these features are enabled by this flag: - * - * 1) Allow "implicit return" of last value in a control method - * 2) Allow access beyond the end of an operation region - * 3) Allow access to uninitialized locals/args (auto-init to integer 0) - * 4) Allow ANY object type to be a source operand for the Store() operator - * 5) Allow unresolved references (invalid target name) in package objects - * 6) Enable warning messages for behavior that is not ACPI spec compliant - */ -ACPI_INIT_GLOBAL (UINT8, AcpiGbl_EnableInterpreterSlack, FALSE); - -/* - * Automatically serialize all methods that create named objects? Default - * is TRUE, meaning that all NonSerialized methods are scanned once at - * table load time to determine those that create named objects. Methods - * that create named objects are marked Serialized in order to prevent - * possible run-time problems if they are entered by more than one thread. - */ -ACPI_INIT_GLOBAL (UINT8, AcpiGbl_AutoSerializeMethods, TRUE); - -/* - * Create the predefined _OSI method in the namespace? Default is TRUE - * because ACPICA is fully compatible with other ACPI implementations. - * Changing this will revert ACPICA (and machine ASL) to pre-OSI behavior. - */ -ACPI_INIT_GLOBAL (UINT8, AcpiGbl_CreateOsiMethod, TRUE); - -/* - * Optionally use default values for the ACPI register widths. Set this to - * TRUE to use the defaults, if an FADT contains incorrect widths/lengths. - */ -ACPI_INIT_GLOBAL (UINT8, AcpiGbl_UseDefaultRegisterWidths, TRUE); - -/* - * Whether or not to validate (map) an entire table to verify - * checksum/duplication in early stage before install. Set this to TRUE to - * allow early table validation before install it to the table manager. - * Note that enabling this option causes errors to happen in some OSPMs - * during early initialization stages. Default behavior is to allow such - * validation. - */ -ACPI_INIT_GLOBAL (UINT8, AcpiGbl_EnableTableValidation, TRUE); - -/* - * Optionally enable output from the AML Debug Object. - */ -ACPI_INIT_GLOBAL (UINT8, AcpiGbl_EnableAmlDebugObject, FALSE); - -/* - * Optionally copy the entire DSDT to local memory (instead of simply - * mapping it.) There are some BIOSs that corrupt or replace the original - * DSDT, creating the need for this option. Default is FALSE, do not copy - * the DSDT. - */ -ACPI_INIT_GLOBAL (UINT8, AcpiGbl_CopyDsdtLocally, FALSE); - -/* - * Optionally ignore an XSDT if present and use the RSDT instead. - * Although the ACPI specification requires that an XSDT be used instead - * of the RSDT, the XSDT has been found to be corrupt or ill-formed on - * some machines. Default behavior is to use the XSDT if present. - */ -ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DoNotUseXsdt, FALSE); - -/* - * Optionally use 32-bit FADT addresses if and when there is a conflict - * (address mismatch) between the 32-bit and 64-bit versions of the - * address. Although ACPICA adheres to the ACPI specification which - * requires the use of the corresponding 64-bit address if it is non-zero, - * some machines have been found to have a corrupted non-zero 64-bit - * address. Default is FALSE, do not favor the 32-bit addresses. - */ -ACPI_INIT_GLOBAL (UINT8, AcpiGbl_Use32BitFadtAddresses, FALSE); - -/* - * Optionally use 32-bit FACS table addresses. - * It is reported that some platforms fail to resume from system suspending - * if 64-bit FACS table address is selected: - * https://bugzilla.kernel.org/show_bug.cgi?id=74021 - * Default is TRUE, favor the 32-bit addresses. - */ -ACPI_INIT_GLOBAL (UINT8, AcpiGbl_Use32BitFacsAddresses, TRUE); - -/* - * Optionally truncate I/O addresses to 16 bits. Provides compatibility - * with other ACPI implementations. NOTE: During ACPICA initialization, - * this value is set to TRUE if any Windows OSI strings have been - * requested by the BIOS. - */ -ACPI_INIT_GLOBAL (UINT8, AcpiGbl_TruncateIoAddresses, FALSE); - -/* - * Disable runtime checking and repair of values returned by control methods. - * Use only if the repair is causing a problem on a particular machine. - */ -ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DisableAutoRepair, FALSE); - -/* - * Optionally do not install any SSDTs from the RSDT/XSDT during initialization. - * This can be useful for debugging ACPI problems on some machines. - */ -ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DisableSsdtTableInstall, FALSE); - -/* - * Optionally enable runtime namespace override. - */ -ACPI_INIT_GLOBAL (UINT8, AcpiGbl_RuntimeNamespaceOverride, TRUE); - -/* - * We keep track of the latest version of Windows that has been requested by - * the BIOS. ACPI 5.0. - */ -ACPI_INIT_GLOBAL (UINT8, AcpiGbl_OsiData, 0); - -/* - * ACPI 5.0 introduces the concept of a "reduced hardware platform", meaning - * that the ACPI hardware is no longer required. A flag in the FADT indicates - * a reduced HW machine, and that flag is duplicated here for convenience. - */ -ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_ReducedHardware, FALSE); - -/* - * ACPI Global Lock is mainly used for systems with SMM, so no-SMM systems - * (such as LoongArch) may not have and not use Global Lock. - */ -ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_UseGlobalLock, TRUE); - -/* - * Maximum timeout for While() loop iterations before forced method abort. - * This mechanism is intended to prevent infinite loops during interpreter - * execution within a host kernel. - */ -ACPI_INIT_GLOBAL (UINT32, AcpiGbl_MaxLoopIterations, ACPI_MAX_LOOP_TIMEOUT); - -/* - * Optionally ignore AE_NOT_FOUND errors from named reference package elements - * during DSDT/SSDT table loading. This reduces error "noise" in platforms - * whose firmware is carrying around a bunch of unused package objects that - * refer to non-existent named objects. However, If the AML actually tries to - * use such a package, the unresolved element(s) will be replaced with NULL - * elements. - */ -ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_IgnorePackageResolutionErrors, FALSE); - -/* - * This mechanism is used to trace a specified AML method. The method is - * traced each time it is executed. - */ -ACPI_INIT_GLOBAL (UINT32, AcpiGbl_TraceFlags, 0); -ACPI_INIT_GLOBAL (const char *, AcpiGbl_TraceMethodName, NULL); -ACPI_INIT_GLOBAL (UINT32, AcpiGbl_TraceDbgLevel, ACPI_TRACE_LEVEL_DEFAULT); -ACPI_INIT_GLOBAL (UINT32, AcpiGbl_TraceDbgLayer, ACPI_TRACE_LAYER_DEFAULT); - -/* - * Runtime configuration of debug output control masks. We want the debug - * switches statically initialized so they are already set when the debugger - * is entered. - */ -#ifdef ACPI_DEBUG_OUTPUT -ACPI_INIT_GLOBAL (UINT32, AcpiDbgLevel, ACPI_DEBUG_DEFAULT); -#else -ACPI_INIT_GLOBAL (UINT32, AcpiDbgLevel, ACPI_NORMAL_DEFAULT); -#endif -ACPI_INIT_GLOBAL (UINT32, AcpiDbgLayer, ACPI_COMPONENT_DEFAULT); - -/* Optionally enable timer output with Debug Object output */ - -ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DisplayDebugTimer, FALSE); - -/* - * Debugger command handshake globals. Host OSes need to access these - * variables to implement their own command handshake mechanism. - */ -#ifdef ACPI_DEBUGGER -ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_MethodExecuting, FALSE); -ACPI_GLOBAL (char, AcpiGbl_DbLineBuf[ACPI_DB_LINE_BUFFER_SIZE]); -#endif - -/* - * Other miscellaneous globals - */ -ACPI_GLOBAL (ACPI_TABLE_FADT, AcpiGbl_FADT); -ACPI_GLOBAL (UINT32, AcpiCurrentGpeCount); -ACPI_GLOBAL (BOOLEAN, AcpiGbl_SystemAwakeAndRunning); - - -/***************************************************************************** - * - * ACPICA public interface configuration. - * - * Interfaces that are configured out of the ACPICA build are replaced - * by inlined stubs by default. - * - ****************************************************************************/ - -/* - * Hardware-reduced prototypes (default: Not hardware reduced). - * - * All ACPICA hardware-related interfaces that use these macros will be - * configured out of the ACPICA build if the ACPI_REDUCED_HARDWARE flag - * is set to TRUE. - * - * Note: This static build option for reduced hardware is intended to - * reduce ACPICA code size if desired or necessary. However, even if this - * option is not specified, the runtime behavior of ACPICA is dependent - * on the actual FADT reduced hardware flag (HW_REDUCED_ACPI). If set, - * the flag will enable similar behavior -- ACPICA will not attempt - * to access any ACPI-relate hardware (SCI, GPEs, Fixed Events, etc.) - */ -#if (!ACPI_REDUCED_HARDWARE) -#define ACPI_HW_DEPENDENT_RETURN_STATUS(Prototype) \ - ACPI_EXTERNAL_RETURN_STATUS(Prototype) - -#define ACPI_HW_DEPENDENT_RETURN_OK(Prototype) \ - ACPI_EXTERNAL_RETURN_OK(Prototype) - -#define ACPI_HW_DEPENDENT_RETURN_UINT32(prototype) \ - ACPI_EXTERNAL_RETURN_UINT32(prototype) - -#define ACPI_HW_DEPENDENT_RETURN_VOID(Prototype) \ - ACPI_EXTERNAL_RETURN_VOID(Prototype) - -#else -#define ACPI_HW_DEPENDENT_RETURN_STATUS(Prototype) \ - static ACPI_INLINE Prototype {return(AE_NOT_CONFIGURED);} - -#define ACPI_HW_DEPENDENT_RETURN_OK(Prototype) \ - static ACPI_INLINE Prototype {return(AE_OK);} - -#define ACPI_HW_DEPENDENT_RETURN_UINT32(prototype) \ - static ACPI_INLINE prototype {return(0);} - -#define ACPI_HW_DEPENDENT_RETURN_VOID(Prototype) \ - static ACPI_INLINE Prototype {return;} - -#endif /* !ACPI_REDUCED_HARDWARE */ - - -/* - * Error message prototypes (default: error messages enabled). - * - * All interfaces related to error and warning messages - * will be configured out of the ACPICA build if the - * ACPI_NO_ERROR_MESSAGE flag is defined. - */ -#ifndef ACPI_NO_ERROR_MESSAGES -#define ACPI_MSG_DEPENDENT_RETURN_VOID(Prototype) \ - Prototype; - -#else -#define ACPI_MSG_DEPENDENT_RETURN_VOID(Prototype) \ - static ACPI_INLINE Prototype {return;} - -#endif /* ACPI_NO_ERROR_MESSAGES */ - - -/* - * Debugging output prototypes (default: no debug output). - * - * All interfaces related to debug output messages - * will be configured out of the ACPICA build unless the - * ACPI_DEBUG_OUTPUT flag is defined. - */ -#ifdef ACPI_DEBUG_OUTPUT -#define ACPI_DBG_DEPENDENT_RETURN_VOID(Prototype) \ - Prototype; - -#else -#define ACPI_DBG_DEPENDENT_RETURN_VOID(Prototype) \ - static ACPI_INLINE Prototype {return;} - -#endif /* ACPI_DEBUG_OUTPUT */ - - -/* - * Application prototypes - * - * All interfaces used by application will be configured - * out of the ACPICA build unless the ACPI_APPLICATION - * flag is defined. - */ -#ifdef ACPI_APPLICATION -#define ACPI_APP_DEPENDENT_RETURN_VOID(Prototype) \ - Prototype; - -#else -#define ACPI_APP_DEPENDENT_RETURN_VOID(Prototype) \ - static ACPI_INLINE Prototype {return;} - -#endif /* ACPI_APPLICATION */ - - -/* - * Debugger prototypes - * - * All interfaces used by debugger will be configured - * out of the ACPICA build unless the ACPI_DEBUGGER - * flag is defined. - */ -#ifdef ACPI_DEBUGGER -#define ACPI_DBR_DEPENDENT_RETURN_OK(Prototype) \ - ACPI_EXTERNAL_RETURN_OK(Prototype) - -#define ACPI_DBR_DEPENDENT_RETURN_VOID(Prototype) \ - ACPI_EXTERNAL_RETURN_VOID(Prototype) - -#else -#define ACPI_DBR_DEPENDENT_RETURN_OK(Prototype) \ - static ACPI_INLINE Prototype {return(AE_OK);} - -#define ACPI_DBR_DEPENDENT_RETURN_VOID(Prototype) \ - static ACPI_INLINE Prototype {return;} - -#endif /* ACPI_DEBUGGER */ - - -/***************************************************************************** - * - * ACPICA public interface prototypes - * - ****************************************************************************/ - -/* - * Initialization - */ -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS ACPI_INIT_FUNCTION -AcpiInitializeTables ( - ACPI_TABLE_DESC *InitialStorage, - UINT32 InitialTableCount, - BOOLEAN AllowResize)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS ACPI_INIT_FUNCTION -AcpiInitializeSubsystem ( - void)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS ACPI_INIT_FUNCTION -AcpiEnableSubsystem ( - UINT32 Flags)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS ACPI_INIT_FUNCTION -AcpiInitializeObjects ( - UINT32 Flags)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS ACPI_INIT_FUNCTION -AcpiTerminate ( - void)) - - -/* - * Miscellaneous global interfaces - */ -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiEnable ( - void)) - -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiDisable ( - void)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiSubsystemStatus ( - void)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiGetSystemInfo ( - ACPI_BUFFER *RetBuffer)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiGetStatistics ( - ACPI_STATISTICS *Stats)) - -ACPI_EXTERNAL_RETURN_PTR ( -const char * -AcpiFormatException ( - ACPI_STATUS Exception)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiPurgeCachedObjects ( - void)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiInstallInterface ( - ACPI_STRING InterfaceName)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiRemoveInterface ( - ACPI_STRING InterfaceName)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiUpdateInterfaces ( - UINT8 Action)) - -ACPI_EXTERNAL_RETURN_UINT32 ( -UINT32 -AcpiCheckAddressRange ( - ACPI_ADR_SPACE_TYPE SpaceId, - ACPI_PHYSICAL_ADDRESS Address, - ACPI_SIZE Length, - BOOLEAN Warn)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiDecodePldBuffer ( - UINT8 *InBuffer, - ACPI_SIZE Length, - ACPI_PLD_INFO **ReturnBuffer)) - - -/* - * ACPI table load/unload interfaces - */ -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS ACPI_INIT_FUNCTION -AcpiInstallTable ( - ACPI_TABLE_HEADER *Table)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS ACPI_INIT_FUNCTION -AcpiInstallPhysicalTable ( - ACPI_PHYSICAL_ADDRESS Address)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiLoadTable ( - ACPI_TABLE_HEADER *Table, - UINT32 *TableIdx)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiUnloadTable ( - UINT32 TableIndex)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiUnloadParentTable ( - ACPI_HANDLE Object)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS ACPI_INIT_FUNCTION -AcpiLoadTables ( - void)) - - -/* - * ACPI table manipulation interfaces - */ -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS ACPI_INIT_FUNCTION -AcpiReallocateRootTable ( - void)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS ACPI_INIT_FUNCTION -AcpiFindRootPointer ( - ACPI_PHYSICAL_ADDRESS *RsdpAddress)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiGetTableHeader ( - ACPI_STRING Signature, - UINT32 Instance, - ACPI_TABLE_HEADER *OutTableHeader)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiGetTable ( - ACPI_STRING Signature, - UINT32 Instance, - ACPI_TABLE_HEADER **OutTable)) - -ACPI_EXTERNAL_RETURN_VOID ( -void -AcpiPutTable ( - ACPI_TABLE_HEADER *Table)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiGetTableByIndex ( - UINT32 TableIndex, - ACPI_TABLE_HEADER **OutTable)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiInstallTableHandler ( - ACPI_TABLE_HANDLER Handler, - void *Context)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiRemoveTableHandler ( - ACPI_TABLE_HANDLER Handler)) - - -/* - * Namespace and name interfaces - */ -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiWalkNamespace ( - ACPI_OBJECT_TYPE Type, - ACPI_HANDLE StartObject, - UINT32 MaxDepth, - ACPI_WALK_CALLBACK DescendingCallback, - ACPI_WALK_CALLBACK AscendingCallback, - void *Context, - void **ReturnValue)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiGetDevices ( - char *HID, - ACPI_WALK_CALLBACK UserFunction, - void *Context, - void **ReturnValue)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiGetName ( - ACPI_HANDLE Object, - UINT32 NameType, - ACPI_BUFFER *RetPathPtr)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiGetHandle ( - ACPI_HANDLE Parent, - const char *Pathname, - ACPI_HANDLE *RetHandle)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiAttachData ( - ACPI_HANDLE Object, - ACPI_OBJECT_HANDLER Handler, - void *Data)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiDetachData ( - ACPI_HANDLE Object, - ACPI_OBJECT_HANDLER Handler)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiGetData ( - ACPI_HANDLE Object, - ACPI_OBJECT_HANDLER Handler, - void **Data)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiDebugTrace ( - const char *Name, - UINT32 DebugLevel, - UINT32 DebugLayer, - UINT32 Flags)) - - -/* - * Object manipulation and enumeration - */ -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiEvaluateObject ( - ACPI_HANDLE Object, - ACPI_STRING Pathname, - ACPI_OBJECT_LIST *ParameterObjects, - ACPI_BUFFER *ReturnObjectBuffer)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiEvaluateObjectTyped ( - ACPI_HANDLE Object, - ACPI_STRING Pathname, - ACPI_OBJECT_LIST *ExternalParams, - ACPI_BUFFER *ReturnBuffer, - ACPI_OBJECT_TYPE ReturnType)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiGetObjectInfo ( - ACPI_HANDLE Object, - ACPI_DEVICE_INFO **ReturnBuffer)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiInstallMethod ( - UINT8 *Buffer)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiGetNextObject ( - ACPI_OBJECT_TYPE Type, - ACPI_HANDLE Parent, - ACPI_HANDLE Child, - ACPI_HANDLE *OutHandle)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiGetType ( - ACPI_HANDLE Object, - ACPI_OBJECT_TYPE *OutType)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiGetParent ( - ACPI_HANDLE Object, - ACPI_HANDLE *OutHandle)) - - -/* - * Handler interfaces - */ -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiInstallInitializationHandler ( - ACPI_INIT_HANDLER Handler, - UINT32 Function)) - -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiInstallSciHandler ( - ACPI_SCI_HANDLER Address, - void *Context)) - -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiRemoveSciHandler ( - ACPI_SCI_HANDLER Address)) - -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiInstallGlobalEventHandler ( - ACPI_GBL_EVENT_HANDLER Handler, - void *Context)) - -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiInstallFixedEventHandler ( - UINT32 AcpiEvent, - ACPI_EVENT_HANDLER Handler, - void *Context)) - -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiRemoveFixedEventHandler ( - UINT32 AcpiEvent, - ACPI_EVENT_HANDLER Handler)) - -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiInstallGpeHandler ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber, - UINT32 Type, - ACPI_GPE_HANDLER Address, - void *Context)) - -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiInstallGpeRawHandler ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber, - UINT32 Type, - ACPI_GPE_HANDLER Address, - void *Context)) - -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiRemoveGpeHandler ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber, - ACPI_GPE_HANDLER Address)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiInstallNotifyHandler ( - ACPI_HANDLE Device, - UINT32 HandlerType, - ACPI_NOTIFY_HANDLER Handler, - void *Context)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiRemoveNotifyHandler ( - ACPI_HANDLE Device, - UINT32 HandlerType, - ACPI_NOTIFY_HANDLER Handler)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiInstallAddressSpaceHandler ( - ACPI_HANDLE Device, - ACPI_ADR_SPACE_TYPE SpaceId, - ACPI_ADR_SPACE_HANDLER Handler, - ACPI_ADR_SPACE_SETUP Setup, - void *Context)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiInstallAddressSpaceHandlerNo_Reg( - ACPI_HANDLE Device, - ACPI_ADR_SPACE_TYPE SpaceId, - ACPI_ADR_SPACE_HANDLER Handler, - ACPI_ADR_SPACE_SETUP Setup, - void *Context)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiExecuteRegMethods ( - ACPI_HANDLE Device, - ACPI_ADR_SPACE_TYPE SpaceId)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiRemoveAddressSpaceHandler ( - ACPI_HANDLE Device, - ACPI_ADR_SPACE_TYPE SpaceId, - ACPI_ADR_SPACE_HANDLER Handler)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiInstallExceptionHandler ( - ACPI_EXCEPTION_HANDLER Handler)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiInstallInterfaceHandler ( - ACPI_INTERFACE_HANDLER Handler)) - - -/* - * Global Lock interfaces - */ -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiAcquireGlobalLock ( - UINT16 Timeout, - UINT32 *Handle)) - -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiReleaseGlobalLock ( - UINT32 Handle)) - - -/* - * Interfaces to AML mutex objects - */ -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiAcquireMutex ( - ACPI_HANDLE Handle, - ACPI_STRING Pathname, - UINT16 Timeout)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiReleaseMutex ( - ACPI_HANDLE Handle, - ACPI_STRING Pathname)) - - -/* - * Fixed Event interfaces - */ -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiEnableEvent ( - UINT32 Event, - UINT32 Flags)) - -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiDisableEvent ( - UINT32 Event, - UINT32 Flags)) - -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiClearEvent ( - UINT32 Event)) - -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiGetEventStatus ( - UINT32 Event, - ACPI_EVENT_STATUS *EventStatus)) - - -/* - * General Purpose Event (GPE) Interfaces - */ -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiUpdateAllGpes ( - void)) - -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiEnableGpe ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber)) - -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiDisableGpe ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber)) - -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiClearGpe ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber)) - -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiSetGpe ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber, - UINT8 Action)) - -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiFinishGpe ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber)) - -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiMaskGpe ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber, - BOOLEAN IsMasked)) - -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiMarkGpeForWake ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber)) - -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiSetupGpeForWake ( - ACPI_HANDLE ParentDevice, - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber)) - -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiSetGpeWakeMask ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber, - UINT8 Action)) - -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiGetGpeStatus ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber, - ACPI_EVENT_STATUS *EventStatus)) - -ACPI_HW_DEPENDENT_RETURN_UINT32 ( -UINT32 -AcpiDispatchGpe ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber)) - -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiDisableAllGpes ( - void)) - -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiEnableAllRuntimeGpes ( - void)) - -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiEnableAllWakeupGpes ( - void)) - -ACPI_HW_DEPENDENT_RETURN_UINT32 ( - UINT32 AcpiAnyGpeStatusSet ( - void)) - -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiGetGpeDevice ( - UINT32 GpeIndex, - ACPI_HANDLE *GpeDevice)) - -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiInstallGpeBlock ( - ACPI_HANDLE GpeDevice, - ACPI_GENERIC_ADDRESS *GpeBlockAddress, - UINT32 RegisterCount, - UINT32 InterruptNumber)) - -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiRemoveGpeBlock ( - ACPI_HANDLE GpeDevice)) - - -/* - * Resource interfaces - */ -typedef -ACPI_STATUS (*ACPI_WALK_RESOURCE_CALLBACK) ( - ACPI_RESOURCE *Resource, - void *Context); - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiGetVendorResource ( - ACPI_HANDLE Device, - char *Name, - ACPI_VENDOR_UUID *Uuid, - ACPI_BUFFER *RetBuffer)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiGetCurrentResources ( - ACPI_HANDLE Device, - ACPI_BUFFER *RetBuffer)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiGetPossibleResources ( - ACPI_HANDLE Device, - ACPI_BUFFER *RetBuffer)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiGetEventResources ( - ACPI_HANDLE DeviceHandle, - ACPI_BUFFER *RetBuffer)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiWalkResourceBuffer ( - ACPI_BUFFER *Buffer, - ACPI_WALK_RESOURCE_CALLBACK UserFunction, - void *Context)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiWalkResources ( - ACPI_HANDLE Device, - char *Name, - ACPI_WALK_RESOURCE_CALLBACK UserFunction, - void *Context)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiSetCurrentResources ( - ACPI_HANDLE Device, - ACPI_BUFFER *InBuffer)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiGetIrqRoutingTable ( - ACPI_HANDLE Device, - ACPI_BUFFER *RetBuffer)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiResourceToAddress64 ( - ACPI_RESOURCE *Resource, - ACPI_RESOURCE_ADDRESS64 *Out)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiBufferToResource ( - UINT8 *AmlBuffer, - UINT16 AmlBufferLength, - ACPI_RESOURCE **ResourcePtr)) - - -/* - * Hardware (ACPI device) interfaces - */ -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiReset ( - void)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiRead ( - UINT64 *Value, - ACPI_GENERIC_ADDRESS *Reg)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiWrite ( - UINT64 Value, - ACPI_GENERIC_ADDRESS *Reg)) - -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiReadBitRegister ( - UINT32 RegisterId, - UINT32 *ReturnValue)) - -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiWriteBitRegister ( - UINT32 RegisterId, - UINT32 Value)) - - -/* - * Sleep/Wake interfaces - */ -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiGetSleepTypeData ( - UINT8 SleepState, - UINT8 *Slp_TypA, - UINT8 *Slp_TypB)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiEnterSleepStatePrep ( - UINT8 SleepState)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiEnterSleepState ( - UINT8 SleepState)) - -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiEnterSleepStateS4bios ( - void)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiLeaveSleepStatePrep ( - UINT8 SleepState)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiLeaveSleepState ( - UINT8 SleepState)) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiSetFirmwareWakingVector ( - ACPI_PHYSICAL_ADDRESS PhysicalAddress, - ACPI_PHYSICAL_ADDRESS PhysicalAddress64)) - - -/* - * ACPI Timer interfaces - */ -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiGetTimerResolution ( - UINT32 *Resolution)) - -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiGetTimer ( - UINT32 *Ticks)) - -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiGetTimerDuration ( - UINT32 StartTicks, - UINT32 EndTicks, - UINT32 *TimeElapsed)) - - -/* - * Error/Warning output - */ -ACPI_MSG_DEPENDENT_RETURN_VOID ( -ACPI_PRINTF_LIKE(3) -void ACPI_INTERNAL_VAR_XFACE -AcpiError ( - const char *ModuleName, - UINT32 LineNumber, - const char *Format, - ...)) - -ACPI_MSG_DEPENDENT_RETURN_VOID ( -ACPI_PRINTF_LIKE(4) -void ACPI_INTERNAL_VAR_XFACE -AcpiException ( - const char *ModuleName, - UINT32 LineNumber, - ACPI_STATUS Status, - const char *Format, - ...)) - -ACPI_MSG_DEPENDENT_RETURN_VOID ( -ACPI_PRINTF_LIKE(3) -void ACPI_INTERNAL_VAR_XFACE -AcpiWarning ( - const char *ModuleName, - UINT32 LineNumber, - const char *Format, - ...)) - -ACPI_MSG_DEPENDENT_RETURN_VOID ( -ACPI_PRINTF_LIKE(1) -void ACPI_INTERNAL_VAR_XFACE -AcpiInfo ( - const char *Format, - ...)) - -ACPI_MSG_DEPENDENT_RETURN_VOID ( -ACPI_PRINTF_LIKE(3) -void ACPI_INTERNAL_VAR_XFACE -AcpiBiosError ( - const char *ModuleName, - UINT32 LineNumber, - const char *Format, - ...)) - -ACPI_MSG_DEPENDENT_RETURN_VOID ( -ACPI_PRINTF_LIKE(4) -void ACPI_INTERNAL_VAR_XFACE -AcpiBiosException ( - const char *ModuleName, - UINT32 LineNumber, - ACPI_STATUS Status, - const char *Format, - ...)) - -ACPI_MSG_DEPENDENT_RETURN_VOID ( -ACPI_PRINTF_LIKE(3) -void ACPI_INTERNAL_VAR_XFACE -AcpiBiosWarning ( - const char *ModuleName, - UINT32 LineNumber, - const char *Format, - ...)) - - -/* - * Debug output - */ -ACPI_DBG_DEPENDENT_RETURN_VOID ( -ACPI_PRINTF_LIKE(6) -void ACPI_INTERNAL_VAR_XFACE -AcpiDebugPrint ( - UINT32 RequestedDebugLevel, - UINT32 LineNumber, - const char *FunctionName, - const char *ModuleName, - UINT32 ComponentId, - const char *Format, - ...)) - -ACPI_DBG_DEPENDENT_RETURN_VOID ( -ACPI_PRINTF_LIKE(6) -void ACPI_INTERNAL_VAR_XFACE -AcpiDebugPrintRaw ( - UINT32 RequestedDebugLevel, - UINT32 LineNumber, - const char *FunctionName, - const char *ModuleName, - UINT32 ComponentId, - const char *Format, - ...)) - -ACPI_DBG_DEPENDENT_RETURN_VOID ( -void -AcpiTracePoint ( - ACPI_TRACE_EVENT_TYPE Type, - BOOLEAN Begin, - UINT8 *Aml, - char *Pathname)) - -ACPI_STATUS -AcpiInitializeDebugger ( - void); - -void -AcpiTerminateDebugger ( - void); - -void -AcpiRunDebugger ( - char *BatchBuffer); - -void -AcpiSetDebuggerThreadId ( - ACPI_THREAD_ID ThreadId); - -#endif /* __ACXFACE_H__ */ diff --git a/drivers/include/acpica/acpredef.h b/drivers/include/acpica/acpredef.h deleted file mode 100644 index 8cf6cf2..0000000 --- a/drivers/include/acpica/acpredef.h +++ /dev/null @@ -1,1308 +0,0 @@ -/****************************************************************************** - * - * Name: acpredef - Information table for ACPI predefined methods and objects - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef __ACPREDEF_H__ -#define __ACPREDEF_H__ - - -/****************************************************************************** - * - * Return Package types - * - * 1) PTYPE1 packages do not contain subpackages. - * - * ACPI_PTYPE1_FIXED: Fixed-length length, 1 or 2 object types: - * object type - * count - * object type - * count - * - * ACPI_PTYPE1_VAR: Variable-length length. Zero-length package is allowed: - * object type (Int/Buf/Ref) - * - * ACPI_PTYPE1_OPTION: Package has some required and some optional elements - * (Used for _PRW) - * - * - * 2) PTYPE2 packages contain a Variable-length number of subpackages. Each - * of the different types describe the contents of each of the subpackages. - * - * ACPI_PTYPE2: Each subpackage contains 1 or 2 object types. Zero-length - * parent package is allowed: - * object type - * count - * object type - * count - * (Used for _ALR,_MLS,_PSS,_TRT,_TSS) - * - * ACPI_PTYPE2_COUNT: Each subpackage has a count as first element. - * Zero-length parent package is allowed: - * object type - * (Used for _CSD,_PSD,_TSD) - * - * ACPI_PTYPE2_PKG_COUNT: Count of subpackages at start, 1 or 2 object types: - * object type - * count - * object type - * count - * (Used for _CST) - * - * ACPI_PTYPE2_FIXED: Each subpackage is of Fixed-length. Zero-length - * parent package is allowed. - * (Used for _PRT) - * - * ACPI_PTYPE2_MIN: Each subpackage has a Variable-length but minimum length. - * Zero-length parent package is allowed: - * (Used for _HPX) - * - * ACPI_PTYPE2_REV_FIXED: Revision at start, each subpackage is Fixed-length - * (Used for _ART, _FPS) - * - * ACPI_PTYPE2_FIX_VAR: Each subpackage consists of some fixed-length elements - * followed by an optional element. Zero-length parent package is allowed. - * object type - * count - * object type - * count = 0 (optional) - * (Used for _DLM) - * - * ACPI_PTYPE2_VAR_VAR: Variable number of subpackages, each of either a - * constant or variable length. The subpackages are preceded by a - * constant number of objects. - * (Used for _LPI, _RDI) - * - * ACPI_PTYPE2_UUID_PAIR: Each subpackage is preceded by a UUID Buffer. The UUID - * defines the format of the package. Zero-length parent package is - * allowed. - * (Used for _DSD) - * - *****************************************************************************/ - -enum AcpiReturnPackageTypes -{ - ACPI_PTYPE1_FIXED = 1, - ACPI_PTYPE1_VAR = 2, - ACPI_PTYPE1_OPTION = 3, - ACPI_PTYPE2 = 4, - ACPI_PTYPE2_COUNT = 5, - ACPI_PTYPE2_PKG_COUNT = 6, - ACPI_PTYPE2_FIXED = 7, - ACPI_PTYPE2_MIN = 8, - ACPI_PTYPE2_REV_FIXED = 9, - ACPI_PTYPE2_FIX_VAR = 10, - ACPI_PTYPE2_VAR_VAR = 11, - ACPI_PTYPE2_UUID_PAIR = 12, - ACPI_PTYPE_CUSTOM = 13 -}; - - -/* Support macros for users of the predefined info table */ - -#define METHOD_PREDEF_ARGS_MAX 5 -#define METHOD_ARG_BIT_WIDTH 3 -#define METHOD_ARG_MASK 0x0007 -#define ARG_COUNT_IS_MINIMUM 0x8000 -#define METHOD_MAX_ARG_TYPE ACPI_TYPE_PACKAGE - -#define METHOD_GET_ARG_COUNT(ArgList) ((ArgList) & METHOD_ARG_MASK) -#define METHOD_GET_NEXT_TYPE(ArgList) (((ArgList) >>= METHOD_ARG_BIT_WIDTH) & METHOD_ARG_MASK) - -/* Macros used to build the predefined info table */ - -#define METHOD_0ARGS 0 -#define METHOD_1ARGS(a1) (1 | (a1 << 3)) -#define METHOD_2ARGS(a1,a2) (2 | (a1 << 3) | (a2 << 6)) -#define METHOD_3ARGS(a1,a2,a3) (3 | (a1 << 3) | (a2 << 6) | (a3 << 9)) -#define METHOD_4ARGS(a1,a2,a3,a4) (4 | (a1 << 3) | (a2 << 6) | (a3 << 9) | (a4 << 12)) -#define METHOD_5ARGS(a1,a2,a3,a4,a5) (5 | (a1 << 3) | (a2 << 6) | (a3 << 9) | (a4 << 12) | (a5 << 15)) - -#define METHOD_RETURNS(type) (type) -#define METHOD_NO_RETURN_VALUE 0 - -#define PACKAGE_INFO(a,b,c,d,e,f) {{{(a),(b),(c),(d)}, ((((UINT16)(f)) << 8) | (e)), 0}} - - -/* Support macros for the resource descriptor info table */ - -#define WIDTH_1 0x0001 -#define WIDTH_2 0x0002 -#define WIDTH_3 0x0004 -#define WIDTH_8 0x0008 -#define WIDTH_16 0x0010 -#define WIDTH_32 0x0020 -#define WIDTH_64 0x0040 -#define VARIABLE_DATA 0x0080 -#define NUM_RESOURCE_WIDTHS 8 - -#define WIDTH_ADDRESS WIDTH_16 | WIDTH_32 | WIDTH_64 - - -#ifdef ACPI_CREATE_PREDEFINED_TABLE -/****************************************************************************** - * - * Predefined method/object information table. - * - * These are the names that can actually be evaluated via AcpiEvaluateObject. - * Not present in this table are the following: - * - * 1) Predefined/Reserved names that are not usually evaluated via - * AcpiEvaluateObject: - * _Lxx and _Exx GPE methods - * _Qxx EC methods - * _T_x compiler temporary variables - * _Wxx wake events - * - * 2) Predefined names that never actually exist within the AML code: - * Predefined resource descriptor field names - * - * 3) Predefined names that are implemented within ACPICA: - * _OSI - * - * The main entries in the table each contain the following items: - * - * Name - The ACPI reserved name - * ArgumentList - Contains (in 16 bits), the number of required - * arguments to the method (3 bits), and a 3-bit type - * field for each argument (up to 4 arguments). The - * METHOD_?ARGS macros generate the correct packed data. - * ExpectedBtypes - Allowed type(s) for the return value. - * 0 means that no return value is expected. - * - * For methods that return packages, the next entry in the table contains - * information about the expected structure of the package. This information - * is saved here (rather than in a separate table) in order to minimize the - * overall size of the stored data. - * - * Note: The additional braces are intended to promote portability. - * - * Note2: Table is used by the kernel-resident subsystem, the iASL compiler, - * and the AcpiHelp utility. - * - * TBD: _PRT - currently ignore reversed entries. Attempt to fix in nsrepair. - * Possibly fixing package elements like _BIF, etc. - * - *****************************************************************************/ - -const ACPI_PREDEFINED_INFO AcpiGbl_PredefinedMethods[] = -{ - {{"_AC0", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_AC1", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_AC2", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_AC3", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_AC4", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_AC5", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_AC6", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_AC7", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_AC8", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_AC9", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_ADR", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_AEI", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, - - {{"_AL0", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ - PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), - - {{"_AL1", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ - PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), - - {{"_AL2", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ - PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), - - {{"_AL3", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ - PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), - - {{"_AL4", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ - PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), - - {{"_AL5", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ - PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), - - {{"_AL6", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ - PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), - - {{"_AL7", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ - PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), - - {{"_AL8", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ - PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), - - {{"_AL9", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ - PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), - - {{"_ALC", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_ALI", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_ALP", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_ALR", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each 2 (Ints) */ - PACKAGE_INFO (ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 2,0,0,0), - - {{"_ALT", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_ART", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (1 Int(rev), n Pkg (2 Ref/11 Int) */ - PACKAGE_INFO (ACPI_PTYPE2_REV_FIXED, ACPI_RTYPE_REFERENCE, 2, ACPI_RTYPE_INTEGER, 11,0), - - {{"_BBN", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_BCL", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Ints) */ - PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0,0,0,0), - - {{"_BCM", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_NO_RETURN_VALUE}}, - - {{"_BCT", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_BDN", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_BFS", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_NO_RETURN_VALUE}}, - - {{"_BIF", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (9 Int),(4 Str) */ - PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 9, ACPI_RTYPE_STRING, 4,0), - - {{"_BIX", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (16 Int),(4 Str) */ - PACKAGE_INFO (ACPI_PTYPE_CUSTOM, ACPI_RTYPE_INTEGER, 16, ACPI_RTYPE_STRING, 4,0), - - {{"_BLT", METHOD_3ARGS (ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER), - METHOD_NO_RETURN_VALUE}}, - - {{"_BMA", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_BMC", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_NO_RETURN_VALUE}}, - - {{"_BMD", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (5 Int) */ - PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 5,0,0,0), - - {{"_BMS", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_BPC", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (4 Int) */ - PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0,0,0), - - {{"_BPS", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (5 Int) */ - PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 5,0,0,0), - - {{"_BPT", METHOD_1ARGS (ACPI_TYPE_PACKAGE), - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_BQC", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_BST", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (4 Int) */ - PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0,0,0), - - {{"_BTH", METHOD_1ARGS (ACPI_TYPE_INTEGER), /* ACPI 6.0 */ - METHOD_NO_RETURN_VALUE}}, - - {{"_BTM", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_BTP", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_NO_RETURN_VALUE}}, - - {{"_CBA", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, /* See PCI firmware spec 3.0 */ - - {{"_CBR", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (3 Int) */ - PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3,0,0,0), - - {{"_CCA", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, /* ACPI 5.1 */ - - {{"_CDM", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_CID", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Ints/Strs) */ - PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING, 0,0,0,0), - - {{"_CLS", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (3 Int) */ - PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3,0,0,0), - - {{"_CPC", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Ints/Bufs) */ - PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER, 0,0,0,0), - - {{"_CR3", METHOD_0ARGS, /* ACPI 6.0 */ - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_CRS", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, - - {{"_CRT", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_CSD", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (1 Int(n), n-1 Int) */ - PACKAGE_INFO (ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 0,0,0,0), - - {{"_CST", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (1 Int(n), n Pkg (1 Buf/3 Int) */ - PACKAGE_INFO (ACPI_PTYPE2_PKG_COUNT,ACPI_RTYPE_BUFFER, 1, ACPI_RTYPE_INTEGER, 3,0), - - {{"_CWS", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_DCK", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_DCS", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_DDC", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_RETURNS (ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER)}}, - - {{"_DDN", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_STRING)}}, - - {{"_DEP", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ - PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), - - {{"_DGS", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_DIS", METHOD_0ARGS, - METHOD_NO_RETURN_VALUE}}, - - {{"_DLM", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each (1 Ref, 0/1 Optional Buf/Ref) */ - PACKAGE_INFO (ACPI_PTYPE2_FIX_VAR, ACPI_RTYPE_REFERENCE, 1, ACPI_RTYPE_REFERENCE | ACPI_RTYPE_BUFFER, 0,0), - - {{"_DMA", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, - - {{"_DOD", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Ints) */ - PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0,0,0,0), - - {{"_DOS", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_NO_RETURN_VALUE}}, - - { {"_DSC", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_DSD", METHOD_0ARGS, /* ACPI 6.0 */ - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each: 1 Buf, 1 Pkg */ - PACKAGE_INFO (ACPI_PTYPE2_UUID_PAIR, ACPI_RTYPE_BUFFER, 1, ACPI_RTYPE_PACKAGE, 1,0), - - {{"_DSM", METHOD_4ARGS (ACPI_TYPE_BUFFER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_ANY | ACPI_TYPE_PACKAGE) | ARG_COUNT_IS_MINIMUM, - METHOD_RETURNS (ACPI_RTYPE_ALL)}}, /* Must return a value, but it can be of any type */ - - {{"_DSS", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_NO_RETURN_VALUE}}, - - {{"_DSW", METHOD_3ARGS (ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER), - METHOD_NO_RETURN_VALUE}}, - - {{"_DTI", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_NO_RETURN_VALUE}}, - - {{"_EC_", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_EDL", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs)*/ - PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), - - {{"_EJ0", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_NO_RETURN_VALUE}}, - - {{"_EJ1", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_NO_RETURN_VALUE}}, - - {{"_EJ2", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_NO_RETURN_VALUE}}, - - {{"_EJ3", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_NO_RETURN_VALUE}}, - - {{"_EJ4", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_NO_RETURN_VALUE}}, - - {{"_EJD", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_STRING)}}, - - {{"_ERR", METHOD_3ARGS (ACPI_TYPE_INTEGER, ACPI_TYPE_STRING, ACPI_TYPE_INTEGER), - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, /* Internal use only, used by ACPICA test suites */ - - {{"_EVT", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_NO_RETURN_VALUE}}, - - {{"_FDE", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, - - {{"_FDI", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (16 Int) */ - PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16,0,0,0), - - {{"_FDM", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_NO_RETURN_VALUE}}, - - {{"_FIF", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (4 Int) */ - PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0,0,0), - - {{"_FIT", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, /* ACPI 6.0 */ - - {{"_FIX", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Ints) */ - PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0,0,0,0), - - {{"_FPS", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (1 Int(rev), n Pkg (5 Int) */ - PACKAGE_INFO (ACPI_PTYPE2_REV_FIXED,ACPI_RTYPE_INTEGER, 5, 0,0,0), - - {{"_FSL", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_NO_RETURN_VALUE}}, - - {{"_FST", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (3 Int) */ - PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3,0,0,0), - - {{"_GAI", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_GCP", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_GHL", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_GLK", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_GPD", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_GPE", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, /* _GPE method, not _GPE scope */ - - {{"_GRT", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, - - {{"_GSB", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_GTF", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, - - {{"_GTM", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, - - {{"_GTS", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_NO_RETURN_VALUE}}, - - {{"_GWS", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_HID", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING)}}, - - {{"_HMA", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, - - {{"_HOT", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_HPP", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (4 Int) */ - PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0,0,0), - - /* - * For _HPX, a single package is returned, containing a variable-length number - * of subpackages. Each subpackage contains a PCI record setting. - * There are several different type of record settings, of different - * lengths, but all elements of all settings are Integers. - */ - {{"_HPX", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each (var Ints) */ - PACKAGE_INFO (ACPI_PTYPE2_MIN, ACPI_RTYPE_INTEGER, 5,0,0,0), - - {{"_VDM", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_HRV", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_IFT", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, /* See IPMI spec */ - - {{"_INI", METHOD_0ARGS, - METHOD_NO_RETURN_VALUE}}, - - {{"_IRC", METHOD_0ARGS, - METHOD_NO_RETURN_VALUE}}, - - {{"_LCK", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_NO_RETURN_VALUE}}, - - {{"_LID", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_LPD", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (1 Int(rev), n Pkg (2 Int) */ - PACKAGE_INFO (ACPI_PTYPE2_REV_FIXED, ACPI_RTYPE_INTEGER, 2,0,0,0), - - {{"_LPI", METHOD_0ARGS, /* ACPI 6.0 */ - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (3 Int, n Pkg (10 Int/Buf) */ - PACKAGE_INFO (ACPI_PTYPE2_VAR_VAR, ACPI_RTYPE_INTEGER, 3, - ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER | ACPI_RTYPE_STRING, 10,0), - - {{"_LSI", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, - PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3,0,0,0), - - {{"_LSR", METHOD_2ARGS (ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER), - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, - PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 1, ACPI_RTYPE_BUFFER, 1,0), - - {{"_LSW", METHOD_3ARGS (ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_BUFFER), - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_MAT", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, - - {{"_MBM", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (8 Int) */ - PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 8,0,0,0), - - {{"_MLS", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each (1 Str/1 Buf) */ - PACKAGE_INFO (ACPI_PTYPE2, ACPI_RTYPE_STRING, 1, ACPI_RTYPE_BUFFER, 1,0), - - {{"_MSG", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_NO_RETURN_VALUE}}, - - {{"_MSM", METHOD_4ARGS (ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER), - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_MTL", METHOD_0ARGS, /* ACPI 6.0 */ - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_NBS", METHOD_0ARGS, /* ACPI 6.3 */ - METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, - - {{"_NCH", METHOD_0ARGS, /* ACPI 6.3 */ - METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, - - {{"_NIC", METHOD_0ARGS, /* ACPI 6.3 */ - METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, - - {{"_NIG", METHOD_0ARGS, /* ACPI 6.3 */ - METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, - - {{"_NIH", METHOD_1ARGS (ACPI_TYPE_BUFFER), /* ACPI 6.3 */ - METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, - - {{"_NTT", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_OFF", METHOD_0ARGS, - METHOD_NO_RETURN_VALUE}}, - - {{"_ON_", METHOD_0ARGS, - METHOD_NO_RETURN_VALUE}}, - - {{"_OS_", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_STRING)}}, - - {{"_OSC", METHOD_4ARGS (ACPI_TYPE_BUFFER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_BUFFER), - METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, - - {{"_OST", METHOD_3ARGS (ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_BUFFER), - METHOD_NO_RETURN_VALUE}}, - - {{"_PAI", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_PCL", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ - PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), - - {{"_PCT", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (2 Buf) */ - PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2,0,0,0), - - {{"_PDC", METHOD_1ARGS (ACPI_TYPE_BUFFER), - METHOD_NO_RETURN_VALUE}}, - - {{"_PDL", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_PIC", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_NO_RETURN_VALUE}}, - - {{"_PIF", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (3 Int),(3 Str) */ - PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3, ACPI_RTYPE_STRING, 3,0), - - {{"_PLD", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Bufs) */ - PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_BUFFER, 0,0,0,0), - - {{"_PMC", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (11 Int),(3 Str) */ - PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 11, ACPI_RTYPE_STRING, 3,0), - - {{"_PMD", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ - PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), - - {{"_PMM", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_PPC", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_PPE", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, /* See dig64 spec */ - - {{"_PR0", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ - PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), - - {{"_PR1", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ - PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), - - {{"_PR2", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ - PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), - - {{"_PR3", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ - PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), - - {{"_PRE", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ - PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), - - {{"_PRL", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ - PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), - - {{"_PRR", METHOD_0ARGS, /* ACPI 6.0 */ - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (1 Ref) */ - PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_REFERENCE, 1,0,0,0), - - {{"_PRS", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, - - /* - * For _PRT, many BIOSs reverse the 3rd and 4th Package elements (Source - * and SourceIndex). This bug is so prevalent that there is code in the - * ACPICA Resource Manager to detect this and switch them back. For now, - * do not allow and issue a warning. To allow this and eliminate the - * warning, add the ACPI_RTYPE_REFERENCE type to the 4th element (index 3) - * in the statement below. - */ - {{"_PRT", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each (4): Int,Int,Int/Ref,Int */ - PACKAGE_INFO (ACPI_PTYPE2_FIXED, 4, ACPI_RTYPE_INTEGER, ACPI_RTYPE_INTEGER, - ACPI_RTYPE_INTEGER | ACPI_RTYPE_REFERENCE, ACPI_RTYPE_INTEGER), - - {{"_PRW", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each: Pkg/Int,Int,[Variable-length Refs] (Pkg is Ref/Int) */ - PACKAGE_INFO (ACPI_PTYPE1_OPTION, 2, ACPI_RTYPE_INTEGER | ACPI_RTYPE_PACKAGE, - ACPI_RTYPE_INTEGER, ACPI_RTYPE_REFERENCE, 0), - - {{"_PS0", METHOD_0ARGS, - METHOD_NO_RETURN_VALUE}}, - - {{"_PS1", METHOD_0ARGS, - METHOD_NO_RETURN_VALUE}}, - - {{"_PS2", METHOD_0ARGS, - METHOD_NO_RETURN_VALUE}}, - - {{"_PS3", METHOD_0ARGS, - METHOD_NO_RETURN_VALUE}}, - - {{"_PSC", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_PSD", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each (5 Int) with count */ - PACKAGE_INFO (ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 0,0,0,0), - - {{"_PSE", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_NO_RETURN_VALUE}}, - - {{"_PSL", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ - PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), - - {{"_PSR", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_PSS", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each (6 Int) */ - PACKAGE_INFO (ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 6,0,0,0), - - {{"_PSV", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_PSW", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_NO_RETURN_VALUE}}, - - {{"_PTC", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (2 Buf) */ - PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2,0,0,0), - - {{"_PTP", METHOD_2ARGS (ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER), - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_PTS", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_NO_RETURN_VALUE}}, - - {{"_PUR", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (2 Int) */ - PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2,0,0,0), - - {{"_PXM", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_RDI", METHOD_0ARGS, /* ACPI 6.0 */ - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (1 Int, n Pkg (m Ref)) */ - PACKAGE_INFO (ACPI_PTYPE2_VAR_VAR, ACPI_RTYPE_INTEGER, 1, - ACPI_RTYPE_REFERENCE,0,0), - - {{"_REG", METHOD_2ARGS (ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER), - METHOD_NO_RETURN_VALUE}}, - - {{"_REV", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_RMV", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_ROM", METHOD_2ARGS (ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER), - METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, - - {{"_RST", METHOD_0ARGS, /* ACPI 6.0 */ - METHOD_NO_RETURN_VALUE}}, - - {{"_RTV", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - /* - * For _S0_ through _S5_, the ACPI spec defines a return Package - * containing 1 Integer, but most DSDTs have it wrong - 2,3, or 4 integers. - * Allow this by making the objects "Variable-length length", but all elements - * must be Integers. - */ - {{"_S0_", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (1 Int) */ - PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0,0,0), - - {{"_S1_", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (1 Int) */ - PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0,0,0), - - {{"_S2_", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (1 Int) */ - PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0,0,0), - - {{"_S3_", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (1 Int) */ - PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0,0,0), - - {{"_S4_", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (1 Int) */ - PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0,0,0), - - {{"_S5_", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (1 Int) */ - PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0,0,0), - - {{"_S1D", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_S2D", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_S3D", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_S4D", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_S0W", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_S1W", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_S2W", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_S3W", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_S4W", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_SBA", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (4 Int) */ - PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0,0,0), - - {{"_SBI", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (1 Int, 1 Buf) */ - PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 1, ACPI_RTYPE_BUFFER,1,0), - - {{"_SBR", METHOD_3ARGS (ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER), - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (2 Int) */ - PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2, ACPI_RTYPE_BUFFER | ACPI_RTYPE_INTEGER, 1,0), - - {{"_SBS", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_SBT", METHOD_4ARGS (ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_ANY), - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (2 Int, 1 Buf | Int) */ - PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2, ACPI_RTYPE_BUFFER | ACPI_RTYPE_INTEGER, 1,0), - - {{"_SBW", METHOD_5ARGS (ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_ANY), - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, - PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER | ACPI_RTYPE_INTEGER, 1, 0,0,0), - - {{"_SCP", METHOD_1ARGS (ACPI_TYPE_INTEGER) | ARG_COUNT_IS_MINIMUM, - METHOD_NO_RETURN_VALUE}}, /* Acpi 1.0 allowed 1 integer arg. Acpi 3.0 expanded to 3 args. Allow both. */ - - {{"_SDD", METHOD_1ARGS (ACPI_TYPE_BUFFER), - METHOD_NO_RETURN_VALUE}}, - - {{"_SEG", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_SHL", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_SLI", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, - - {{"_SPD", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_SRS", METHOD_1ARGS (ACPI_TYPE_BUFFER), - METHOD_NO_RETURN_VALUE}}, - - {{"_SRT", METHOD_1ARGS (ACPI_TYPE_BUFFER), - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_SRV", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, /* See IPMI spec */ - - {{"_SST", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_NO_RETURN_VALUE}}, - - {{"_STA", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_STM", METHOD_3ARGS (ACPI_TYPE_BUFFER, ACPI_TYPE_BUFFER, ACPI_TYPE_BUFFER), - METHOD_NO_RETURN_VALUE}}, - - {{"_STP", METHOD_2ARGS (ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER), - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_STR", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, - - {{"_STV", METHOD_2ARGS (ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER), - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_SUB", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_STRING)}}, - - {{"_SUN", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_SWS", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_TC1", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_TC2", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_TDL", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_TFP", METHOD_0ARGS, /* ACPI 6.0 */ - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_TIP", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_TIV", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_TMP", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_TPC", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_TPT", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_NO_RETURN_VALUE}}, - - {{"_TRT", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each 2 Ref/6 Int */ - PACKAGE_INFO (ACPI_PTYPE2, ACPI_RTYPE_REFERENCE, 2, ACPI_RTYPE_INTEGER, 6, 0), - - {{"_TSD", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each 5 Int with count */ - PACKAGE_INFO (ACPI_PTYPE2_COUNT,ACPI_RTYPE_INTEGER, 5,0,0,0), - - {{"_TSN", METHOD_0ARGS, /* ACPI 6.0 */ - METHOD_RETURNS (ACPI_RTYPE_REFERENCE)}}, - - {{"_TSP", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_TSS", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each 5 Int */ - PACKAGE_INFO (ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 5,0,0,0), - - {{"_TST", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_TTS", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_NO_RETURN_VALUE}}, - - {{"_TZD", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ - PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), - - {{"_TZM", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_REFERENCE)}}, - - {{"_TZP", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_UID", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING)}}, - - {{"_UPC", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (4 Int) */ - PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0,0,0), - - {{"_UPD", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_UPP", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - {{"_VPO", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - - /* Acpi 1.0 defined _WAK with no return value. Later, it was changed to return a package */ - - {{"_WAK", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_RETURNS (ACPI_RTYPE_NONE | ACPI_RTYPE_INTEGER | ACPI_RTYPE_PACKAGE)}}, - PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2,0,0,0), /* Fixed-length (2 Int), but is optional */ - - /* _WDG/_WED are MS extensions defined by "Windows Instrumentation" */ - - {{"_WDG", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, - - {{"_WED", METHOD_1ARGS (ACPI_TYPE_INTEGER), - METHOD_RETURNS (ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER)}}, - - {{"_WPC", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, /* ACPI 6.1 */ - - {{"_WPP", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, /* ACPI 6.1 */ - - PACKAGE_INFO (0,0,0,0,0,0) /* Table terminator */ -}; -#else -extern const ACPI_PREDEFINED_INFO AcpiGbl_PredefinedMethods[]; -#endif - - -#if (defined ACPI_CREATE_RESOURCE_TABLE && defined ACPI_APPLICATION) -/****************************************************************************** - * - * Predefined names for use in Resource Descriptors. These names do not - * appear in the global Predefined Name table (since these names never - * appear in actual AML byte code, only in the original ASL) - * - * Note: Used by iASL compiler and AcpiHelp utility only. - * - *****************************************************************************/ - -const ACPI_PREDEFINED_INFO AcpiGbl_ResourceNames[] = -{ - {{"_ADR", WIDTH_16 | WIDTH_64, 0}}, - {{"_ALN", WIDTH_8 | WIDTH_16 | WIDTH_32, 0}}, - {{"_ASI", WIDTH_8, 0}}, - {{"_ASZ", WIDTH_8, 0}}, - {{"_ATT", WIDTH_64, 0}}, - {{"_BAS", WIDTH_16 | WIDTH_32, 0}}, - {{"_BM_", WIDTH_1, 0}}, - {{"_DBT", WIDTH_16, 0}}, /* Acpi 5.0 */ - {{"_DEC", WIDTH_1, 0}}, - {{"_DMA", WIDTH_8, 0}}, - {{"_DPL", WIDTH_1, 0}}, /* Acpi 5.0 */ - {{"_DRS", WIDTH_16, 0}}, /* Acpi 5.0 */ - {{"_END", WIDTH_1, 0}}, /* Acpi 5.0 */ - {{"_FLC", WIDTH_2, 0}}, /* Acpi 5.0 */ - {{"_GRA", WIDTH_ADDRESS, 0}}, - {{"_HE_", WIDTH_1, 0}}, - {{"_INT", WIDTH_16 | WIDTH_32, 0}}, - {{"_IOR", WIDTH_2, 0}}, /* Acpi 5.0 */ - {{"_LEN", WIDTH_8 | WIDTH_ADDRESS, 0}}, - {{"_LIN", WIDTH_8, 0}}, /* Acpi 5.0 */ - {{"_LL_", WIDTH_1, 0}}, - {{"_MAF", WIDTH_1, 0}}, - {{"_MAX", WIDTH_ADDRESS, 0}}, - {{"_MEM", WIDTH_2, 0}}, - {{"_MIF", WIDTH_1, 0}}, - {{"_MIN", WIDTH_ADDRESS, 0}}, - {{"_MOD", WIDTH_1, 0}}, /* Acpi 5.0 */ - {{"_MTP", WIDTH_2, 0}}, - {{"_PAR", WIDTH_8, 0}}, /* Acpi 5.0 */ - {{"_PHA", WIDTH_1, 0}}, /* Acpi 5.0 */ - {{"_PIN", WIDTH_16, 0}}, /* Acpi 5.0 */ - {{"_PPI", WIDTH_8, 0}}, /* Acpi 5.0 */ - {{"_POL", WIDTH_1 | WIDTH_2, 0}}, /* Acpi 5.0 */ - {{"_RBO", WIDTH_8, 0}}, - {{"_RBW", WIDTH_8, 0}}, - {{"_RNG", WIDTH_1, 0}}, - {{"_RT_", WIDTH_8, 0}}, /* Acpi 3.0 */ - {{"_RW_", WIDTH_1, 0}}, - {{"_RXL", WIDTH_16, 0}}, /* Acpi 5.0 */ - {{"_SHR", WIDTH_2, 0}}, - {{"_SIZ", WIDTH_2, 0}}, - {{"_SLV", WIDTH_1, 0}}, /* Acpi 5.0 */ - {{"_SPE", WIDTH_32, 0}}, /* Acpi 5.0 */ - {{"_STB", WIDTH_2, 0}}, /* Acpi 5.0 */ - {{"_TRA", WIDTH_ADDRESS, 0}}, - {{"_TRS", WIDTH_1, 0}}, - {{"_TSF", WIDTH_8, 0}}, /* Acpi 3.0 */ - {{"_TTP", WIDTH_1, 0}}, - {{"_TXL", WIDTH_16, 0}}, /* Acpi 5.0 */ - {{"_TYP", WIDTH_2 | WIDTH_16, 0}}, - {{"_VEN", VARIABLE_DATA, 0}}, /* Acpi 5.0 */ - PACKAGE_INFO (0,0,0,0,0,0) /* Table terminator */ -}; - -const ACPI_PREDEFINED_INFO AcpiGbl_ScopeNames[] = { - {{"_GPE", 0, 0}}, - {{"_PR_", 0, 0}}, - {{"_SB_", 0, 0}}, - {{"_SI_", 0, 0}}, - {{"_TZ_", 0, 0}}, - PACKAGE_INFO (0,0,0,0,0,0) /* Table terminator */ -}; -#else -extern const ACPI_PREDEFINED_INFO AcpiGbl_ResourceNames[]; -#endif - -#endif diff --git a/drivers/include/acpica/acresrc.h b/drivers/include/acpica/acresrc.h deleted file mode 100644 index e5a96d5..0000000 --- a/drivers/include/acpica/acresrc.h +++ /dev/null @@ -1,569 +0,0 @@ -/****************************************************************************** - * - * Name: acresrc.h - Resource Manager function prototypes - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef __ACRESRC_H__ -#define __ACRESRC_H__ - -/* Need the AML resource descriptor structs */ - -#include "amlresrc.h" - - -/* - * If possible, pack the following structures to byte alignment, since we - * don't care about performance for debug output. Two cases where we cannot - * pack the structures: - * - * 1) Hardware does not support misaligned memory transfers - * 2) Compiler does not support pointers within packed structures - */ -#if (!defined(ACPI_MISALIGNMENT_NOT_SUPPORTED) && !defined(ACPI_PACKED_POINTERS_NOT_SUPPORTED)) -#pragma pack(1) -#endif - -/* - * Individual entry for the resource conversion tables - */ -typedef const struct acpi_rsconvert_info -{ - UINT8 Opcode; - UINT8 ResourceOffset; - UINT8 AmlOffset; - UINT8 Value; - -} ACPI_RSCONVERT_INFO; - -/* Resource conversion opcodes */ - -typedef enum -{ - ACPI_RSC_INITGET = 0, - ACPI_RSC_INITSET, - ACPI_RSC_FLAGINIT, - ACPI_RSC_1BITFLAG, - ACPI_RSC_2BITFLAG, - ACPI_RSC_3BITFLAG, - ACPI_RSC_6BITFLAG, - ACPI_RSC_ADDRESS, - ACPI_RSC_BITMASK, - ACPI_RSC_BITMASK16, - ACPI_RSC_COUNT, - ACPI_RSC_COUNT16, - ACPI_RSC_COUNT_GPIO_PIN, - ACPI_RSC_COUNT_GPIO_RES, - ACPI_RSC_COUNT_GPIO_VEN, - ACPI_RSC_COUNT_SERIAL_RES, - ACPI_RSC_COUNT_SERIAL_VEN, - ACPI_RSC_DATA8, - ACPI_RSC_EXIT_EQ, - ACPI_RSC_EXIT_LE, - ACPI_RSC_EXIT_NE, - ACPI_RSC_LENGTH, - ACPI_RSC_MOVE_GPIO_PIN, - ACPI_RSC_MOVE_GPIO_RES, - ACPI_RSC_MOVE_SERIAL_RES, - ACPI_RSC_MOVE_SERIAL_VEN, - ACPI_RSC_MOVE8, - ACPI_RSC_MOVE16, - ACPI_RSC_MOVE32, - ACPI_RSC_MOVE64, - ACPI_RSC_SET8, - ACPI_RSC_SOURCE, - ACPI_RSC_SOURCEX - -} ACPI_RSCONVERT_OPCODES; - -/* Resource Conversion sub-opcodes */ - -#define ACPI_RSC_COMPARE_AML_LENGTH 0 -#define ACPI_RSC_COMPARE_VALUE 1 - -#define ACPI_RSC_TABLE_SIZE(d) (sizeof (d) / sizeof (ACPI_RSCONVERT_INFO)) - -#define ACPI_RS_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_RESOURCE,f) -#define AML_OFFSET(f) (UINT8) ACPI_OFFSET (AML_RESOURCE,f) - - -/* - * Individual entry for the resource dump tables - */ -typedef const struct acpi_rsdump_info -{ - UINT8 Opcode; - UINT8 Offset; - const char *Name; - const char **Pointer; - -} ACPI_RSDUMP_INFO; - -/* Values for the Opcode field above */ - -typedef enum -{ - ACPI_RSD_TITLE = 0, - ACPI_RSD_1BITFLAG, - ACPI_RSD_2BITFLAG, - ACPI_RSD_3BITFLAG, - ACPI_RSD_6BITFLAG, - ACPI_RSD_ADDRESS, - ACPI_RSD_DWORDLIST, - ACPI_RSD_LITERAL, - ACPI_RSD_LONGLIST, - ACPI_RSD_SHORTLIST, - ACPI_RSD_SHORTLISTX, - ACPI_RSD_SOURCE, - ACPI_RSD_STRING, - ACPI_RSD_UINT8, - ACPI_RSD_UINT16, - ACPI_RSD_UINT32, - ACPI_RSD_UINT64, - ACPI_RSD_WORDLIST, - ACPI_RSD_LABEL, - ACPI_RSD_SOURCE_LABEL, - -} ACPI_RSDUMP_OPCODES; - -/* restore default alignment */ - -#pragma pack() - - -/* Resource tables indexed by internal resource type */ - -extern const UINT8 AcpiGbl_AmlResourceSizes[]; -extern const UINT8 AcpiGbl_AmlResourceSerialBusSizes[]; -extern ACPI_RSCONVERT_INFO *AcpiGbl_SetResourceDispatch[]; - -/* Resource tables indexed by raw AML resource descriptor type */ - -extern const UINT8 AcpiGbl_ResourceStructSizes[]; -extern const UINT8 AcpiGbl_ResourceStructSerialBusSizes[]; -extern ACPI_RSCONVERT_INFO *AcpiGbl_GetResourceDispatch[]; - -extern ACPI_RSCONVERT_INFO *AcpiGbl_ConvertResourceSerialBusDispatch[]; - -typedef struct acpi_vendor_walk_info -{ - ACPI_VENDOR_UUID *Uuid; - ACPI_BUFFER *Buffer; - ACPI_STATUS Status; - -} ACPI_VENDOR_WALK_INFO; - - -/* - * rscreate - */ -ACPI_STATUS -AcpiRsCreateResourceList ( - ACPI_OPERAND_OBJECT *AmlBuffer, - ACPI_BUFFER *OutputBuffer); - -ACPI_STATUS -AcpiRsCreateAmlResources ( - ACPI_BUFFER *ResourceList, - ACPI_BUFFER *OutputBuffer); - -ACPI_STATUS -AcpiRsCreatePciRoutingTable ( - ACPI_OPERAND_OBJECT *PackageObject, - ACPI_BUFFER *OutputBuffer); - - -/* - * rsutils - */ -ACPI_STATUS -AcpiRsGetPrtMethodData ( - ACPI_NAMESPACE_NODE *Node, - ACPI_BUFFER *RetBuffer); - -ACPI_STATUS -AcpiRsGetCrsMethodData ( - ACPI_NAMESPACE_NODE *Node, - ACPI_BUFFER *RetBuffer); - -ACPI_STATUS -AcpiRsGetPrsMethodData ( - ACPI_NAMESPACE_NODE *Node, - ACPI_BUFFER *RetBuffer); - -ACPI_STATUS -AcpiRsGetMethodData ( - ACPI_HANDLE Handle, - const char *Path, - ACPI_BUFFER *RetBuffer); - -ACPI_STATUS -AcpiRsSetSrsMethodData ( - ACPI_NAMESPACE_NODE *Node, - ACPI_BUFFER *RetBuffer); - -ACPI_STATUS -AcpiRsGetAeiMethodData ( - ACPI_NAMESPACE_NODE *Node, - ACPI_BUFFER *RetBuffer); - -/* - * rscalc - */ -ACPI_STATUS -AcpiRsGetListLength ( - UINT8 *AmlBuffer, - UINT32 AmlBufferLength, - ACPI_SIZE *SizeNeeded); - -ACPI_STATUS -AcpiRsGetAmlLength ( - ACPI_RESOURCE *ResourceList, - ACPI_SIZE ResourceListSize, - ACPI_SIZE *SizeNeeded); - -ACPI_STATUS -AcpiRsGetPciRoutingTableLength ( - ACPI_OPERAND_OBJECT *PackageObject, - ACPI_SIZE *BufferSizeNeeded); - -ACPI_STATUS -AcpiRsConvertAmlToResources ( - UINT8 *Aml, - UINT32 Length, - UINT32 Offset, - UINT8 ResourceIndex, - void **Context); - -ACPI_STATUS -AcpiRsConvertResourcesToAml ( - ACPI_RESOURCE *Resource, - ACPI_SIZE AmlSizeNeeded, - UINT8 *OutputBuffer); - - -/* - * rsaddr - */ -void -AcpiRsSetAddressCommon ( - AML_RESOURCE *Aml, - ACPI_RESOURCE *Resource); - -BOOLEAN -AcpiRsGetAddressCommon ( - ACPI_RESOURCE *Resource, - AML_RESOURCE *Aml); - - -/* - * rsmisc - */ -ACPI_STATUS -AcpiRsConvertAmlToResource ( - ACPI_RESOURCE *Resource, - AML_RESOURCE *Aml, - ACPI_RSCONVERT_INFO *Info); - -ACPI_STATUS -AcpiRsConvertResourceToAml ( - ACPI_RESOURCE *Resource, - AML_RESOURCE *Aml, - ACPI_RSCONVERT_INFO *Info); - - -/* - * rsutils - */ -void -AcpiRsMoveData ( - void *Destination, - void *Source, - UINT16 ItemCount, - UINT8 MoveType); - -UINT8 -AcpiRsDecodeBitmask ( - UINT16 Mask, - UINT8 *List); - -UINT16 -AcpiRsEncodeBitmask ( - UINT8 *List, - UINT8 Count); - -ACPI_RS_LENGTH -AcpiRsGetResourceSource ( - ACPI_RS_LENGTH ResourceLength, - ACPI_RS_LENGTH MinimumLength, - ACPI_RESOURCE_SOURCE *ResourceSource, - AML_RESOURCE *Aml, - char *StringPtr); - -ACPI_RSDESC_SIZE -AcpiRsSetResourceSource ( - AML_RESOURCE *Aml, - ACPI_RS_LENGTH MinimumLength, - ACPI_RESOURCE_SOURCE *ResourceSource); - -void -AcpiRsSetResourceHeader ( - UINT8 DescriptorType, - ACPI_RSDESC_SIZE TotalLength, - AML_RESOURCE *Aml); - -void -AcpiRsSetResourceLength ( - ACPI_RSDESC_SIZE TotalLength, - AML_RESOURCE *Aml); - - -/* - * rsdump - Debugger support - */ -#ifdef ACPI_DEBUGGER -void -AcpiRsDumpResourceList ( - ACPI_RESOURCE *Resource); - -void -AcpiRsDumpIrqList ( - UINT8 *RouteTable); -#endif - - -/* - * Resource conversion tables - */ -extern ACPI_RSCONVERT_INFO AcpiRsConvertDma[]; -extern ACPI_RSCONVERT_INFO AcpiRsConvertEndDpf[]; -extern ACPI_RSCONVERT_INFO AcpiRsConvertIo[]; -extern ACPI_RSCONVERT_INFO AcpiRsConvertFixedIo[]; -extern ACPI_RSCONVERT_INFO AcpiRsConvertEndTag[]; -extern ACPI_RSCONVERT_INFO AcpiRsConvertMemory24[]; -extern ACPI_RSCONVERT_INFO AcpiRsConvertGenericReg[]; -extern ACPI_RSCONVERT_INFO AcpiRsConvertMemory32[]; -extern ACPI_RSCONVERT_INFO AcpiRsConvertFixedMemory32[]; -extern ACPI_RSCONVERT_INFO AcpiRsConvertAddress32[]; -extern ACPI_RSCONVERT_INFO AcpiRsConvertAddress16[]; -extern ACPI_RSCONVERT_INFO AcpiRsConvertExtIrq[]; -extern ACPI_RSCONVERT_INFO AcpiRsConvertAddress64[]; -extern ACPI_RSCONVERT_INFO AcpiRsConvertExtAddress64[]; -extern ACPI_RSCONVERT_INFO AcpiRsConvertGpio[]; -extern ACPI_RSCONVERT_INFO AcpiRsConvertFixedDma[]; -extern ACPI_RSCONVERT_INFO AcpiRsConvertCsi2SerialBus[]; -extern ACPI_RSCONVERT_INFO AcpiRsConvertI2cSerialBus[]; -extern ACPI_RSCONVERT_INFO AcpiRsConvertSpiSerialBus[]; -extern ACPI_RSCONVERT_INFO AcpiRsConvertUartSerialBus[]; -extern ACPI_RSCONVERT_INFO AcpiRsConvertPinFunction[]; -extern ACPI_RSCONVERT_INFO AcpiRsConvertPinConfig[]; -extern ACPI_RSCONVERT_INFO AcpiRsConvertPinGroup[]; -extern ACPI_RSCONVERT_INFO AcpiRsConvertPinGroupFunction[]; -extern ACPI_RSCONVERT_INFO AcpiRsConvertPinGroupConfig[]; -extern ACPI_RSCONVERT_INFO AcpiRsConvertClockInput[]; - -/* These resources require separate get/set tables */ - -extern ACPI_RSCONVERT_INFO AcpiRsGetIrq[]; -extern ACPI_RSCONVERT_INFO AcpiRsGetStartDpf[]; -extern ACPI_RSCONVERT_INFO AcpiRsGetVendorSmall[]; -extern ACPI_RSCONVERT_INFO AcpiRsGetVendorLarge[]; - -extern ACPI_RSCONVERT_INFO AcpiRsSetIrq[]; -extern ACPI_RSCONVERT_INFO AcpiRsSetStartDpf[]; -extern ACPI_RSCONVERT_INFO AcpiRsSetVendor[]; - - -#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) -/* - * rsinfo - */ -extern ACPI_RSDUMP_INFO *AcpiGbl_DumpResourceDispatch[]; -extern ACPI_RSDUMP_INFO *AcpiGbl_DumpSerialBusDispatch[]; - -/* - * rsdumpinfo - */ -extern ACPI_RSDUMP_INFO AcpiRsDumpIrq[]; -extern ACPI_RSDUMP_INFO AcpiRsDumpPrt[]; -extern ACPI_RSDUMP_INFO AcpiRsDumpDma[]; -extern ACPI_RSDUMP_INFO AcpiRsDumpStartDpf[]; -extern ACPI_RSDUMP_INFO AcpiRsDumpEndDpf[]; -extern ACPI_RSDUMP_INFO AcpiRsDumpIo[]; -extern ACPI_RSDUMP_INFO AcpiRsDumpIoFlags[]; -extern ACPI_RSDUMP_INFO AcpiRsDumpFixedIo[]; -extern ACPI_RSDUMP_INFO AcpiRsDumpVendor[]; -extern ACPI_RSDUMP_INFO AcpiRsDumpEndTag[]; -extern ACPI_RSDUMP_INFO AcpiRsDumpMemory24[]; -extern ACPI_RSDUMP_INFO AcpiRsDumpMemory32[]; -extern ACPI_RSDUMP_INFO AcpiRsDumpMemoryFlags[]; -extern ACPI_RSDUMP_INFO AcpiRsDumpFixedMemory32[]; -extern ACPI_RSDUMP_INFO AcpiRsDumpAddress16[]; -extern ACPI_RSDUMP_INFO AcpiRsDumpAddress32[]; -extern ACPI_RSDUMP_INFO AcpiRsDumpAddress64[]; -extern ACPI_RSDUMP_INFO AcpiRsDumpExtAddress64[]; -extern ACPI_RSDUMP_INFO AcpiRsDumpExtIrq[]; -extern ACPI_RSDUMP_INFO AcpiRsDumpGenericReg[]; -extern ACPI_RSDUMP_INFO AcpiRsDumpGpio[]; -extern ACPI_RSDUMP_INFO AcpiRsDumpPinFunction[]; -extern ACPI_RSDUMP_INFO AcpiRsDumpFixedDma[]; -extern ACPI_RSDUMP_INFO AcpiRsDumpCommonSerialBus[]; -extern ACPI_RSDUMP_INFO AcpiRsDumpCsi2SerialBus[]; -extern ACPI_RSDUMP_INFO AcpiRsDumpI2cSerialBus[]; -extern ACPI_RSDUMP_INFO AcpiRsDumpSpiSerialBus[]; -extern ACPI_RSDUMP_INFO AcpiRsDumpUartSerialBus[]; -extern ACPI_RSDUMP_INFO AcpiRsDumpGeneralFlags[]; -extern ACPI_RSDUMP_INFO AcpiRsDumpPinConfig[]; -extern ACPI_RSDUMP_INFO AcpiRsDumpPinGroup[]; -extern ACPI_RSDUMP_INFO AcpiRsDumpPinGroupFunction[]; -extern ACPI_RSDUMP_INFO AcpiRsDumpPinGroupConfig[]; -extern ACPI_RSDUMP_INFO AcpiRsDumpClockInput[]; -#endif - -#endif /* __ACRESRC_H__ */ diff --git a/drivers/include/acpica/acrestyp.h b/drivers/include/acpica/acrestyp.h deleted file mode 100644 index ab48a39..0000000 --- a/drivers/include/acpica/acrestyp.h +++ /dev/null @@ -1,957 +0,0 @@ -/****************************************************************************** - * - * Name: acrestyp.h - Defines, types, and structures for resource descriptors - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef __ACRESTYP_H__ -#define __ACRESTYP_H__ - - -/* - * Definitions for Resource Attributes - */ -typedef UINT16 ACPI_RS_LENGTH; /* Resource Length field is fixed at 16 bits */ -typedef UINT32 ACPI_RSDESC_SIZE; /* Max Resource Descriptor size is (Length+3) = (64K-1)+3 */ - -/* - * Memory Attributes - */ -#define ACPI_READ_ONLY_MEMORY (UINT8) 0x00 -#define ACPI_READ_WRITE_MEMORY (UINT8) 0x01 - -#define ACPI_NON_CACHEABLE_MEMORY (UINT8) 0x00 -#define ACPI_CACHABLE_MEMORY (UINT8) 0x01 -#define ACPI_WRITE_COMBINING_MEMORY (UINT8) 0x02 -#define ACPI_PREFETCHABLE_MEMORY (UINT8) 0x03 - -/*! [Begin] no source code translation */ -/* - * IO Attributes - * The ISA IO ranges are: n000-n0FFh, n400-n4FFh, n800-n8FFh, nC00-nCFFh. - * The non-ISA IO ranges are: n100-n3FFh, n500-n7FFh, n900-nBFFh, nCD0-nFFFh. - */ -/*! [End] no source code translation !*/ - -#define ACPI_NON_ISA_ONLY_RANGES (UINT8) 0x01 -#define ACPI_ISA_ONLY_RANGES (UINT8) 0x02 -#define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES) - -/* Type of translation - 1=Sparse, 0=Dense */ - -#define ACPI_SPARSE_TRANSLATION (UINT8) 0x01 - -/* - * IO Port Descriptor Decode - */ -#define ACPI_DECODE_10 (UINT8) 0x00 /* 10-bit IO address decode */ -#define ACPI_DECODE_16 (UINT8) 0x01 /* 16-bit IO address decode */ - -/* - * Interrupt attributes - used in multiple descriptors - */ - -/* Triggering */ - -#define ACPI_LEVEL_SENSITIVE (UINT8) 0x00 -#define ACPI_EDGE_SENSITIVE (UINT8) 0x01 - -/* Polarity */ - -#define ACPI_ACTIVE_HIGH (UINT8) 0x00 -#define ACPI_ACTIVE_LOW (UINT8) 0x01 -#define ACPI_ACTIVE_BOTH (UINT8) 0x02 - -/* Sharing */ - -#define ACPI_EXCLUSIVE (UINT8) 0x00 -#define ACPI_SHARED (UINT8) 0x01 - -/* Wake */ - -#define ACPI_NOT_WAKE_CAPABLE (UINT8) 0x00 -#define ACPI_WAKE_CAPABLE (UINT8) 0x01 - -/* - * DMA Attributes - */ -#define ACPI_COMPATIBILITY (UINT8) 0x00 -#define ACPI_TYPE_A (UINT8) 0x01 -#define ACPI_TYPE_B (UINT8) 0x02 -#define ACPI_TYPE_F (UINT8) 0x03 - -#define ACPI_NOT_BUS_MASTER (UINT8) 0x00 -#define ACPI_BUS_MASTER (UINT8) 0x01 - -#define ACPI_TRANSFER_8 (UINT8) 0x00 -#define ACPI_TRANSFER_8_16 (UINT8) 0x01 -#define ACPI_TRANSFER_16 (UINT8) 0x02 - -/* - * Start Dependent Functions Priority definitions - */ -#define ACPI_GOOD_CONFIGURATION (UINT8) 0x00 -#define ACPI_ACCEPTABLE_CONFIGURATION (UINT8) 0x01 -#define ACPI_SUB_OPTIMAL_CONFIGURATION (UINT8) 0x02 - -/* - * 16, 32 and 64-bit Address Descriptor resource types - */ -#define ACPI_MEMORY_RANGE (UINT8) 0x00 -#define ACPI_IO_RANGE (UINT8) 0x01 -#define ACPI_BUS_NUMBER_RANGE (UINT8) 0x02 - -#define ACPI_ADDRESS_NOT_FIXED (UINT8) 0x00 -#define ACPI_ADDRESS_FIXED (UINT8) 0x01 - -#define ACPI_POS_DECODE (UINT8) 0x00 -#define ACPI_SUB_DECODE (UINT8) 0x01 - -/* Producer/Consumer */ - -#define ACPI_PRODUCER (UINT8) 0x00 -#define ACPI_CONSUMER (UINT8) 0x01 - - -/* - * If possible, pack the following structures to byte alignment - */ -#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED -#pragma pack(1) -#endif - -/* UUID data structures for use in vendor-defined resource descriptors */ - -typedef struct acpi_uuid -{ - UINT8 Data[ACPI_UUID_LENGTH]; -} ACPI_UUID; - -typedef struct acpi_vendor_uuid -{ - UINT8 Subtype; - UINT8 Data[ACPI_UUID_LENGTH]; - -} ACPI_VENDOR_UUID; - -/* - * Structures used to describe device resources - */ -typedef struct acpi_resource_irq -{ - UINT8 DescriptorLength; - UINT8 Triggering; - UINT8 Polarity; - UINT8 Shareable; - UINT8 WakeCapable; - UINT8 InterruptCount; - union { - UINT8 Interrupt; - ACPI_FLEX_ARRAY(UINT8, Interrupts); - }; - -} ACPI_RESOURCE_IRQ; - -typedef struct acpi_resource_dma -{ - UINT8 Type; - UINT8 BusMaster; - UINT8 Transfer; - UINT8 ChannelCount; - union { - UINT8 Channel; - ACPI_FLEX_ARRAY(UINT8, Channels); - }; - -} ACPI_RESOURCE_DMA; - -typedef struct acpi_resource_start_dependent -{ - UINT8 DescriptorLength; - UINT8 CompatibilityPriority; - UINT8 PerformanceRobustness; - -} ACPI_RESOURCE_START_DEPENDENT; - - -/* - * The END_DEPENDENT_FUNCTIONS_RESOURCE struct is not - * needed because it has no fields - */ - - -typedef struct acpi_resource_io -{ - UINT8 IoDecode; - UINT8 Alignment; - UINT8 AddressLength; - UINT16 Minimum; - UINT16 Maximum; - -} ACPI_RESOURCE_IO; - -typedef struct acpi_resource_fixed_io -{ - UINT16 Address; - UINT8 AddressLength; - -} ACPI_RESOURCE_FIXED_IO; - -typedef struct acpi_resource_fixed_dma -{ - UINT16 RequestLines; - UINT16 Channels; - UINT8 Width; - -} ACPI_RESOURCE_FIXED_DMA; - -/* Values for Width field above */ - -#define ACPI_DMA_WIDTH8 0 -#define ACPI_DMA_WIDTH16 1 -#define ACPI_DMA_WIDTH32 2 -#define ACPI_DMA_WIDTH64 3 -#define ACPI_DMA_WIDTH128 4 -#define ACPI_DMA_WIDTH256 5 - - -typedef struct acpi_resource_vendor -{ - UINT16 ByteLength; - UINT8 ByteData[]; - -} ACPI_RESOURCE_VENDOR; - -/* Vendor resource with UUID info (introduced in ACPI 3.0) */ - -typedef struct acpi_resource_vendor_typed -{ - UINT16 ByteLength; - UINT8 UuidSubtype; - UINT8 Uuid[ACPI_UUID_LENGTH]; - UINT8 ByteData[]; - -} ACPI_RESOURCE_VENDOR_TYPED; - -typedef struct acpi_resource_end_tag -{ - UINT8 Checksum; - -} ACPI_RESOURCE_END_TAG; - -typedef struct acpi_resource_memory24 -{ - UINT8 WriteProtect; - UINT16 Minimum; - UINT16 Maximum; - UINT16 Alignment; - UINT16 AddressLength; - -} ACPI_RESOURCE_MEMORY24; - -typedef struct acpi_resource_memory32 -{ - UINT8 WriteProtect; - UINT32 Minimum; - UINT32 Maximum; - UINT32 Alignment; - UINT32 AddressLength; - -} ACPI_RESOURCE_MEMORY32; - -typedef struct acpi_resource_fixed_memory32 -{ - UINT8 WriteProtect; - UINT32 Address; - UINT32 AddressLength; - -} ACPI_RESOURCE_FIXED_MEMORY32; - -typedef struct acpi_memory_attribute -{ - UINT8 WriteProtect; - UINT8 Caching; - UINT8 RangeType; - UINT8 Translation; - -} ACPI_MEMORY_ATTRIBUTE; - -typedef struct acpi_io_attribute -{ - UINT8 RangeType; - UINT8 Translation; - UINT8 TranslationType; - UINT8 Reserved1; - -} ACPI_IO_ATTRIBUTE; - -typedef union acpi_resource_attribute -{ - ACPI_MEMORY_ATTRIBUTE Mem; - ACPI_IO_ATTRIBUTE Io; - - /* Used for the *WordSpace macros */ - - UINT8 TypeSpecific; - -} ACPI_RESOURCE_ATTRIBUTE; - -typedef struct acpi_resource_label -{ - UINT16 StringLength; - char *StringPtr; - -} ACPI_RESOURCE_LABEL; - -typedef struct acpi_resource_source -{ - UINT8 Index; - UINT16 StringLength; - char *StringPtr; - -} ACPI_RESOURCE_SOURCE; - -/* Fields common to all address descriptors, 16/32/64 bit */ - -#define ACPI_RESOURCE_ADDRESS_COMMON \ - UINT8 ResourceType; \ - UINT8 ProducerConsumer; \ - UINT8 Decode; \ - UINT8 MinAddressFixed; \ - UINT8 MaxAddressFixed; \ - ACPI_RESOURCE_ATTRIBUTE Info; - -typedef struct acpi_address16_attribute -{ - UINT16 Granularity; - UINT16 Minimum; - UINT16 Maximum; - UINT16 TranslationOffset; - UINT16 AddressLength; - -} ACPI_ADDRESS16_ATTRIBUTE; - -typedef struct acpi_address32_attribute -{ - UINT32 Granularity; - UINT32 Minimum; - UINT32 Maximum; - UINT32 TranslationOffset; - UINT32 AddressLength; - -} ACPI_ADDRESS32_ATTRIBUTE; - -typedef struct acpi_address64_attribute -{ - UINT64 Granularity; - UINT64 Minimum; - UINT64 Maximum; - UINT64 TranslationOffset; - UINT64 AddressLength; - -} ACPI_ADDRESS64_ATTRIBUTE; - -typedef struct acpi_resource_address -{ - ACPI_RESOURCE_ADDRESS_COMMON - -} ACPI_RESOURCE_ADDRESS; - -typedef struct acpi_resource_address16 -{ - ACPI_RESOURCE_ADDRESS_COMMON - ACPI_ADDRESS16_ATTRIBUTE Address; - ACPI_RESOURCE_SOURCE ResourceSource; - -} ACPI_RESOURCE_ADDRESS16; - -typedef struct acpi_resource_address32 -{ - ACPI_RESOURCE_ADDRESS_COMMON - ACPI_ADDRESS32_ATTRIBUTE Address; - ACPI_RESOURCE_SOURCE ResourceSource; - -} ACPI_RESOURCE_ADDRESS32; - -typedef struct acpi_resource_address64 -{ - ACPI_RESOURCE_ADDRESS_COMMON - ACPI_ADDRESS64_ATTRIBUTE Address; - ACPI_RESOURCE_SOURCE ResourceSource; - -} ACPI_RESOURCE_ADDRESS64; - -typedef struct acpi_resource_extended_address64 -{ - ACPI_RESOURCE_ADDRESS_COMMON - UINT8 RevisionID; - ACPI_ADDRESS64_ATTRIBUTE Address; - UINT64 TypeSpecific; - -} ACPI_RESOURCE_EXTENDED_ADDRESS64; - -typedef struct acpi_resource_extended_irq -{ - UINT8 ProducerConsumer; - UINT8 Triggering; - UINT8 Polarity; - UINT8 Shareable; - UINT8 WakeCapable; - UINT8 InterruptCount; - ACPI_RESOURCE_SOURCE ResourceSource; - union { - UINT32 Interrupt; - ACPI_FLEX_ARRAY(UINT32, Interrupts); - }; - -} ACPI_RESOURCE_EXTENDED_IRQ; - -typedef struct acpi_resource_generic_register -{ - UINT8 SpaceId; - UINT8 BitWidth; - UINT8 BitOffset; - UINT8 AccessSize; - UINT64 Address; - -} ACPI_RESOURCE_GENERIC_REGISTER; - -typedef struct acpi_resource_gpio -{ - UINT8 RevisionId; - UINT8 ConnectionType; - UINT8 ProducerConsumer; /* For values, see Producer/Consumer above */ - UINT8 PinConfig; - UINT8 Shareable; /* For values, see Interrupt Attributes above */ - UINT8 WakeCapable; /* For values, see Interrupt Attributes above */ - UINT8 IoRestriction; - UINT8 Triggering; /* For values, see Interrupt Attributes above */ - UINT8 Polarity; /* For values, see Interrupt Attributes above */ - UINT16 DriveStrength; - UINT16 DebounceTimeout; - UINT16 PinTableLength; - UINT16 VendorLength; - ACPI_RESOURCE_SOURCE ResourceSource; - UINT16 *PinTable; - UINT8 *VendorData; - -} ACPI_RESOURCE_GPIO; - -/* Values for GPIO ConnectionType field above */ - -#define ACPI_RESOURCE_GPIO_TYPE_INT 0 -#define ACPI_RESOURCE_GPIO_TYPE_IO 1 - -/* Values for PinConfig field above */ - -#define ACPI_PIN_CONFIG_DEFAULT 0 -#define ACPI_PIN_CONFIG_PULLUP 1 -#define ACPI_PIN_CONFIG_PULLDOWN 2 -#define ACPI_PIN_CONFIG_NOPULL 3 - -/* Values for IoRestriction field above */ - -#define ACPI_IO_RESTRICT_NONE 0 -#define ACPI_IO_RESTRICT_INPUT 1 -#define ACPI_IO_RESTRICT_OUTPUT 2 -#define ACPI_IO_RESTRICT_NONE_PRESERVE 3 - - -/* Common structure for I2C, SPI, UART, CSI2 serial descriptors */ - -#define ACPI_RESOURCE_SERIAL_COMMON \ - UINT8 RevisionId; \ - UINT8 Type; \ - UINT8 ProducerConsumer; /* For values, see Producer/Consumer above */\ - UINT8 SlaveMode; \ - UINT8 ConnectionSharing; \ - UINT8 TypeRevisionId; \ - UINT16 TypeDataLength; \ - UINT16 VendorLength; \ - ACPI_RESOURCE_SOURCE ResourceSource; \ - UINT8 *VendorData; - -typedef struct acpi_resource_common_serialbus -{ - ACPI_RESOURCE_SERIAL_COMMON - -} ACPI_RESOURCE_COMMON_SERIALBUS; - -/* Values for the Type field above */ - -#define ACPI_RESOURCE_SERIAL_TYPE_I2C 1 -#define ACPI_RESOURCE_SERIAL_TYPE_SPI 2 -#define ACPI_RESOURCE_SERIAL_TYPE_UART 3 -#define ACPI_RESOURCE_SERIAL_TYPE_CSI2 4 - -/* Values for SlaveMode field above */ - -#define ACPI_CONTROLLER_INITIATED 0 -#define ACPI_DEVICE_INITIATED 1 - - -typedef struct acpi_resource_i2c_serialbus -{ - ACPI_RESOURCE_SERIAL_COMMON - UINT8 AccessMode; - UINT16 SlaveAddress; - UINT32 ConnectionSpeed; - -} ACPI_RESOURCE_I2C_SERIALBUS; - -/* Values for AccessMode field above */ - -#define ACPI_I2C_7BIT_MODE 0 -#define ACPI_I2C_10BIT_MODE 1 - - -typedef struct acpi_resource_spi_serialbus -{ - ACPI_RESOURCE_SERIAL_COMMON - UINT8 WireMode; - UINT8 DevicePolarity; - UINT8 DataBitLength; - UINT8 ClockPhase; - UINT8 ClockPolarity; - UINT16 DeviceSelection; - UINT32 ConnectionSpeed; - -} ACPI_RESOURCE_SPI_SERIALBUS; - -/* Values for WireMode field above */ - -#define ACPI_SPI_4WIRE_MODE 0 -#define ACPI_SPI_3WIRE_MODE 1 - -/* Values for DevicePolarity field above */ - -#define ACPI_SPI_ACTIVE_LOW 0 -#define ACPI_SPI_ACTIVE_HIGH 1 - -/* Values for ClockPhase field above */ - -#define ACPI_SPI_FIRST_PHASE 0 -#define ACPI_SPI_SECOND_PHASE 1 - -/* Values for ClockPolarity field above */ - -#define ACPI_SPI_START_LOW 0 -#define ACPI_SPI_START_HIGH 1 - - -typedef struct acpi_resource_uart_serialbus -{ - ACPI_RESOURCE_SERIAL_COMMON - UINT8 Endian; - UINT8 DataBits; - UINT8 StopBits; - UINT8 FlowControl; - UINT8 Parity; - UINT8 LinesEnabled; - UINT16 RxFifoSize; - UINT16 TxFifoSize; - UINT32 DefaultBaudRate; - -} ACPI_RESOURCE_UART_SERIALBUS; - -/* Values for Endian field above */ - -#define ACPI_UART_LITTLE_ENDIAN 0 -#define ACPI_UART_BIG_ENDIAN 1 - -/* Values for DataBits field above */ - -#define ACPI_UART_5_DATA_BITS 0 -#define ACPI_UART_6_DATA_BITS 1 -#define ACPI_UART_7_DATA_BITS 2 -#define ACPI_UART_8_DATA_BITS 3 -#define ACPI_UART_9_DATA_BITS 4 - -/* Values for StopBits field above */ - -#define ACPI_UART_NO_STOP_BITS 0 -#define ACPI_UART_1_STOP_BIT 1 -#define ACPI_UART_1P5_STOP_BITS 2 -#define ACPI_UART_2_STOP_BITS 3 - -/* Values for FlowControl field above */ - -#define ACPI_UART_FLOW_CONTROL_NONE 0 -#define ACPI_UART_FLOW_CONTROL_HW 1 -#define ACPI_UART_FLOW_CONTROL_XON_XOFF 2 - -/* Values for Parity field above */ - -#define ACPI_UART_PARITY_NONE 0 -#define ACPI_UART_PARITY_EVEN 1 -#define ACPI_UART_PARITY_ODD 2 -#define ACPI_UART_PARITY_MARK 3 -#define ACPI_UART_PARITY_SPACE 4 - -/* Values for LinesEnabled bitfield above */ - -#define ACPI_UART_CARRIER_DETECT (1<<2) -#define ACPI_UART_RING_INDICATOR (1<<3) -#define ACPI_UART_DATA_SET_READY (1<<4) -#define ACPI_UART_DATA_TERMINAL_READY (1<<5) -#define ACPI_UART_CLEAR_TO_SEND (1<<6) -#define ACPI_UART_REQUEST_TO_SEND (1<<7) - -typedef struct acpi_resource_csi2_serialbus -{ - ACPI_RESOURCE_SERIAL_COMMON - UINT8 LocalPortInstance; - UINT8 PhyType; - -} ACPI_RESOURCE_CSI2_SERIALBUS; - -typedef struct acpi_resource_pin_function -{ - UINT8 RevisionId; - UINT8 PinConfig; - UINT8 Shareable; /* For values, see Interrupt Attributes above */ - UINT16 FunctionNumber; - UINT16 PinTableLength; - UINT16 VendorLength; - ACPI_RESOURCE_SOURCE ResourceSource; - UINT16 *PinTable; - UINT8 *VendorData; - -} ACPI_RESOURCE_PIN_FUNCTION; - -typedef struct acpi_resource_pin_config -{ - UINT8 RevisionId; - UINT8 ProducerConsumer; /* For values, see Producer/Consumer above */ - UINT8 Shareable; /* For values, see Interrupt Attributes above */ - UINT8 PinConfigType; - UINT32 PinConfigValue; - UINT16 PinTableLength; - UINT16 VendorLength; - ACPI_RESOURCE_SOURCE ResourceSource; - UINT16 *PinTable; - UINT8 *VendorData; - -} ACPI_RESOURCE_PIN_CONFIG; - -typedef struct acpi_resource_clock_input -{ - UINT8 RevisionId; - UINT8 Mode; - UINT8 Scale; - UINT16 FrequencyDivisor; - UINT32 FrequencyNumerator; - ACPI_RESOURCE_SOURCE ResourceSource; -} ACPI_RESOURCE_CLOCK_INPUT; - -/* Values for PinConfigType field above */ - -#define ACPI_PIN_CONFIG_DEFAULT 0 -#define ACPI_PIN_CONFIG_BIAS_PULL_UP 1 -#define ACPI_PIN_CONFIG_BIAS_PULL_DOWN 2 -#define ACPI_PIN_CONFIG_BIAS_DEFAULT 3 -#define ACPI_PIN_CONFIG_BIAS_DISABLE 4 -#define ACPI_PIN_CONFIG_BIAS_HIGH_IMPEDANCE 5 -#define ACPI_PIN_CONFIG_BIAS_BUS_HOLD 6 -#define ACPI_PIN_CONFIG_DRIVE_OPEN_DRAIN 7 -#define ACPI_PIN_CONFIG_DRIVE_OPEN_SOURCE 8 -#define ACPI_PIN_CONFIG_DRIVE_PUSH_PULL 9 -#define ACPI_PIN_CONFIG_DRIVE_STRENGTH 10 -#define ACPI_PIN_CONFIG_SLEW_RATE 11 -#define ACPI_PIN_CONFIG_INPUT_DEBOUNCE 12 -#define ACPI_PIN_CONFIG_INPUT_SCHMITT_TRIGGER 13 - -typedef struct acpi_resource_pin_group -{ - UINT8 RevisionId; - UINT8 ProducerConsumer; /* For values, see Producer/Consumer above */ - UINT16 PinTableLength; - UINT16 VendorLength; - UINT16 *PinTable; - ACPI_RESOURCE_LABEL ResourceLabel; - UINT8 *VendorData; - -} ACPI_RESOURCE_PIN_GROUP; - -typedef struct acpi_resource_pin_group_function -{ - UINT8 RevisionId; - UINT8 ProducerConsumer; /* For values, see Producer/Consumer above */ - UINT8 Shareable; /* For values, see Interrupt Attributes above */ - UINT16 FunctionNumber; - UINT16 VendorLength; - ACPI_RESOURCE_SOURCE ResourceSource; - ACPI_RESOURCE_LABEL ResourceSourceLabel; - UINT8 *VendorData; - -} ACPI_RESOURCE_PIN_GROUP_FUNCTION; - -typedef struct acpi_resource_pin_group_config -{ - UINT8 RevisionId; - UINT8 ProducerConsumer; /* For values, see Producer/Consumer above */ - UINT8 Shareable; /* For values, see Interrupt Attributes above */ - UINT8 PinConfigType; /* For values, see PinConfigType above */ - UINT32 PinConfigValue; - UINT16 VendorLength; - ACPI_RESOURCE_SOURCE ResourceSource; - ACPI_RESOURCE_LABEL ResourceSourceLabel; - UINT8 *VendorData; - -} ACPI_RESOURCE_PIN_GROUP_CONFIG; - -/* ACPI_RESOURCE_TYPEs */ - -#define ACPI_RESOURCE_TYPE_IRQ 0 -#define ACPI_RESOURCE_TYPE_DMA 1 -#define ACPI_RESOURCE_TYPE_START_DEPENDENT 2 -#define ACPI_RESOURCE_TYPE_END_DEPENDENT 3 -#define ACPI_RESOURCE_TYPE_IO 4 -#define ACPI_RESOURCE_TYPE_FIXED_IO 5 -#define ACPI_RESOURCE_TYPE_VENDOR 6 -#define ACPI_RESOURCE_TYPE_END_TAG 7 -#define ACPI_RESOURCE_TYPE_MEMORY24 8 -#define ACPI_RESOURCE_TYPE_MEMORY32 9 -#define ACPI_RESOURCE_TYPE_FIXED_MEMORY32 10 -#define ACPI_RESOURCE_TYPE_ADDRESS16 11 -#define ACPI_RESOURCE_TYPE_ADDRESS32 12 -#define ACPI_RESOURCE_TYPE_ADDRESS64 13 -#define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14 /* ACPI 3.0 */ -#define ACPI_RESOURCE_TYPE_EXTENDED_IRQ 15 -#define ACPI_RESOURCE_TYPE_GENERIC_REGISTER 16 -#define ACPI_RESOURCE_TYPE_GPIO 17 /* ACPI 5.0 */ -#define ACPI_RESOURCE_TYPE_FIXED_DMA 18 /* ACPI 5.0 */ -#define ACPI_RESOURCE_TYPE_SERIAL_BUS 19 /* ACPI 5.0 */ -#define ACPI_RESOURCE_TYPE_PIN_FUNCTION 20 /* ACPI 6.2 */ -#define ACPI_RESOURCE_TYPE_PIN_CONFIG 21 /* ACPI 6.2 */ -#define ACPI_RESOURCE_TYPE_PIN_GROUP 22 /* ACPI 6.2 */ -#define ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION 23 /* ACPI 6.2 */ -#define ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG 24 /* ACPI 6.2 */ -#define ACPI_RESOURCE_TYPE_CLOCK_INPUT 25 /* ACPI 6.5 */ -#define ACPI_RESOURCE_TYPE_MAX 25 - -/* Master union for resource descriptors */ - -typedef union acpi_resource_data -{ - ACPI_RESOURCE_IRQ Irq; - ACPI_RESOURCE_DMA Dma; - ACPI_RESOURCE_START_DEPENDENT StartDpf; - ACPI_RESOURCE_IO Io; - ACPI_RESOURCE_FIXED_IO FixedIo; - ACPI_RESOURCE_FIXED_DMA FixedDma; - ACPI_RESOURCE_VENDOR Vendor; - ACPI_RESOURCE_VENDOR_TYPED VendorTyped; - ACPI_RESOURCE_END_TAG EndTag; - ACPI_RESOURCE_MEMORY24 Memory24; - ACPI_RESOURCE_MEMORY32 Memory32; - ACPI_RESOURCE_FIXED_MEMORY32 FixedMemory32; - ACPI_RESOURCE_ADDRESS16 Address16; - ACPI_RESOURCE_ADDRESS32 Address32; - ACPI_RESOURCE_ADDRESS64 Address64; - ACPI_RESOURCE_EXTENDED_ADDRESS64 ExtAddress64; - ACPI_RESOURCE_EXTENDED_IRQ ExtendedIrq; - ACPI_RESOURCE_GENERIC_REGISTER GenericReg; - ACPI_RESOURCE_GPIO Gpio; - ACPI_RESOURCE_I2C_SERIALBUS I2cSerialBus; - ACPI_RESOURCE_SPI_SERIALBUS SpiSerialBus; - ACPI_RESOURCE_UART_SERIALBUS UartSerialBus; - ACPI_RESOURCE_CSI2_SERIALBUS Csi2SerialBus; - ACPI_RESOURCE_COMMON_SERIALBUS CommonSerialBus; - ACPI_RESOURCE_PIN_FUNCTION PinFunction; - ACPI_RESOURCE_PIN_CONFIG PinConfig; - ACPI_RESOURCE_PIN_GROUP PinGroup; - ACPI_RESOURCE_PIN_GROUP_FUNCTION PinGroupFunction; - ACPI_RESOURCE_PIN_GROUP_CONFIG PinGroupConfig; - ACPI_RESOURCE_CLOCK_INPUT ClockInput; - - /* Common fields */ - - ACPI_RESOURCE_ADDRESS Address; /* Common 16/32/64 address fields */ - -} ACPI_RESOURCE_DATA; - - -/* Common resource header */ - -typedef struct acpi_resource -{ - UINT32 Type; - UINT32 Length; - ACPI_RESOURCE_DATA Data; - -} ACPI_RESOURCE; - -/* restore default alignment */ - -#pragma pack() - - -#define ACPI_RS_SIZE_NO_DATA 8 /* Id + Length fields */ -#define ACPI_RS_SIZE_MIN (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (12) -#define ACPI_RS_SIZE(Type) (UINT32) (ACPI_RS_SIZE_NO_DATA + sizeof (Type)) - -/* Macro for walking resource templates with multiple descriptors */ - -#define ACPI_NEXT_RESOURCE(Res) \ - ACPI_ADD_PTR (ACPI_RESOURCE, (Res), (Res)->Length) - - -typedef struct acpi_pci_routing_table -{ - UINT32 Length; - UINT32 Pin; - UINT64 Address; /* here for 64-bit alignment */ - UINT32 SourceIndex; - union { - char Pad[4]; /* pad to 64 bits so sizeof() works in all cases */ - ACPI_FLEX_ARRAY(char, Source); - }; -} ACPI_PCI_ROUTING_TABLE; - -#endif /* __ACRESTYP_H__ */ diff --git a/drivers/include/acpica/acstruct.h b/drivers/include/acpica/acstruct.h deleted file mode 100644 index b1c54f0..0000000 --- a/drivers/include/acpica/acstruct.h +++ /dev/null @@ -1,393 +0,0 @@ -/****************************************************************************** - * - * Name: acstruct.h - Internal structs - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef __ACSTRUCT_H__ -#define __ACSTRUCT_H__ - -/* acpisrc:StructDefs -- for acpisrc conversion */ - -/***************************************************************************** - * - * Tree walking typedefs and structs - * - ****************************************************************************/ - - -/* - * Walk state - current state of a parse tree walk. Used for both a leisurely - * stroll through the tree (for whatever reason), and for control method - * execution. - */ -#define ACPI_NEXT_OP_DOWNWARD 1 -#define ACPI_NEXT_OP_UPWARD 2 - -/* - * Groups of definitions for WalkType used for different implementations of - * walkers (never simultaneously) - flags for interpreter: - */ -#define ACPI_WALK_NON_METHOD 0 -#define ACPI_WALK_METHOD 0x01 -#define ACPI_WALK_METHOD_RESTART 0x02 - - -typedef struct acpi_walk_state -{ - struct acpi_walk_state *Next; /* Next WalkState in list */ - UINT8 DescriptorType; /* To differentiate various internal objs */ - UINT8 WalkType; - UINT16 Opcode; /* Current AML opcode */ - UINT8 NextOpInfo; /* Info about NextOp */ - UINT8 NumOperands; /* Stack pointer for Operands[] array */ - UINT8 OperandIndex; /* Index into operand stack, to be used by AcpiDsObjStackPush */ - ACPI_OWNER_ID OwnerId; /* Owner of objects created during the walk */ - BOOLEAN LastPredicate; /* Result of last predicate */ - UINT8 CurrentResult; - UINT8 ReturnUsed; - UINT8 ScopeDepth; - UINT8 PassNumber; /* Parse pass during table load */ - BOOLEAN NamespaceOverride; /* Override existing objects */ - UINT8 ResultSize; /* Total elements for the result stack */ - UINT8 ResultCount; /* Current number of occupied elements of result stack */ - UINT8 *Aml; - UINT32 ArgTypes; - UINT32 MethodBreakpoint; /* For single stepping */ - UINT32 UserBreakpoint; /* User AML breakpoint */ - UINT32 ParseFlags; - - ACPI_PARSE_STATE ParserState; /* Current state of parser */ - UINT32 PrevArgTypes; - UINT32 ArgCount; /* push for fixed or var args */ - UINT16 MethodNestingDepth; - UINT8 MethodIsNested; - - struct acpi_namespace_node Arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */ - struct acpi_namespace_node LocalVariables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */ - union acpi_operand_object *Operands[ACPI_OBJ_NUM_OPERANDS + 1]; /* Operands passed to the interpreter (+1 for NULL terminator) */ - union acpi_operand_object **Params; - - UINT8 *AmlLastWhile; - union acpi_operand_object **CallerReturnDesc; - ACPI_GENERIC_STATE *ControlState; /* List of control states (nested IFs) */ - struct acpi_namespace_node *DeferredNode; /* Used when executing deferred opcodes */ - union acpi_operand_object *ImplicitReturnObj; - struct acpi_namespace_node *MethodCallNode; /* Called method Node*/ - ACPI_PARSE_OBJECT *MethodCallOp; /* MethodCall Op if running a method */ - union acpi_operand_object *MethodDesc; /* Method descriptor if running a method */ - struct acpi_namespace_node *MethodNode; /* Method node if running a method */ - char *MethodPathname; /* Full pathname of running method */ - ACPI_PARSE_OBJECT *Op; /* Current parser op */ - const ACPI_OPCODE_INFO *OpInfo; /* Info on current opcode */ - ACPI_PARSE_OBJECT *Origin; /* Start of walk [Obsolete] */ - union acpi_operand_object *ResultObj; - ACPI_GENERIC_STATE *Results; /* Stack of accumulated results */ - union acpi_operand_object *ReturnDesc; /* Return object, if any */ - ACPI_GENERIC_STATE *ScopeInfo; /* Stack of nested scopes */ - ACPI_PARSE_OBJECT *PrevOp; /* Last op that was processed */ - ACPI_PARSE_OBJECT *NextOp; /* next op to be processed */ - ACPI_THREAD_STATE *Thread; - ACPI_PARSE_DOWNWARDS DescendingCallback; - ACPI_PARSE_UPWARDS AscendingCallback; - -} ACPI_WALK_STATE; - - -/* Info used by AcpiNsInitializeObjects and AcpiDsInitializeObjects */ - -typedef struct acpi_init_walk_info -{ - UINT32 TableIndex; - UINT32 ObjectCount; - UINT32 MethodCount; - UINT32 SerialMethodCount; - UINT32 NonSerialMethodCount; - UINT32 SerializedMethodCount; - UINT32 DeviceCount; - UINT32 OpRegionCount; - UINT32 FieldCount; - UINT32 BufferCount; - UINT32 PackageCount; - UINT32 OpRegionInit; - UINT32 FieldInit; - UINT32 BufferInit; - UINT32 PackageInit; - ACPI_OWNER_ID OwnerId; - -} ACPI_INIT_WALK_INFO; - - -typedef struct acpi_get_devices_info -{ - ACPI_WALK_CALLBACK UserFunction; - void *Context; - char *Hid; - -} ACPI_GET_DEVICES_INFO; - - -typedef union acpi_aml_operands -{ - ACPI_OPERAND_OBJECT *Operands[7]; - - struct - { - ACPI_OBJECT_INTEGER *Type; - ACPI_OBJECT_INTEGER *Code; - ACPI_OBJECT_INTEGER *Argument; - - } Fatal; - - struct - { - ACPI_OPERAND_OBJECT *Source; - ACPI_OBJECT_INTEGER *Index; - ACPI_OPERAND_OBJECT *Target; - - } Index; - - struct - { - ACPI_OPERAND_OBJECT *Source; - ACPI_OBJECT_INTEGER *Index; - ACPI_OBJECT_INTEGER *Length; - ACPI_OPERAND_OBJECT *Target; - - } Mid; - -} ACPI_AML_OPERANDS; - - -/* - * Structure used to pass object evaluation information and parameters. - * Purpose is to reduce CPU stack use. - */ -typedef struct acpi_evaluate_info -{ - /* The first 3 elements are passed by the caller to AcpiNsEvaluate */ - - ACPI_NAMESPACE_NODE *PrefixNode; /* Input: starting node */ - const char *RelativePathname; /* Input: path relative to PrefixNode */ - ACPI_OPERAND_OBJECT **Parameters; /* Input: argument list */ - - ACPI_NAMESPACE_NODE *Node; /* Resolved node (PrefixNode:RelativePathname) */ - ACPI_OPERAND_OBJECT *ObjDesc; /* Object attached to the resolved node */ - char *FullPathname; /* Full pathname of the resolved node */ - - const ACPI_PREDEFINED_INFO *Predefined; /* Used if Node is a predefined name */ - ACPI_OPERAND_OBJECT *ReturnObject; /* Object returned from the evaluation */ - union acpi_operand_object *ParentPackage; /* Used if return object is a Package */ - - UINT32 ReturnFlags; /* Used for return value analysis */ - UINT32 ReturnBtype; /* Bitmapped type of the returned object */ - UINT16 ParamCount; /* Count of the input argument list */ - UINT16 NodeFlags; /* Same as Node->Flags */ - UINT8 PassNumber; /* Parser pass number */ - UINT8 ReturnObjectType; /* Object type of the returned object */ - UINT8 Flags; /* General flags */ - -} ACPI_EVALUATE_INFO; - -/* Values for Flags above */ - -#define ACPI_IGNORE_RETURN_VALUE 1 - -/* Defines for ReturnFlags field above */ - -#define ACPI_OBJECT_REPAIRED 1 -#define ACPI_OBJECT_WRAPPED 2 - - -/* Info used by AcpiNsInitializeDevices */ - -typedef struct acpi_device_walk_info -{ - ACPI_TABLE_DESC *TableDesc; - ACPI_EVALUATE_INFO *EvaluateInfo; - UINT32 DeviceCount; - UINT32 Num_STA; - UINT32 Num_INI; - -} ACPI_DEVICE_WALK_INFO; - - -/* Info used by Acpi AcpiDbDisplayFields */ - -typedef struct acpi_region_walk_info -{ - UINT32 DebugLevel; - UINT32 Count; - ACPI_OWNER_ID OwnerId; - UINT8 DisplayType; - UINT32 AddressSpaceId; - -} ACPI_REGION_WALK_INFO; - - -/* TBD: [Restructure] Merge with struct above */ - -typedef struct acpi_walk_info -{ - UINT32 DebugLevel; - UINT32 Count; - ACPI_OWNER_ID OwnerId; - UINT8 DisplayType; - -} ACPI_WALK_INFO; - -/* Display Types */ - -#define ACPI_DISPLAY_SUMMARY (UINT8) 0 -#define ACPI_DISPLAY_OBJECTS (UINT8) 1 -#define ACPI_DISPLAY_MASK (UINT8) 1 - -#define ACPI_DISPLAY_SHORT (UINT8) 2 - - -#endif diff --git a/drivers/include/acpica/actables.h b/drivers/include/acpica/actables.h deleted file mode 100644 index 6f2cacb..0000000 --- a/drivers/include/acpica/actables.h +++ /dev/null @@ -1,383 +0,0 @@ -/****************************************************************************** - * - * Name: actables.h - ACPI table management - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef __ACTABLES_H__ -#define __ACTABLES_H__ - - -ACPI_STATUS -AcpiAllocateRootTable ( - UINT32 InitialTableCount); - -/* - * tbxfroot - Root pointer utilities - */ -UINT32 -AcpiTbGetRsdpLength ( - ACPI_TABLE_RSDP *Rsdp); - -ACPI_STATUS -AcpiTbValidateRsdp ( - ACPI_TABLE_RSDP *Rsdp); - -UINT8 * -AcpiTbScanMemoryForRsdp ( - UINT8 *StartAddress, - UINT32 Length); - - -/* - * tbdata - table data structure management - */ -ACPI_STATUS -AcpiTbGetNextTableDescriptor ( - UINT32 *TableIndex, - ACPI_TABLE_DESC **TableDesc); - -void -AcpiTbInitTableDescriptor ( - ACPI_TABLE_DESC *TableDesc, - ACPI_PHYSICAL_ADDRESS Address, - UINT8 Flags, - ACPI_TABLE_HEADER *Table); - -ACPI_STATUS -AcpiTbAcquireTempTable ( - ACPI_TABLE_DESC *TableDesc, - ACPI_PHYSICAL_ADDRESS Address, - UINT8 Flags, - ACPI_TABLE_HEADER *Table); - -void -AcpiTbReleaseTempTable ( - ACPI_TABLE_DESC *TableDesc); - -ACPI_STATUS -AcpiTbValidateTempTable ( - ACPI_TABLE_DESC *TableDesc); - -ACPI_STATUS -AcpiTbVerifyTempTable ( - ACPI_TABLE_DESC *TableDesc, - char *Signature, - UINT32 *TableIndex); - -BOOLEAN -AcpiTbIsTableLoaded ( - UINT32 TableIndex); - -void -AcpiTbSetTableLoadedFlag ( - UINT32 TableIndex, - BOOLEAN IsLoaded); - - -/* - * tbfadt - FADT parse/convert/validate - */ -void -AcpiTbParseFadt ( - void); - -void -AcpiTbCreateLocalFadt ( - ACPI_TABLE_HEADER *Table, - UINT32 Length); - - -/* - * tbfind - find ACPI table - */ -ACPI_STATUS -AcpiTbFindTable ( - char *Signature, - char *OemId, - char *OemTableId, - UINT32 *TableIndex); - - -/* - * tbinstal - Table removal and deletion - */ -ACPI_STATUS -AcpiTbResizeRootTableList ( - void); - -ACPI_STATUS -AcpiTbValidateTable ( - ACPI_TABLE_DESC *TableDesc); - -void -AcpiTbInvalidateTable ( - ACPI_TABLE_DESC *TableDesc); - -void -AcpiTbOverrideTable ( - ACPI_TABLE_DESC *OldTableDesc); - -ACPI_STATUS -AcpiTbAcquireTable ( - ACPI_TABLE_DESC *TableDesc, - ACPI_TABLE_HEADER **TablePtr, - UINT32 *TableLength, - UINT8 *TableFlags); - -void -AcpiTbReleaseTable ( - ACPI_TABLE_HEADER *Table, - UINT32 TableLength, - UINT8 TableFlags); - -ACPI_STATUS -AcpiTbInstallStandardTable ( - ACPI_PHYSICAL_ADDRESS Address, - UINT8 Flags, - ACPI_TABLE_HEADER *Table, - BOOLEAN Reload, - BOOLEAN Override, - UINT32 *TableIndex); - -void -AcpiTbUninstallTable ( - ACPI_TABLE_DESC *TableDesc); - -ACPI_STATUS -AcpiTbLoadTable ( - UINT32 TableIndex, - ACPI_NAMESPACE_NODE *ParentNode); - -ACPI_STATUS -AcpiTbInstallAndLoadTable ( - ACPI_PHYSICAL_ADDRESS Address, - UINT8 Flags, - ACPI_TABLE_HEADER *Table, - BOOLEAN Override, - UINT32 *TableIndex); - -ACPI_STATUS -AcpiTbUnloadTable ( - UINT32 TableIndex); - -void -AcpiTbNotifyTable ( - UINT32 Event, - void *Table); - -void -AcpiTbTerminate ( - void); - -ACPI_STATUS -AcpiTbDeleteNamespaceByOwner ( - UINT32 TableIndex); - -ACPI_STATUS -AcpiTbAllocateOwnerId ( - UINT32 TableIndex); - -ACPI_STATUS -AcpiTbReleaseOwnerId ( - UINT32 TableIndex); - -ACPI_STATUS -AcpiTbGetOwnerId ( - UINT32 TableIndex, - ACPI_OWNER_ID *OwnerId); - - -/* - * tbutils - table manager utilities - */ -ACPI_STATUS -AcpiTbInitializeFacs ( - void); - -void -AcpiTbPrintTableHeader( - ACPI_PHYSICAL_ADDRESS Address, - ACPI_TABLE_HEADER *Header); - -void -AcpiTbCheckDsdtHeader ( - void); - -ACPI_TABLE_HEADER * -AcpiTbCopyDsdt ( - UINT32 TableIndex); - -void -AcpiTbInstallTableWithOverride ( - ACPI_TABLE_DESC *NewTableDesc, - BOOLEAN Override, - UINT32 *TableIndex); - -ACPI_STATUS -AcpiTbParseRootTable ( - ACPI_PHYSICAL_ADDRESS RsdpAddress); - -ACPI_STATUS -AcpiTbGetTable ( - ACPI_TABLE_DESC *TableDesc, - ACPI_TABLE_HEADER **OutTable); - -void -AcpiTbPutTable ( - ACPI_TABLE_DESC *TableDesc); - - -/* - * tbxfload - */ -ACPI_STATUS -AcpiTbLoadNamespace ( - void); - -#endif /* __ACTABLES_H__ */ diff --git a/drivers/include/acpica/actbinfo.h b/drivers/include/acpica/actbinfo.h deleted file mode 100644 index 0d80f67..0000000 --- a/drivers/include/acpica/actbinfo.h +++ /dev/null @@ -1,570 +0,0 @@ -/****************************************************************************** - * - * Module Name: actbinfo - Table disassembly info for non-AML tables - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -/* - * Macros used to generate offsets to specific table fields - */ -#define ACPI_AGDI_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_AGDI,f) -#define ACPI_ASPT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_ASPT,f) -#define ACPI_FACS_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_FACS,f) -#define ACPI_GAS_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_GENERIC_ADDRESS,f) -#define ACPI_HDR_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_HEADER,f) -#define ACPI_RSDP_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_RSDP,f) -#define ACPI_BDAT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_BDAT,f) -#define ACPI_BERT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_BERT,f) -#define ACPI_BGRT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_BGRT,f) -#define ACPI_BOOT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_BOOT,f) -#define ACPI_CCEL_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_CCEL,f) -#define ACPI_CPEP_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_CPEP,f) -#define ACPI_DBG2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_DBG2,f) -#define ACPI_DBGP_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_DBGP,f) -#define ACPI_DMAR_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_DMAR,f) -#define ACPI_DRTM_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_DRTM,f) -#define ACPI_ECDT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_ECDT,f) -#define ACPI_EINJ_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_EINJ,f) -#define ACPI_ERDT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_ERDT,f) -#define ACPI_ERST_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_ERST,f) -#define ACPI_GTDT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_GTDT,f) -#define ACPI_HEST_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_HEST,f) -#define ACPI_HPET_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_HPET,f) -#define ACPI_HMAT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_HMAT,f) -#define ACPI_IORT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_IORT,f) -#define ACPI_IOVT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_IOVT,f) -#define ACPI_IVRS_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_IVRS,f) -#define ACPI_MADT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_MADT,f) -#define ACPI_MCFG_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_MCFG,f) -#define ACPI_MCHI_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_MCHI,f) -#define ACPI_MPST_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_MPST,f) -#define ACPI_MRRM_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_MRRM,f) -#define ACPI_MSCT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_MSCT,f) -#define ACPI_NFIT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_NFIT,f) -#define ACPI_PCCT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_PCCT,f) -#define ACPI_PDTT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_PDTT,f) -#define ACPI_PMTT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_PMTT,f) -#define ACPI_RASF_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_RASF,f) -#define ACPI_RAS2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_RAS2,f) -#define ACPI_RGRT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_RGRT,f) -#define ACPI_RHCT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_RHCT,f) -#define ACPI_RIMT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_RIMT,f) -#define ACPI_S3PT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_S3PT,f) -#define ACPI_SBST_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SBST,f) -#define ACPI_SDEI_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SDEI,f) -#define ACPI_SDEV_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SDEV,f) -#define ACPI_SLIT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SLIT,f) -#define ACPI_SPCR_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SPCR,f) -#define ACPI_SPMI_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SPMI,f) -#define ACPI_SRAT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SRAT,f) -#define ACPI_STAO_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_STAO,f) -#define ACPI_SVKL_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SVKL,f) -#define ACPI_TCPA_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_TCPA_HDR,f) -#define ACPI_TDEL_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_TDEL,f) -#define ACPI_TPM2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_TPM2,f) -#define ACPI_TPM23_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_TPM23,f) -#define ACPI_UEFI_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_UEFI,f) -#define ACPI_VIOT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_VIOT,f) -#define ACPI_WAET_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_WAET,f) -#define ACPI_WDAT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_WDAT,f) -#define ACPI_WDDT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_WDDT,f) -#define ACPI_WDRT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_WDRT,f) -#define ACPI_WPBT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_WPBT,f) -#define ACPI_WPBT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_WPBT_UNICODE,f) -#define ACPI_WSMT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_WSMT,f) -#define ACPI_XENV_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_XENV,f) - -/* Subtables */ - -#define ACPI_AESTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_AEST_HEADER,f) -#define ACPI_AEST0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_AEST_PROCESSOR,f) -#define ACPI_AEST0A_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_AEST_PROCESSOR_CACHE,f) -#define ACPI_AEST0B_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_AEST_PROCESSOR_TLB,f) -#define ACPI_AEST0C_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_AEST_PROCESSOR_GENERIC,f) -#define ACPI_AEST1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_AEST_MEMORY,f) -#define ACPI_AEST2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_AEST_SMMU,f) -#define ACPI_AEST3_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_AEST_VENDOR,f) -#define ACPI_AEST3A_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_AEST_VENDOR_V2,f) -#define ACPI_AEST4_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_AEST_GIC,f) -#define ACPI_AEST5_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_AEST_PCIE,f) -#define ACPI_AEST6_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_AEST_PROXY,f) -#define ACPI_AEST0D_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_AEST_NODE_INTERFACE,f) -#define ACPI_AEST0DH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_AEST_NODE_INTERFACE_HEADER,f) -#define ACPI_AEST0D4_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_AEST_NODE_INTERFACE_4K,f) -#define ACPI_AEST0D16_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_AEST_NODE_INTERFACE_16K,f) -#define ACPI_AEST0D64_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_AEST_NODE_INTERFACE_64K,f) -#define ACPI_AEST0E_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_AEST_NODE_INTERRUPT,f) -#define ACPI_AEST0EA_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_AEST_NODE_INTERRUPT_V2,f) -#define ACPI_APMTN_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_APMT_NODE,f) -#define ACPI_ASF0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ASF_INFO,f) -#define ACPI_ASF1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ASF_ALERT,f) -#define ACPI_ASF1a_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ASF_ALERT_DATA,f) -#define ACPI_ASF2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ASF_REMOTE,f) -#define ACPI_ASF2a_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ASF_CONTROL_DATA,f) -#define ACPI_ASF3_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ASF_RMCP,f) -#define ACPI_ASF4_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ASF_ADDRESS,f) -#define ACPI_ASPTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ASPT_HEADER,f) -#define ACPI_ASPT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ASPT_GLOBAL_REGS,f) -#define ACPI_ASPT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ASPT_SEV_MBOX_REGS,f) -#define ACPI_ASPT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ASPT_ACPI_MBOX_REGS,f) -#define ACPI_CDAT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_CDAT,f) -#define ACPI_CDATH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CDAT_HEADER,f) -#define ACPI_CDAT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CDAT_DSMAS,f) -#define ACPI_CDAT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CDAT_DSLBIS,f) -#define ACPI_CDAT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CDAT_DSMSCIS,f) -#define ACPI_CDAT3_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CDAT_DSIS,f) -#define ACPI_CDAT4_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CDAT_DSEMTS,f) -#define ACPI_CDAT5_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CDAT_SSLBIS,f) -#define ACPI_CDATE_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CDAT_SSLBE,f) -#define ACPI_CEDT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CEDT_HEADER, f) -#define ACPI_CEDT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CEDT_CHBS, f) -#define ACPI_CEDT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CEDT_CFMWS, f) -#define ACPI_CEDT1_TE_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CEDT_CFMWS_TARGET_ELEMENT, f) -#define ACPI_CEDT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CEDT_CXIMS, f) -#define ACPI_CEDT2_TE_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CEDT_CXIMS_TARGET_ELEMENT, f) -#define ACPI_CPEP0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CPEP_POLLING,f) -#define ACPI_CSRT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CSRT_GROUP,f) -#define ACPI_CSRT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CSRT_SHARED_INFO,f) -#define ACPI_CSRT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CSRT_DESCRIPTOR,f) -#define ACPI_DBG20_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DBG2_DEVICE,f) -#define ACPI_DMARS_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DMAR_DEVICE_SCOPE,f) -#define ACPI_DMAR0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DMAR_HARDWARE_UNIT,f) -#define ACPI_DMAR1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DMAR_RESERVED_MEMORY,f) -#define ACPI_DMAR2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DMAR_ATSR,f) -#define ACPI_DMAR3_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DMAR_RHSA,f) -#define ACPI_DMAR4_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DMAR_ANDD,f) -#define ACPI_DMAR5_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DMAR_SATC,f) -#define ACPI_DMAR6_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DMAR_SIDP,f) -#define ACPI_DRTM0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DRTM_VTABLE_LIST,f) -#define ACPI_DRTM1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DRTM_RESOURCE_LIST,f) -#define ACPI_DRTM1a_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DRTM_RESOURCE,f) -#define ACPI_DRTM2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DRTM_DPS_ID,f) -#define ACPI_EINJ0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_WHEA_HEADER,f) -#define ACPI_ERDT_HDR_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SUBTBL_HDR_16,f) -#define ACPI_ERDT_CACD_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ERDT_CACD,f) -#define ACPI_ERDT_CARC_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ERDT_CARC,f) -#define ACPI_ERDT_CARD_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ERDT_CARD,f) -#define ACPI_ERDT_CMRC_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ERDT_CMRC,f) -#define ACPI_ERDT_CMRD_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ERDT_CMRD,f) -#define ACPI_ERDT_DACD_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ERDT_DACD,f) -#define ACPI_ERDT_DACD_PATH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ERDT_DACD_PATHS,f) -#define ACPI_ERDT_IBAD_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ERDT_IBAD,f) -#define ACPI_ERDT_IBRD_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ERDT_IBRD,f) -#define ACPI_ERDT_MARC_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ERDT_MARC,f) -#define ACPI_ERDT_MMRC_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ERDT_MMRC,f) -#define ACPI_ERDT_RMDD_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ERDT_RMDD,f) -#define ACPI_ERST0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_WHEA_HEADER,f) -#define ACPI_FPDTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_FPDT_HEADER,f) -#define ACPI_FPDT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_FPDT_BOOT_POINTER,f) -#define ACPI_FPDT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_FPDT_S3PT_POINTER,f) -#define ACPI_GTDT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_GTDT_TIMER_BLOCK,f) -#define ACPI_GTDT0a_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_GTDT_TIMER_ENTRY,f) -#define ACPI_GTDT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_GTDT_WATCHDOG,f) -#define ACPI_GTDTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_GTDT_HEADER,f) -#define ACPI_GTDT_EL2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_GTDT_EL2,f) -#define ACPI_HEST0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_IA_MACHINE_CHECK,f) -#define ACPI_HEST1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_IA_CORRECTED,f) -#define ACPI_HEST2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_IA_NMI,f) -#define ACPI_HEST6_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_AER_ROOT,f) -#define ACPI_HEST7_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_AER,f) -#define ACPI_HEST8_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_AER_BRIDGE,f) -#define ACPI_HEST9_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_GENERIC,f) -#define ACPI_HEST10_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_GENERIC_V2,f) -#define ACPI_HEST11_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_IA_DEFERRED_CHECK,f) -#define ACPI_HESTN_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_NOTIFY,f) -#define ACPI_HESTB_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_IA_ERROR_BANK,f) -#define ACPI_HMAT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HMAT_PROXIMITY_DOMAIN,f) -#define ACPI_HMAT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HMAT_LOCALITY,f) -#define ACPI_HMAT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HMAT_CACHE,f) -#define ACPI_HMATH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HMAT_STRUCTURE,f) -#define ACPI_IORT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_ITS_GROUP,f) -#define ACPI_IORT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_NAMED_COMPONENT,f) -#define ACPI_IORT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_ROOT_COMPLEX,f) -#define ACPI_IORT3_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_SMMU,f) -#define ACPI_IORT3A_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_SMMU_GSI,f) -#define ACPI_IORT4_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_SMMU_V3,f) -#define ACPI_IORT5_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_PMCG,f) -#define ACPI_IORT6_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_RMR,f) -#define ACPI_IORT6A_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_RMR_DESC,f) -#define ACPI_IORT7_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_IWB,f) -#define ACPI_IORTA_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_MEMORY_ACCESS,f) -#define ACPI_IORTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_NODE,f) -#define ACPI_IORTM_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_ID_MAPPING,f) -#define ACPI_IOVTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IOVT_HEADER,f) -#define ACPI_IOVT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IOVT_IOMMU,f) -#define ACPI_IOVTDEV_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IOVT_DEVICE_ENTRY,f) -#define ACPI_IVRSH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IVRS_HEADER,f) -#define ACPI_IVRS0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IVRS_HARDWARE1,f) -#define ACPI_IVRS01_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IVRS_HARDWARE2,f) -#define ACPI_IVRS1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IVRS_MEMORY,f) -#define ACPI_IVRSD_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IVRS_DE_HEADER,f) -#define ACPI_IVRS8A_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IVRS_DEVICE8A,f) -#define ACPI_IVRS8B_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IVRS_DEVICE8B,f) -#define ACPI_IVRS8C_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IVRS_DEVICE8C,f) -#define ACPI_IVRSHID_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IVRS_DEVICE_HID,f) -#define ACPI_LPITH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_LPIT_HEADER,f) -#define ACPI_LPIT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_LPIT_NATIVE,f) -#define ACPI_MADT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_LOCAL_APIC,f) -#define ACPI_MADT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_IO_APIC,f) -#define ACPI_MADT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_INTERRUPT_OVERRIDE,f) -#define ACPI_MADT3_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_NMI_SOURCE,f) -#define ACPI_MADT4_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_LOCAL_APIC_NMI,f) -#define ACPI_MADT5_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_LOCAL_APIC_OVERRIDE,f) -#define ACPI_MADT6_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_IO_SAPIC,f) -#define ACPI_MADT7_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_LOCAL_SAPIC,f) -#define ACPI_MADT8_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_INTERRUPT_SOURCE,f) -#define ACPI_MADT9_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_LOCAL_X2APIC,f) -#define ACPI_MADT10_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_LOCAL_X2APIC_NMI,f) -#define ACPI_MADT11_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_GENERIC_INTERRUPT,f) -#define ACPI_MADT12_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_GENERIC_DISTRIBUTOR,f) -#define ACPI_MADT13_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_GENERIC_MSI_FRAME,f) -#define ACPI_MADT14_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_GENERIC_REDISTRIBUTOR,f) -#define ACPI_MADT15_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_GENERIC_TRANSLATOR,f) -#define ACPI_MADT16_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_MULTIPROC_WAKEUP,f) -#define ACPI_MADT17_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_CORE_PIC,f) -#define ACPI_MADT18_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_LIO_PIC,f) -#define ACPI_MADT19_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_HT_PIC,f) -#define ACPI_MADT20_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_EIO_PIC,f) -#define ACPI_MADT21_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_MSI_PIC,f) -#define ACPI_MADT22_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_BIO_PIC,f) -#define ACPI_MADT23_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_LPC_PIC,f) -#define ACPI_MADT24_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_RINTC,f) -#define ACPI_MADT25_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_IMSIC,f) -#define ACPI_MADT26_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_APLIC,f) -#define ACPI_MADT27_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_PLIC,f) -#define ACPI_MADT28_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_GICV5_IRS,f) -#define ACPI_MADT29_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_GICv5_ITS,f) -#define ACPI_MADT30_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_GICv5_ITS_TRANSLATE,f) -#define ACPI_MADT128_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_OEM_DATA,f) -#define ACPI_MADTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SUBTABLE_HEADER,f) -#define ACPI_MCFG0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MCFG_ALLOCATION,f) -#define ACPI_MPAM0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MPAM_MSC_NODE,f) -#define ACPI_MPAM1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MPAM_RESOURCE_NODE,f) -#define ACPI_MPAM1A_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MPAM_RESOURCE_CACHE_LOCATOR,f) -#define ACPI_MPAM1B_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MPAM_RESOURCE_MEMORY_LOCATOR,f) -#define ACPI_MPAM1C_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MPAM_RESOURCE_SMMU_INTERFACE,f) -#define ACPI_MPAM1D_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MPAM_RESOURCE_MEMCACHE_INTERFACE,f) -#define ACPI_MPAM1E_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MPAM_RESOURCE_ACPI_INTERFACE,f) -#define ACPI_MPAM1F_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MPAM_RESOURCE_INTERCONNECT_INTERFACE,f) -#define ACPI_MPAM1G_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MPAM_RESOURCE_GENERIC_LOCATOR,f) -#define ACPI_MPAM2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MPAM_FUNC_DEPS,f) -#define ACPI_MPST0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MPST_POWER_NODE,f) -#define ACPI_MPST0A_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MPST_POWER_STATE,f) -#define ACPI_MPST0B_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MPST_COMPONENT,f) -#define ACPI_MPST1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MPST_DATA_HDR,f) -#define ACPI_MPST2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MPST_POWER_DATA,f) -#define ACPI_MRRM0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MRRM_MEM_RANGE_ENTRY,f) -#define ACPI_MSCT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MSCT_PROXIMITY,f) -#define ACPI_NFITH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NFIT_HEADER,f) -#define ACPI_NFIT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NFIT_SYSTEM_ADDRESS,f) -#define ACPI_NFIT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NFIT_MEMORY_MAP,f) -#define ACPI_NFIT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NFIT_INTERLEAVE,f) -#define ACPI_NFIT3_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NFIT_SMBIOS,f) -#define ACPI_NFIT4_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NFIT_CONTROL_REGION,f) -#define ACPI_NFIT5_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NFIT_DATA_REGION,f) -#define ACPI_NFIT6_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NFIT_FLUSH_ADDRESS,f) -#define ACPI_NFIT7_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NFIT_CAPABILITIES,f) -#define ACPI_PCCT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PCCT_SUBSPACE,f) -#define ACPI_PCCT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PCCT_HW_REDUCED,f) -#define ACPI_PCCT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PCCT_HW_REDUCED_TYPE2,f) -#define ACPI_PCCT3_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PCCT_EXT_PCC_MASTER,f) -#define ACPI_PCCT4_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PCCT_EXT_PCC_SLAVE,f) -#define ACPI_PCCT5_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PCCT_HW_REG,f) -#define ACPI_PDTT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PDTT_CHANNEL,f) -#define ACPI_PHATH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PHAT_HEADER,f) -#define ACPI_PHAT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PHAT_VERSION_DATA,f) -#define ACPI_PHAT0A_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PHAT_VERSION_ELEMENT,f) -#define ACPI_PHAT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PHAT_HEALTH_DATA,f) -#define ACPI_PMTT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PMTT_SOCKET,f) -#define ACPI_PMTT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PMTT_CONTROLLER,f) -#define ACPI_PMTT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PMTT_PHYSICAL_COMPONENT,f) -#define ACPI_PMTT_VENDOR_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PMTT_VENDOR_SPECIFIC,f) -#define ACPI_PMTTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PMTT_HEADER,f) -#define ACPI_PPTTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SUBTABLE_HEADER,f) -#define ACPI_PPTT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PPTT_PROCESSOR,f) -#define ACPI_PPTT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PPTT_CACHE,f) -#define ACPI_PPTT1A_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PPTT_CACHE_V1,f) -#define ACPI_PPTT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PPTT_ID,f) -#define ACPI_PRMTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_PRMT_HEADER,f) -#define ACPI_PRMT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PRMT_MODULE_INFO,f) -#define ACPI_PRMT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PRMT_HANDLER_INFO,f) -#define ACPI_RAS2_PCC_DESC_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_RAS2_PCC_DESC,f) -#define ACPI_RHCTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_RHCT_NODE_HEADER,f) -#define ACPI_RHCT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_RHCT_ISA_STRING,f) -#define ACPI_RHCT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_RHCT_CMO_NODE,f) -#define ACPI_RHCT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_RHCT_MMU_NODE,f) -#define ACPI_RHCTFFFF_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_RHCT_HART_INFO,f) -#define ACPI_RIMTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_RIMT_NODE,f) -#define ACPI_RIMTI_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_RIMT_IOMMU,f) -#define ACPI_RIMTW_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_RIMT_IOMMU_WIRE_GSI,f) -#define ACPI_RIMTP_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_RIMT_PCIE_RC,f) -#define ACPI_RIMTM_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_RIMT_ID_MAPPING,f) -#define ACPI_RIMTN_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_RIMT_PLATFORM_DEVICE,f) -#define ACPI_S3PTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_FPDT_HEADER,f) -#define ACPI_S3PT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_S3PT_RESUME,f) -#define ACPI_S3PT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_S3PT_SUSPEND,f) -#define ACPI_SDEVH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SDEV_HEADER,f) -#define ACPI_SDEV0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SDEV_NAMESPACE,f) -#define ACPI_SDEV0B_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SDEV_SECURE_COMPONENT,f) -#define ACPI_SDEVCH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SDEV_HEADER,f) -#define ACPI_SDEVC0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SDEV_ID_COMPONENT, f) -#define ACPI_SDEVC1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SDEV_MEM_COMPONENT, f) -#define ACPI_SDEV1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SDEV_PCIE,f) -#define ACPI_SDEV1A_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SDEV_PCIE_PATH,f) -#define ACPI_SLIC_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SLIC,f) -#define ACPI_SRATH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SUBTABLE_HEADER,f) -#define ACPI_SRAT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SRAT_CPU_AFFINITY,f) -#define ACPI_SRAT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SRAT_MEM_AFFINITY,f) -#define ACPI_SRAT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SRAT_X2APIC_CPU_AFFINITY,f) -#define ACPI_SRAT3_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SRAT_GICC_AFFINITY,f) -#define ACPI_SRAT4_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SRAT_GIC_ITS_AFFINITY,f) -#define ACPI_SRAT5_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SRAT_GENERIC_AFFINITY,f) -#define ACPI_SRAT7_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SRAT_RINTC_AFFINITY,f) -#define ACPI_SVKL0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SVKL_KEY,f) -#define ACPI_SWFT_FILE_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SWFT_FILE,f) -#define ACPI_TCPA_CLIENT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_TCPA_CLIENT,f) -#define ACPI_TCPA_SERVER_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_TCPA_SERVER,f) -#define ACPI_TPM2A_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TPM2_TRAILER,f) -#define ACPI_TPM211_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TPM2_ARM_SMC,f) -#define ACPI_TPM23A_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TPM23_TRAILER,f) -#define ACPI_VIOTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_VIOT_HEADER,f) -#define ACPI_VIOT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_VIOT_PCI_RANGE,f) -#define ACPI_VIOT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_VIOT_MMIO,f) -#define ACPI_VIOT3_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_VIOT_VIRTIO_IOMMU_PCI,f) -#define ACPI_VIOT4_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_VIOT_VIRTIO_IOMMU_MMIO,f) -#define ACPI_WDAT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_WDAT_ENTRY,f) - -/* - * Simplify access to flag fields by breaking them up into bytes - */ -#define ACPI_FLAG_OFFSET(d,f,o) (UINT16) (ACPI_OFFSET (d,f) + o) - -/* Flags */ - -#define ACPI_AEST0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_AEST_PROCESSOR,f,o) -#define ACPI_AEST0D_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_AEST_NODE_INTERFACE,f,o) -#define ACPI_AEST0E_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_AEST_NODE_INTERRUPT,f,o) -#define ACPI_AEST0EA_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_AEST_NODE_INTERRUPT_V2,f,o) -#define ACPI_AGDI_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_AGDI,f,o) -#define ACPI_APMTN_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_APMT_NODE,f,o) -#define ACPI_BGRT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_BGRT,f,o) -#define ACPI_DMAR0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_DMAR_HARDWARE_UNIT,f,o) -#define ACPI_DRTM_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_DRTM,f,o) -#define ACPI_DRTM1a_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_DRTM_RESOURCE,f,o) -#define ACPI_ERDT_RMDD_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_ERDT_RMDD,f,o) -#define ACPI_FADT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_FADT,f,o) -#define ACPI_FACS_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_FACS,f,o) -#define ACPI_HPET_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_HPET,f,o) -#define ACPI_PPTT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_PPTT_PROCESSOR,f,o) -#define ACPI_PPTT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_PPTT_CACHE,f,o) -#define ACPI_PPTT1A_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_PPTT_CACHE_V1,f,o) -#define ACPI_SRAT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_SRAT_CPU_AFFINITY,f,o) -#define ACPI_SRAT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_SRAT_MEM_AFFINITY,f,o) -#define ACPI_SRAT2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_SRAT_X2APIC_CPU_AFFINITY,f,o) -#define ACPI_SRAT3_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_SRAT_GICC_AFFINITY,f,o) -#define ACPI_SRAT5_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_SRAT_GENERIC_AFFINITY,f,o) -#define ACPI_SRAT7_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_SRAT_RINTC_AFFINITY,f,o) -#define ACPI_GTDT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_GTDT,f,o) -#define ACPI_GTDT0a_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_GTDT_TIMER_ENTRY,f,o) -#define ACPI_GTDT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_GTDT_WATCHDOG,f,o) -#define ACPI_HMAT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_HMAT_PROXIMITY_DOMAIN,f,o) -#define ACPI_HMAT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_HMAT_LOCALITY,f,o) -#define ACPI_HMAT2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_HMAT_CACHE,f,o) -#define ACPI_IORT3_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_IORT_SMMU,f,o) -#define ACPI_IORT3a_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_IORT_SMMU_GSI,f,o) -#define ACPI_IORT4_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_IORT_SMMU_V3,f,o) -#define ACPI_IORT6_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_IORT_RMR,f,o) -#define ACPI_IORTA_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_IORT_MEMORY_ACCESS,f,o) -#define ACPI_IORTM_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_IORT_ID_MAPPING,f,o) -#define ACPI_IOVT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_IOVT_IOMMU,f,o) -#define ACPI_IVRS_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_IVRS_HEADER,f,o) -#define ACPI_IVRSDE_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_IVRS_DE_HEADER,f,o) -#define ACPI_LPITH_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_LPIT_HEADER,f,o) -#define ACPI_MADT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_MADT,f,o) -#define ACPI_MADT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_APIC,f,o) -#define ACPI_MADT2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_INTERRUPT_OVERRIDE,f,o) -#define ACPI_MADT3_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_NMI_SOURCE,f,o) -#define ACPI_MADT4_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_APIC_NMI,f,o) -#define ACPI_MADT7_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_SAPIC,f,o) -#define ACPI_MADT8_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_INTERRUPT_SOURCE,f,o) -#define ACPI_MADT9_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_X2APIC,f,o) -#define ACPI_MADT10_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_X2APIC_NMI,f,o) -#define ACPI_MADT11_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_GENERIC_INTERRUPT,f,o) -#define ACPI_MADT13_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_GENERIC_MSI_FRAME,f,o) -#define ACPI_MADT14_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_GENERIC_REDISTRIBUTOR,f,o) -#define ACPI_MADT15_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_GENERIC_TRANSLATOR,f,o) -#define ACPI_MADT28_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_GICV5_IRS,f,o) -#define ACPI_MADT29_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_GICv5_ITS,f,o) -#define ACPI_MPST0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MPST_POWER_NODE,f,o) -#define ACPI_MPST2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MPST_POWER_DATA,f,o) -#define ACPI_NFIT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_NFIT_SYSTEM_ADDRESS,f,o) -#define ACPI_NFIT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_NFIT_MEMORY_MAP,f,o) -#define ACPI_NFIT4_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_NFIT_CONTROL_REGION,f,o) -#define ACPI_NFIT7_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_NFIT_CAPABILITIES,f,o) -#define ACPI_PCCT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_PCCT,f,o) -#define ACPI_PCCT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_PCCT_HW_REDUCED,f,o) -#define ACPI_PCCT2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_PCCT_HW_REDUCED_TYPE2,f,o) -#define ACPI_PCCT3_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_PCCT_EXT_PCC_MASTER,f,o) -#define ACPI_PCCT4_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_PCCT_EXT_PCC_SLAVE,f,o) -#define ACPI_PDTT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_PDTT_CHANNEL,f,o) -#define ACPI_PMTTH_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_PMTT_HEADER,f,o) -#define ACPI_SDEVH_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_SDEV_HEADER,f,o) -#define ACPI_WDDT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_WDDT,f,o) -#define ACPI_WSMT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_WSMT,f,o) -#define ACPI_EINJ0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_WHEA_HEADER,f,o) -#define ACPI_ERST0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_WHEA_HEADER,f,o) -#define ACPI_HEST0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_HEST_IA_MACHINE_CHECK,f,o) -#define ACPI_HEST1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_HEST_IA_CORRECTED,f,o) -#define ACPI_HEST6_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_HEST_AER_ROOT,f,o) -#define ACPI_HEST11_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_HEST_IA_DEFERRED_CHECK,f,o) - -/* - * Required terminator for all tables below - */ -#define ACPI_DMT_TERMINATOR {ACPI_DMT_EXIT, 0, NULL, 0} -#define ACPI_DMT_NEW_LINE {ACPI_DMT_EXTRA_TEXT, 0, "\n", 0} diff --git a/drivers/include/acpica/actbl.h b/drivers/include/acpica/actbl.h deleted file mode 100644 index e3bfafd..0000000 --- a/drivers/include/acpica/actbl.h +++ /dev/null @@ -1,579 +0,0 @@ -/****************************************************************************** - * - * Name: actbl.h - Basic ACPI Table Definitions - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef __ACTBL_H__ -#define __ACTBL_H__ - - -/******************************************************************************* - * - * Fundamental ACPI tables - * - * This file contains definitions for the ACPI tables that are directly consumed - * by ACPICA. All other tables are consumed by the OS-dependent ACPI-related - * device drivers and other OS support code. - * - * The RSDP and FACS do not use the common ACPI table header. All other ACPI - * tables use the header. - * - ******************************************************************************/ - - -/* - * Values for description table header signatures for tables defined in this - * file. Useful because they make it more difficult to inadvertently type in - * the wrong signature. - */ -#define ACPI_SIG_DSDT "DSDT" /* Differentiated System Description Table */ -#define ACPI_SIG_FADT "FACP" /* Fixed ACPI Description Table */ -#define ACPI_SIG_FACS "FACS" /* Firmware ACPI Control Structure */ -#define ACPI_SIG_OSDT "OSDT" /* Override System Description Table */ -#define ACPI_SIG_PSDT "PSDT" /* Persistent System Description Table */ -#define ACPI_SIG_RSDP "RSD PTR " /* Root System Description Pointer */ -#define ACPI_SIG_RSDT "RSDT" /* Root System Description Table */ -#define ACPI_SIG_XSDT "XSDT" /* Extended System Description Table */ -#define ACPI_SIG_SSDT "SSDT" /* Secondary System Description Table */ -#define ACPI_RSDP_NAME "RSDP" /* Short name for RSDP, not signature */ -#define ACPI_OEM_NAME "OEM" /* Short name for OEM, not signature */ - - -/* - * All tables and structures must be byte-packed to match the ACPI - * specification, since the tables are provided by the system BIOS - */ -#pragma pack(1) - -/* - * Note: C bitfields are not used for this reason: - * - * "Bitfields are great and easy to read, but unfortunately the C language - * does not specify the layout of bitfields in memory, which means they are - * essentially useless for dealing with packed data in on-disk formats or - * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me, - * this decision was a design error in C. Ritchie could have picked an order - * and stuck with it." Norman Ramsey. - * See http://stackoverflow.com/a/1053662/41661 - */ - - -/******************************************************************************* - * - * Master ACPI Table Header. This common header is used by all ACPI tables - * except the RSDP and FACS. - * - ******************************************************************************/ - -typedef struct acpi_table_header -{ - char Signature[ACPI_NAMESEG_SIZE] ACPI_NONSTRING; /* ASCII table signature */ - UINT32 Length; /* Length of table in bytes, including this header */ - UINT8 Revision; /* ACPI Specification minor version number */ - UINT8 Checksum; /* To make sum of entire table == 0 */ - char OemId[ACPI_OEM_ID_SIZE] ACPI_NONSTRING; /* ASCII OEM identification */ - char OemTableId[ACPI_OEM_TABLE_ID_SIZE] ACPI_NONSTRING; /* ASCII OEM table identification */ - UINT32 OemRevision; /* OEM revision number */ - char AslCompilerId[ACPI_NAMESEG_SIZE] ACPI_NONSTRING; /* ASCII ASL compiler vendor ID */ - UINT32 AslCompilerRevision; /* ASL compiler version */ - -} ACPI_TABLE_HEADER; - - -/******************************************************************************* - * - * GAS - Generic Address Structure (ACPI 2.0+) - * - * Note: Since this structure is used in the ACPI tables, it is byte aligned. - * If misaligned access is not supported by the hardware, accesses to the - * 64-bit Address field must be performed with care. - * - ******************************************************************************/ - -typedef struct acpi_generic_address -{ - UINT8 SpaceId; /* Address space where struct or register exists */ - UINT8 BitWidth; /* Size in bits of given register */ - UINT8 BitOffset; /* Bit offset within the register */ - UINT8 AccessWidth; /* Minimum Access size (ACPI 3.0) */ - UINT64 Address; /* 64-bit address of struct or register */ - -} ACPI_GENERIC_ADDRESS; - - -/******************************************************************************* - * - * RSDP - Root System Description Pointer (Signature is "RSD PTR ") - * Version 2 - * - ******************************************************************************/ - -typedef struct acpi_table_rsdp -{ - char Signature[8]; /* ACPI signature, contains "RSD PTR " */ - UINT8 Checksum; /* ACPI 1.0 checksum */ - char OemId[ACPI_OEM_ID_SIZE]; /* OEM identification */ - UINT8 Revision; /* Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ */ - UINT32 RsdtPhysicalAddress; /* 32-bit physical address of the RSDT */ - UINT32 Length; /* Table length in bytes, including header (ACPI 2.0+) */ - UINT64 XsdtPhysicalAddress; /* 64-bit physical address of the XSDT (ACPI 2.0+) */ - UINT8 ExtendedChecksum; /* Checksum of entire table (ACPI 2.0+) */ - UINT8 Reserved[3]; /* Reserved, must be zero */ - -} ACPI_TABLE_RSDP; - -/* Standalone struct for the ACPI 1.0 RSDP */ - -typedef struct acpi_rsdp_common -{ - char Signature[8]; - UINT8 Checksum; - char OemId[ACPI_OEM_ID_SIZE]; - UINT8 Revision; - UINT32 RsdtPhysicalAddress; - -} ACPI_RSDP_COMMON; - -/* Standalone struct for the extended part of the RSDP (ACPI 2.0+) */ - -typedef struct acpi_rsdp_extension -{ - UINT32 Length; - UINT64 XsdtPhysicalAddress; - UINT8 ExtendedChecksum; - UINT8 Reserved[3]; - -} ACPI_RSDP_EXTENSION; - - -/******************************************************************************* - * - * RSDT/XSDT - Root System Description Tables - * Version 1 (both) - * - ******************************************************************************/ - -typedef struct acpi_table_rsdt -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT32 TableOffsetEntry[1]; /* Array of pointers to ACPI tables */ - -} ACPI_TABLE_RSDT; - -typedef struct acpi_table_xsdt -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT64 TableOffsetEntry[1]; /* Array of pointers to ACPI tables */ - -} ACPI_TABLE_XSDT; - -#define ACPI_RSDT_ENTRY_SIZE (sizeof (UINT32)) -#define ACPI_XSDT_ENTRY_SIZE (sizeof (UINT64)) - - -/******************************************************************************* - * - * FACS - Firmware ACPI Control Structure (FACS) - * - ******************************************************************************/ - -typedef struct acpi_table_facs -{ - char Signature[4]; /* ASCII table signature */ - UINT32 Length; /* Length of structure, in bytes */ - UINT32 HardwareSignature; /* Hardware configuration signature */ - UINT32 FirmwareWakingVector; /* 32-bit physical address of the Firmware Waking Vector */ - UINT32 GlobalLock; /* Global Lock for shared hardware resources */ - UINT32 Flags; - UINT64 XFirmwareWakingVector; /* 64-bit version of the Firmware Waking Vector (ACPI 2.0+) */ - UINT8 Version; /* Version of this table (ACPI 2.0+) */ - UINT8 Reserved[3]; /* Reserved, must be zero */ - UINT32 OspmFlags; /* Flags to be set by OSPM (ACPI 4.0) */ - UINT8 Reserved1[24]; /* Reserved, must be zero */ - -} ACPI_TABLE_FACS; - -/* Masks for GlobalLock flag field above */ - -#define ACPI_GLOCK_PENDING (1) /* 00: Pending global lock ownership */ -#define ACPI_GLOCK_OWNED (1<<1) /* 01: Global lock is owned */ - -/* Masks for Flags field above */ - -#define ACPI_FACS_S4_BIOS_PRESENT (1) /* 00: S4BIOS support is present */ -#define ACPI_FACS_64BIT_WAKE (1<<1) /* 01: 64-bit wake vector supported (ACPI 4.0) */ - -/* Masks for OspmFlags field above */ - -#define ACPI_FACS_64BIT_ENVIRONMENT (1) /* 00: 64-bit wake environment is required (ACPI 4.0) */ - - -/******************************************************************************* - * - * FADT - Fixed ACPI Description Table (Signature "FACP") - * Version 6 - * - ******************************************************************************/ - -/* Fields common to all versions of the FADT */ - -typedef struct acpi_table_fadt -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT32 Facs; /* 32-bit physical address of FACS */ - UINT32 Dsdt; /* 32-bit physical address of DSDT */ - UINT8 Model; /* System Interrupt Model (ACPI 1.0) - not used in ACPI 2.0+ */ - UINT8 PreferredProfile; /* Conveys preferred power management profile to OSPM. */ - UINT16 SciInterrupt; /* System vector of SCI interrupt */ - UINT32 SmiCommand; /* 32-bit Port address of SMI command port */ - UINT8 AcpiEnable; /* Value to write to SMI_CMD to enable ACPI */ - UINT8 AcpiDisable; /* Value to write to SMI_CMD to disable ACPI */ - UINT8 S4BiosRequest; /* Value to write to SMI_CMD to enter S4BIOS state */ - UINT8 PstateControl; /* Processor performance state control*/ - UINT32 Pm1aEventBlock; /* 32-bit port address of Power Mgt 1a Event Reg Blk */ - UINT32 Pm1bEventBlock; /* 32-bit port address of Power Mgt 1b Event Reg Blk */ - UINT32 Pm1aControlBlock; /* 32-bit port address of Power Mgt 1a Control Reg Blk */ - UINT32 Pm1bControlBlock; /* 32-bit port address of Power Mgt 1b Control Reg Blk */ - UINT32 Pm2ControlBlock; /* 32-bit port address of Power Mgt 2 Control Reg Blk */ - UINT32 PmTimerBlock; /* 32-bit port address of Power Mgt Timer Ctrl Reg Blk */ - UINT32 Gpe0Block; /* 32-bit port address of General Purpose Event 0 Reg Blk */ - UINT32 Gpe1Block; /* 32-bit port address of General Purpose Event 1 Reg Blk */ - UINT8 Pm1EventLength; /* Byte Length of ports at Pm1xEventBlock */ - UINT8 Pm1ControlLength; /* Byte Length of ports at Pm1xControlBlock */ - UINT8 Pm2ControlLength; /* Byte Length of ports at Pm2ControlBlock */ - UINT8 PmTimerLength; /* Byte Length of ports at PmTimerBlock */ - UINT8 Gpe0BlockLength; /* Byte Length of ports at Gpe0Block */ - UINT8 Gpe1BlockLength; /* Byte Length of ports at Gpe1Block */ - UINT8 Gpe1Base; /* Offset in GPE number space where GPE1 events start */ - UINT8 CstControl; /* Support for the _CST object and C-States change notification */ - UINT16 C2Latency; /* Worst case HW latency to enter/exit C2 state */ - UINT16 C3Latency; /* Worst case HW latency to enter/exit C3 state */ - UINT16 FlushSize; /* Processor memory cache line width, in bytes */ - UINT16 FlushStride; /* Number of flush strides that need to be read */ - UINT8 DutyOffset; /* Processor duty cycle index in processor P_CNT reg */ - UINT8 DutyWidth; /* Processor duty cycle value bit width in P_CNT register */ - UINT8 DayAlarm; /* Index to day-of-month alarm in RTC CMOS RAM */ - UINT8 MonthAlarm; /* Index to month-of-year alarm in RTC CMOS RAM */ - UINT8 Century; /* Index to century in RTC CMOS RAM */ - UINT16 BootFlags; /* IA-PC Boot Architecture Flags (see below for individual flags) */ - UINT8 Reserved; /* Reserved, must be zero */ - UINT32 Flags; /* Miscellaneous flag bits (see below for individual flags) */ - ACPI_GENERIC_ADDRESS ResetRegister; /* 64-bit address of the Reset register */ - UINT8 ResetValue; /* Value to write to the ResetRegister port to reset the system */ - UINT16 ArmBootFlags; /* ARM-Specific Boot Flags (see below for individual flags) (ACPI 5.1) */ - UINT8 MinorRevision; /* FADT Minor Revision (ACPI 5.1) */ - UINT64 XFacs; /* 64-bit physical address of FACS */ - UINT64 XDsdt; /* 64-bit physical address of DSDT */ - ACPI_GENERIC_ADDRESS XPm1aEventBlock; /* 64-bit Extended Power Mgt 1a Event Reg Blk address */ - ACPI_GENERIC_ADDRESS XPm1bEventBlock; /* 64-bit Extended Power Mgt 1b Event Reg Blk address */ - ACPI_GENERIC_ADDRESS XPm1aControlBlock; /* 64-bit Extended Power Mgt 1a Control Reg Blk address */ - ACPI_GENERIC_ADDRESS XPm1bControlBlock; /* 64-bit Extended Power Mgt 1b Control Reg Blk address */ - ACPI_GENERIC_ADDRESS XPm2ControlBlock; /* 64-bit Extended Power Mgt 2 Control Reg Blk address */ - ACPI_GENERIC_ADDRESS XPmTimerBlock; /* 64-bit Extended Power Mgt Timer Ctrl Reg Blk address */ - ACPI_GENERIC_ADDRESS XGpe0Block; /* 64-bit Extended General Purpose Event 0 Reg Blk address */ - ACPI_GENERIC_ADDRESS XGpe1Block; /* 64-bit Extended General Purpose Event 1 Reg Blk address */ - ACPI_GENERIC_ADDRESS SleepControl; /* 64-bit Sleep Control register (ACPI 5.0) */ - ACPI_GENERIC_ADDRESS SleepStatus; /* 64-bit Sleep Status register (ACPI 5.0) */ - UINT64 HypervisorId; /* Hypervisor Vendor ID (ACPI 6.0) */ - -} ACPI_TABLE_FADT; - - -/* Masks for FADT IA-PC Boot Architecture Flags (boot_flags) [Vx]=Introduced in this FADT revision */ - -#define ACPI_FADT_LEGACY_DEVICES (1) /* 00: [V2] System has LPC or ISA bus devices */ -#define ACPI_FADT_8042 (1<<1) /* 01: [V3] System has an 8042 controller on port 60/64 */ -#define ACPI_FADT_NO_VGA (1<<2) /* 02: [V4] It is not safe to probe for VGA hardware */ -#define ACPI_FADT_NO_MSI (1<<3) /* 03: [V4] Message Signaled Interrupts (MSI) must not be enabled */ -#define ACPI_FADT_NO_ASPM (1<<4) /* 04: [V4] PCIe ASPM control must not be enabled */ -#define ACPI_FADT_NO_CMOS_RTC (1<<5) /* 05: [V5] No CMOS real-time clock present */ - -/* Masks for FADT ARM Boot Architecture Flags (arm_boot_flags) ACPI 5.1 */ - -#define ACPI_FADT_PSCI_COMPLIANT (1) /* 00: [V5+] PSCI 0.2+ is implemented */ -#define ACPI_FADT_PSCI_USE_HVC (1<<1) /* 01: [V5+] HVC must be used instead of SMC as the PSCI conduit */ - -/* Masks for FADT flags */ - -#define ACPI_FADT_WBINVD (1) /* 00: [V1] The WBINVD instruction works properly */ -#define ACPI_FADT_WBINVD_FLUSH (1<<1) /* 01: [V1] WBINVD flushes but does not invalidate caches */ -#define ACPI_FADT_C1_SUPPORTED (1<<2) /* 02: [V1] All processors support C1 state */ -#define ACPI_FADT_C2_MP_SUPPORTED (1<<3) /* 03: [V1] C2 state works on MP system */ -#define ACPI_FADT_POWER_BUTTON (1<<4) /* 04: [V1] Power button is handled as a control method device */ -#define ACPI_FADT_SLEEP_BUTTON (1<<5) /* 05: [V1] Sleep button is handled as a control method device */ -#define ACPI_FADT_FIXED_RTC (1<<6) /* 06: [V1] RTC wakeup status is not in fixed register space */ -#define ACPI_FADT_S4_RTC_WAKE (1<<7) /* 07: [V1] RTC alarm can wake system from S4 */ -#define ACPI_FADT_32BIT_TIMER (1<<8) /* 08: [V1] ACPI timer width is 32-bit (0=24-bit) */ -#define ACPI_FADT_DOCKING_SUPPORTED (1<<9) /* 09: [V1] Docking supported */ -#define ACPI_FADT_RESET_REGISTER (1<<10) /* 10: [V2] System reset via the FADT RESET_REG supported */ -#define ACPI_FADT_SEALED_CASE (1<<11) /* 11: [V3] No internal expansion capabilities and case is sealed */ -#define ACPI_FADT_HEADLESS (1<<12) /* 12: [V3] No local video capabilities or local input devices */ -#define ACPI_FADT_SLEEP_TYPE (1<<13) /* 13: [V3] Must execute native instruction after writing SLP_TYPx register */ -#define ACPI_FADT_PCI_EXPRESS_WAKE (1<<14) /* 14: [V4] System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */ -#define ACPI_FADT_PLATFORM_CLOCK (1<<15) /* 15: [V4] OSPM should use platform-provided timer (ACPI 3.0) */ -#define ACPI_FADT_S4_RTC_VALID (1<<16) /* 16: [V4] Contents of RTC_STS valid after S4 wake (ACPI 3.0) */ -#define ACPI_FADT_REMOTE_POWER_ON (1<<17) /* 17: [V4] System is compatible with remote power on (ACPI 3.0) */ -#define ACPI_FADT_APIC_CLUSTER (1<<18) /* 18: [V4] All local APICs must use cluster model (ACPI 3.0) */ -#define ACPI_FADT_APIC_PHYSICAL (1<<19) /* 19: [V4] All local xAPICs must use physical dest mode (ACPI 3.0) */ -#define ACPI_FADT_HW_REDUCED (1<<20) /* 20: [V5] ACPI hardware is not implemented (ACPI 5.0) */ -#define ACPI_FADT_LOW_POWER_S0 (1<<21) /* 21: [V5] S0 power savings are equal or better than S3 (ACPI 5.0) */ - - -/* Values for PreferredProfile (Preferred Power Management Profiles) */ - -enum AcpiPreferredPmProfiles -{ - PM_UNSPECIFIED = 0, - PM_DESKTOP = 1, - PM_MOBILE = 2, - PM_WORKSTATION = 3, - PM_ENTERPRISE_SERVER = 4, - PM_SOHO_SERVER = 5, - PM_APPLIANCE_PC = 6, - PM_PERFORMANCE_SERVER = 7, - PM_TABLET = 8 -}; - -/* Values for SleepStatus and SleepControl registers (V5+ FADT) */ - -#define ACPI_X_WAKE_STATUS 0x80 -#define ACPI_X_SLEEP_TYPE_MASK 0x1C -#define ACPI_X_SLEEP_TYPE_POSITION 0x02 -#define ACPI_X_SLEEP_ENABLE 0x20 - - -/* Reset to default packing */ - -#pragma pack() - - -/* - * Internal table-related structures - */ -typedef union acpi_name_union -{ - UINT32 Integer; - char Ascii[4]; - -} ACPI_NAME_UNION; - - -/* Internal ACPI Table Descriptor. One per ACPI table. */ - -typedef struct acpi_table_desc -{ - ACPI_PHYSICAL_ADDRESS Address; - ACPI_TABLE_HEADER *Pointer; - UINT32 Length; /* Length fixed at 32 bits (fixed in table header) */ - ACPI_NAME_UNION Signature; - ACPI_OWNER_ID OwnerId; - UINT8 Flags; - UINT16 ValidationCount; - -} ACPI_TABLE_DESC; - -/* - * Maximum value of the ValidationCount field in ACPI_TABLE_DESC. - * When reached, ValidationCount cannot be changed any more and the table will - * be permanently regarded as validated. - * - * This is to prevent situations in which unbalanced table get/put operations - * may cause premature table unmapping in the OS to happen. - * - * The maximum validation count can be defined to any value, but should be - * greater than the maximum number of OS early stage mapping slots to avoid - * leaking early stage table mappings to the late stage. - */ -#define ACPI_MAX_TABLE_VALIDATIONS ACPI_UINT16_MAX - -/* Masks for Flags field above */ - -#define ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL (0) /* Virtual address, external maintained */ -#define ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL (1) /* Physical address, internally mapped */ -#define ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL (2) /* Virtual address, internallly allocated */ -#define ACPI_TABLE_ORIGIN_MASK (3) -#define ACPI_TABLE_IS_VERIFIED (4) -#define ACPI_TABLE_IS_LOADED (8) - - -/* - * Get the remaining ACPI tables - */ -#include "actbl1.h" -#include "actbl2.h" -#include "actbl3.h" - -/* Macros used to generate offsets to specific table fields */ - -#define ACPI_FADT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_FADT, f) - -/* - * Sizes of the various flavors of FADT. We need to look closely - * at the FADT length because the version number essentially tells - * us nothing because of many BIOS bugs where the version does not - * match the expected length. In other words, the length of the - * FADT is the bottom line as to what the version really is. - * - * For reference, the values below are as follows: - * FADT V1 size: 0x074 - * FADT V2 size: 0x084 - * FADT V3 size: 0x0F4 - * FADT V4 size: 0x0F4 - * FADT V5 size: 0x10C - * FADT V6 size: 0x114 - */ -#define ACPI_FADT_V1_SIZE (UINT32) (ACPI_FADT_OFFSET (Flags) + 4) -#define ACPI_FADT_V2_SIZE (UINT32) (ACPI_FADT_OFFSET (MinorRevision) + 1) -#define ACPI_FADT_V3_SIZE (UINT32) (ACPI_FADT_OFFSET (SleepControl)) -#define ACPI_FADT_V5_SIZE (UINT32) (ACPI_FADT_OFFSET (HypervisorId)) -#define ACPI_FADT_V6_SIZE (UINT32) (sizeof (ACPI_TABLE_FADT)) - -#define ACPI_FADT_CONFORMANCE "ACPI 6.1 (FADT version 6)" - -#endif /* __ACTBL_H__ */ diff --git a/drivers/include/acpica/actbl1.h b/drivers/include/acpica/actbl1.h deleted file mode 100644 index 6e79379..0000000 --- a/drivers/include/acpica/actbl1.h +++ /dev/null @@ -1,2481 +0,0 @@ -/****************************************************************************** - * - * Name: actbl1.h - Additional ACPI table definitions - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef __ACTBL1_H__ -#define __ACTBL1_H__ - - -/******************************************************************************* - * - * Additional ACPI Tables - * - * These tables are not consumed directly by the ACPICA subsystem, but are - * included here to support device drivers and the AML disassembler. - * - ******************************************************************************/ - - -/* - * Values for description table header signatures for tables defined in this - * file. Useful because they make it more difficult to inadvertently type in - * the wrong signature. - */ -#define ACPI_SIG_AEST "AEST" /* Arm Error Source Table */ -#define ACPI_SIG_ASF "ASF!" /* Alert Standard Format table */ -#define ACPI_SIG_ASPT "ASPT" /* AMD Secure Processor Table */ -#define ACPI_SIG_BERT "BERT" /* Boot Error Record Table */ -#define ACPI_SIG_BGRT "BGRT" /* Boot Graphics Resource Table */ -#define ACPI_SIG_BOOT "BOOT" /* Simple Boot Flag Table */ -#define ACPI_SIG_CEDT "CEDT" /* CXL Early Discovery Table */ -#define ACPI_SIG_CPEP "CPEP" /* Corrected Platform Error Polling table */ -#define ACPI_SIG_CSRT "CSRT" /* Core System Resource Table */ -#define ACPI_SIG_DBG2 "DBG2" /* Debug Port table type 2 */ -#define ACPI_SIG_DBGP "DBGP" /* Debug Port table */ -#define ACPI_SIG_DMAR "DMAR" /* DMA Remapping table */ -#define ACPI_SIG_DRTM "DRTM" /* Dynamic Root of Trust for Measurement table */ -#define ACPI_SIG_ECDT "ECDT" /* Embedded Controller Boot Resources Table */ -#define ACPI_SIG_EINJ "EINJ" /* Error Injection table */ -#define ACPI_SIG_ERST "ERST" /* Error Record Serialization Table */ -#define ACPI_SIG_FPDT "FPDT" /* Firmware Performance Data Table */ -#define ACPI_SIG_GTDT "GTDT" /* Generic Timer Description Table */ -#define ACPI_SIG_HEST "HEST" /* Hardware Error Source Table */ -#define ACPI_SIG_HMAT "HMAT" /* Heterogeneous Memory Attributes Table */ -#define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */ -#define ACPI_SIG_IBFT "IBFT" /* iSCSI Boot Firmware Table */ -#define ACPI_SIG_MSCT "MSCT" /* Maximum System Characteristics Table*/ - -#define ACPI_SIG_S3PT "S3PT" /* S3 Performance (sub)Table */ -#define ACPI_SIG_PCCS "PCC" /* PCC Shared Memory Region */ - - -/* Reserved table signatures */ - -#define ACPI_SIG_MATR "MATR" /* Memory Address Translation Table */ -#define ACPI_SIG_MSDM "MSDM" /* Microsoft Data Management Table */ - -/* - * These tables have been seen in the field, but no definition has been found - */ -#ifdef ACPI_UNDEFINED_TABLES -#define ACPI_SIG_ATKG "ATKG" -#define ACPI_SIG_GSCI "GSCI" /* GMCH SCI table */ -#define ACPI_SIG_IEIT "IEIT" -#endif - -/* - * All tables must be byte-packed to match the ACPI specification, since - * the tables are provided by the system BIOS. - */ -#pragma pack(1) - -/* - * Note: C bitfields are not used for this reason: - * - * "Bitfields are great and easy to read, but unfortunately the C language - * does not specify the layout of bitfields in memory, which means they are - * essentially useless for dealing with packed data in on-disk formats or - * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me, - * this decision was a design error in C. Ritchie could have picked an order - * and stuck with it." Norman Ramsey. - * See http://stackoverflow.com/a/1053662/41661 - */ - - -/******************************************************************************* - * - * Common subtable headers - * - ******************************************************************************/ - -/* Generic subtable header (used in MADT, SRAT, etc.) */ - -typedef struct acpi_subtable_header -{ - UINT8 Type; - UINT8 Length; - -} ACPI_SUBTABLE_HEADER; - - -/* Subtable header for WHEA tables (EINJ, ERST, WDAT) */ - -typedef struct acpi_whea_header -{ - UINT8 Action; - UINT8 Instruction; - UINT8 Flags; - UINT8 Reserved; - ACPI_GENERIC_ADDRESS RegisterRegion; - UINT64 Value; /* Value used with Read/Write register */ - UINT64 Mask; /* Bitmask required for this register instruction */ - -} ACPI_WHEA_HEADER; - - -/* Larger subtable header (when Length can exceed 255) */ - -typedef struct acpi_subtbl_hdr_16 -{ - UINT16 Type; - UINT16 Length; - -} ACPI_SUBTBL_HDR_16; - - -/******************************************************************************* - * - * ASF - Alert Standard Format table (Signature "ASF!") - * Revision 0x10 - * - * Conforms to the Alert Standard Format Specification V2.0, 23 April 2003 - * - ******************************************************************************/ - -typedef struct acpi_table_asf -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - -} ACPI_TABLE_ASF; - - -/* ASF subtable header */ - -typedef struct acpi_asf_header -{ - UINT8 Type; - UINT8 Reserved; - UINT16 Length; - -} ACPI_ASF_HEADER; - - -/* Values for Type field above */ - -enum AcpiAsfType -{ - ACPI_ASF_TYPE_INFO = 0, - ACPI_ASF_TYPE_ALERT = 1, - ACPI_ASF_TYPE_CONTROL = 2, - ACPI_ASF_TYPE_BOOT = 3, - ACPI_ASF_TYPE_ADDRESS = 4, - ACPI_ASF_TYPE_RESERVED = 5 -}; - -/* - * ASF subtables - */ - -/* 0: ASF Information */ - -typedef struct acpi_asf_info -{ - ACPI_ASF_HEADER Header; - UINT8 MinResetValue; - UINT8 MinPollInterval; - UINT16 SystemId; - UINT32 MfgId; - UINT8 Flags; - UINT8 Reserved2[3]; - -} ACPI_ASF_INFO; - -/* Masks for Flags field above */ - -#define ACPI_ASF_SMBUS_PROTOCOLS (1) - - -/* 1: ASF Alerts */ - -typedef struct acpi_asf_alert -{ - ACPI_ASF_HEADER Header; - UINT8 AssertMask; - UINT8 DeassertMask; - UINT8 Alerts; - UINT8 DataLength; - -} ACPI_ASF_ALERT; - -typedef struct acpi_asf_alert_data -{ - UINT8 Address; - UINT8 Command; - UINT8 Mask; - UINT8 Value; - UINT8 SensorType; - UINT8 Type; - UINT8 Offset; - UINT8 SourceType; - UINT8 Severity; - UINT8 SensorNumber; - UINT8 Entity; - UINT8 Instance; - -} ACPI_ASF_ALERT_DATA; - - -/* 2: ASF Remote Control */ - -typedef struct acpi_asf_remote -{ - ACPI_ASF_HEADER Header; - UINT8 Controls; - UINT8 DataLength; - UINT16 Reserved2; - -} ACPI_ASF_REMOTE; - -typedef struct acpi_asf_control_data -{ - UINT8 Function; - UINT8 Address; - UINT8 Command; - UINT8 Value; - -} ACPI_ASF_CONTROL_DATA; - - -/* 3: ASF RMCP Boot Options */ - -typedef struct acpi_asf_rmcp -{ - ACPI_ASF_HEADER Header; - UINT8 Capabilities[7]; - UINT8 CompletionCode; - UINT32 EnterpriseId; - UINT8 Command; - UINT16 Parameter; - UINT16 BootOptions; - UINT16 OemParameters; - -} ACPI_ASF_RMCP; - - -/* 4: ASF Address */ - -typedef struct acpi_asf_address -{ - ACPI_ASF_HEADER Header; - UINT8 EpromAddress; - UINT8 Devices; - -} ACPI_ASF_ADDRESS; - -/******************************************************************************* - * - * ASPT - AMD Secure Processor Table (Signature "ASPT") - * Revision 0x1 - * - * Conforms to AMD Socket SP5/SP6 Platform ASPT Rev1 Specification, - * 12 September 2022 - * - ******************************************************************************/ - -typedef struct acpi_table_aspt -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT32 NumEntries; - -} ACPI_TABLE_ASPT; - - -/* ASPT subtable header */ - -typedef struct acpi_aspt_header -{ - UINT16 Type; - UINT16 Length; - -} ACPI_ASPT_HEADER; - - -/* Values for Type field above */ - -enum AcpiAsptType -{ - ACPI_ASPT_TYPE_GLOBAL_REGS = 0, - ACPI_ASPT_TYPE_SEV_MBOX_REGS = 1, - ACPI_ASPT_TYPE_ACPI_MBOX_REGS = 2, - ACPI_ASPT_TYPE_UNKNOWN = 3, -}; - -/* - * ASPT subtables - */ - -/* 0: ASPT Global Registers */ - -typedef struct acpi_aspt_global_regs -{ - ACPI_ASPT_HEADER Header; - UINT32 Reserved; - UINT64 FeatureRegAddr; - UINT64 IrqEnRegAddr; - UINT64 IrqStRegAddr; - -} ACPI_ASPT_GLOBAL_REGS; - - -/* 1: ASPT SEV Mailbox Registers */ - -typedef struct acpi_aspt_sev_mbox_regs -{ - ACPI_ASPT_HEADER Header; - UINT8 MboxIrqId; - UINT8 Reserved[3]; - UINT64 CmdRespRegAddr; - UINT64 CmdBufLoRegAddr; - UINT64 CmdBufHiRegAddr; - -} ACPI_ASPT_SEV_MBOX_REGS; - - -/* 2: ASPT ACPI Mailbox Registers */ - -typedef struct acpi_aspt_acpi_mbox_regs -{ - ACPI_ASPT_HEADER Header; - UINT32 Reserved1; - UINT64 CmdRespRegAddr; - UINT64 Reserved2[2]; - -} ACPI_ASPT_ACPI_MBOX_REGS; - - -/******************************************************************************* - * - * BERT - Boot Error Record Table (ACPI 4.0) - * Version 1 - * - ******************************************************************************/ - -typedef struct acpi_table_bert -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT32 RegionLength; /* Length of the boot error region */ - UINT64 Address; /* Physical address of the error region */ - -} ACPI_TABLE_BERT; - - -/* Boot Error Region (not a subtable, pointed to by Address field above) */ - -typedef struct acpi_bert_region -{ - UINT32 BlockStatus; /* Type of error information */ - UINT32 RawDataOffset; /* Offset to raw error data */ - UINT32 RawDataLength; /* Length of raw error data */ - UINT32 DataLength; /* Length of generic error data */ - UINT32 ErrorSeverity; /* Severity code */ - -} ACPI_BERT_REGION; - -/* Values for BlockStatus flags above */ - -#define ACPI_BERT_UNCORRECTABLE (1) -#define ACPI_BERT_CORRECTABLE (1<<1) -#define ACPI_BERT_MULTIPLE_UNCORRECTABLE (1<<2) -#define ACPI_BERT_MULTIPLE_CORRECTABLE (1<<3) -#define ACPI_BERT_ERROR_ENTRY_COUNT (0xFF<<4) /* 8 bits, error count */ - -/* Values for ErrorSeverity above */ - -enum AcpiBertErrorSeverity -{ - ACPI_BERT_ERROR_CORRECTABLE = 0, - ACPI_BERT_ERROR_FATAL = 1, - ACPI_BERT_ERROR_CORRECTED = 2, - ACPI_BERT_ERROR_NONE = 3, - ACPI_BERT_ERROR_RESERVED = 4 /* 4 and greater are reserved */ -}; - -/* - * Note: The generic error data that follows the ErrorSeverity field above - * uses the ACPI_HEST_GENERIC_DATA defined under the HEST table below - */ - - -/******************************************************************************* - * - * BGRT - Boot Graphics Resource Table (ACPI 5.0) - * Version 1 - * - ******************************************************************************/ - -typedef struct acpi_table_bgrt -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT16 Version; - UINT8 Status; - UINT8 ImageType; - UINT64 ImageAddress; - UINT32 ImageOffsetX; - UINT32 ImageOffsetY; - -} ACPI_TABLE_BGRT; - -/* Flags for Status field above */ - -#define ACPI_BGRT_DISPLAYED (1) -#define ACPI_BGRT_ORIENTATION_OFFSET (3 << 1) - - -/******************************************************************************* - * - * BOOT - Simple Boot Flag Table - * Version 1 - * - * Conforms to the "Simple Boot Flag Specification", Version 2.1 - * - ******************************************************************************/ - -typedef struct acpi_table_boot -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT8 CmosIndex; /* Index in CMOS RAM for the boot register */ - UINT8 Reserved[3]; - -} ACPI_TABLE_BOOT; - - -/******************************************************************************* - * - * CDAT - Coherent Device Attribute Table - * Version 1 - * - * Conforms to the "Coherent Device Attribute Table (CDAT) Specification - " (Revision 1.01, October 2020.) - * - ******************************************************************************/ - -typedef struct acpi_table_cdat -{ - UINT32 Length; /* Length of table in bytes, including this header */ - UINT8 Revision; /* ACPI Specification minor version number */ - UINT8 Checksum; /* To make sum of entire table == 0 */ - UINT8 Reserved[6]; - UINT32 Sequence; /* Used to detect runtime CDAT table changes */ - -} ACPI_TABLE_CDAT; - - -/* CDAT common subtable header */ - -typedef struct acpi_cdat_header -{ - UINT8 Type; - UINT8 Reserved; - UINT16 Length; - -} ACPI_CDAT_HEADER; - -/* Values for Type field above */ - -enum AcpiCdatType -{ - ACPI_CDAT_TYPE_DSMAS = 0, - ACPI_CDAT_TYPE_DSLBIS = 1, - ACPI_CDAT_TYPE_DSMSCIS = 2, - ACPI_CDAT_TYPE_DSIS = 3, - ACPI_CDAT_TYPE_DSEMTS = 4, - ACPI_CDAT_TYPE_SSLBIS = 5, - ACPI_CDAT_TYPE_RESERVED = 6 /* 6 through 0xFF are reserved */ -}; - - -/* Subtable 0: Device Scoped Memory Affinity Structure (DSMAS) */ - -typedef struct acpi_cdat_dsmas -{ - UINT8 DsmadHandle; - UINT8 Flags; - UINT16 Reserved; - UINT64 DpaBaseAddress; - UINT64 DpaLength; - -} ACPI_CDAT_DSMAS; - -/* Flags for subtable above */ - -#define ACPI_CDAT_DSMAS_NON_VOLATILE (1 << 2) -#define ACPI_CDAT_DSMAS_SHAREABLE (1 << 3) -#define ACPI_CDAT_DSMAS_READ_ONLY (1 << 6) - - -/* Subtable 1: Device scoped Latency and Bandwidth Information Structure (DSLBIS) */ - -typedef struct acpi_cdat_dslbis -{ - UINT8 Handle; - UINT8 Flags; /* If Handle matches a DSMAS handle, the definition of this field matches - * Flags field in HMAT System Locality Latency */ - UINT8 DataType; - UINT8 Reserved; - UINT64 EntryBaseUnit; - UINT16 Entry[3]; - UINT16 Reserved2; - -} ACPI_CDAT_DSLBIS; - - -/* Subtable 2: Device Scoped Memory Side Cache Information Structure (DSMSCIS) */ - -typedef struct acpi_cdat_dsmscis -{ - UINT8 DsmasHandle; - UINT8 Reserved[3]; - UINT64 SideCacheSize; - UINT32 CacheAttributes; - -} ACPI_CDAT_DSMSCIS; - - -/* Subtable 3: Device Scoped Initiator Structure (DSIS) */ - -typedef struct acpi_cdat_dsis -{ - UINT8 Flags; - UINT8 Handle; - UINT16 Reserved; - -} ACPI_CDAT_DSIS; - -/* Flags for above subtable */ - -#define ACPI_CDAT_DSIS_MEM_ATTACHED (1 << 0) - - -/* Subtable 4: Device Scoped EFI Memory Type Structure (DSEMTS) */ - -typedef struct acpi_cdat_dsemts -{ - UINT8 DsmasHandle; - UINT8 MemoryType; - UINT16 Reserved; - UINT64 DpaOffset; - UINT64 RangeLength; - -} ACPI_CDAT_DSEMTS; - - -/* Subtable 5: Switch Scoped Latency and Bandwidth Information Structure (SSLBIS) */ - -typedef struct acpi_cdat_sslbis -{ - UINT8 DataType; - UINT8 Reserved[3]; - UINT64 EntryBaseUnit; - -} ACPI_CDAT_SSLBIS; - - -/* Sub-subtable for above, SslbeEntries field */ - -typedef struct acpi_cdat_sslbe -{ - UINT16 PortxId; - UINT16 PortyId; - UINT16 LatencyOrBandwidth; - UINT16 Reserved; - -} ACPI_CDAT_SSLBE; - -#define ACPI_CDAT_SSLBIS_US_PORT 0x0100 -#define ACPI_CDAT_SSLBIS_ANY_PORT 0xffff - -/******************************************************************************* - * - * CEDT - CXL Early Discovery Table - * Version 1 - * - * Conforms to the "CXL Early Discovery Table" (CXL 2.0, October 2020) - * - ******************************************************************************/ - -typedef struct acpi_table_cedt -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - -} ACPI_TABLE_CEDT; - -/* CEDT subtable header (Performance Record Structure) */ - -typedef struct acpi_cedt_header -{ - UINT8 Type; - UINT8 Reserved; - UINT16 Length; - -} ACPI_CEDT_HEADER; - -/* Values for Type field above */ - -enum AcpiCedtType -{ - ACPI_CEDT_TYPE_CHBS = 0, - ACPI_CEDT_TYPE_CFMWS = 1, - ACPI_CEDT_TYPE_CXIMS = 2, - ACPI_CEDT_TYPE_RDPAS = 3, - ACPI_CEDT_TYPE_RESERVED = 4, -}; - -/* Values for version field above */ - -#define ACPI_CEDT_CHBS_VERSION_CXL11 (0) -#define ACPI_CEDT_CHBS_VERSION_CXL20 (1) - -/* Values for length field above */ - -#define ACPI_CEDT_CHBS_LENGTH_CXL11 (0x2000) -#define ACPI_CEDT_CHBS_LENGTH_CXL20 (0x10000) - -/* - * CEDT subtables - */ - -/* 0: CXL Host Bridge Structure */ - -typedef struct acpi_cedt_chbs -{ - ACPI_CEDT_HEADER Header; - UINT32 Uid; - UINT32 CxlVersion; - UINT32 Reserved; - UINT64 Base; - UINT64 Length; - -} ACPI_CEDT_CHBS; - - -/* 1: CXL Fixed Memory Window Structure */ - -typedef struct acpi_cedt_cfmws -{ - ACPI_CEDT_HEADER Header; - UINT32 Reserved1; - UINT64 BaseHpa; - UINT64 WindowSize; - UINT8 InterleaveWays; - UINT8 InterleaveArithmetic; - UINT16 Reserved2; - UINT32 Granularity; - UINT16 Restrictions; - UINT16 QtgId; - UINT32 InterleaveTargets[]; - -} ACPI_CEDT_CFMWS; - -typedef struct acpi_cedt_cfmws_target_element -{ - UINT32 InterleaveTarget; - -} ACPI_CEDT_CFMWS_TARGET_ELEMENT; - -/* Values for Interleave Arithmetic field above */ - -#define ACPI_CEDT_CFMWS_ARITHMETIC_MODULO (0) -#define ACPI_CEDT_CFMWS_ARITHMETIC_XOR (1) - -/* Values for Restrictions field above */ - -#define ACPI_CEDT_CFMWS_RESTRICT_DEVMEM (1) -#define ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM (1<<1) -#define ACPI_CEDT_CFMWS_RESTRICT_VOLATILE (1<<2) -#define ACPI_CEDT_CFMWS_RESTRICT_PMEM (1<<3) -#define ACPI_CEDT_CFMWS_RESTRICT_FIXED (1<<4) -#define ACPI_CEDT_CFMWS_RESTRICT_BI (1<<5) - -/* 2: CXL XOR Interleave Math Structure */ - -typedef struct acpi_cedt_cxims { - ACPI_CEDT_HEADER Header; - UINT16 Reserved1; - UINT8 Hbig; - UINT8 NrXormaps; - UINT64 XormapList[]; -} ACPI_CEDT_CXIMS; - -typedef struct acpi_cedt_cxims_target_element -{ - UINT64 Xormap; - -} ACPI_CEDT_CXIMS_TARGET_ELEMENT; - - -/* 3: CXL RCEC Downstream Port Association Structure */ - -struct acpi_cedt_rdpas { - ACPI_CEDT_HEADER Header; - UINT16 Segment; - UINT16 Bdf; - UINT8 Protocol; - UINT64 Address; -}; - -/* Masks for bdf field above */ -#define ACPI_CEDT_RDPAS_BUS_MASK 0xff00 -#define ACPI_CEDT_RDPAS_DEVICE_MASK 0x00f8 -#define ACPI_CEDT_RDPAS_FUNCTION_MASK 0x0007 - -#define ACPI_CEDT_RDPAS_PROTOCOL_IO (0) -#define ACPI_CEDT_RDPAS_PROTOCOL_CACHEMEM (1) - -/******************************************************************************* - * - * CPEP - Corrected Platform Error Polling table (ACPI 4.0) - * Version 1 - * - ******************************************************************************/ - -typedef struct acpi_table_cpep -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT64 Reserved; - -} ACPI_TABLE_CPEP; - - -/* Subtable */ - -typedef struct acpi_cpep_polling -{ - ACPI_SUBTABLE_HEADER Header; - UINT8 Id; /* Processor ID */ - UINT8 Eid; /* Processor EID */ - UINT32 Interval; /* Polling interval (msec) */ - -} ACPI_CPEP_POLLING; - - -/******************************************************************************* - * - * CSRT - Core System Resource Table - * Version 0 - * - * Conforms to the "Core System Resource Table (CSRT)", November 14, 2011 - * - ******************************************************************************/ - -typedef struct acpi_table_csrt -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - -} ACPI_TABLE_CSRT; - - -/* Resource Group subtable */ - -typedef struct acpi_csrt_group -{ - UINT32 Length; - UINT32 VendorId; - UINT32 SubvendorId; - UINT16 DeviceId; - UINT16 SubdeviceId; - UINT16 Revision; - UINT16 Reserved; - UINT32 SharedInfoLength; - - /* Shared data immediately follows (Length = SharedInfoLength) */ - -} ACPI_CSRT_GROUP; - -/* Shared Info subtable */ - -typedef struct acpi_csrt_shared_info -{ - UINT16 MajorVersion; - UINT16 MinorVersion; - UINT32 MmioBaseLow; - UINT32 MmioBaseHigh; - UINT32 GsiInterrupt; - UINT8 InterruptPolarity; - UINT8 InterruptMode; - UINT8 NumChannels; - UINT8 DmaAddressWidth; - UINT16 BaseRequestLine; - UINT16 NumHandshakeSignals; - UINT32 MaxBlockSize; - - /* Resource descriptors immediately follow (Length = Group Length - SharedInfoLength) */ - -} ACPI_CSRT_SHARED_INFO; - -/* Resource Descriptor subtable */ - -typedef struct acpi_csrt_descriptor -{ - UINT32 Length; - UINT16 Type; - UINT16 Subtype; - UINT32 Uid; - - /* Resource-specific information immediately follows */ - -} ACPI_CSRT_DESCRIPTOR; - - -/* Resource Types */ - -#define ACPI_CSRT_TYPE_INTERRUPT 0x0001 -#define ACPI_CSRT_TYPE_TIMER 0x0002 -#define ACPI_CSRT_TYPE_DMA 0x0003 - -/* Resource Subtypes */ - -#define ACPI_CSRT_XRUPT_LINE 0x0000 -#define ACPI_CSRT_XRUPT_CONTROLLER 0x0001 -#define ACPI_CSRT_TIMER 0x0000 -#define ACPI_CSRT_DMA_CHANNEL 0x0000 -#define ACPI_CSRT_DMA_CONTROLLER 0x0001 - - -/******************************************************************************* - * - * DBG2 - Debug Port Table 2 - * Version 0 (Both main table and subtables) - * - * Conforms to "Microsoft Debug Port Table 2 (DBG2)", September 21, 2020 - * - ******************************************************************************/ - -typedef struct acpi_table_dbg2 -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT32 InfoOffset; - UINT32 InfoCount; - -} ACPI_TABLE_DBG2; - - -typedef struct acpi_dbg2_header -{ - UINT32 InfoOffset; - UINT32 InfoCount; - -} ACPI_DBG2_HEADER; - - -/* Debug Device Information Subtable */ - -typedef struct acpi_dbg2_device -{ - UINT8 Revision; - UINT16 Length; - UINT8 RegisterCount; /* Number of BaseAddress registers */ - UINT16 NamepathLength; - UINT16 NamepathOffset; - UINT16 OemDataLength; - UINT16 OemDataOffset; - UINT16 PortType; - UINT16 PortSubtype; - UINT16 Reserved; - UINT16 BaseAddressOffset; - UINT16 AddressSizeOffset; - /* - * Data that follows: - * BaseAddress (required) - Each in 12-byte Generic Address Structure format. - * AddressSize (required) - Array of UINT32 sizes corresponding to each BaseAddress register. - * Namepath (required) - Null terminated string. Single dot if not supported. - * OemData (optional) - Length is OemDataLength. - */ -} ACPI_DBG2_DEVICE; - -/* Types for PortType field above */ - -#define ACPI_DBG2_SERIAL_PORT 0x8000 -#define ACPI_DBG2_1394_PORT 0x8001 -#define ACPI_DBG2_USB_PORT 0x8002 -#define ACPI_DBG2_NET_PORT 0x8003 - -/* Subtypes for PortSubtype field above */ - -#define ACPI_DBG2_16550_COMPATIBLE 0x0000 -#define ACPI_DBG2_16550_SUBSET 0x0001 -#define ACPI_DBG2_MAX311XE_SPI 0x0002 -#define ACPI_DBG2_ARM_PL011 0x0003 -#define ACPI_DBG2_MSM8X60 0x0004 -#define ACPI_DBG2_16550_NVIDIA 0x0005 -#define ACPI_DBG2_TI_OMAP 0x0006 -#define ACPI_DBG2_APM88XXXX 0x0008 -#define ACPI_DBG2_MSM8974 0x0009 -#define ACPI_DBG2_SAM5250 0x000A -#define ACPI_DBG2_INTEL_USIF 0x000B -#define ACPI_DBG2_IMX6 0x000C -#define ACPI_DBG2_ARM_SBSA_32BIT 0x000D -#define ACPI_DBG2_ARM_SBSA_GENERIC 0x000E -#define ACPI_DBG2_ARM_DCC 0x000F -#define ACPI_DBG2_BCM2835 0x0010 -#define ACPI_DBG2_SDM845_1_8432MHZ 0x0011 -#define ACPI_DBG2_16550_WITH_GAS 0x0012 -#define ACPI_DBG2_SDM845_7_372MHZ 0x0013 -#define ACPI_DBG2_INTEL_LPSS 0x0014 -#define ACPI_DBG2_RISCV_SBI_CON 0x0015 - -#define ACPI_DBG2_1394_STANDARD 0x0000 - -#define ACPI_DBG2_USB_XHCI 0x0000 -#define ACPI_DBG2_USB_EHCI 0x0001 - - -/******************************************************************************* - * - * DBGP - Debug Port table - * Version 1 - * - * Conforms to the "Debug Port Specification", Version 1.00, 2/9/2000 - * - ******************************************************************************/ - -typedef struct acpi_table_dbgp -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT8 Type; /* 0=full 16550, 1=subset of 16550 */ - UINT8 Reserved[3]; - ACPI_GENERIC_ADDRESS DebugPort; - -} ACPI_TABLE_DBGP; - - -/******************************************************************************* - * - * DMAR - DMA Remapping table - * Version 1 - * - * Conforms to "Intel Virtualization Technology for Directed I/O", - * Version 2.3, October 2014 - * - ******************************************************************************/ - -typedef struct acpi_table_dmar -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT8 Width; /* Host Address Width */ - UINT8 Flags; - UINT8 Reserved[10]; - -} ACPI_TABLE_DMAR; - -/* Masks for Flags field above */ - -#define ACPI_DMAR_INTR_REMAP (1) -#define ACPI_DMAR_X2APIC_OPT_OUT (1<<1) -#define ACPI_DMAR_X2APIC_MODE (1<<2) - - -/* DMAR subtable header */ - -typedef struct acpi_dmar_header -{ - UINT16 Type; - UINT16 Length; - -} ACPI_DMAR_HEADER; - -/* Values for subtable type in ACPI_DMAR_HEADER */ - -enum AcpiDmarType -{ - ACPI_DMAR_TYPE_HARDWARE_UNIT = 0, - ACPI_DMAR_TYPE_RESERVED_MEMORY = 1, - ACPI_DMAR_TYPE_ROOT_ATS = 2, - ACPI_DMAR_TYPE_HARDWARE_AFFINITY = 3, - ACPI_DMAR_TYPE_NAMESPACE = 4, - ACPI_DMAR_TYPE_SATC = 5, - ACPI_DMAR_TYPE_SIDP = 6, - ACPI_DMAR_TYPE_RESERVED = 7 /* 7 and greater are reserved */ -}; - - -/* DMAR Device Scope structure */ - -typedef struct acpi_dmar_device_scope -{ - UINT8 EntryType; - UINT8 Length; - UINT8 Flags; - UINT8 Reserved; - UINT8 EnumerationId; - UINT8 Bus; - -} ACPI_DMAR_DEVICE_SCOPE; - -/* Values for EntryType in ACPI_DMAR_DEVICE_SCOPE - device types */ - -enum AcpiDmarScopeType -{ - ACPI_DMAR_SCOPE_TYPE_NOT_USED = 0, - ACPI_DMAR_SCOPE_TYPE_ENDPOINT = 1, - ACPI_DMAR_SCOPE_TYPE_BRIDGE = 2, - ACPI_DMAR_SCOPE_TYPE_IOAPIC = 3, - ACPI_DMAR_SCOPE_TYPE_HPET = 4, - ACPI_DMAR_SCOPE_TYPE_NAMESPACE = 5, - ACPI_DMAR_SCOPE_TYPE_RESERVED = 6 /* 6 and greater are reserved */ -}; - -typedef struct acpi_dmar_pci_path -{ - UINT8 Device; - UINT8 Function; - -} ACPI_DMAR_PCI_PATH; - - -/* - * DMAR Subtables, correspond to Type in ACPI_DMAR_HEADER - */ - -/* 0: Hardware Unit Definition */ - -typedef struct acpi_dmar_hardware_unit -{ - ACPI_DMAR_HEADER Header; - UINT8 Flags; - UINT8 Size; - UINT16 Segment; - UINT64 Address; /* Register Base Address */ - -} ACPI_DMAR_HARDWARE_UNIT; - -/* Masks for Flags field above */ - -#define ACPI_DMAR_INCLUDE_ALL (1) - - -/* 1: Reserved Memory Definition */ - -typedef struct acpi_dmar_reserved_memory -{ - ACPI_DMAR_HEADER Header; - UINT16 Reserved; - UINT16 Segment; - UINT64 BaseAddress; /* 4K aligned base address */ - UINT64 EndAddress; /* 4K aligned limit address */ - -} ACPI_DMAR_RESERVED_MEMORY; - -/* Masks for Flags field above */ - -#define ACPI_DMAR_ALLOW_ALL (1) - - -/* 2: Root Port ATS Capability Reporting Structure */ - -typedef struct acpi_dmar_atsr -{ - ACPI_DMAR_HEADER Header; - UINT8 Flags; - UINT8 Reserved; - UINT16 Segment; - -} ACPI_DMAR_ATSR; - -/* Masks for Flags field above */ - -#define ACPI_DMAR_ALL_PORTS (1) - - -/* 3: Remapping Hardware Static Affinity Structure */ - -typedef struct acpi_dmar_rhsa -{ - ACPI_DMAR_HEADER Header; - UINT32 Reserved; - UINT64 BaseAddress; - UINT32 ProximityDomain; - -} ACPI_DMAR_RHSA; - - -/* 4: ACPI Namespace Device Declaration Structure */ - -typedef struct acpi_dmar_andd -{ - ACPI_DMAR_HEADER Header; - UINT8 Reserved[3]; - UINT8 DeviceNumber; - union { - char __pad; - ACPI_FLEX_ARRAY(char, DeviceName); - }; - -} ACPI_DMAR_ANDD; - - -/* 5: SoC Integrated Address Translation Cache (SATC) */ - -typedef struct acpi_dmar_satc -{ - ACPI_DMAR_HEADER Header; - UINT8 Flags; - UINT8 Reserved; - UINT16 Segment; - -} ACPI_DMAR_SATC; - - -/* 6: SoC Integrated Device Property Reporting Structure */ - -typedef struct acpi_dmar_sidp -{ - ACPI_DMAR_HEADER Header; - UINT16 Reserved; - UINT16 Segment; - -} ACPI_DMAR_SIDP; - - -/******************************************************************************* - * - * DRTM - Dynamic Root of Trust for Measurement table - * Conforms to "TCG D-RTM Architecture" June 17 2013, Version 1.0.0 - * Table version 1 - * - ******************************************************************************/ - -typedef struct acpi_table_drtm -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT64 EntryBaseAddress; - UINT64 EntryLength; - UINT32 EntryAddress32; - UINT64 EntryAddress64; - UINT64 ExitAddress; - UINT64 LogAreaAddress; - UINT32 LogAreaLength; - UINT64 ArchDependentAddress; - UINT32 Flags; - -} ACPI_TABLE_DRTM; - -/* Flag Definitions for above */ - -#define ACPI_DRTM_ACCESS_ALLOWED (1) -#define ACPI_DRTM_ENABLE_GAP_CODE (1<<1) -#define ACPI_DRTM_INCOMPLETE_MEASUREMENTS (1<<2) -#define ACPI_DRTM_AUTHORITY_ORDER (1<<3) - - -/* 1) Validated Tables List (64-bit addresses) */ - -typedef struct acpi_drtm_vtable_list -{ - UINT32 ValidatedTableCount; - UINT64 ValidatedTables[]; - -} ACPI_DRTM_VTABLE_LIST; - -/* 2) Resources List (of Resource Descriptors) */ - -/* Resource Descriptor */ - -typedef struct acpi_drtm_resource -{ - UINT8 Size[7]; - UINT8 Type; - UINT64 Address; - -} ACPI_DRTM_RESOURCE; - -typedef struct acpi_drtm_resource_list -{ - UINT32 ResourceCount; - ACPI_DRTM_RESOURCE Resources[]; - -} ACPI_DRTM_RESOURCE_LIST; - -/* 3) Platform-specific Identifiers List */ - -typedef struct acpi_drtm_dps_id -{ - UINT32 DpsIdLength; - UINT8 DpsId[16]; - -} ACPI_DRTM_DPS_ID; - - -/******************************************************************************* - * - * ECDT - Embedded Controller Boot Resources Table - * Version 1 - * - ******************************************************************************/ - -typedef struct acpi_table_ecdt -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - ACPI_GENERIC_ADDRESS Control; /* Address of EC command/status register */ - ACPI_GENERIC_ADDRESS Data; /* Address of EC data register */ - UINT32 Uid; /* Unique ID - must be same as the EC _UID method */ - UINT8 Gpe; /* The GPE for the EC */ - UINT8 Id[]; /* Full namepath of the EC in the ACPI namespace */ - -} ACPI_TABLE_ECDT; - - -/******************************************************************************* - * - * EINJ - Error Injection Table (ACPI 4.0) - * Version 1 - * - ******************************************************************************/ - -typedef struct acpi_table_einj -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT32 HeaderLength; - UINT8 Flags; - UINT8 Reserved[3]; - UINT32 Entries; - -} ACPI_TABLE_EINJ; - - -/* EINJ Injection Instruction Entries (actions) */ - -typedef struct acpi_einj_entry -{ - ACPI_WHEA_HEADER WheaHeader; /* Common header for WHEA tables */ - -} ACPI_EINJ_ENTRY; - -/* Masks for Flags field above */ - -#define ACPI_EINJ_PRESERVE (1) - -/* Values for Action field above */ - -enum AcpiEinjActions -{ - ACPI_EINJ_BEGIN_OPERATION = 0x0, - ACPI_EINJ_GET_TRIGGER_TABLE = 0x1, - ACPI_EINJ_SET_ERROR_TYPE = 0x2, - ACPI_EINJ_GET_ERROR_TYPE = 0x3, - ACPI_EINJ_END_OPERATION = 0x4, - ACPI_EINJ_EXECUTE_OPERATION = 0x5, - ACPI_EINJ_CHECK_BUSY_STATUS = 0x6, - ACPI_EINJ_GET_COMMAND_STATUS = 0x7, - ACPI_EINJ_SET_ERROR_TYPE_WITH_ADDRESS = 0x8, - ACPI_EINJ_GET_EXECUTE_TIMINGS = 0x9, - ACPI_EINJV2_GET_ERROR_TYPE = 0x11, - ACPI_EINJ_ACTION_RESERVED = 0x12, /* 0x12 and greater are reserved */ - ACPI_EINJ_TRIGGER_ERROR = 0xFF /* Except for this value */ -}; - -/* Values for Instruction field above */ - -enum AcpiEinjInstructions -{ - ACPI_EINJ_READ_REGISTER = 0, - ACPI_EINJ_READ_REGISTER_VALUE = 1, - ACPI_EINJ_WRITE_REGISTER = 2, - ACPI_EINJ_WRITE_REGISTER_VALUE = 3, - ACPI_EINJ_NOOP = 4, - ACPI_EINJ_FLUSH_CACHELINE = 5, - ACPI_EINJ_INSTRUCTION_RESERVED = 6 /* 6 and greater are reserved */ -}; - -typedef struct acpi_einj_error_type_with_addr -{ - UINT32 ErrorType; - UINT32 VendorStructOffset; - UINT32 Flags; - UINT32 ApicId; - UINT64 Address; - UINT64 Range; - UINT32 PcieId; - -} ACPI_EINJ_ERROR_TYPE_WITH_ADDR; - -typedef struct acpi_einj_vendor -{ - UINT32 Length; - UINT32 PcieId; - UINT16 VendorId; - UINT16 DeviceId; - UINT8 RevisionId; - UINT8 Reserved[3]; - -} ACPI_EINJ_VENDOR; - - -/* EINJ Trigger Error Action Table */ - -typedef struct acpi_einj_trigger -{ - UINT32 HeaderSize; - UINT32 Revision; - UINT32 TableSize; - UINT32 EntryCount; - -} ACPI_EINJ_TRIGGER; - -/* Command status return values */ - -enum AcpiEinjCommandStatus -{ - ACPI_EINJ_SUCCESS = 0, - ACPI_EINJ_FAILURE = 1, - ACPI_EINJ_INVALID_ACCESS = 2, - ACPI_EINJ_STATUS_RESERVED = 3 /* 3 and greater are reserved */ -}; - - -/* Error types returned from ACPI_EINJ_GET_ERROR_TYPE (bitfield) */ - -#define ACPI_EINJ_PROCESSOR_CORRECTABLE (1) -#define ACPI_EINJ_PROCESSOR_UNCORRECTABLE (1<<1) -#define ACPI_EINJ_PROCESSOR_FATAL (1<<2) -#define ACPI_EINJ_MEMORY_CORRECTABLE (1<<3) -#define ACPI_EINJ_MEMORY_UNCORRECTABLE (1<<4) -#define ACPI_EINJ_MEMORY_FATAL (1<<5) -#define ACPI_EINJ_PCIX_CORRECTABLE (1<<6) -#define ACPI_EINJ_PCIX_UNCORRECTABLE (1<<7) -#define ACPI_EINJ_PCIX_FATAL (1<<8) -#define ACPI_EINJ_PLATFORM_CORRECTABLE (1<<9) -#define ACPI_EINJ_PLATFORM_UNCORRECTABLE (1<<10) -#define ACPI_EINJ_PLATFORM_FATAL (1<<11) -#define ACPI_EINJ_CXL_CACHE_CORRECTABLE (1<<12) -#define ACPI_EINJ_CXL_CACHE_UNCORRECTABLE (1<<13) -#define ACPI_EINJ_CXL_CACHE_FATAL (1<<14) -#define ACPI_EINJ_CXL_MEM_CORRECTABLE (1<<15) -#define ACPI_EINJ_CXL_MEM_UNCORRECTABLE (1<<16) -#define ACPI_EINJ_CXL_MEM_FATAL (1<<17) -#define ACPI_EINJ_VENDOR_DEFINED (1<<31) - - -/******************************************************************************* - * - * ERST - Error Record Serialization Table (ACPI 4.0) - * Version 1 - * - ******************************************************************************/ - -typedef struct acpi_table_erst -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT32 HeaderLength; - UINT32 Reserved; - UINT32 Entries; - -} ACPI_TABLE_ERST; - - -/* ERST Serialization Entries (actions) */ - -typedef struct acpi_erst_entry -{ - ACPI_WHEA_HEADER WheaHeader; /* Common header for WHEA tables */ - -} ACPI_ERST_ENTRY; - -/* Masks for Flags field above */ - -#define ACPI_ERST_PRESERVE (1) - -/* Values for Action field above */ - -enum AcpiErstActions -{ - ACPI_ERST_BEGIN_WRITE = 0, - ACPI_ERST_BEGIN_READ = 1, - ACPI_ERST_BEGIN_CLEAR = 2, - ACPI_ERST_END = 3, - ACPI_ERST_SET_RECORD_OFFSET = 4, - ACPI_ERST_EXECUTE_OPERATION = 5, - ACPI_ERST_CHECK_BUSY_STATUS = 6, - ACPI_ERST_GET_COMMAND_STATUS = 7, - ACPI_ERST_GET_RECORD_ID = 8, - ACPI_ERST_SET_RECORD_ID = 9, - ACPI_ERST_GET_RECORD_COUNT = 10, - ACPI_ERST_BEGIN_DUMMY_WRIITE = 11, - ACPI_ERST_NOT_USED = 12, - ACPI_ERST_GET_ERROR_RANGE = 13, - ACPI_ERST_GET_ERROR_LENGTH = 14, - ACPI_ERST_GET_ERROR_ATTRIBUTES = 15, - ACPI_ERST_EXECUTE_TIMINGS = 16, - ACPI_ERST_ACTION_RESERVED = 17 /* 17 and greater are reserved */ -}; - -/* Values for Instruction field above */ - -enum AcpiErstInstructions -{ - ACPI_ERST_READ_REGISTER = 0, - ACPI_ERST_READ_REGISTER_VALUE = 1, - ACPI_ERST_WRITE_REGISTER = 2, - ACPI_ERST_WRITE_REGISTER_VALUE = 3, - ACPI_ERST_NOOP = 4, - ACPI_ERST_LOAD_VAR1 = 5, - ACPI_ERST_LOAD_VAR2 = 6, - ACPI_ERST_STORE_VAR1 = 7, - ACPI_ERST_ADD = 8, - ACPI_ERST_SUBTRACT = 9, - ACPI_ERST_ADD_VALUE = 10, - ACPI_ERST_SUBTRACT_VALUE = 11, - ACPI_ERST_STALL = 12, - ACPI_ERST_STALL_WHILE_TRUE = 13, - ACPI_ERST_SKIP_NEXT_IF_TRUE = 14, - ACPI_ERST_GOTO = 15, - ACPI_ERST_SET_SRC_ADDRESS_BASE = 16, - ACPI_ERST_SET_DST_ADDRESS_BASE = 17, - ACPI_ERST_MOVE_DATA = 18, - ACPI_ERST_INSTRUCTION_RESERVED = 19 /* 19 and greater are reserved */ -}; - -/* Command status return values */ - -enum AcpiErstCommandStatus -{ - ACPI_ERST_SUCCESS = 0, - ACPI_ERST_NO_SPACE = 1, - ACPI_ERST_NOT_AVAILABLE = 2, - ACPI_ERST_FAILURE = 3, - ACPI_ERST_RECORD_EMPTY = 4, - ACPI_ERST_NOT_FOUND = 5, - ACPI_ERST_STATUS_RESERVED = 6 /* 6 and greater are reserved */ -}; - - -/* Error Record Serialization Information */ - -typedef struct acpi_erst_info -{ - UINT16 Signature; /* Should be "ER" */ - UINT8 Data[48]; - -} ACPI_ERST_INFO; - - -/******************************************************************************* - * - * FPDT - Firmware Performance Data Table (ACPI 5.0) - * Version 1 - * - ******************************************************************************/ - -typedef struct acpi_table_fpdt -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - -} ACPI_TABLE_FPDT; - - -/* FPDT subtable header (Performance Record Structure) */ - -typedef struct acpi_fpdt_header -{ - UINT16 Type; - UINT8 Length; - UINT8 Revision; - -} ACPI_FPDT_HEADER; - -/* Values for Type field above */ - -enum AcpiFpdtType -{ - ACPI_FPDT_TYPE_BOOT = 0, - ACPI_FPDT_TYPE_S3PERF = 1 -}; - - -/* - * FPDT subtables - */ - -/* 0: Firmware Basic Boot Performance Record */ - -typedef struct acpi_fpdt_boot_pointer -{ - ACPI_FPDT_HEADER Header; - UINT8 Reserved[4]; - UINT64 Address; - -} ACPI_FPDT_BOOT_POINTER; - - -/* 1: S3 Performance Table Pointer Record */ - -typedef struct acpi_fpdt_s3pt_pointer -{ - ACPI_FPDT_HEADER Header; - UINT8 Reserved[4]; - UINT64 Address; - -} ACPI_FPDT_S3PT_POINTER; - - -/* - * S3PT - S3 Performance Table. This table is pointed to by the - * S3 Pointer Record above. - */ -typedef struct acpi_table_s3pt -{ - UINT8 Signature[4]; /* "S3PT" */ - UINT32 Length; - -} ACPI_TABLE_S3PT; - - -/* - * S3PT Subtables (Not part of the actual FPDT) - */ - -/* Values for Type field in S3PT header */ - -enum AcpiS3ptType -{ - ACPI_S3PT_TYPE_RESUME = 0, - ACPI_S3PT_TYPE_SUSPEND = 1, - ACPI_FPDT_BOOT_PERFORMANCE = 2 -}; - -typedef struct acpi_s3pt_resume -{ - ACPI_FPDT_HEADER Header; - UINT32 ResumeCount; - UINT64 FullResume; - UINT64 AverageResume; - -} ACPI_S3PT_RESUME; - -typedef struct acpi_s3pt_suspend -{ - ACPI_FPDT_HEADER Header; - UINT64 SuspendStart; - UINT64 SuspendEnd; - -} ACPI_S3PT_SUSPEND; - - -/* - * FPDT Boot Performance Record (Not part of the actual FPDT) - */ -typedef struct acpi_fpdt_boot -{ - ACPI_FPDT_HEADER Header; - UINT8 Reserved[4]; - UINT64 ResetEnd; - UINT64 LoadStart; - UINT64 StartupStart; - UINT64 ExitServicesEntry; - UINT64 ExitServicesExit; - -} ACPI_FPDT_BOOT; - - -/******************************************************************************* - * - * GTDT - Generic Timer Description Table (ACPI 5.1) - * Version 2 - * - ******************************************************************************/ - -typedef struct acpi_table_gtdt -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT64 CounterBlockAddresss; - UINT32 Reserved; - UINT32 SecureEl1Interrupt; - UINT32 SecureEl1Flags; - UINT32 NonSecureEl1Interrupt; - UINT32 NonSecureEl1Flags; - UINT32 VirtualTimerInterrupt; - UINT32 VirtualTimerFlags; - UINT32 NonSecureEl2Interrupt; - UINT32 NonSecureEl2Flags; - UINT64 CounterReadBlockAddress; - UINT32 PlatformTimerCount; - UINT32 PlatformTimerOffset; - -} ACPI_TABLE_GTDT; - -/* Flag Definitions: Timer Block Physical Timers and Virtual timers */ - -#define ACPI_GTDT_INTERRUPT_MODE (1) -#define ACPI_GTDT_INTERRUPT_POLARITY (1<<1) -#define ACPI_GTDT_ALWAYS_ON (1<<2) - -typedef struct acpi_gtdt_el2 -{ - UINT32 VirtualEL2TimerGsiv; - UINT32 VirtualEL2TimerFlags; -} ACPI_GTDT_EL2; - - -/* Common GTDT subtable header */ - -typedef struct acpi_gtdt_header -{ - UINT8 Type; - UINT16 Length; - -} ACPI_GTDT_HEADER; - -/* Values for GTDT subtable type above */ - -enum AcpiGtdtType -{ - ACPI_GTDT_TYPE_TIMER_BLOCK = 0, - ACPI_GTDT_TYPE_WATCHDOG = 1, - ACPI_GTDT_TYPE_RESERVED = 2 /* 2 and greater are reserved */ -}; - - -/* GTDT Subtables, correspond to Type in acpi_gtdt_header */ - -/* 0: Generic Timer Block */ - -typedef struct acpi_gtdt_timer_block -{ - ACPI_GTDT_HEADER Header; - UINT8 Reserved; - UINT64 BlockAddress; - UINT32 TimerCount; - UINT32 TimerOffset; - -} ACPI_GTDT_TIMER_BLOCK; - -/* Timer Sub-Structure, one per timer */ - -typedef struct acpi_gtdt_timer_entry -{ - UINT8 FrameNumber; - UINT8 Reserved[3]; - UINT64 BaseAddress; - UINT64 El0BaseAddress; - UINT32 TimerInterrupt; - UINT32 TimerFlags; - UINT32 VirtualTimerInterrupt; - UINT32 VirtualTimerFlags; - UINT32 CommonFlags; - -} ACPI_GTDT_TIMER_ENTRY; - -/* Flag Definitions: TimerFlags and VirtualTimerFlags above */ - -#define ACPI_GTDT_GT_IRQ_MODE (1) -#define ACPI_GTDT_GT_IRQ_POLARITY (1<<1) - -/* Flag Definitions: CommonFlags above */ - -#define ACPI_GTDT_GT_IS_SECURE_TIMER (1) -#define ACPI_GTDT_GT_ALWAYS_ON (1<<1) - - -/* 1: SBSA Generic Watchdog Structure */ - -typedef struct acpi_gtdt_watchdog -{ - ACPI_GTDT_HEADER Header; - UINT8 Reserved; - UINT64 RefreshFrameAddress; - UINT64 ControlFrameAddress; - UINT32 TimerInterrupt; - UINT32 TimerFlags; - -} ACPI_GTDT_WATCHDOG; - -/* Flag Definitions: TimerFlags above */ - -#define ACPI_GTDT_WATCHDOG_IRQ_MODE (1) -#define ACPI_GTDT_WATCHDOG_IRQ_POLARITY (1<<1) -#define ACPI_GTDT_WATCHDOG_SECURE (1<<2) - - -/******************************************************************************* - * - * HEST - Hardware Error Source Table (ACPI 4.0) - * Version 1 - * - ******************************************************************************/ - -typedef struct acpi_table_hest -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT32 ErrorSourceCount; - -} ACPI_TABLE_HEST; - - -/* HEST subtable header */ - -typedef struct acpi_hest_header -{ - UINT16 Type; - UINT16 SourceId; - -} ACPI_HEST_HEADER; - - -/* Values for Type field above for subtables */ - -enum AcpiHestTypes -{ - ACPI_HEST_TYPE_IA32_CHECK = 0, - ACPI_HEST_TYPE_IA32_CORRECTED_CHECK = 1, - ACPI_HEST_TYPE_IA32_NMI = 2, - ACPI_HEST_TYPE_NOT_USED3 = 3, - ACPI_HEST_TYPE_NOT_USED4 = 4, - ACPI_HEST_TYPE_NOT_USED5 = 5, - ACPI_HEST_TYPE_AER_ROOT_PORT = 6, - ACPI_HEST_TYPE_AER_ENDPOINT = 7, - ACPI_HEST_TYPE_AER_BRIDGE = 8, - ACPI_HEST_TYPE_GENERIC_ERROR = 9, - ACPI_HEST_TYPE_GENERIC_ERROR_V2 = 10, - ACPI_HEST_TYPE_IA32_DEFERRED_CHECK = 11, - ACPI_HEST_TYPE_RESERVED = 12 /* 12 and greater are reserved */ -}; - - -/* - * HEST substructures contained in subtables - */ - -/* - * IA32 Error Bank(s) - Follows the ACPI_HEST_IA_MACHINE_CHECK and - * ACPI_HEST_IA_CORRECTED structures. - */ -typedef struct acpi_hest_ia_error_bank -{ - UINT8 BankNumber; - UINT8 ClearStatusOnInit; - UINT8 StatusFormat; - UINT8 Reserved; - UINT32 ControlRegister; - UINT64 ControlData; - UINT32 StatusRegister; - UINT32 AddressRegister; - UINT32 MiscRegister; - -} ACPI_HEST_IA_ERROR_BANK; - - -/* Common HEST sub-structure for PCI/AER structures below (6,7,8) */ - -typedef struct acpi_hest_aer_common -{ - UINT16 Reserved1; - UINT8 Flags; - UINT8 Enabled; - UINT32 RecordsToPreallocate; - UINT32 MaxSectionsPerRecord; - UINT32 Bus; /* Bus and Segment numbers */ - UINT16 Device; - UINT16 Function; - UINT16 DeviceControl; - UINT16 Reserved2; - UINT32 UncorrectableMask; - UINT32 UncorrectableSeverity; - UINT32 CorrectableMask; - UINT32 AdvancedCapabilities; - -} ACPI_HEST_AER_COMMON; - -/* Masks for HEST Flags fields */ - -#define ACPI_HEST_FIRMWARE_FIRST (1) -#define ACPI_HEST_GLOBAL (1<<1) -#define ACPI_HEST_GHES_ASSIST (1<<2) - -/* - * Macros to access the bus/segment numbers in Bus field above: - * Bus number is encoded in bits 7:0 - * Segment number is encoded in bits 23:8 - */ -#define ACPI_HEST_BUS(Bus) ((Bus) & 0xFF) -#define ACPI_HEST_SEGMENT(Bus) (((Bus) >> 8) & 0xFFFF) - - -/* Hardware Error Notification */ - -typedef struct acpi_hest_notify -{ - UINT8 Type; - UINT8 Length; - UINT16 ConfigWriteEnable; - UINT32 PollInterval; - UINT32 Vector; - UINT32 PollingThresholdValue; - UINT32 PollingThresholdWindow; - UINT32 ErrorThresholdValue; - UINT32 ErrorThresholdWindow; - -} ACPI_HEST_NOTIFY; - -/* Values for Notify Type field above */ - -enum AcpiHestNotifyTypes -{ - ACPI_HEST_NOTIFY_POLLED = 0, - ACPI_HEST_NOTIFY_EXTERNAL = 1, - ACPI_HEST_NOTIFY_LOCAL = 2, - ACPI_HEST_NOTIFY_SCI = 3, - ACPI_HEST_NOTIFY_NMI = 4, - ACPI_HEST_NOTIFY_CMCI = 5, /* ACPI 5.0 */ - ACPI_HEST_NOTIFY_MCE = 6, /* ACPI 5.0 */ - ACPI_HEST_NOTIFY_GPIO = 7, /* ACPI 6.0 */ - ACPI_HEST_NOTIFY_SEA = 8, /* ACPI 6.1 */ - ACPI_HEST_NOTIFY_SEI = 9, /* ACPI 6.1 */ - ACPI_HEST_NOTIFY_GSIV = 10, /* ACPI 6.1 */ - ACPI_HEST_NOTIFY_SOFTWARE_DELEGATED = 11, /* ACPI 6.2 */ - ACPI_HEST_NOTIFY_RESERVED = 12 /* 12 and greater are reserved */ -}; - -/* Values for ConfigWriteEnable bitfield above */ - -#define ACPI_HEST_TYPE (1) -#define ACPI_HEST_POLL_INTERVAL (1<<1) -#define ACPI_HEST_POLL_THRESHOLD_VALUE (1<<2) -#define ACPI_HEST_POLL_THRESHOLD_WINDOW (1<<3) -#define ACPI_HEST_ERR_THRESHOLD_VALUE (1<<4) -#define ACPI_HEST_ERR_THRESHOLD_WINDOW (1<<5) - - -/* - * HEST subtables - */ - -/* 0: IA32 Machine Check Exception */ - -typedef struct acpi_hest_ia_machine_check -{ - ACPI_HEST_HEADER Header; - UINT16 Reserved1; - UINT8 Flags; /* See flags ACPI_HEST_GLOBAL, etc. above */ - UINT8 Enabled; - UINT32 RecordsToPreallocate; - UINT32 MaxSectionsPerRecord; - UINT64 GlobalCapabilityData; - UINT64 GlobalControlData; - UINT8 NumHardwareBanks; - UINT8 Reserved3[7]; - -} ACPI_HEST_IA_MACHINE_CHECK; - - -/* 1: IA32 Corrected Machine Check */ - -typedef struct acpi_hest_ia_corrected -{ - ACPI_HEST_HEADER Header; - UINT16 Reserved1; - UINT8 Flags; /* See flags ACPI_HEST_GLOBAL, etc. above */ - UINT8 Enabled; - UINT32 RecordsToPreallocate; - UINT32 MaxSectionsPerRecord; - ACPI_HEST_NOTIFY Notify; - UINT8 NumHardwareBanks; - UINT8 Reserved2[3]; - -} ACPI_HEST_IA_CORRECTED; - - -/* 2: IA32 Non-Maskable Interrupt */ - -typedef struct acpi_hest_ia_nmi -{ - ACPI_HEST_HEADER Header; - UINT32 Reserved; - UINT32 RecordsToPreallocate; - UINT32 MaxSectionsPerRecord; - UINT32 MaxRawDataLength; - -} ACPI_HEST_IA_NMI; - - -/* 3,4,5: Not used */ - -/* 6: PCI Express Root Port AER */ - -typedef struct acpi_hest_aer_root -{ - ACPI_HEST_HEADER Header; - ACPI_HEST_AER_COMMON Aer; - UINT32 RootErrorCommand; - -} ACPI_HEST_AER_ROOT; - - -/* 7: PCI Express AER (AER Endpoint) */ - -typedef struct acpi_hest_aer -{ - ACPI_HEST_HEADER Header; - ACPI_HEST_AER_COMMON Aer; - -} ACPI_HEST_AER; - - -/* 8: PCI Express/PCI-X Bridge AER */ - -typedef struct acpi_hest_aer_bridge -{ - ACPI_HEST_HEADER Header; - ACPI_HEST_AER_COMMON Aer; - UINT32 UncorrectableMask2; - UINT32 UncorrectableSeverity2; - UINT32 AdvancedCapabilities2; - -} ACPI_HEST_AER_BRIDGE; - - -/* 9: Generic Hardware Error Source */ - -typedef struct acpi_hest_generic -{ - ACPI_HEST_HEADER Header; - UINT16 RelatedSourceId; - UINT8 Reserved; - UINT8 Enabled; - UINT32 RecordsToPreallocate; - UINT32 MaxSectionsPerRecord; - UINT32 MaxRawDataLength; - ACPI_GENERIC_ADDRESS ErrorStatusAddress; - ACPI_HEST_NOTIFY Notify; - UINT32 ErrorBlockLength; - -} ACPI_HEST_GENERIC; - - -/* 10: Generic Hardware Error Source, version 2 */ - -typedef struct acpi_hest_generic_v2 -{ - ACPI_HEST_HEADER Header; - UINT16 RelatedSourceId; - UINT8 Reserved; - UINT8 Enabled; - UINT32 RecordsToPreallocate; - UINT32 MaxSectionsPerRecord; - UINT32 MaxRawDataLength; - ACPI_GENERIC_ADDRESS ErrorStatusAddress; - ACPI_HEST_NOTIFY Notify; - UINT32 ErrorBlockLength; - ACPI_GENERIC_ADDRESS ReadAckRegister; - UINT64 ReadAckPreserve; - UINT64 ReadAckWrite; - -} ACPI_HEST_GENERIC_V2; - - -/* Generic Error Status block */ - -typedef struct acpi_hest_generic_status -{ - UINT32 BlockStatus; - UINT32 RawDataOffset; - UINT32 RawDataLength; - UINT32 DataLength; - UINT32 ErrorSeverity; - -} ACPI_HEST_GENERIC_STATUS; - -/* Values for BlockStatus flags above */ - -#define ACPI_HEST_UNCORRECTABLE (1) -#define ACPI_HEST_CORRECTABLE (1<<1) -#define ACPI_HEST_MULTIPLE_UNCORRECTABLE (1<<2) -#define ACPI_HEST_MULTIPLE_CORRECTABLE (1<<3) -#define ACPI_HEST_ERROR_ENTRY_COUNT (0xFF<<4) /* 8 bits, error count */ - - -/* Generic Error Data entry */ - -typedef struct acpi_hest_generic_data -{ - UINT8 SectionType[16]; - UINT32 ErrorSeverity; - UINT16 Revision; - UINT8 ValidationBits; - UINT8 Flags; - UINT32 ErrorDataLength; - UINT8 FruId[16]; - UINT8 FruText[20]; - -} ACPI_HEST_GENERIC_DATA; - -/* Extension for revision 0x0300 */ - -typedef struct acpi_hest_generic_data_v300 -{ - UINT8 SectionType[16]; - UINT32 ErrorSeverity; - UINT16 Revision; - UINT8 ValidationBits; - UINT8 Flags; - UINT32 ErrorDataLength; - UINT8 FruId[16]; - UINT8 FruText[20]; - UINT64 TimeStamp; - -} ACPI_HEST_GENERIC_DATA_V300; - -/* Values for ErrorSeverity above */ - -#define ACPI_HEST_GEN_ERROR_RECOVERABLE 0 -#define ACPI_HEST_GEN_ERROR_FATAL 1 -#define ACPI_HEST_GEN_ERROR_CORRECTED 2 -#define ACPI_HEST_GEN_ERROR_NONE 3 - -/* Flags for ValidationBits above */ - -#define ACPI_HEST_GEN_VALID_FRU_ID (1) -#define ACPI_HEST_GEN_VALID_FRU_STRING (1<<1) -#define ACPI_HEST_GEN_VALID_TIMESTAMP (1<<2) - - -/* 11: IA32 Deferred Machine Check Exception (ACPI 6.2) */ - -typedef struct acpi_hest_ia_deferred_check -{ - ACPI_HEST_HEADER Header; - UINT16 Reserved1; - UINT8 Flags; /* See flags ACPI_HEST_GLOBAL, etc. above */ - UINT8 Enabled; - UINT32 RecordsToPreallocate; - UINT32 MaxSectionsPerRecord; - ACPI_HEST_NOTIFY Notify; - UINT8 NumHardwareBanks; - UINT8 Reserved2[3]; - -} ACPI_HEST_IA_DEFERRED_CHECK; - - -/******************************************************************************* - * - * HMAT - Heterogeneous Memory Attributes Table (ACPI 6.3) - * - ******************************************************************************/ - -typedef struct acpi_table_hmat -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT32 Reserved; - -} ACPI_TABLE_HMAT; - - -/* Values for HMAT structure types */ - -enum AcpiHmatType -{ - ACPI_HMAT_TYPE_ADDRESS_RANGE = 0, /* Memory subsystem address range */ - ACPI_HMAT_TYPE_LOCALITY = 1, /* System locality latency and bandwidth information */ - ACPI_HMAT_TYPE_CACHE = 2, /* Memory side cache information */ - ACPI_HMAT_TYPE_RESERVED = 3 /* 3 and greater are reserved */ -}; - -typedef struct acpi_hmat_structure -{ - UINT16 Type; - UINT16 Reserved; - UINT32 Length; - -} ACPI_HMAT_STRUCTURE; - - -/* - * HMAT Structures, correspond to Type in ACPI_HMAT_STRUCTURE - */ - -/* 0: Memory proximity domain attributes */ - -typedef struct acpi_hmat_proximity_domain -{ - ACPI_HMAT_STRUCTURE Header; - UINT16 Flags; - UINT16 Reserved1; - UINT32 InitiatorPD; /* Attached Initiator proximity domain */ - UINT32 MemoryPD; /* Memory proximity domain */ - UINT32 Reserved2; - UINT64 Reserved3; - UINT64 Reserved4; - -} ACPI_HMAT_PROXIMITY_DOMAIN; - -/* Masks for Flags field above */ - -#define ACPI_HMAT_INITIATOR_PD_VALID (1) /* 1: InitiatorPD field is valid */ - - -/* 1: System locality latency and bandwidth information */ - -typedef struct acpi_hmat_locality -{ - ACPI_HMAT_STRUCTURE Header; - UINT8 Flags; - UINT8 DataType; - UINT8 MinTransferSize; - UINT8 Reserved1; - UINT32 NumberOfInitiatorPDs; - UINT32 NumberOfTargetPDs; - UINT32 Reserved2; - UINT64 EntryBaseUnit; - -} ACPI_HMAT_LOCALITY; - -/* Masks for Flags field above */ - -#define ACPI_HMAT_MEMORY_HIERARCHY (0x0F) /* Bits 0-3 */ - -/* Values for Memory Hierarchy flags */ - -#define ACPI_HMAT_MEMORY 0 -#define ACPI_HMAT_1ST_LEVEL_CACHE 1 -#define ACPI_HMAT_2ND_LEVEL_CACHE 2 -#define ACPI_HMAT_3RD_LEVEL_CACHE 3 -#define ACPI_HMAT_MINIMUM_XFER_SIZE 0x10 /* Bit 4: ACPI 6.4 */ -#define ACPI_HMAT_NON_SEQUENTIAL_XFERS 0x20 /* Bit 5: ACPI 6.4 */ - - -/* Values for DataType field above */ - -#define ACPI_HMAT_ACCESS_LATENCY 0 -#define ACPI_HMAT_READ_LATENCY 1 -#define ACPI_HMAT_WRITE_LATENCY 2 -#define ACPI_HMAT_ACCESS_BANDWIDTH 3 -#define ACPI_HMAT_READ_BANDWIDTH 4 -#define ACPI_HMAT_WRITE_BANDWIDTH 5 - - -/* 2: Memory side cache information */ - -typedef struct acpi_hmat_cache -{ - ACPI_HMAT_STRUCTURE Header; - UINT32 MemoryPD; - UINT32 Reserved1; - UINT64 CacheSize; - UINT32 CacheAttributes; - UINT16 AddressMode; - UINT16 NumberOfSMBIOSHandles; - -} ACPI_HMAT_CACHE; - -/* Masks for CacheAttributes field above */ - -#define ACPI_HMAT_TOTAL_CACHE_LEVEL (0x0000000F) -#define ACPI_HMAT_CACHE_LEVEL (0x000000F0) -#define ACPI_HMAT_CACHE_ASSOCIATIVITY (0x00000F00) -#define ACPI_HMAT_WRITE_POLICY (0x0000F000) -#define ACPI_HMAT_CACHE_LINE_SIZE (0xFFFF0000) - -#define ACPI_HMAT_CACHE_MODE_UNKNOWN (0) -#define ACPI_HMAT_CACHE_MODE_EXTENDED_LINEAR (1) - -/* Values for cache associativity flag */ - -#define ACPI_HMAT_CA_NONE (0) -#define ACPI_HMAT_CA_DIRECT_MAPPED (1) -#define ACPI_HMAT_CA_COMPLEX_CACHE_INDEXING (2) - -/* Values for write policy flag */ - -#define ACPI_HMAT_CP_NONE (0) -#define ACPI_HMAT_CP_WB (1) -#define ACPI_HMAT_CP_WT (2) - - -/******************************************************************************* - * - * HPET - High Precision Event Timer table - * Version 1 - * - * Conforms to "IA-PC HPET (High Precision Event Timers) Specification", - * Version 1.0a, October 2004 - * - ******************************************************************************/ - -typedef struct acpi_table_hpet -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT32 Id; /* Hardware ID of event timer block */ - ACPI_GENERIC_ADDRESS Address; /* Address of event timer block */ - UINT8 Sequence; /* HPET sequence number */ - UINT16 MinimumTick; /* Main counter min tick, periodic mode */ - UINT8 Flags; - -} ACPI_TABLE_HPET; - -/* Masks for Flags field above */ - -#define ACPI_HPET_PAGE_PROTECT_MASK (3) - -/* Values for Page Protect flags */ - -enum AcpiHpetPageProtect -{ - ACPI_HPET_NO_PAGE_PROTECT = 0, - ACPI_HPET_PAGE_PROTECT4 = 1, - ACPI_HPET_PAGE_PROTECT64 = 2 -}; - - -/******************************************************************************* - * - * IBFT - Boot Firmware Table - * Version 1 - * - * Conforms to "iSCSI Boot Firmware Table (iBFT) as Defined in ACPI 3.0b - * Specification", Version 1.01, March 1, 2007 - * - * Note: It appears that this table is not intended to appear in the RSDT/XSDT. - * Therefore, it is not currently supported by the disassembler. - * - ******************************************************************************/ - -typedef struct acpi_table_ibft -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT8 Reserved[12]; - -} ACPI_TABLE_IBFT; - - -/* IBFT common subtable header */ - -typedef struct acpi_ibft_header -{ - UINT8 Type; - UINT8 Version; - UINT16 Length; - UINT8 Index; - UINT8 Flags; - -} ACPI_IBFT_HEADER; - -/* Values for Type field above */ - -enum AcpiIbftType -{ - ACPI_IBFT_TYPE_NOT_USED = 0, - ACPI_IBFT_TYPE_CONTROL = 1, - ACPI_IBFT_TYPE_INITIATOR = 2, - ACPI_IBFT_TYPE_NIC = 3, - ACPI_IBFT_TYPE_TARGET = 4, - ACPI_IBFT_TYPE_EXTENSIONS = 5, - ACPI_IBFT_TYPE_RESERVED = 6 /* 6 and greater are reserved */ -}; - - -/* IBFT subtables */ - -typedef struct acpi_ibft_control -{ - ACPI_IBFT_HEADER Header; - UINT16 Extensions; - UINT16 InitiatorOffset; - UINT16 Nic0Offset; - UINT16 Target0Offset; - UINT16 Nic1Offset; - UINT16 Target1Offset; - -} ACPI_IBFT_CONTROL; - -typedef struct acpi_ibft_initiator -{ - ACPI_IBFT_HEADER Header; - UINT8 SnsServer[16]; - UINT8 SlpServer[16]; - UINT8 PrimaryServer[16]; - UINT8 SecondaryServer[16]; - UINT16 NameLength; - UINT16 NameOffset; - -} ACPI_IBFT_INITIATOR; - -typedef struct acpi_ibft_nic -{ - ACPI_IBFT_HEADER Header; - UINT8 IpAddress[16]; - UINT8 SubnetMaskPrefix; - UINT8 Origin; - UINT8 Gateway[16]; - UINT8 PrimaryDns[16]; - UINT8 SecondaryDns[16]; - UINT8 Dhcp[16]; - UINT16 Vlan; - UINT8 MacAddress[6]; - UINT16 PciAddress; - UINT16 NameLength; - UINT16 NameOffset; - -} ACPI_IBFT_NIC; - -typedef struct acpi_ibft_target -{ - ACPI_IBFT_HEADER Header; - UINT8 TargetIpAddress[16]; - UINT16 TargetIpSocket; - UINT8 TargetBootLun[8]; - UINT8 ChapType; - UINT8 NicAssociation; - UINT16 TargetNameLength; - UINT16 TargetNameOffset; - UINT16 ChapNameLength; - UINT16 ChapNameOffset; - UINT16 ChapSecretLength; - UINT16 ChapSecretOffset; - UINT16 ReverseChapNameLength; - UINT16 ReverseChapNameOffset; - UINT16 ReverseChapSecretLength; - UINT16 ReverseChapSecretOffset; - -} ACPI_IBFT_TARGET; - - -/* Reset to default packing */ - -#pragma pack() - -#endif /* __ACTBL1_H__ */ diff --git a/drivers/include/acpica/actbl2.h b/drivers/include/acpica/actbl2.h deleted file mode 100644 index a51ff1e..0000000 --- a/drivers/include/acpica/actbl2.h +++ /dev/null @@ -1,4351 +0,0 @@ -/****************************************************************************** - * - * Name: actbl2.h - ACPI Table Definitions - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef __ACTBL2_H__ -#define __ACTBL2_H__ - - -/******************************************************************************* - * - * Additional ACPI Tables (2) - * - * These tables are not consumed directly by the ACPICA subsystem, but are - * included here to support device drivers and the AML disassembler. - * - ******************************************************************************/ - - -/* - * Values for description table header signatures for tables defined in this - * file. Useful because they make it more difficult to inadvertently type in - * the wrong signature. - */ -#define ACPI_SIG_AGDI "AGDI" /* Arm Generic Diagnostic Dump and Reset Device Interface */ -#define ACPI_SIG_APMT "APMT" /* Arm Performance Monitoring Unit table */ -#define ACPI_SIG_BDAT "BDAT" /* BIOS Data ACPI Table */ -#define ACPI_SIG_CCEL "CCEL" /* CC Event Log Table */ -#define ACPI_SIG_CDAT "CDAT" /* Coherent Device Attribute Table */ -#define ACPI_SIG_ERDT "ERDT" /* Enhanced Resource Director Technology */ -#define ACPI_SIG_IORT "IORT" /* IO Remapping Table */ -#define ACPI_SIG_IOVT "IOVT" /* I/O Virtualization Table */ -#define ACPI_SIG_IVRS "IVRS" /* I/O Virtualization Reporting Structure */ -#define ACPI_SIG_KEYP "KEYP" /* Key Programming Interface for IDE */ -#define ACPI_SIG_LPIT "LPIT" /* Low Power Idle Table */ -#define ACPI_SIG_MADT "APIC" /* Multiple APIC Description Table */ -#define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */ -#define ACPI_SIG_MCHI "MCHI" /* Management Controller Host Interface table */ -#define ACPI_SIG_MPAM "MPAM" /* Memory System Resource Partitioning and Monitoring Table */ -#define ACPI_SIG_MPST "MPST" /* Memory Power State Table */ -#define ACPI_SIG_MRRM "MRRM" /* Memory Range and Region Mapping table */ -#define ACPI_SIG_MSDM "MSDM" /* Microsoft Data Management Table */ -#define ACPI_SIG_NFIT "NFIT" /* NVDIMM Firmware Interface Table */ -#define ACPI_SIG_NHLT "NHLT" /* Non HD Audio Link Table */ -#define ACPI_SIG_PCCT "PCCT" /* Platform Communications Channel Table */ -#define ACPI_SIG_PDTT "PDTT" /* Platform Debug Trigger Table */ -#define ACPI_SIG_PHAT "PHAT" /* Platform Health Assessment Table */ -#define ACPI_SIG_PMTT "PMTT" /* Platform Memory Topology Table */ -#define ACPI_SIG_PPTT "PPTT" /* Processor Properties Topology Table */ -#define ACPI_SIG_PRMT "PRMT" /* Platform Runtime Mechanism Table */ -#define ACPI_SIG_RASF "RASF" /* RAS Feature table */ -#define ACPI_SIG_RAS2 "RAS2" /* RAS2 Feature table */ -#define ACPI_SIG_RGRT "RGRT" /* Regulatory Graphics Resource Table */ -#define ACPI_SIG_RHCT "RHCT" /* RISC-V Hart Capabilities Table */ -#define ACPI_SIG_RIMT "RIMT" /* RISC-V IO Mapping Table */ -#define ACPI_SIG_SBST "SBST" /* Smart Battery Specification Table */ -#define ACPI_SIG_SDEI "SDEI" /* Software Delegated Exception Interface Table */ -#define ACPI_SIG_SDEV "SDEV" /* Secure Devices table */ -#define ACPI_SIG_SVKL "SVKL" /* Storage Volume Key Location Table */ -#define ACPI_SIG_SWFT "SWFT" /* SoundWire File Table */ -#define ACPI_SIG_TDEL "TDEL" /* TD Event Log Table */ - - -/* - * All tables must be byte-packed to match the ACPI specification, since - * the tables are provided by the system BIOS. - */ -#pragma pack(1) - -/* - * Note: C bitfields are not used for this reason: - * - * "Bitfields are great and easy to read, but unfortunately the C language - * does not specify the layout of bitfields in memory, which means they are - * essentially useless for dealing with packed data in on-disk formats or - * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me, - * this decision was a design error in C. Ritchie could have picked an order - * and stuck with it." Norman Ramsey. - * See http://stackoverflow.com/a/1053662/41661 - */ - - -/******************************************************************************* - * - * AEST - Arm Error Source Table - * - * Conforms to: ACPI for the Armv8 RAS Extensions 1.1 Platform Design Document - * September 2020. - * - ******************************************************************************/ - -typedef struct acpi_table_aest -{ - ACPI_TABLE_HEADER Header; - -} ACPI_TABLE_AEST; - -/* Common Subtable header - one per Node Structure (Subtable) */ - -typedef struct acpi_aest_hdr -{ - UINT8 Type; - UINT16 Length; - UINT8 Reserved; - UINT32 NodeSpecificOffset; - UINT32 NodeInterfaceOffset; - UINT32 NodeInterruptOffset; - UINT32 NodeInterruptCount; - UINT64 TimestampRate; - UINT64 Reserved1; - UINT64 ErrorInjectionRate; - -} ACPI_AEST_HEADER; - -/* Values for Type above */ - -#define ACPI_AEST_PROCESSOR_ERROR_NODE 0 -#define ACPI_AEST_MEMORY_ERROR_NODE 1 -#define ACPI_AEST_SMMU_ERROR_NODE 2 -#define ACPI_AEST_VENDOR_ERROR_NODE 3 -#define ACPI_AEST_GIC_ERROR_NODE 4 -#define ACPI_AEST_PCIE_ERROR_NODE 5 -#define ACPI_AEST_PROXY_ERROR_NODE 6 -#define ACPI_AEST_NODE_TYPE_RESERVED 7 /* 7 and above are reserved */ - - -/* - * AEST subtables (Error nodes) - */ - -/* 0: Processor Error */ - -typedef struct acpi_aest_processor -{ - UINT32 ProcessorId; - UINT8 ResourceType; - UINT8 Reserved; - UINT8 Flags; - UINT8 Revision; - UINT64 ProcessorAffinity; - -} ACPI_AEST_PROCESSOR; - -/* Values for ResourceType above, related structs below */ - -#define ACPI_AEST_CACHE_RESOURCE 0 -#define ACPI_AEST_TLB_RESOURCE 1 -#define ACPI_AEST_GENERIC_RESOURCE 2 -#define ACPI_AEST_RESOURCE_RESERVED 3 /* 3 and above are reserved */ - -/* 0R: Processor Cache Resource Substructure */ - -typedef struct acpi_aest_processor_cache -{ - UINT32 CacheReference; - UINT32 Reserved; - -} ACPI_AEST_PROCESSOR_CACHE; - -/* Values for CacheType above */ - -#define ACPI_AEST_CACHE_DATA 0 -#define ACPI_AEST_CACHE_INSTRUCTION 1 -#define ACPI_AEST_CACHE_UNIFIED 2 -#define ACPI_AEST_CACHE_RESERVED 3 /* 3 and above are reserved */ - -/* 1R: Processor TLB Resource Substructure */ - -typedef struct acpi_aest_processor_tlb -{ - UINT32 TlbLevel; - UINT32 Reserved; - -} ACPI_AEST_PROCESSOR_TLB; - -/* 2R: Processor Generic Resource Substructure */ - -typedef struct acpi_aest_processor_generic -{ - UINT32 Resource; - -} ACPI_AEST_PROCESSOR_GENERIC; - -/* 1: Memory Error */ - -typedef struct acpi_aest_memory -{ - UINT32 SratProximityDomain; - -} ACPI_AEST_MEMORY; - -/* 2: Smmu Error */ - -typedef struct acpi_aest_smmu -{ - UINT32 IortNodeReference; - UINT32 SubcomponentReference; - -} ACPI_AEST_SMMU; - -/* 3: Vendor Defined */ - -typedef struct acpi_aest_vendor -{ - UINT32 AcpiHid; - UINT32 AcpiUid; - UINT8 VendorSpecificData[16]; - -} ACPI_AEST_VENDOR; - -/* 3: Vendor Defined V2 */ - -typedef struct acpi_aest_vendor_v2 -{ - UINT64 AcpiHid; - UINT32 AcpiUid; - UINT8 VendorSpecificData[16]; - -} ACPI_AEST_VENDOR_V2; - -/* 4: Gic Error */ - -typedef struct acpi_aest_gic -{ - UINT32 InterfaceType; - UINT32 InstanceId; - -} ACPI_AEST_GIC; - -/* Values for InterfaceType above */ - -#define ACPI_AEST_GIC_CPU 0 -#define ACPI_AEST_GIC_DISTRIBUTOR 1 -#define ACPI_AEST_GIC_REDISTRIBUTOR 2 -#define ACPI_AEST_GIC_ITS 3 -#define ACPI_AEST_GIC_RESERVED 4 /* 4 and above are reserved */ - -/* 5: PCIe Error */ - -typedef struct acpi_aest_pcie -{ - UINT32 IortNodeReference; - -} ACPI_AEST_PCIE; - - -/* 6: Proxy Error */ - -typedef struct acpi_aest_proxy -{ - UINT64 NodeAddress; - -} ACPI_AEST_PROXY; - -/* Node Interface Structure */ - -typedef struct acpi_aest_node_interface -{ - UINT8 Type; - UINT8 Reserved[3]; - UINT32 Flags; - UINT64 Address; - UINT32 ErrorRecordIndex; - UINT32 ErrorRecordCount; - UINT64 ErrorRecordImplemented; - UINT64 ErrorStatusReporting; - UINT64 AddressingMode; - -} ACPI_AEST_NODE_INTERFACE; - -/* Node Interface Structure V2*/ - -typedef struct acpi_aest_node_interface_header -{ - UINT8 Type; - UINT8 GroupFormat; - UINT8 Reserved[2]; - UINT32 Flags; - UINT64 Address; - UINT32 ErrorRecordIndex; - UINT32 ErrorRecordCount; - -} ACPI_AEST_NODE_INTERFACE_HEADER; - -#define ACPI_AEST_NODE_GROUP_FORMAT_4K 0 -#define ACPI_AEST_NODE_GROUP_FORMAT_16K 1 -#define ACPI_AEST_NODE_GROUP_FORMAT_64K 2 - -typedef struct acpi_aest_node_interface_common -{ - UINT32 ErrorNodeDevice; - UINT32 ProcessorAffinity; - UINT64 ErrorGroupRegisterBase; - UINT64 FaultInjectRegisterBase; - UINT64 InterruptConfigRegisterBase; - -} ACPI_AEST_NODE_INTERFACE_COMMON; - -typedef struct acpi_aest_node_interface_4k -{ - UINT64 ErrorRecordImplemented; - UINT64 ErrorStatusReporting; - UINT64 AddressingMode; - ACPI_AEST_NODE_INTERFACE_COMMON Common; - -} ACPI_AEST_NODE_INTERFACE_4K; - -typedef struct acpi_aest_node_interface_16k -{ - UINT64 ErrorRecordImplemented[4]; - UINT64 ErrorStatusReporting[4]; - UINT64 AddressingMode[4]; - ACPI_AEST_NODE_INTERFACE_COMMON Common; - -} ACPI_AEST_NODE_INTERFACE_16K; - -typedef struct acpi_aest_node_interface_64k -{ - INT64 ErrorRecordImplemented[14]; - UINT64 ErrorStatusReporting[14]; - UINT64 AddressingMode[14]; - ACPI_AEST_NODE_INTERFACE_COMMON Common; - -} ACPI_AEST_NODE_INTERFACE_64K; - -/* Values for Type field above */ - -#define ACPI_AEST_NODE_SYSTEM_REGISTER 0 -#define ACPI_AEST_NODE_MEMORY_MAPPED 1 -#define ACPI_AEST_NODE_SINGLE_RECORD_MEMORY_MAPPED 2 -#define ACPI_AEST_XFACE_RESERVED 3 /* 2 and above are reserved */ - -/* Node Interrupt Structure */ - -typedef struct acpi_aest_node_interrupt -{ - UINT8 Type; - UINT8 Reserved[2]; - UINT8 Flags; - UINT32 Gsiv; - UINT8 IortId; - UINT8 Reserved1[3]; - -} ACPI_AEST_NODE_INTERRUPT; - -/* Node Interrupt Structure V2 */ - -typedef struct acpi_aest_node_interrupt_v2 -{ - UINT8 Type; - UINT8 Reserved[2]; - UINT8 Flags; - UINT32 Gsiv; - UINT8 Reserved1[4]; - -} ACPI_AEST_NODE_INTERRUPT_V2; - -/* Values for Type field above */ - -#define ACPI_AEST_NODE_FAULT_HANDLING 0 -#define ACPI_AEST_NODE_ERROR_RECOVERY 1 -#define ACPI_AEST_XRUPT_RESERVED 2 /* 2 and above are reserved */ - - -/******************************************************************************* - * AGDI - Arm Generic Diagnostic Dump and Reset Device Interface - * - * Conforms to "ACPI for Arm Components 1.1, Platform Design Document" - * ARM DEN0093 v1.1 - * - ******************************************************************************/ -typedef struct acpi_table_agdi -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT8 Flags; - UINT8 Reserved[3]; - UINT32 SdeiEvent; - UINT32 Gsiv; - -} ACPI_TABLE_AGDI; - -/* Mask for Flags field above */ - -#define ACPI_AGDI_SIGNALING_MODE (1) - - -/******************************************************************************* - * - * APMT - ARM Performance Monitoring Unit Table - * - * Conforms to: - * ARM Performance Monitoring Unit Architecture 1.0 Platform Design Document - * ARM DEN0117 v1.0 November 25, 2021 - * - ******************************************************************************/ - -typedef struct acpi_table_apmt { - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ -} ACPI_TABLE_APMT; - -#define ACPI_APMT_NODE_ID_LENGTH 4 - -/* - * APMT subtables - */ -typedef struct acpi_apmt_node { - UINT16 Length; - UINT8 Flags; - UINT8 Type; - UINT32 Id; - UINT64 InstPrimary; - UINT32 InstSecondary; - UINT64 BaseAddress0; - UINT64 BaseAddress1; - UINT32 OvflwIrq; - UINT32 Reserved; - UINT32 OvflwIrqFlags; - UINT32 ProcAffinity; - UINT32 ImplId; -} ACPI_APMT_NODE; - -/* Masks for Flags field above */ - -#define ACPI_APMT_FLAGS_DUAL_PAGE (1<<0) -#define ACPI_APMT_FLAGS_AFFINITY (1<<1) -#define ACPI_APMT_FLAGS_ATOMIC (1<<2) - -/* Values for Flags dual page field above */ - -#define ACPI_APMT_FLAGS_DUAL_PAGE_NSUPP (0<<0) -#define ACPI_APMT_FLAGS_DUAL_PAGE_SUPP (1<<0) - -/* Values for Flags processor affinity field above */ -#define ACPI_APMT_FLAGS_AFFINITY_PROC (0<<1) -#define ACPI_APMT_FLAGS_AFFINITY_PROC_CONTAINER (1<<1) - -/* Values for Flags 64-bit atomic field above */ -#define ACPI_APMT_FLAGS_ATOMIC_NSUPP (0<<2) -#define ACPI_APMT_FLAGS_ATOMIC_SUPP (1<<2) - -/* Values for Type field above */ - -enum acpi_apmt_node_type { - ACPI_APMT_NODE_TYPE_MC = 0x00, - ACPI_APMT_NODE_TYPE_SMMU = 0x01, - ACPI_APMT_NODE_TYPE_PCIE_ROOT = 0x02, - ACPI_APMT_NODE_TYPE_ACPI = 0x03, - ACPI_APMT_NODE_TYPE_CACHE = 0x04, - ACPI_APMT_NODE_TYPE_COUNT -}; - -/* Masks for ovflw_irq_flags field above */ - -#define ACPI_APMT_OVFLW_IRQ_FLAGS_MODE (1<<0) -#define ACPI_APMT_OVFLW_IRQ_FLAGS_TYPE (1<<1) - -/* Values for ovflw_irq_flags mode field above */ - -#define ACPI_APMT_OVFLW_IRQ_FLAGS_MODE_LEVEL (0<<0) -#define ACPI_APMT_OVFLW_IRQ_FLAGS_MODE_EDGE (1<<0) - -/* Values for ovflw_irq_flags type field above */ - -#define ACPI_APMT_OVFLW_IRQ_FLAGS_TYPE_WIRED (0<<1) - - -/******************************************************************************* - * - * BDAT - BIOS Data ACPI Table - * - * Conforms to "BIOS Data ACPI Table", Interface Specification v4.0 Draft 5 - * Nov 2020 - * - ******************************************************************************/ - -typedef struct acpi_table_bdat -{ - ACPI_TABLE_HEADER Header; - ACPI_GENERIC_ADDRESS Gas; - -} ACPI_TABLE_BDAT; - -/******************************************************************************* - * - * CCEL - CC-Event Log - * From: "Guest-Host-Communication Interface (GHCI) for Intel - * Trust Domain Extensions (Intel TDX)". Feb 2022 - * - ******************************************************************************/ - -typedef struct acpi_table_ccel -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT8 CCType; - UINT8 CCSubType; - UINT16 Reserved; - UINT64 LogAreaMinimumLength; - UINT64 LogAreaStartAddress; - -} ACPI_TABLE_CCEL; - -/******************************************************************************* - * - * ERDT - Enhanced Resource Director Technology (ERDT) table - * - * Conforms to "Intel Resource Director Technology Architecture Specification" - * Version 1.1, January 2025 - * - ******************************************************************************/ - -typedef struct acpi_table_erdt -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT32 MaxClos; /* Maximum classes of service */ - UINT8 Reserved[24]; - UINT8 Erdt_Substructures[]; - -} ACPI_TABLE_ERDT; - - -/* Values for subtable type in ACPI_SUBTBL_HDR_16 */ - -enum AcpiErdtType -{ - ACPI_ERDT_TYPE_RMDD = 0, - ACPI_ERDT_TYPE_CACD = 1, - ACPI_ERDT_TYPE_DACD = 2, - ACPI_ERDT_TYPE_CMRC = 3, - ACPI_ERDT_TYPE_MMRC = 4, - ACPI_ERDT_TYPE_MARC = 5, - ACPI_ERDT_TYPE_CARC = 6, - ACPI_ERDT_TYPE_CMRD = 7, - ACPI_ERDT_TYPE_IBRD = 8, - ACPI_ERDT_TYPE_IBAD = 9, - ACPI_ERDT_TYPE_CARD = 10, - ACPI_ERDT_TYPE_RESERVED = 11 /* 11 and above are reserved */ - -}; - -/* - * ERDT Subtables, correspond to Type in ACPI_SUBTBL_HDR_16 - */ - -/* 0: RMDD - Resource Management Domain Description */ - -typedef struct acpi_erdt_rmdd -{ - ACPI_SUBTBL_HDR_16 Header; - UINT16 Flags; - UINT16 IO_l3_Slices; /* Number of slices in IO cache */ - UINT8 IO_l3_Sets; /* Number of sets in IO cache */ - UINT8 IO_l3_Ways; /* Number of ways in IO cache */ - UINT64 Reserved; - UINT16 DomainId; /* Unique domain ID */ - UINT32 MaxRmid; /* Maximun RMID supported */ - UINT64 CregBase; /* Control Register Base Address */ - UINT16 CregSize; /* Control Register Size (4K pages) */ - UINT8 RmddStructs[]; - -} ACPI_ERDT_RMDD; - - -/* 1: CACD - CPU Agent Collection Description */ - -typedef struct acpi_erdt_cacd -{ - ACPI_SUBTBL_HDR_16 Header; - UINT16 Reserved; - UINT16 DomainId; /* Unique domain ID */ - UINT32 X2APICIDS[]; - -} ACPI_ERDT_CACD; - - -/* 2: DACD - Device Agent Collection Description */ - -typedef struct acpi_erdt_dacd -{ - ACPI_SUBTBL_HDR_16 Header; - UINT16 Reserved; - UINT16 DomainId; /* Unique domain ID */ - UINT8 DevPaths[]; - -} ACPI_ERDT_DACD; - -typedef struct acpi_erdt_dacd_dev_paths -{ - ACPI_SUBTABLE_HEADER Header; - UINT16 Segment; - UINT8 Reserved; - UINT8 StartBus; - UINT8 Path[]; - -} ACPI_ERDT_DACD_PATHS; - - -/* 3: CMRC - Cache Monitoring Registers for CPU Agents */ - -typedef struct acpi_erdt_cmrc -{ - ACPI_SUBTBL_HDR_16 Header; - UINT32 Reserved1; - UINT32 Flags; - UINT8 IndexFn; - UINT8 Reserved2[11]; - UINT64 CmtRegBase; - UINT32 CmtRegSize; - UINT16 ClumpSize; - UINT16 ClumpStride; - UINT64 UpScale; - -} ACPI_ERDT_CMRC; - - -/* 4: MMRC - Memory-bandwidth Monitoring Registers for CPU Agents */ - -typedef struct acpi_erdt_mmrc -{ - ACPI_SUBTBL_HDR_16 Header; - UINT32 Reserved1; - UINT32 Flags; - UINT8 IndexFn; - UINT8 Reserved2[11]; - UINT64 RegBase; - UINT32 RegSize; - UINT8 CounterWidth; - UINT64 UpScale; - UINT8 Reserved3[7]; - UINT32 CorrFactorListLen; - UINT32 CorrFactorList[]; - -} ACPI_ERDT_MMRC; - - -/* 5: MARC - Memory-bandwidth Allocation Registers for CPU Agents */ - -typedef struct acpi_erdt_marc -{ - ACPI_SUBTBL_HDR_16 Header; - UINT16 Reserved1; - UINT16 Flags; - UINT8 IndexFn; - UINT8 Reserved2[7]; - UINT64 RegBaseOpt; - UINT64 RegBaseMin; - UINT64 RegBaseMax; - UINT32 MbaRegSize; - UINT32 MbaCtrlRange; - -} ACPI_ERDT_MARC; - - -/* 6: CARC - Cache Allocation Registers for CPU Agents */ - -typedef struct acpi_erdt_carc -{ - ACPI_SUBTBL_HDR_16 Header; - -} ACPI_ERDT_CARC; - - -/* 7: CMRD - Cache Monitoring Registers for Device Agents */ - -typedef struct acpi_erdt_cmrd -{ - ACPI_SUBTBL_HDR_16 Header; - UINT32 Reserved1; - UINT32 Flags; - UINT8 IndexFn; - UINT8 Reserved2[11]; - UINT64 RegBase; - UINT32 RegSize; - UINT16 CmtRegOff; - UINT16 CmtClumpSize; - UINT64 UpScale; - -} ACPI_ERDT_CMRD; - - -/* 8: IBRD - Cache Monitoring Registers for Device Agents */ - -typedef struct acpi_erdt_ibrd -{ - ACPI_SUBTBL_HDR_16 Header; - UINT32 Reserved1; - UINT32 Flags; - UINT8 IndexFn; - UINT8 Reserved2[11]; - UINT64 RegBase; - UINT32 RegSize; - UINT16 TotalBwOffset; - UINT16 IOMissBwOffset; - UINT16 TotalBwClump; - UINT16 IOMissBwClump; - UINT8 Reserved3[7]; - UINT8 CounterWidth; - UINT64 UpScale; - UINT32 CorrFactorListLen; - UINT32 CorrFactorList[]; - -} ACPI_ERDT_IBRD; - - -/* 9: IBAD - IO bandwidth Allocation Registers for device agents */ - -typedef struct acpi_erdt_ibad -{ - ACPI_SUBTBL_HDR_16 Header; - -} ACPI_ERDT_IBAD; - - -/* 10: CARD - IO bandwidth Allocation Registers for Device Agents */ - -typedef struct acpi_erdt_card -{ - ACPI_SUBTBL_HDR_16 Header; - UINT32 Reserved1; - UINT32 Flags; - UINT32 ContentionMask; - UINT8 IndexFn; - UINT8 Reserved2[7]; - UINT64 RegBase; - UINT32 RegSize; - UINT16 CatRegOffset; - UINT16 CatRegBlockSize; - -} ACPI_ERDT_CARD; - - -/******************************************************************************* - * - * IORT - IO Remapping Table - * - * Conforms to "IO Remapping Table System Software on ARM Platforms", - * Document number: ARM DEN 0049E.f, Apr 2024 - * - ******************************************************************************/ - -typedef struct acpi_table_iort -{ - ACPI_TABLE_HEADER Header; - UINT32 NodeCount; - UINT32 NodeOffset; - UINT32 Reserved; - -} ACPI_TABLE_IORT; - - -/* - * IORT subtables - */ -typedef struct acpi_iort_node -{ - UINT8 Type; - UINT16 Length; - UINT8 Revision; - UINT32 Identifier; - UINT32 MappingCount; - UINT32 MappingOffset; - char NodeData[]; - -} ACPI_IORT_NODE; - -/* Values for subtable Type above */ - -enum AcpiIortNodeType -{ - ACPI_IORT_NODE_ITS_GROUP = 0x00, - ACPI_IORT_NODE_NAMED_COMPONENT = 0x01, - ACPI_IORT_NODE_PCI_ROOT_COMPLEX = 0x02, - ACPI_IORT_NODE_SMMU = 0x03, - ACPI_IORT_NODE_SMMU_V3 = 0x04, - ACPI_IORT_NODE_PMCG = 0x05, - ACPI_IORT_NODE_RMR = 0x06, - ACPI_IORT_NODE_IWB = 0x07, -}; - - -typedef struct acpi_iort_id_mapping -{ - UINT32 InputBase; /* Lowest value in input range */ - UINT32 IdCount; /* Number of IDs */ - UINT32 OutputBase; /* Lowest value in output range */ - UINT32 OutputReference; /* A reference to the output node */ - UINT32 Flags; - -} ACPI_IORT_ID_MAPPING; - -/* Masks for Flags field above for IORT subtable */ - -#define ACPI_IORT_ID_SINGLE_MAPPING (1) - - -typedef struct acpi_iort_memory_access -{ - UINT32 CacheCoherency; - UINT8 Hints; - UINT16 Reserved; - UINT8 MemoryFlags; - -} ACPI_IORT_MEMORY_ACCESS; - -/* Values for CacheCoherency field above */ - -#define ACPI_IORT_NODE_COHERENT 0x00000001 /* The device node is fully coherent */ -#define ACPI_IORT_NODE_NOT_COHERENT 0x00000000 /* The device node is not coherent */ - -/* Masks for Hints field above */ - -#define ACPI_IORT_HT_TRANSIENT (1) -#define ACPI_IORT_HT_WRITE (1<<1) -#define ACPI_IORT_HT_READ (1<<2) -#define ACPI_IORT_HT_OVERRIDE (1<<3) - -/* Masks for MemoryFlags field above */ - -#define ACPI_IORT_MF_COHERENCY (1) -#define ACPI_IORT_MF_ATTRIBUTES (1<<1) -#define ACPI_IORT_MF_CANWBS (1<<2) - - -/* - * IORT node specific subtables - */ -typedef struct acpi_iort_its_group -{ - UINT32 ItsCount; - UINT32 Identifiers[]; /* GIC ITS identifier array */ - -} ACPI_IORT_ITS_GROUP; - - -typedef struct acpi_iort_named_component -{ - UINT32 NodeFlags; - UINT64 MemoryProperties; /* Memory access properties */ - UINT8 MemoryAddressLimit; /* Memory address size limit */ - char DeviceName[]; /* Path of namespace object */ - -} ACPI_IORT_NAMED_COMPONENT; - -/* Masks for Flags field above */ - -#define ACPI_IORT_NC_STALL_SUPPORTED (1) -#define ACPI_IORT_NC_PASID_BITS (31<<1) - -typedef struct acpi_iort_root_complex -{ - UINT64 MemoryProperties; /* Memory access properties */ - UINT32 AtsAttribute; - UINT32 PciSegmentNumber; - UINT8 MemoryAddressLimit; /* Memory address size limit */ - UINT16 PasidCapabilities; /* PASID Capabilities */ - UINT8 Reserved[]; /* Reserved, must be zero */ - -} ACPI_IORT_ROOT_COMPLEX; - -/* Masks for AtsAttribute field above */ - -#define ACPI_IORT_ATS_SUPPORTED (1) /* The root complex ATS support */ -#define ACPI_IORT_PRI_SUPPORTED (1<<1) /* The root complex PRI support */ -#define ACPI_IORT_PASID_FWD_SUPPORTED (1<<2) /* The root complex PASID forward support */ - -/* Masks for PasidCapabilities field above */ -#define ACPI_IORT_PASID_MAX_WIDTH (0x1F) /* Bits 0-4 */ - -typedef struct acpi_iort_smmu -{ - UINT64 BaseAddress; /* SMMU base address */ - UINT64 Span; /* Length of memory range */ - UINT32 Model; - UINT32 Flags; - UINT32 GlobalInterruptOffset; - UINT32 ContextInterruptCount; - UINT32 ContextInterruptOffset; - UINT32 PmuInterruptCount; - UINT32 PmuInterruptOffset; - UINT64 Interrupts[]; /* Interrupt array */ - -} ACPI_IORT_SMMU; - -/* Values for Model field above */ - -#define ACPI_IORT_SMMU_V1 0x00000000 /* Generic SMMUv1 */ -#define ACPI_IORT_SMMU_V2 0x00000001 /* Generic SMMUv2 */ -#define ACPI_IORT_SMMU_CORELINK_MMU400 0x00000002 /* ARM Corelink MMU-400 */ -#define ACPI_IORT_SMMU_CORELINK_MMU500 0x00000003 /* ARM Corelink MMU-500 */ -#define ACPI_IORT_SMMU_CORELINK_MMU401 0x00000004 /* ARM Corelink MMU-401 */ -#define ACPI_IORT_SMMU_CAVIUM_THUNDERX 0x00000005 /* Cavium ThunderX SMMUv2 */ - -/* Masks for Flags field above */ - -#define ACPI_IORT_SMMU_DVM_SUPPORTED (1) -#define ACPI_IORT_SMMU_COHERENT_WALK (1<<1) - -/* Global interrupt format */ - -typedef struct acpi_iort_smmu_gsi -{ - UINT32 NSgIrpt; - UINT32 NSgIrptFlags; - UINT32 NSgCfgIrpt; - UINT32 NSgCfgIrptFlags; - -} ACPI_IORT_SMMU_GSI; - - -typedef struct acpi_iort_smmu_v3 -{ - UINT64 BaseAddress; /* SMMUv3 base address */ - UINT32 Flags; - UINT32 Reserved; - UINT64 VatosAddress; - UINT32 Model; - UINT32 EventGsiv; - UINT32 PriGsiv; - UINT32 GerrGsiv; - UINT32 SyncGsiv; - UINT32 Pxm; - UINT32 IdMappingIndex; - -} ACPI_IORT_SMMU_V3; - -/* Values for Model field above */ - -#define ACPI_IORT_SMMU_V3_GENERIC 0x00000000 /* Generic SMMUv3 */ -#define ACPI_IORT_SMMU_V3_HISILICON_HI161X 0x00000001 /* HiSilicon Hi161x SMMUv3 */ -#define ACPI_IORT_SMMU_V3_CAVIUM_CN99XX 0x00000002 /* Cavium CN99xx SMMUv3 */ - -/* Masks for Flags field above */ - -#define ACPI_IORT_SMMU_V3_COHACC_OVERRIDE (1) -#define ACPI_IORT_SMMU_V3_HTTU_OVERRIDE (3<<1) -#define ACPI_IORT_SMMU_V3_PXM_VALID (1<<3) -#define ACPI_IORT_SMMU_V3_DEVICEID_VALID (1<<4) - -typedef struct acpi_iort_pmcg -{ - UINT64 Page0BaseAddress; - UINT32 OverflowGsiv; - UINT32 NodeReference; - UINT64 Page1BaseAddress; - -} ACPI_IORT_PMCG; - -typedef struct acpi_iort_rmr { - UINT32 Flags; - UINT32 RmrCount; - UINT32 RmrOffset; - -} ACPI_IORT_RMR; - -/* Masks for Flags field above */ -#define ACPI_IORT_RMR_REMAP_PERMITTED (1) -#define ACPI_IORT_RMR_ACCESS_PRIVILEGE (1<<1) - -/* - * Macro to access the Access Attributes in flags field above: - * Access Attributes is encoded in bits 9:2 - */ -#define ACPI_IORT_RMR_ACCESS_ATTRIBUTES(flags) (((flags) >> 2) & 0xFF) - -/* Values for above Access Attributes */ - -#define ACPI_IORT_RMR_ATTR_DEVICE_NGNRNE 0x00 -#define ACPI_IORT_RMR_ATTR_DEVICE_NGNRE 0x01 -#define ACPI_IORT_RMR_ATTR_DEVICE_NGRE 0x02 -#define ACPI_IORT_RMR_ATTR_DEVICE_GRE 0x03 -#define ACPI_IORT_RMR_ATTR_NORMAL_NC 0x04 -#define ACPI_IORT_RMR_ATTR_NORMAL_IWB_OWB 0x05 - -typedef struct acpi_iort_rmr_desc { - UINT64 BaseAddress; - UINT64 Length; - UINT32 Reserved; - -} ACPI_IORT_RMR_DESC; - -typedef struct acpi_iort_iwb { - UINT64 BaseAddress; - UINT16 IwbIndex; /* Unique IWB identifier matching with the IWB GSI namespace. */ - char DeviceName[]; /* Path of the IWB namespace object */ - -} ACPI_IORT_IWB; - - -/******************************************************************************* - * - * IOVT - I/O Virtualization Table - * - * Conforms to "LoongArch I/O Virtualization Table", - * Version 0.1, October 2024 - * - ******************************************************************************/ - -typedef struct acpi_table_iovt -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT16 IommuCount; - UINT16 IommuOffset; - UINT8 Reserved[8]; - -} ACPI_TABLE_IOVT; - -/* IOVT subtable header */ - -typedef struct acpi_iovt_header -{ - UINT16 Type; - UINT16 Length; - -} ACPI_IOVT_HEADER; - -/* Values for Type field above */ - -enum AcpiIovtIommuType -{ - ACPI_IOVT_IOMMU_V1 = 0x00, - ACPI_IOVT_IOMMU_RESERVED = 0x01 /* 1 and greater are reserved */ -}; - -/* IOVT subtables */ - -typedef struct acpi_iovt_iommu -{ - ACPI_IOVT_HEADER Header; - UINT32 Flags; - UINT16 Segment; - UINT16 PhyWidth; /* Physical Address Width */ - UINT16 VirtWidth; /* Virtual Address Width */ - UINT16 MaxPageLevel; - UINT64 PageSize; - UINT32 DeviceId; - UINT64 BaseAddress; - UINT32 AddressSpaceSize; - UINT8 InterruptType; - UINT8 Reserved[3]; - UINT32 GsiNumber; - UINT32 ProximityDomain; - UINT32 MaxDeviceNum; - UINT32 DeviceEntryNum; - UINT32 DeviceEntryOffset; - -} ACPI_IOVT_IOMMU; - -typedef struct acpi_iovt_device_entry -{ - UINT8 Type; - UINT8 Length; - UINT8 Flags; - UINT8 Reserved[3]; - UINT16 DeviceId; - -} ACPI_IOVT_DEVICE_ENTRY; - -enum AcpiIovtDeviceEntryType -{ - ACPI_IOVT_DEVICE_ENTRY_SINGLE = 0x00, - ACPI_IOVT_DEVICE_ENTRY_START = 0x01, - ACPI_IOVT_DEVICE_ENTRY_END = 0x02, - ACPI_IOVT_DEVICE_ENTRY_RESERVED = 0x03 /* 3 and greater are reserved */ -}; - - -/******************************************************************************* - * - * IVRS - I/O Virtualization Reporting Structure - * Version 1 - * - * Conforms to "AMD I/O Virtualization Technology (IOMMU) Specification", - * Revision 1.26, February 2009. - * - ******************************************************************************/ - -typedef struct acpi_table_ivrs -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT32 Info; /* Common virtualization info */ - UINT64 Reserved; - -} ACPI_TABLE_IVRS; - -/* Values for Info field above */ - -#define ACPI_IVRS_PHYSICAL_SIZE 0x00007F00 /* 7 bits, physical address size */ -#define ACPI_IVRS_VIRTUAL_SIZE 0x003F8000 /* 7 bits, virtual address size */ -#define ACPI_IVRS_ATS_RESERVED 0x00400000 /* ATS address translation range reserved */ - - -/* IVRS subtable header */ - -typedef struct acpi_ivrs_header -{ - UINT8 Type; /* Subtable type */ - UINT8 Flags; - UINT16 Length; /* Subtable length */ - UINT16 DeviceId; /* ID of IOMMU */ - -} ACPI_IVRS_HEADER; - -/* Values for subtable Type above */ - -enum AcpiIvrsType -{ - ACPI_IVRS_TYPE_HARDWARE1 = 0x10, - ACPI_IVRS_TYPE_HARDWARE2 = 0x11, - ACPI_IVRS_TYPE_HARDWARE3 = 0x40, - ACPI_IVRS_TYPE_MEMORY1 = 0x20, - ACPI_IVRS_TYPE_MEMORY2 = 0x21, - ACPI_IVRS_TYPE_MEMORY3 = 0x22 -}; - -/* Masks for Flags field above for IVHD subtable */ - -#define ACPI_IVHD_TT_ENABLE (1) -#define ACPI_IVHD_PASS_PW (1<<1) -#define ACPI_IVHD_RES_PASS_PW (1<<2) -#define ACPI_IVHD_ISOC (1<<3) -#define ACPI_IVHD_IOTLB (1<<4) - -/* Masks for Flags field above for IVMD subtable */ - -#define ACPI_IVMD_UNITY (1) -#define ACPI_IVMD_READ (1<<1) -#define ACPI_IVMD_WRITE (1<<2) -#define ACPI_IVMD_EXCLUSION_RANGE (1<<3) - - -/* - * IVRS subtables, correspond to Type in ACPI_IVRS_HEADER - */ - -/* 0x10: I/O Virtualization Hardware Definition Block (IVHD) */ - -typedef struct acpi_ivrs_hardware_10 -{ - ACPI_IVRS_HEADER Header; - UINT16 CapabilityOffset; /* Offset for IOMMU control fields */ - UINT64 BaseAddress; /* IOMMU control registers */ - UINT16 PciSegmentGroup; - UINT16 Info; /* MSI number and unit ID */ - UINT32 FeatureReporting; - -} ACPI_IVRS_HARDWARE1; - -/* 0x11: I/O Virtualization Hardware Definition Block (IVHD) */ - -typedef struct acpi_ivrs_hardware_11 -{ - ACPI_IVRS_HEADER Header; - UINT16 CapabilityOffset; /* Offset for IOMMU control fields */ - UINT64 BaseAddress; /* IOMMU control registers */ - UINT16 PciSegmentGroup; - UINT16 Info; /* MSI number and unit ID */ - UINT32 Attributes; - UINT64 EfrRegisterImage; - UINT64 Reserved; -} ACPI_IVRS_HARDWARE2; - -/* Masks for Info field above */ - -#define ACPI_IVHD_MSI_NUMBER_MASK 0x001F /* 5 bits, MSI message number */ -#define ACPI_IVHD_UNIT_ID_MASK 0x1F00 /* 5 bits, UnitID */ - - -/* - * Device Entries for IVHD subtable, appear after ACPI_IVRS_HARDWARE structure. - * Upper two bits of the Type field are the (encoded) length of the structure. - * Currently, only 4 and 8 byte entries are defined. 16 and 32 byte entries - * are reserved for future use but not defined. - */ -typedef struct acpi_ivrs_de_header -{ - UINT8 Type; - UINT16 Id; - UINT8 DataSetting; - -} ACPI_IVRS_DE_HEADER; - -/* Length of device entry is in the top two bits of Type field above */ - -#define ACPI_IVHD_ENTRY_LENGTH 0xC0 - -/* Values for device entry Type field above */ - -enum AcpiIvrsDeviceEntryType -{ - /* 4-byte device entries, all use ACPI_IVRS_DEVICE4 */ - - ACPI_IVRS_TYPE_PAD4 = 0, - ACPI_IVRS_TYPE_ALL = 1, - ACPI_IVRS_TYPE_SELECT = 2, - ACPI_IVRS_TYPE_START = 3, - ACPI_IVRS_TYPE_END = 4, - - /* 8-byte device entries */ - - ACPI_IVRS_TYPE_PAD8 = 64, - ACPI_IVRS_TYPE_NOT_USED = 65, - ACPI_IVRS_TYPE_ALIAS_SELECT = 66, /* Uses ACPI_IVRS_DEVICE8A */ - ACPI_IVRS_TYPE_ALIAS_START = 67, /* Uses ACPI_IVRS_DEVICE8A */ - ACPI_IVRS_TYPE_EXT_SELECT = 70, /* Uses ACPI_IVRS_DEVICE8B */ - ACPI_IVRS_TYPE_EXT_START = 71, /* Uses ACPI_IVRS_DEVICE8B */ - ACPI_IVRS_TYPE_SPECIAL = 72, /* Uses ACPI_IVRS_DEVICE8C */ - - /* Variable-length device entries */ - - ACPI_IVRS_TYPE_HID = 240 /* Uses ACPI_IVRS_DEVICE_HID */ -}; - -/* Values for Data field above */ - -#define ACPI_IVHD_INIT_PASS (1) -#define ACPI_IVHD_EINT_PASS (1<<1) -#define ACPI_IVHD_NMI_PASS (1<<2) -#define ACPI_IVHD_SYSTEM_MGMT (3<<4) -#define ACPI_IVHD_LINT0_PASS (1<<6) -#define ACPI_IVHD_LINT1_PASS (1<<7) - - -/* Types 0-4: 4-byte device entry */ - -typedef struct acpi_ivrs_device4 -{ - ACPI_IVRS_DE_HEADER Header; - -} ACPI_IVRS_DEVICE4; - -/* Types 66-67: 8-byte device entry */ - -typedef struct acpi_ivrs_device8a -{ - ACPI_IVRS_DE_HEADER Header; - UINT8 Reserved1; - UINT16 UsedId; - UINT8 Reserved2; - -} ACPI_IVRS_DEVICE8A; - -/* Types 70-71: 8-byte device entry */ - -typedef struct acpi_ivrs_device8b -{ - ACPI_IVRS_DE_HEADER Header; - UINT32 ExtendedData; - -} ACPI_IVRS_DEVICE8B; - -/* Values for ExtendedData above */ - -#define ACPI_IVHD_ATS_DISABLED (1<<31) - -/* Type 72: 8-byte device entry */ - -typedef struct acpi_ivrs_device8c -{ - ACPI_IVRS_DE_HEADER Header; - UINT8 Handle; - UINT16 UsedId; - UINT8 Variety; - -} ACPI_IVRS_DEVICE8C; - -/* Values for Variety field above */ - -#define ACPI_IVHD_IOAPIC 1 -#define ACPI_IVHD_HPET 2 - -/* Type 240: variable-length device entry */ - -typedef struct acpi_ivrs_device_hid -{ - ACPI_IVRS_DE_HEADER Header; - UINT64 AcpiHid; - UINT64 AcpiCid; - UINT8 UidType; - UINT8 UidLength; - -} ACPI_IVRS_DEVICE_HID; - -/* Values for UidType above */ - -#define ACPI_IVRS_UID_NOT_PRESENT 0 -#define ACPI_IVRS_UID_IS_INTEGER 1 -#define ACPI_IVRS_UID_IS_STRING 2 - -/* 0x20, 0x21, 0x22: I/O Virtualization Memory Definition Block (IVMD) */ - -typedef struct acpi_ivrs_memory -{ - ACPI_IVRS_HEADER Header; - UINT16 AuxData; - UINT64 Reserved; - UINT64 StartAddress; - UINT64 MemoryLength; - -} ACPI_IVRS_MEMORY; - -/******************************************************************************* - * - * KEYP - Key Programming Interface for Root Complex Integrity and Data - * Encryption (IDE) - * Version 1 - * - * Conforms to "Key Programming Interface for Root Complex Integrity and Data - * Encryption (IDE)" document. See under ACPI-Related Documents. - * - ******************************************************************************/ -typedef struct acpi_table_keyp { - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT32 Reserved; -} ACPI_TABLE_KEYP; - -/* KEYP common subtable header */ - -typedef struct acpi_keyp_common_header { - UINT8 Type; - UINT8 Reserved; - UINT16 Length; -} ACPI_KEYP_COMMON_HEADER; - -/* Values for Type field above */ - -enum AcpiKeypType -{ - ACPI_KEYP_TYPE_CONFIG_UNIT = 0, -}; - -/* Root Port Information Structure */ - -typedef struct acpi_keyp_rp_info { - UINT16 Segment; - UINT8 Bus; - UINT8 Devfn; -} ACPI_KEYP_RP_INFO; - -/* Key Configuration Unit Structure */ - -typedef struct acpi_keyp_config_unit { - ACPI_KEYP_COMMON_HEADER Header; - UINT8 ProtocolType; - UINT8 Version; - UINT8 RootPortCount; - UINT8 Flags; - UINT64 RegisterBaseAddress; - ACPI_KEYP_RP_INFO RpInfo[]; -} ACPI_KEYP_CONFIG_UNIT; - -enum AcpiKeypProtocolType -{ - ACPI_KEYP_PROTO_TYPE_INVALID = 0, - ACPI_KEYP_PROTO_TYPE_PCIE, - ACPI_KEYP_PROTO_TYPE_CXL, - ACPI_KEYP_PROTO_TYPE_RESERVED -}; - -#define ACPI_KEYP_F_TVM_USABLE (1) - -/******************************************************************************* - * - * LPIT - Low Power Idle Table - * - * Conforms to "ACPI Low Power Idle Table (LPIT)" July 2014. - * - ******************************************************************************/ - -typedef struct acpi_table_lpit -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - -} ACPI_TABLE_LPIT; - - -/* LPIT subtable header */ - -typedef struct acpi_lpit_header -{ - UINT32 Type; /* Subtable type */ - UINT32 Length; /* Subtable length */ - UINT16 UniqueId; - UINT16 Reserved; - UINT32 Flags; - -} ACPI_LPIT_HEADER; - -/* Values for subtable Type above */ - -enum AcpiLpitType -{ - ACPI_LPIT_TYPE_NATIVE_CSTATE = 0x00, - ACPI_LPIT_TYPE_RESERVED = 0x01 /* 1 and above are reserved */ -}; - -/* Masks for Flags field above */ - -#define ACPI_LPIT_STATE_DISABLED (1) -#define ACPI_LPIT_NO_COUNTER (1<<1) - -/* - * LPIT subtables, correspond to Type in ACPI_LPIT_HEADER - */ - -/* 0x00: Native C-state instruction based LPI structure */ - -typedef struct acpi_lpit_native -{ - ACPI_LPIT_HEADER Header; - ACPI_GENERIC_ADDRESS EntryTrigger; - UINT32 Residency; - UINT32 Latency; - ACPI_GENERIC_ADDRESS ResidencyCounter; - UINT64 CounterFrequency; - -} ACPI_LPIT_NATIVE; - - -/******************************************************************************* - * - * MADT - Multiple APIC Description Table - * Version 3 - * - ******************************************************************************/ - -typedef struct acpi_table_madt -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT32 Address; /* Physical address of local APIC */ - UINT32 Flags; - -} ACPI_TABLE_MADT; - -/* Masks for Flags field above */ - -#define ACPI_MADT_PCAT_COMPAT (1) /* 00: System also has dual 8259s */ - -/* Values for PCATCompat flag */ - -#define ACPI_MADT_DUAL_PIC 1 -#define ACPI_MADT_MULTIPLE_APIC 0 - - -/* Values for MADT subtable type in ACPI_SUBTABLE_HEADER */ - -enum AcpiMadtType -{ - ACPI_MADT_TYPE_LOCAL_APIC = 0, - ACPI_MADT_TYPE_IO_APIC = 1, - ACPI_MADT_TYPE_INTERRUPT_OVERRIDE = 2, - ACPI_MADT_TYPE_NMI_SOURCE = 3, - ACPI_MADT_TYPE_LOCAL_APIC_NMI = 4, - ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE = 5, - ACPI_MADT_TYPE_IO_SAPIC = 6, - ACPI_MADT_TYPE_LOCAL_SAPIC = 7, - ACPI_MADT_TYPE_INTERRUPT_SOURCE = 8, - ACPI_MADT_TYPE_LOCAL_X2APIC = 9, - ACPI_MADT_TYPE_LOCAL_X2APIC_NMI = 10, - ACPI_MADT_TYPE_GENERIC_INTERRUPT = 11, - ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR = 12, - ACPI_MADT_TYPE_GENERIC_MSI_FRAME = 13, - ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR = 14, - ACPI_MADT_TYPE_GENERIC_TRANSLATOR = 15, - ACPI_MADT_TYPE_MULTIPROC_WAKEUP = 16, - ACPI_MADT_TYPE_CORE_PIC = 17, - ACPI_MADT_TYPE_LIO_PIC = 18, - ACPI_MADT_TYPE_HT_PIC = 19, - ACPI_MADT_TYPE_EIO_PIC = 20, - ACPI_MADT_TYPE_MSI_PIC = 21, - ACPI_MADT_TYPE_BIO_PIC = 22, - ACPI_MADT_TYPE_LPC_PIC = 23, - ACPI_MADT_TYPE_RINTC = 24, - ACPI_MADT_TYPE_IMSIC = 25, - ACPI_MADT_TYPE_APLIC = 26, - ACPI_MADT_TYPE_PLIC = 27, - ACPI_MADT_TYPE_GICV5_IRS = 28, - ACPI_MADT_TYPE_GICV5_ITS = 29, - ACPI_MADT_TYPE_GICV5_ITS_TRANSLATE = 30, - ACPI_MADT_TYPE_RESERVED = 31, /* 31 to 0x7F are reserved */ - ACPI_MADT_TYPE_OEM_RESERVED = 0x80 /* 0x80 to 0xFF are reserved for OEM use */ -}; - - -/* - * MADT Subtables, correspond to Type in ACPI_SUBTABLE_HEADER - */ - -/* 0: Processor Local APIC */ - -typedef struct acpi_madt_local_apic -{ - ACPI_SUBTABLE_HEADER Header; - UINT8 ProcessorId; /* ACPI processor id */ - UINT8 Id; /* Processor's local APIC id */ - UINT32 LapicFlags; - -} ACPI_MADT_LOCAL_APIC; - - -/* 1: IO APIC */ - -typedef struct acpi_madt_io_apic -{ - ACPI_SUBTABLE_HEADER Header; - UINT8 Id; /* I/O APIC ID */ - UINT8 Reserved; /* Reserved - must be zero */ - UINT32 Address; /* APIC physical address */ - UINT32 GlobalIrqBase; /* Global system interrupt where INTI lines start */ - -} ACPI_MADT_IO_APIC; - - -/* 2: Interrupt Override */ - -typedef struct acpi_madt_interrupt_override -{ - ACPI_SUBTABLE_HEADER Header; - UINT8 Bus; /* 0 - ISA */ - UINT8 SourceIrq; /* Interrupt source (IRQ) */ - UINT32 GlobalIrq; /* Global system interrupt */ - UINT16 IntiFlags; - -} ACPI_MADT_INTERRUPT_OVERRIDE; - - -/* 3: NMI Source */ - -typedef struct acpi_madt_nmi_source -{ - ACPI_SUBTABLE_HEADER Header; - UINT16 IntiFlags; - UINT32 GlobalIrq; /* Global system interrupt */ - -} ACPI_MADT_NMI_SOURCE; - - -/* 4: Local APIC NMI */ - -typedef struct acpi_madt_local_apic_nmi -{ - ACPI_SUBTABLE_HEADER Header; - UINT8 ProcessorId; /* ACPI processor id */ - UINT16 IntiFlags; - UINT8 Lint; /* LINTn to which NMI is connected */ - -} ACPI_MADT_LOCAL_APIC_NMI; - - -/* 5: Address Override */ - -typedef struct acpi_madt_local_apic_override -{ - ACPI_SUBTABLE_HEADER Header; - UINT16 Reserved; /* Reserved, must be zero */ - UINT64 Address; /* APIC physical address */ - -} ACPI_MADT_LOCAL_APIC_OVERRIDE; - - -/* 6: I/O Sapic */ - -typedef struct acpi_madt_io_sapic -{ - ACPI_SUBTABLE_HEADER Header; - UINT8 Id; /* I/O SAPIC ID */ - UINT8 Reserved; /* Reserved, must be zero */ - UINT32 GlobalIrqBase; /* Global interrupt for SAPIC start */ - UINT64 Address; /* SAPIC physical address */ - -} ACPI_MADT_IO_SAPIC; - - -/* 7: Local Sapic */ - -typedef struct acpi_madt_local_sapic -{ - ACPI_SUBTABLE_HEADER Header; - UINT8 ProcessorId; /* ACPI processor id */ - UINT8 Id; /* SAPIC ID */ - UINT8 Eid; /* SAPIC EID */ - UINT8 Reserved[3]; /* Reserved, must be zero */ - UINT32 LapicFlags; - UINT32 Uid; /* Numeric UID - ACPI 3.0 */ - char UidString[]; /* String UID - ACPI 3.0 */ - -} ACPI_MADT_LOCAL_SAPIC; - - -/* 8: Platform Interrupt Source */ - -typedef struct acpi_madt_interrupt_source -{ - ACPI_SUBTABLE_HEADER Header; - UINT16 IntiFlags; - UINT8 Type; /* 1=PMI, 2=INIT, 3=corrected */ - UINT8 Id; /* Processor ID */ - UINT8 Eid; /* Processor EID */ - UINT8 IoSapicVector; /* Vector value for PMI interrupts */ - UINT32 GlobalIrq; /* Global system interrupt */ - UINT32 Flags; /* Interrupt Source Flags */ - -} ACPI_MADT_INTERRUPT_SOURCE; - -/* Masks for Flags field above */ - -#define ACPI_MADT_CPEI_OVERRIDE (1) - - -/* 9: Processor Local X2APIC (ACPI 4.0) */ - -typedef struct acpi_madt_local_x2apic -{ - ACPI_SUBTABLE_HEADER Header; - UINT16 Reserved; /* Reserved - must be zero */ - UINT32 LocalApicId; /* Processor x2APIC ID */ - UINT32 LapicFlags; - UINT32 Uid; /* ACPI processor UID */ - -} ACPI_MADT_LOCAL_X2APIC; - - -/* 10: Local X2APIC NMI (ACPI 4.0) */ - -typedef struct acpi_madt_local_x2apic_nmi -{ - ACPI_SUBTABLE_HEADER Header; - UINT16 IntiFlags; - UINT32 Uid; /* ACPI processor UID */ - UINT8 Lint; /* LINTn to which NMI is connected */ - UINT8 Reserved[3]; /* Reserved - must be zero */ - -} ACPI_MADT_LOCAL_X2APIC_NMI; - - -/* 11: Generic Interrupt - GICC (ACPI 5.0 + ACPI 6.0 + ACPI 6.3 + ACPI 6.5 + ACPI 6.7 changes) */ - -typedef struct acpi_madt_generic_interrupt -{ - ACPI_SUBTABLE_HEADER Header; - UINT16 Reserved; /* Reserved - must be zero */ - UINT32 CpuInterfaceNumber; - UINT32 Uid; - UINT32 Flags; - UINT32 ParkingVersion; - UINT32 PerformanceInterrupt; - UINT64 ParkedAddress; - UINT64 BaseAddress; - UINT64 GicvBaseAddress; - UINT64 GichBaseAddress; - UINT32 VgicInterrupt; - UINT64 GicrBaseAddress; - UINT64 ArmMpidr; - UINT8 EfficiencyClass; - UINT8 Reserved2[1]; - UINT16 SpeInterrupt; /* ACPI 6.3 */ - UINT16 TrbeInterrupt; /* ACPI 6.5 */ - UINT16 Iaffid; /* ACPI 6.7 */ - UINT32 IrsId; - -} ACPI_MADT_GENERIC_INTERRUPT; - -/* Masks for Flags field above */ - -/* ACPI_MADT_ENABLED (1) Processor is usable if set */ -#define ACPI_MADT_PERFORMANCE_IRQ_MODE (1<<1) /* 01: Performance Interrupt Mode */ -#define ACPI_MADT_VGIC_IRQ_MODE (1<<2) /* 02: VGIC Maintenance Interrupt mode */ -#define ACPI_MADT_GICC_ONLINE_CAPABLE (1<<3) /* 03: Processor is online capable */ -#define ACPI_MADT_GICC_NON_COHERENT (1<<4) /* 04: GIC redistributor is not coherent */ - -/* 12: Generic Distributor (ACPI 5.0 + ACPI 6.0 changes) */ - -typedef struct acpi_madt_generic_distributor -{ - ACPI_SUBTABLE_HEADER Header; - UINT16 Reserved; /* Reserved - must be zero */ - UINT32 GicId; - UINT64 BaseAddress; - UINT32 GlobalIrqBase; - UINT8 Version; - UINT8 Reserved2[3]; /* Reserved - must be zero */ - -} ACPI_MADT_GENERIC_DISTRIBUTOR; - -/* Values for Version field above and Version field in acpi_madt_gicv5_irs */ - -enum AcpiMadtGicVersion -{ - ACPI_MADT_GIC_VERSION_NONE = 0, - ACPI_MADT_GIC_VERSION_V1 = 1, - ACPI_MADT_GIC_VERSION_V2 = 2, - ACPI_MADT_GIC_VERSION_V3 = 3, - ACPI_MADT_GIC_VERSION_V4 = 4, - ACPI_MADT_GIC_VERSION_V5 = 5, - ACPI_MADT_GIC_VERSION_RESERVED = 6 /* 6 and greater are reserved */ -}; - - -/* 13: Generic MSI Frame (ACPI 5.1) */ - -typedef struct acpi_madt_generic_msi_frame -{ - ACPI_SUBTABLE_HEADER Header; - UINT16 Reserved; /* Reserved - must be zero */ - UINT32 MsiFrameId; - UINT64 BaseAddress; - UINT32 Flags; - UINT16 SpiCount; - UINT16 SpiBase; - -} ACPI_MADT_GENERIC_MSI_FRAME; - -/* Masks for Flags field above */ - -#define ACPI_MADT_OVERRIDE_SPI_VALUES (1) - - -/* 14: Generic Redistributor (ACPI 5.1) */ - -typedef struct acpi_madt_generic_redistributor -{ - ACPI_SUBTABLE_HEADER Header; - UINT8 Flags; - UINT8 Reserved; /* reserved - must be zero */ - UINT64 BaseAddress; - UINT32 Length; - -} ACPI_MADT_GENERIC_REDISTRIBUTOR; - -#define ACPI_MADT_GICR_NON_COHERENT (1) - -/* 15: Generic Translator (ACPI 6.0) */ - -typedef struct acpi_madt_generic_translator -{ - ACPI_SUBTABLE_HEADER Header; - UINT8 Flags; - UINT8 Reserved; /* reserved - must be zero */ - UINT32 TranslationId; - UINT64 BaseAddress; - UINT32 Reserved2; - -} ACPI_MADT_GENERIC_TRANSLATOR; - -#define ACPI_MADT_ITS_NON_COHERENT (1) - -/* 16: Multiprocessor wakeup (ACPI 6.6) */ - -typedef struct acpi_madt_multiproc_wakeup -{ - ACPI_SUBTABLE_HEADER Header; - UINT16 MailboxVersion; - UINT32 Reserved; /* reserved - must be zero */ - UINT64 BaseAddress; - UINT64 ResetVector; - -} ACPI_MADT_MULTIPROC_WAKEUP; - -#define ACPI_MULTIPROC_WAKEUP_MB_OS_SIZE 2032 -#define ACPI_MULTIPROC_WAKEUP_MB_FIRMWARE_SIZE 2048 - -typedef struct acpi_madt_multiproc_wakeup_mailbox -{ - UINT16 Command; - UINT16 Reserved; /* reserved - must be zero */ - UINT32 ApicId; - UINT64 WakeupVector; - UINT8 ReservedOs[ACPI_MULTIPROC_WAKEUP_MB_OS_SIZE]; /* reserved for OS use */ - UINT8 ReservedFirmware[ACPI_MULTIPROC_WAKEUP_MB_FIRMWARE_SIZE]; /* reserved for firmware use */ - -} ACPI_MADT_MULTIPROC_WAKEUP_MAILBOX; - -#define ACPI_MP_WAKE_COMMAND_WAKEUP 1 -#define ACPI_MP_WAKE_COMMAND_TEST 2 - -/* 17: CPU Core Interrupt Controller (ACPI 6.5) */ - -typedef struct acpi_madt_core_pic { - ACPI_SUBTABLE_HEADER Header; - UINT8 Version; - UINT32 ProcessorId; - UINT32 CoreId; - UINT32 Flags; -} ACPI_MADT_CORE_PIC; - -/* Values for Version field above */ - -enum AcpiMadtCorePicVersion { - ACPI_MADT_CORE_PIC_VERSION_NONE = 0, - ACPI_MADT_CORE_PIC_VERSION_V1 = 1, - ACPI_MADT_CORE_PIC_VERSION_RESERVED = 2 /* 2 and greater are reserved */ -}; - -/* 18: Legacy I/O Interrupt Controller (ACPI 6.5) */ - -typedef struct acpi_madt_lio_pic { - ACPI_SUBTABLE_HEADER Header; - UINT8 Version; - UINT64 Address; - UINT16 Size; - UINT8 Cascade[2]; - UINT32 CascadeMap[2]; -} ACPI_MADT_LIO_PIC; - -/* Values for Version field above */ - -enum AcpiMadtLioPicVersion { - ACPI_MADT_LIO_PIC_VERSION_NONE = 0, - ACPI_MADT_LIO_PIC_VERSION_V1 = 1, - ACPI_MADT_LIO_PIC_VERSION_RESERVED = 2 /* 2 and greater are reserved */ -}; - -/* 19: HT Interrupt Controller (ACPI 6.5) */ - -typedef struct acpi_madt_ht_pic { - ACPI_SUBTABLE_HEADER Header; - UINT8 Version; - UINT64 Address; - UINT16 Size; - UINT8 Cascade[8]; -} ACPI_MADT_HT_PIC; - -/* Values for Version field above */ - -enum AcpiMadtHtPicVersion { - ACPI_MADT_HT_PIC_VERSION_NONE = 0, - ACPI_MADT_HT_PIC_VERSION_V1 = 1, - ACPI_MADT_HT_PIC_VERSION_RESERVED = 2 /* 2 and greater are reserved */ -}; - -/* 20: Extend I/O Interrupt Controller (ACPI 6.5) */ - -typedef struct acpi_madt_eio_pic { - ACPI_SUBTABLE_HEADER Header; - UINT8 Version; - UINT8 Cascade; - UINT8 Node; - UINT64 NodeMap; -} ACPI_MADT_EIO_PIC; - -/* Values for Version field above */ - -enum AcpiMadtEioPicVersion { - ACPI_MADT_EIO_PIC_VERSION_NONE = 0, - ACPI_MADT_EIO_PIC_VERSION_V1 = 1, - ACPI_MADT_EIO_PIC_VERSION_RESERVED = 2 /* 2 and greater are reserved */ -}; - -/* 21: MSI Interrupt Controller (ACPI 6.5) */ - -typedef struct acpi_madt_msi_pic { - ACPI_SUBTABLE_HEADER Header; - UINT8 Version; - UINT64 MsgAddress; - UINT32 Start; - UINT32 Count; -} ACPI_MADT_MSI_PIC; - -/* Values for Version field above */ - -enum AcpiMadtMsiPicVersion { - ACPI_MADT_MSI_PIC_VERSION_NONE = 0, - ACPI_MADT_MSI_PIC_VERSION_V1 = 1, - ACPI_MADT_MSI_PIC_VERSION_RESERVED = 2 /* 2 and greater are reserved */ -}; - -/* 22: Bridge I/O Interrupt Controller (ACPI 6.5) */ - -typedef struct acpi_madt_bio_pic { - ACPI_SUBTABLE_HEADER Header; - UINT8 Version; - UINT64 Address; - UINT16 Size; - UINT16 Id; - UINT16 GsiBase; -} ACPI_MADT_BIO_PIC; - -/* Values for Version field above */ - -enum AcpiMadtBioPicVersion { - ACPI_MADT_BIO_PIC_VERSION_NONE = 0, - ACPI_MADT_BIO_PIC_VERSION_V1 = 1, - ACPI_MADT_BIO_PIC_VERSION_RESERVED = 2 /* 2 and greater are reserved */ -}; - -/* 23: LPC Interrupt Controller (ACPI 6.5) */ - -typedef struct acpi_madt_lpc_pic { - ACPI_SUBTABLE_HEADER Header; - UINT8 Version; - UINT64 Address; - UINT16 Size; - UINT8 Cascade; -} ACPI_MADT_LPC_PIC; - -/* Values for Version field above */ - -enum AcpiMadtLpcPicVersion { - ACPI_MADT_LPC_PIC_VERSION_NONE = 0, - ACPI_MADT_LPC_PIC_VERSION_V1 = 1, - ACPI_MADT_LPC_PIC_VERSION_RESERVED = 2 /* 2 and greater are reserved */ -}; - -/* 24: RISC-V INTC */ -typedef struct acpi_madt_rintc { - ACPI_SUBTABLE_HEADER Header; - UINT8 Version; - UINT8 Reserved; - UINT32 Flags; - UINT64 HartId; - UINT32 Uid; /* ACPI processor UID */ - UINT32 ExtIntcId; /* External INTC Id */ - UINT64 ImsicAddr; /* IMSIC base address */ - UINT32 ImsicSize; /* IMSIC size */ -} ACPI_MADT_RINTC; - -/* Values for RISC-V INTC Version field above */ - -enum AcpiMadtRintcVersion { - ACPI_MADT_RINTC_VERSION_NONE = 0, - ACPI_MADT_RINTC_VERSION_V1 = 1, - ACPI_MADT_RINTC_VERSION_RESERVED = 2 /* 2 and greater are reserved */ -}; - -/* 25: RISC-V IMSIC */ -typedef struct acpi_madt_imsic { - ACPI_SUBTABLE_HEADER Header; - UINT8 Version; - UINT8 Reserved; - UINT32 Flags; - UINT16 NumIds; - UINT16 NumGuestIds; - UINT8 GuestIndexBits; - UINT8 HartIndexBits; - UINT8 GroupIndexBits; - UINT8 GroupIndexShift; -} ACPI_MADT_IMSIC; - -/* 26: RISC-V APLIC */ -typedef struct acpi_madt_aplic { - ACPI_SUBTABLE_HEADER Header; - UINT8 Version; - UINT8 Id; - UINT32 Flags; - UINT8 HwId[8]; - UINT16 NumIdcs; - UINT16 NumSources; - UINT32 GsiBase; - UINT64 BaseAddr; - UINT32 Size; -} ACPI_MADT_APLIC; - -/* 27: RISC-V PLIC */ -typedef struct acpi_madt_plic { - ACPI_SUBTABLE_HEADER Header; - UINT8 Version; - UINT8 Id; - UINT8 HwId[8]; - UINT16 NumIrqs; - UINT16 MaxPrio; - UINT32 Flags; - UINT32 Size; - UINT64 BaseAddr; - UINT32 GsiBase; -} ACPI_MADT_PLIC; - -/* 28: Arm GICv5 IRS (ACPI 6.7) */ -typedef struct acpi_madt_gicv5_irs { - ACPI_SUBTABLE_HEADER Header; - UINT8 Version; - UINT8 Reserved; - UINT32 IrsId; - UINT32 Flags; - UINT32 Reserved2; - UINT64 ConfigBaseAddress; - UINT64 SetlpiBaseAddress; -} ACPI_MADT_GICV5_IRS; - -#define ACPI_MADT_IRS_NON_COHERENT (1) - - -/* 29: Arm GICv5 ITS Config Frame (ACPI 6.7) */ -typedef struct acpi_madt_gicv5_translator -{ - ACPI_SUBTABLE_HEADER Header; - UINT8 Flags; - UINT8 Reserved; /* reserved - must be zero */ - UINT32 TranslatorId; - UINT64 BaseAddress; - -} ACPI_MADT_GICv5_ITS; - -#define ACPI_MADT_GICV5_ITS_NON_COHERENT (1) - -/* 30: Arm GICv5 ITS Translate Frame (ACPI 6.7) */ -typedef struct acpi_madt_gicv5_translate_frame -{ - ACPI_SUBTABLE_HEADER Header; - UINT16 Reserved; /* reserved - must be zero */ - UINT32 LinkedTranslatorId; - UINT32 TranslateFrameId; - UINT32 Reserved2; - UINT64 BaseAddress; - -} ACPI_MADT_GICv5_ITS_TRANSLATE; - - -/* 80: OEM data */ - -typedef struct acpi_madt_oem_data -{ - ACPI_FLEX_ARRAY(UINT8, OemData); -} ACPI_MADT_OEM_DATA; - - -/* - * Common flags fields for MADT subtables - */ - -/* MADT Local APIC flags */ - -#define ACPI_MADT_ENABLED (1) /* 00: Processor is usable if set */ -#define ACPI_MADT_ONLINE_CAPABLE (2) /* 01: System HW supports enabling processor at runtime */ - -/* MADT MPS INTI flags (IntiFlags) */ - -#define ACPI_MADT_POLARITY_MASK (3) /* 00-01: Polarity of APIC I/O input signals */ -#define ACPI_MADT_TRIGGER_MASK (3<<2) /* 02-03: Trigger mode of APIC input signals */ - -/* Values for MPS INTI flags */ - -#define ACPI_MADT_POLARITY_CONFORMS 0 -#define ACPI_MADT_POLARITY_ACTIVE_HIGH 1 -#define ACPI_MADT_POLARITY_RESERVED 2 -#define ACPI_MADT_POLARITY_ACTIVE_LOW 3 - -#define ACPI_MADT_TRIGGER_CONFORMS (0) -#define ACPI_MADT_TRIGGER_EDGE (1<<2) -#define ACPI_MADT_TRIGGER_RESERVED (2<<2) -#define ACPI_MADT_TRIGGER_LEVEL (3<<2) - - -/******************************************************************************* - * - * MCFG - PCI Memory Mapped Configuration table and subtable - * Version 1 - * - * Conforms to "PCI Firmware Specification", Revision 3.0, June 20, 2005 - * - ******************************************************************************/ - -typedef struct acpi_table_mcfg -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT8 Reserved[8]; - -} ACPI_TABLE_MCFG; - - -/* Subtable */ - -typedef struct acpi_mcfg_allocation -{ - UINT64 Address; /* Base address, processor-relative */ - UINT16 PciSegment; /* PCI segment group number */ - UINT8 StartBusNumber; /* Starting PCI Bus number */ - UINT8 EndBusNumber; /* Final PCI Bus number */ - UINT32 Reserved; - -} ACPI_MCFG_ALLOCATION; - - -/******************************************************************************* - * - * MCHI - Management Controller Host Interface Table - * Version 1 - * - * Conforms to "Management Component Transport Protocol (MCTP) Host - * Interface Specification", Revision 1.0.0a, October 13, 2009 - * - ******************************************************************************/ - -typedef struct acpi_table_mchi -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT8 InterfaceType; - UINT8 Protocol; - UINT64 ProtocolData; - UINT8 InterruptType; - UINT8 Gpe; - UINT8 PciDeviceFlag; - UINT32 GlobalInterrupt; - ACPI_GENERIC_ADDRESS ControlRegister; - UINT8 PciSegment; - UINT8 PciBus; - UINT8 PciDevice; - UINT8 PciFunction; - -} ACPI_TABLE_MCHI; - -/******************************************************************************* - * - * MPAM - Memory System Resource Partitioning and Monitoring - * - * Conforms to "ACPI for Memory System Resource Partitioning and Monitoring 2.0" - * Document number: ARM DEN 0065, December, 2022. - * - ******************************************************************************/ - -/* MPAM RIS locator types. Table 11, Location types */ -enum AcpiMpamLocatorType { - ACPI_MPAM_LOCATION_TYPE_PROCESSOR_CACHE = 0, - ACPI_MPAM_LOCATION_TYPE_MEMORY = 1, - ACPI_MPAM_LOCATION_TYPE_SMMU = 2, - ACPI_MPAM_LOCATION_TYPE_MEMORY_CACHE = 3, - ACPI_MPAM_LOCATION_TYPE_ACPI_DEVICE = 4, - ACPI_MPAM_LOCATION_TYPE_INTERCONNECT = 5, - ACPI_MPAM_LOCATION_TYPE_UNKNOWN = 0xFF -}; - -/* MPAM Functional dependency descriptor. Table 10 */ -typedef struct acpi_mpam_func_deps -{ - UINT32 Producer; - UINT32 Reserved; -} ACPI_MPAM_FUNC_DEPS; - -/* MPAM Processor cache locator descriptor. Table 13 */ -typedef struct acpi_mpam_resource_cache_locator -{ - UINT64 CacheReference; - UINT32 Reserved; -} ACPI_MPAM_RESOURCE_CACHE_LOCATOR; - -/* MPAM Memory locator descriptor. Table 14 */ -typedef struct acpi_mpam_resource_memory_locator -{ - UINT64 ProximityDomain; - UINT32 Reserved; -} ACPI_MPAM_RESOURCE_MEMORY_LOCATOR; - -/* MPAM SMMU locator descriptor. Table 15 */ -typedef struct acpi_mpam_resource_smmu_locator -{ - UINT64 SmmuInterface; - UINT32 Reserved; -} ACPI_MPAM_RESOURCE_SMMU_INTERFACE; - -/* MPAM Memory-side cache locator descriptor. Table 16 */ -typedef struct acpi_mpam_resource_memcache_locator -{ - UINT8 Reserved[7]; - UINT8 Level; - UINT32 Reference; -} ACPI_MPAM_RESOURCE_MEMCACHE_INTERFACE; - -/* MPAM ACPI device locator descriptor. Table 17 */ -typedef struct acpi_mpam_resource_acpi_locator -{ - UINT64 AcpiHwId; - UINT32 AcpiUniqueId; -} ACPI_MPAM_RESOURCE_ACPI_INTERFACE; - -/* MPAM Interconnect locator descriptor. Table 18 */ -typedef struct acpi_mpam_resource_interconnect_locator -{ - UINT64 InterConnectDescTblOff; - UINT32 Reserved; -} ACPI_MPAM_RESOURCE_INTERCONNECT_INTERFACE; - -/* MPAM Locator structure. Table 12 */ -typedef struct acpi_mpam_resource_generic_locator -{ - UINT64 Descriptor1; - UINT32 Descriptor2; -} ACPI_MPAM_RESOURCE_GENERIC_LOCATOR; - -typedef union acpi_mpam_resource_locator -{ - ACPI_MPAM_RESOURCE_CACHE_LOCATOR CacheLocator; - ACPI_MPAM_RESOURCE_MEMORY_LOCATOR MemoryLocator; - ACPI_MPAM_RESOURCE_SMMU_INTERFACE SmmuLocator; - ACPI_MPAM_RESOURCE_MEMCACHE_INTERFACE MemCacheLocator; - ACPI_MPAM_RESOURCE_ACPI_INTERFACE AcpiLocator; - ACPI_MPAM_RESOURCE_INTERCONNECT_INTERFACE InterconnectIfcLocator; - ACPI_MPAM_RESOURCE_GENERIC_LOCATOR GenericLocator; -} ACPI_MPAM_RESOURCE_LOCATOR; - -/* Memory System Component Resource Node Structure Table 9 */ -typedef struct acpi_mpam_resource_node -{ - UINT32 Identifier; - UINT8 RISIndex; - UINT16 Reserved1; - UINT8 LocatorType; - ACPI_MPAM_RESOURCE_LOCATOR Locator; - UINT32 NumFunctionalDeps; -} ACPI_MPAM_RESOURCE_NODE; - -/* Memory System Component (MSC) Node Structure. Table 4 */ -typedef struct acpi_mpam_msc_node -{ - UINT16 Length; - UINT8 InterfaceType; - UINT8 Reserved; - UINT32 Identifier; - UINT64 BaseAddress; - UINT32 MMIOSize; - UINT32 OverflowInterrupt; - UINT32 OverflowInterruptFlags; - UINT32 Reserved1; - UINT32 OverflowInterruptAffinity; - UINT32 ErrorInterrupt; - UINT32 ErrorInterruptFlags; - UINT32 Reserved2; - UINT32 ErrorInterruptAffinity; - UINT32 MaxNrdyUsec; - UINT64 HardwareIdLinkedDevice; - UINT32 InstanceIdLinkedDevice; - UINT32 NumResourceNodes; -} ACPI_MPAM_MSC_NODE; - -typedef struct acpi_table_mpam -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ -} ACPI_TABLE_MPAM; - -/******************************************************************************* - * - * MPST - Memory Power State Table (ACPI 5.0) - * Version 1 - * - ******************************************************************************/ - -#define ACPI_MPST_CHANNEL_INFO \ - UINT8 ChannelId; \ - UINT8 Reserved1[3]; \ - UINT16 PowerNodeCount; \ - UINT16 Reserved2; - -/* Main table */ - -typedef struct acpi_table_mpst -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - ACPI_MPST_CHANNEL_INFO /* Platform Communication Channel */ - -} ACPI_TABLE_MPST; - - -/* Memory Platform Communication Channel Info */ - -typedef struct acpi_mpst_channel -{ - ACPI_MPST_CHANNEL_INFO /* Platform Communication Channel */ - -} ACPI_MPST_CHANNEL; - - -/* Memory Power Node Structure */ - -typedef struct acpi_mpst_power_node -{ - UINT8 Flags; - UINT8 Reserved1; - UINT16 NodeId; - UINT32 Length; - UINT64 RangeAddress; - UINT64 RangeLength; - UINT32 NumPowerStates; - UINT32 NumPhysicalComponents; - -} ACPI_MPST_POWER_NODE; - -/* Values for Flags field above */ - -#define ACPI_MPST_ENABLED 1 -#define ACPI_MPST_POWER_MANAGED 2 -#define ACPI_MPST_HOT_PLUG_CAPABLE 4 - - -/* Memory Power State Structure (follows POWER_NODE above) */ - -typedef struct acpi_mpst_power_state -{ - UINT8 PowerState; - UINT8 InfoIndex; - -} ACPI_MPST_POWER_STATE; - - -/* Physical Component ID Structure (follows POWER_STATE above) */ - -typedef struct acpi_mpst_component -{ - UINT16 ComponentId; - -} ACPI_MPST_COMPONENT; - - -/* Memory Power State Characteristics Structure (follows all POWER_NODEs) */ - -typedef struct acpi_mpst_data_hdr -{ - UINT16 CharacteristicsCount; - UINT16 Reserved; - -} ACPI_MPST_DATA_HDR; - -typedef struct acpi_mpst_power_data -{ - UINT8 StructureId; - UINT8 Flags; - UINT16 Reserved1; - UINT32 AveragePower; - UINT32 PowerSaving; - UINT64 ExitLatency; - UINT64 Reserved2; - -} ACPI_MPST_POWER_DATA; - -/* Values for Flags field above */ - -#define ACPI_MPST_PRESERVE 1 -#define ACPI_MPST_AUTOENTRY 2 -#define ACPI_MPST_AUTOEXIT 4 - - -/* Shared Memory Region (not part of an ACPI table) */ - -typedef struct acpi_mpst_shared -{ - UINT32 Signature; - UINT16 PccCommand; - UINT16 PccStatus; - UINT32 CommandRegister; - UINT32 StatusRegister; - UINT32 PowerStateId; - UINT32 PowerNodeId; - UINT64 EnergyConsumed; - UINT64 AveragePower; - -} ACPI_MPST_SHARED; - - -/******************************************************************************* - * - * MSCT - Maximum System Characteristics Table (ACPI 4.0) - * Version 1 - * - ******************************************************************************/ - -typedef struct acpi_table_msct -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT32 ProximityOffset; /* Location of proximity info struct(s) */ - UINT32 MaxProximityDomains;/* Max number of proximity domains */ - UINT32 MaxClockDomains; /* Max number of clock domains */ - UINT64 MaxAddress; /* Max physical address in system */ - -} ACPI_TABLE_MSCT; - - -/* Subtable - Maximum Proximity Domain Information. Version 1 */ - -typedef struct acpi_msct_proximity -{ - UINT8 Revision; - UINT8 Length; - UINT32 RangeStart; /* Start of domain range */ - UINT32 RangeEnd; /* End of domain range */ - UINT32 ProcessorCapacity; - UINT64 MemoryCapacity; /* In bytes */ - -} ACPI_MSCT_PROXIMITY; - - -/******************************************************************************* - * - * MRRM - Memory Range and Region Mapping (MRRM) table - * Conforms to "Intel Resource Director Technology Architecture Specification" - * Version 1.1, January 2025 - * - ******************************************************************************/ - -typedef struct acpi_table_mrrm -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT8 MaxMemRegion; /* Max Memory Regions supported */ - UINT8 Flags; /* Region assignment type */ - UINT8 Reserved[26]; - UINT8 Memory_Range_Entry[]; - -} ACPI_TABLE_MRRM; - -/* Flags */ -#define ACPI_MRRM_FLAGS_REGION_ASSIGNMENT_OS (1<<0) - -/******************************************************************************* - * - * Memory Range entry - Memory Range entry in MRRM table - * - ******************************************************************************/ - -typedef struct acpi_mrrm_mem_range_entry -{ - ACPI_SUBTBL_HDR_16 Header; - UINT32 Reserved0; /* Reserved */ - UINT64 AddrBase; /* Base addr of the mem range */ - UINT64 AddrLen; /* Length of the mem range */ - UINT16 RegionIdFlags; /* Valid local or remote Region-ID */ - UINT8 LocalRegionId; /* Platform-assigned static local Region-ID */ - UINT8 RemoteRegionId; /* Platform-assigned static remote Region-ID */ - UINT32 Reserved1; /* Reserved */ - /* Region-ID Programming Registers[] */ - -} ACPI_MRRM_MEM_RANGE_ENTRY; - -/* Values for RegionIdFlags above */ -#define ACPI_MRRM_VALID_REGION_ID_FLAGS_LOCAL (1<<0) -#define ACPI_MRRM_VALID_REGION_ID_FLAGS_REMOTE (1<<1) - - -/******************************************************************************* - * - * MSDM - Microsoft Data Management table - * - * Conforms to "Microsoft Software Licensing Tables (SLIC and MSDM)", - * November 29, 2011. Copyright 2011 Microsoft - * - ******************************************************************************/ - -/* Basic MSDM table is only the common ACPI header */ - -typedef struct acpi_table_msdm -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - -} ACPI_TABLE_MSDM; - - -/******************************************************************************* - * - * NFIT - NVDIMM Interface Table (ACPI 6.0+) - * Version 1 - * - ******************************************************************************/ - -typedef struct acpi_table_nfit -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT32 Reserved; /* Reserved, must be zero */ - -} ACPI_TABLE_NFIT; - -/* Subtable header for NFIT */ - -typedef struct acpi_nfit_header -{ - UINT16 Type; - UINT16 Length; - -} ACPI_NFIT_HEADER; - - -/* Values for subtable type in ACPI_NFIT_HEADER */ - -enum AcpiNfitType -{ - ACPI_NFIT_TYPE_SYSTEM_ADDRESS = 0, - ACPI_NFIT_TYPE_MEMORY_MAP = 1, - ACPI_NFIT_TYPE_INTERLEAVE = 2, - ACPI_NFIT_TYPE_SMBIOS = 3, - ACPI_NFIT_TYPE_CONTROL_REGION = 4, - ACPI_NFIT_TYPE_DATA_REGION = 5, - ACPI_NFIT_TYPE_FLUSH_ADDRESS = 6, - ACPI_NFIT_TYPE_CAPABILITIES = 7, - ACPI_NFIT_TYPE_RESERVED = 8 /* 8 and greater are reserved */ -}; - -/* - * NFIT Subtables - */ - -/* 0: System Physical Address Range Structure */ - -typedef struct acpi_nfit_system_address -{ - ACPI_NFIT_HEADER Header; - UINT16 RangeIndex; - UINT16 Flags; - UINT32 Reserved; /* Reserved, must be zero */ - UINT32 ProximityDomain; - UINT8 RangeGuid[16]; - UINT64 Address; - UINT64 Length; - UINT64 MemoryMapping; - UINT64 LocationCookie; /* ACPI 6.4 */ - -} ACPI_NFIT_SYSTEM_ADDRESS; - -/* Flags */ - -#define ACPI_NFIT_ADD_ONLINE_ONLY (1) /* 00: Add/Online Operation Only */ -#define ACPI_NFIT_PROXIMITY_VALID (1<<1) /* 01: Proximity Domain Valid */ -#define ACPI_NFIT_LOCATION_COOKIE_VALID (1<<2) /* 02: SPA location cookie valid (ACPI 6.4) */ - -/* Range Type GUIDs appear in the include/acuuid.h file */ - - -/* 1: Memory Device to System Address Range Map Structure */ - -typedef struct acpi_nfit_memory_map -{ - ACPI_NFIT_HEADER Header; - UINT32 DeviceHandle; - UINT16 PhysicalId; - UINT16 RegionId; - UINT16 RangeIndex; - UINT16 RegionIndex; - UINT64 RegionSize; - UINT64 RegionOffset; - UINT64 Address; - UINT16 InterleaveIndex; - UINT16 InterleaveWays; - UINT16 Flags; - UINT16 Reserved; /* Reserved, must be zero */ - -} ACPI_NFIT_MEMORY_MAP; - -/* Flags */ - -#define ACPI_NFIT_MEM_SAVE_FAILED (1) /* 00: Last SAVE to Memory Device failed */ -#define ACPI_NFIT_MEM_RESTORE_FAILED (1<<1) /* 01: Last RESTORE from Memory Device failed */ -#define ACPI_NFIT_MEM_FLUSH_FAILED (1<<2) /* 02: Platform flush failed */ -#define ACPI_NFIT_MEM_NOT_ARMED (1<<3) /* 03: Memory Device is not armed */ -#define ACPI_NFIT_MEM_HEALTH_OBSERVED (1<<4) /* 04: Memory Device observed SMART/health events */ -#define ACPI_NFIT_MEM_HEALTH_ENABLED (1<<5) /* 05: SMART/health events enabled */ -#define ACPI_NFIT_MEM_MAP_FAILED (1<<6) /* 06: Mapping to SPA failed */ - - -/* 2: Interleave Structure */ - -typedef struct acpi_nfit_interleave -{ - ACPI_NFIT_HEADER Header; - UINT16 InterleaveIndex; - UINT16 Reserved; /* Reserved, must be zero */ - UINT32 LineCount; - UINT32 LineSize; - UINT32 LineOffset[]; /* Variable length */ - -} ACPI_NFIT_INTERLEAVE; - - -/* 3: SMBIOS Management Information Structure */ - -typedef struct acpi_nfit_smbios -{ - ACPI_NFIT_HEADER Header; - UINT32 Reserved; /* Reserved, must be zero */ - UINT8 Data[]; /* Variable length */ - -} ACPI_NFIT_SMBIOS; - - -/* 4: NVDIMM Control Region Structure */ - -typedef struct acpi_nfit_control_region -{ - ACPI_NFIT_HEADER Header; - UINT16 RegionIndex; - UINT16 VendorId; - UINT16 DeviceId; - UINT16 RevisionId; - UINT16 SubsystemVendorId; - UINT16 SubsystemDeviceId; - UINT16 SubsystemRevisionId; - UINT8 ValidFields; - UINT8 ManufacturingLocation; - UINT16 ManufacturingDate; - UINT8 Reserved[2]; /* Reserved, must be zero */ - UINT32 SerialNumber; - UINT16 Code; - UINT16 Windows; - UINT64 WindowSize; - UINT64 CommandOffset; - UINT64 CommandSize; - UINT64 StatusOffset; - UINT64 StatusSize; - UINT16 Flags; - UINT8 Reserved1[6]; /* Reserved, must be zero */ - -} ACPI_NFIT_CONTROL_REGION; - -/* Flags */ - -#define ACPI_NFIT_CONTROL_BUFFERED (1) /* Block Data Windows implementation is buffered */ - -/* ValidFields bits */ - -#define ACPI_NFIT_CONTROL_MFG_INFO_VALID (1) /* Manufacturing fields are valid */ - - -/* 5: NVDIMM Block Data Window Region Structure */ - -typedef struct acpi_nfit_data_region -{ - ACPI_NFIT_HEADER Header; - UINT16 RegionIndex; - UINT16 Windows; - UINT64 Offset; - UINT64 Size; - UINT64 Capacity; - UINT64 StartAddress; - -} ACPI_NFIT_DATA_REGION; - - -/* 6: Flush Hint Address Structure */ - -typedef struct acpi_nfit_flush_address -{ - ACPI_NFIT_HEADER Header; - UINT32 DeviceHandle; - UINT16 HintCount; - UINT8 Reserved[6]; /* Reserved, must be zero */ - UINT64 HintAddress[]; /* Variable length */ - -} ACPI_NFIT_FLUSH_ADDRESS; - - -/* 7: Platform Capabilities Structure */ - -typedef struct acpi_nfit_capabilities -{ - ACPI_NFIT_HEADER Header; - UINT8 HighestCapability; - UINT8 Reserved[3]; /* Reserved, must be zero */ - UINT32 Capabilities; - UINT32 Reserved2; - -} ACPI_NFIT_CAPABILITIES; - -/* Capabilities Flags */ - -#define ACPI_NFIT_CAPABILITY_CACHE_FLUSH (1) /* 00: Cache Flush to NVDIMM capable */ -#define ACPI_NFIT_CAPABILITY_MEM_FLUSH (1<<1) /* 01: Memory Flush to NVDIMM capable */ -#define ACPI_NFIT_CAPABILITY_MEM_MIRRORING (1<<2) /* 02: Memory Mirroring capable */ - - -/* - * NFIT/DVDIMM device handle support - used as the _ADR for each NVDIMM - */ -typedef struct nfit_device_handle -{ - UINT32 Handle; - -} NFIT_DEVICE_HANDLE; - -/* Device handle construction and extraction macros */ - -#define ACPI_NFIT_DIMM_NUMBER_MASK 0x0000000F -#define ACPI_NFIT_CHANNEL_NUMBER_MASK 0x000000F0 -#define ACPI_NFIT_MEMORY_ID_MASK 0x00000F00 -#define ACPI_NFIT_SOCKET_ID_MASK 0x0000F000 -#define ACPI_NFIT_NODE_ID_MASK 0x0FFF0000 - -#define ACPI_NFIT_DIMM_NUMBER_OFFSET 0 -#define ACPI_NFIT_CHANNEL_NUMBER_OFFSET 4 -#define ACPI_NFIT_MEMORY_ID_OFFSET 8 -#define ACPI_NFIT_SOCKET_ID_OFFSET 12 -#define ACPI_NFIT_NODE_ID_OFFSET 16 - -/* Macro to construct a NFIT/NVDIMM device handle */ - -#define ACPI_NFIT_BUILD_DEVICE_HANDLE(dimm, channel, memory, socket, node) \ - ((dimm) | \ - ((channel) << ACPI_NFIT_CHANNEL_NUMBER_OFFSET) | \ - ((memory) << ACPI_NFIT_MEMORY_ID_OFFSET) | \ - ((socket) << ACPI_NFIT_SOCKET_ID_OFFSET) | \ - ((node) << ACPI_NFIT_NODE_ID_OFFSET)) - -/* Macros to extract individual fields from a NFIT/NVDIMM device handle */ - -#define ACPI_NFIT_GET_DIMM_NUMBER(handle) \ - ((handle) & ACPI_NFIT_DIMM_NUMBER_MASK) - -#define ACPI_NFIT_GET_CHANNEL_NUMBER(handle) \ - (((handle) & ACPI_NFIT_CHANNEL_NUMBER_MASK) >> ACPI_NFIT_CHANNEL_NUMBER_OFFSET) - -#define ACPI_NFIT_GET_MEMORY_ID(handle) \ - (((handle) & ACPI_NFIT_MEMORY_ID_MASK) >> ACPI_NFIT_MEMORY_ID_OFFSET) - -#define ACPI_NFIT_GET_SOCKET_ID(handle) \ - (((handle) & ACPI_NFIT_SOCKET_ID_MASK) >> ACPI_NFIT_SOCKET_ID_OFFSET) - -#define ACPI_NFIT_GET_NODE_ID(handle) \ - (((handle) & ACPI_NFIT_NODE_ID_MASK) >> ACPI_NFIT_NODE_ID_OFFSET) - - -/******************************************************************************* - * - * NHLT - Non HDAudio Link Table - * Version 1 - * - ******************************************************************************/ - -typedef struct acpi_table_nhlt -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT8 EndpointsCount; - /* - * ACPI_NHLT_ENDPOINT Endpoints[]; - * ACPI_NHLT_CONFIG OEDConfig; - */ - -} ACPI_TABLE_NHLT; - -typedef struct acpi_nhlt_endpoint -{ - UINT32 Length; - UINT8 LinkType; - UINT8 InstanceId; - UINT16 VendorId; - UINT16 DeviceId; - UINT16 RevisionId; - UINT32 SubsystemId; - UINT8 DeviceType; - UINT8 Direction; - UINT8 VirtualBusId; - /* - * ACPI_NHLT_CONFIG DeviceConfig; - * ACPI_NHLT_FORMATS_CONFIG FormatsConfig; - * ACPI_NHLT_DEVICES_INFO DevicesInfo; - */ - -} ACPI_NHLT_ENDPOINT; - -/* Values for LinkType field above */ - -#define ACPI_NHLT_LINKTYPE_HDA 0 -#define ACPI_NHLT_LINKTYPE_DSP 1 -#define ACPI_NHLT_LINKTYPE_PDM 2 -#define ACPI_NHLT_LINKTYPE_SSP 3 -#define ACPI_NHLT_LINKTYPE_SLIMBUS 4 -#define ACPI_NHLT_LINKTYPE_SDW 5 -#define ACPI_NHLT_LINKTYPE_UAOL 6 - -/* Values for DeviceId field above */ - -#define ACPI_NHLT_DEVICEID_DMIC 0xAE20 -#define ACPI_NHLT_DEVICEID_BT 0xAE30 -#define ACPI_NHLT_DEVICEID_I2S 0xAE34 - -/* Values for DeviceType field above */ - -/* Device types unique to endpoint of LinkType=PDM */ -#define ACPI_NHLT_DEVICETYPE_PDM 0 -#define ACPI_NHLT_DEVICETYPE_PDM_SKL 1 -/* Device types unique to endpoint of LinkType=SSP */ -#define ACPI_NHLT_DEVICETYPE_BT 0 -#define ACPI_NHLT_DEVICETYPE_FM 1 -#define ACPI_NHLT_DEVICETYPE_MODEM 2 -#define ACPI_NHLT_DEVICETYPE_CODEC 4 - -/* Values for Direction field above */ - -#define ACPI_NHLT_DIR_RENDER 0 -#define ACPI_NHLT_DIR_CAPTURE 1 - -typedef struct acpi_nhlt_config -{ - UINT32 CapabilitiesSize; - UINT8 Capabilities[1]; - -} ACPI_NHLT_CONFIG; - -typedef struct acpi_nhlt_gendevice_config -{ - UINT8 VirtualSlot; - UINT8 ConfigType; - -} ACPI_NHLT_GENDEVICE_CONFIG; - -/* Values for ConfigType field above */ - -#define ACPI_NHLT_CONFIGTYPE_GENERIC 0 -#define ACPI_NHLT_CONFIGTYPE_MICARRAY 1 - -typedef struct acpi_nhlt_micdevice_config -{ - UINT8 VirtualSlot; - UINT8 ConfigType; - UINT8 ArrayType; - -} ACPI_NHLT_MICDEVICE_CONFIG; - -/* Values for ArrayType field above */ - -#define ACPI_NHLT_ARRAYTYPE_LINEAR2_SMALL 0xA -#define ACPI_NHLT_ARRAYTYPE_LINEAR2_BIG 0xB -#define ACPI_NHLT_ARRAYTYPE_LINEAR4_GEO1 0xC -#define ACPI_NHLT_ARRAYTYPE_PLANAR4_LSHAPED 0xD -#define ACPI_NHLT_ARRAYTYPE_LINEAR4_GEO2 0xE -#define ACPI_NHLT_ARRAYTYPE_VENDOR 0xF - -typedef struct acpi_nhlt_vendor_mic_config -{ - UINT8 Type; - UINT8 Panel; - UINT16 SpeakerPositionDistance; /* mm */ - UINT16 HorizontalOffset; /* mm */ - UINT16 VerticalOffset; /* mm */ - UINT8 FrequencyLowBand; /* 5*Hz */ - UINT8 FrequencyHighBand; /* 500*Hz */ - UINT16 DirectionAngle; /* -180 - +180 */ - UINT16 ElevationAngle; /* -180 - +180 */ - UINT16 WorkVerticalAngleBegin; /* -180 - +180 with 2 deg step */ - UINT16 WorkVerticalAngleEnd; /* -180 - +180 with 2 deg step */ - UINT16 WorkHorizontalAngleBegin; /* -180 - +180 with 2 deg step */ - UINT16 WorkHorizontalAngleEnd; /* -180 - +180 with 2 deg step */ - -} ACPI_NHLT_VENDOR_MIC_CONFIG; - -/* Values for Type field above */ - -#define ACPI_NHLT_MICTYPE_OMNIDIRECTIONAL 0 -#define ACPI_NHLT_MICTYPE_SUBCARDIOID 1 -#define ACPI_NHLT_MICTYPE_CARDIOID 2 -#define ACPI_NHLT_MICTYPE_SUPERCARDIOID 3 -#define ACPI_NHLT_MICTYPE_HYPERCARDIOID 4 -#define ACPI_NHLT_MICTYPE_8SHAPED 5 -#define ACPI_NHLT_MICTYPE_RESERVED 6 -#define ACPI_NHLT_MICTYPE_VENDORDEFINED 7 - -/* Values for Panel field above */ - -#define ACPI_NHLT_MICLOCATION_TOP 0 -#define ACPI_NHLT_MICLOCATION_BOTTOM 1 -#define ACPI_NHLT_MICLOCATION_LEFT 2 -#define ACPI_NHLT_MICLOCATION_RIGHT 3 -#define ACPI_NHLT_MICLOCATION_FRONT 4 -#define ACPI_NHLT_MICLOCATION_REAR 5 - -typedef struct acpi_nhlt_vendor_micdevice_config -{ - UINT8 VirtualSlot; - UINT8 ConfigType; - UINT8 ArrayType; - UINT8 MicsCount; - ACPI_NHLT_VENDOR_MIC_CONFIG Mics[]; - -} ACPI_NHLT_VENDOR_MICDEVICE_CONFIG; - -typedef union acpi_nhlt_device_config -{ - UINT8 VirtualSlot; - ACPI_NHLT_GENDEVICE_CONFIG Gen; - ACPI_NHLT_MICDEVICE_CONFIG Mic; - ACPI_NHLT_VENDOR_MICDEVICE_CONFIG VendorMic; - -} ACPI_NHLT_DEVICE_CONFIG; - -/* Inherited from Microsoft's WAVEFORMATEXTENSIBLE. */ -typedef struct acpi_nhlt_wave_formatext -{ - UINT16 FormatTag; - UINT16 ChannelCount; - UINT32 SamplesPerSec; - UINT32 AvgBytesPerSec; - UINT16 BlockAlign; - UINT16 BitsPerSample; - UINT16 ExtraFormatSize; - UINT16 ValidBitsPerSample; - UINT32 ChannelMask; - UINT8 Subformat[16]; - -} ACPI_NHLT_WAVE_FORMATEXT; - -typedef struct acpi_nhlt_format_config -{ - ACPI_NHLT_WAVE_FORMATEXT Format; - ACPI_NHLT_CONFIG Config; - -} ACPI_NHLT_FORMAT_CONFIG; - -typedef struct acpi_nhlt_formats_config -{ - UINT8 FormatsCount; - ACPI_NHLT_FORMAT_CONFIG Formats[]; - -} ACPI_NHLT_FORMATS_CONFIG; - -typedef struct acpi_nhlt_device_info -{ - UINT8 Id[16]; - UINT8 InstanceId; - UINT8 PortId; - -} ACPI_NHLT_DEVICE_INFO; - -typedef struct acpi_nhlt_devices_info -{ - UINT8 DevicesCount; - ACPI_NHLT_DEVICE_INFO Devices[]; - -} ACPI_NHLT_DEVICES_INFO; - - -/******************************************************************************* - * - * PCCT - Platform Communications Channel Table (ACPI 5.0) - * Version 2 (ACPI 6.2) - * - ******************************************************************************/ - -typedef struct acpi_table_pcct -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT32 Flags; - UINT64 Reserved; - -} ACPI_TABLE_PCCT; - -/* Values for Flags field above */ - -#define ACPI_PCCT_DOORBELL 1 - -/* Values for subtable type in ACPI_SUBTABLE_HEADER */ - -enum AcpiPcctType -{ - ACPI_PCCT_TYPE_GENERIC_SUBSPACE = 0, - ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE = 1, - ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2 = 2, /* ACPI 6.1 */ - ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE = 3, /* ACPI 6.2 */ - ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE = 4, /* ACPI 6.2 */ - ACPI_PCCT_TYPE_HW_REG_COMM_SUBSPACE = 5, /* ACPI 6.4 */ - ACPI_PCCT_TYPE_RESERVED = 6 /* 6 and greater are reserved */ -}; - -/* - * PCCT Subtables, correspond to Type in ACPI_SUBTABLE_HEADER - */ - -/* 0: Generic Communications Subspace */ - -typedef struct acpi_pcct_subspace -{ - ACPI_SUBTABLE_HEADER Header; - UINT8 Reserved[6]; - UINT64 BaseAddress; - UINT64 Length; - ACPI_GENERIC_ADDRESS DoorbellRegister; - UINT64 PreserveMask; - UINT64 WriteMask; - UINT32 Latency; - UINT32 MaxAccessRate; - UINT16 MinTurnaroundTime; - -} ACPI_PCCT_SUBSPACE; - - -/* 1: HW-reduced Communications Subspace (ACPI 5.1) */ - -typedef struct acpi_pcct_hw_reduced -{ - ACPI_SUBTABLE_HEADER Header; - UINT32 PlatformInterrupt; - UINT8 Flags; - UINT8 Reserved; - UINT64 BaseAddress; - UINT64 Length; - ACPI_GENERIC_ADDRESS DoorbellRegister; - UINT64 PreserveMask; - UINT64 WriteMask; - UINT32 Latency; - UINT32 MaxAccessRate; - UINT16 MinTurnaroundTime; - -} ACPI_PCCT_HW_REDUCED; - - -/* 2: HW-reduced Communications Subspace Type 2 (ACPI 6.1) */ - -typedef struct acpi_pcct_hw_reduced_type2 -{ - ACPI_SUBTABLE_HEADER Header; - UINT32 PlatformInterrupt; - UINT8 Flags; - UINT8 Reserved; - UINT64 BaseAddress; - UINT64 Length; - ACPI_GENERIC_ADDRESS DoorbellRegister; - UINT64 PreserveMask; - UINT64 WriteMask; - UINT32 Latency; - UINT32 MaxAccessRate; - UINT16 MinTurnaroundTime; - ACPI_GENERIC_ADDRESS PlatformAckRegister; - UINT64 AckPreserveMask; - UINT64 AckWriteMask; - -} ACPI_PCCT_HW_REDUCED_TYPE2; - - -/* 3: Extended PCC Master Subspace Type 3 (ACPI 6.2) */ - -typedef struct acpi_pcct_ext_pcc_master -{ - ACPI_SUBTABLE_HEADER Header; - UINT32 PlatformInterrupt; - UINT8 Flags; - UINT8 Reserved1; - UINT64 BaseAddress; - UINT32 Length; - ACPI_GENERIC_ADDRESS DoorbellRegister; - UINT64 PreserveMask; - UINT64 WriteMask; - UINT32 Latency; - UINT32 MaxAccessRate; - UINT32 MinTurnaroundTime; - ACPI_GENERIC_ADDRESS PlatformAckRegister; - UINT64 AckPreserveMask; - UINT64 AckSetMask; - UINT64 Reserved2; - ACPI_GENERIC_ADDRESS CmdCompleteRegister; - UINT64 CmdCompleteMask; - ACPI_GENERIC_ADDRESS CmdUpdateRegister; - UINT64 CmdUpdatePreserveMask; - UINT64 CmdUpdateSetMask; - ACPI_GENERIC_ADDRESS ErrorStatusRegister; - UINT64 ErrorStatusMask; - -} ACPI_PCCT_EXT_PCC_MASTER; - - -/* 4: Extended PCC Slave Subspace Type 4 (ACPI 6.2) */ - -typedef struct acpi_pcct_ext_pcc_slave -{ - ACPI_SUBTABLE_HEADER Header; - UINT32 PlatformInterrupt; - UINT8 Flags; - UINT8 Reserved1; - UINT64 BaseAddress; - UINT32 Length; - ACPI_GENERIC_ADDRESS DoorbellRegister; - UINT64 PreserveMask; - UINT64 WriteMask; - UINT32 Latency; - UINT32 MaxAccessRate; - UINT32 MinTurnaroundTime; - ACPI_GENERIC_ADDRESS PlatformAckRegister; - UINT64 AckPreserveMask; - UINT64 AckSetMask; - UINT64 Reserved2; - ACPI_GENERIC_ADDRESS CmdCompleteRegister; - UINT64 CmdCompleteMask; - ACPI_GENERIC_ADDRESS CmdUpdateRegister; - UINT64 CmdUpdatePreserveMask; - UINT64 CmdUpdateSetMask; - ACPI_GENERIC_ADDRESS ErrorStatusRegister; - UINT64 ErrorStatusMask; - -} ACPI_PCCT_EXT_PCC_SLAVE; - -/* 5: HW Registers based Communications Subspace */ - -typedef struct acpi_pcct_hw_reg -{ - ACPI_SUBTABLE_HEADER Header; - UINT16 Version; - UINT64 BaseAddress; - UINT64 Length; - ACPI_GENERIC_ADDRESS DoorbellRegister; - UINT64 DoorbellPreserve; - UINT64 DoorbellWrite; - ACPI_GENERIC_ADDRESS CmdCompleteRegister; - UINT64 CmdCompleteMask; - ACPI_GENERIC_ADDRESS ErrorStatusRegister; - UINT64 ErrorStatusMask; - UINT32 NominalLatency; - UINT32 MinTurnaroundTime; - -} ACPI_PCCT_HW_REG; - - -/* Values for doorbell flags above */ - -#define ACPI_PCCT_INTERRUPT_POLARITY (1) -#define ACPI_PCCT_INTERRUPT_MODE (1<<1) - - -/* - * PCC memory structures (not part of the ACPI table) - */ - -/* Shared Memory Region */ - -typedef struct acpi_pcct_shared_memory -{ - UINT32 Signature; - UINT16 Command; - UINT16 Status; - -} ACPI_PCCT_SHARED_MEMORY; - - -/* Extended PCC Subspace Shared Memory Region (ACPI 6.2) */ - -typedef struct acpi_pcct_ext_pcc_shared_memory -{ - UINT32 Signature; - UINT32 Flags; - UINT32 Length; - UINT32 Command; - -} ACPI_PCCT_EXT_PCC_SHARED_MEMORY; - - -/******************************************************************************* - * - * PDTT - Platform Debug Trigger Table (ACPI 6.2) - * Version 0 - * - ******************************************************************************/ - -typedef struct acpi_table_pdtt -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT8 TriggerCount; - UINT8 Reserved[3]; - UINT32 ArrayOffset; - -} ACPI_TABLE_PDTT; - - -/* - * PDTT Communication Channel Identifier Structure. - * The number of these structures is defined by TriggerCount above, - * starting at ArrayOffset. - */ -typedef struct acpi_pdtt_channel -{ - UINT8 SubchannelId; - UINT8 Flags; - -} ACPI_PDTT_CHANNEL; - -/* Flags for above */ - -#define ACPI_PDTT_RUNTIME_TRIGGER (1) -#define ACPI_PDTT_WAIT_COMPLETION (1<<1) -#define ACPI_PDTT_TRIGGER_ORDER (1<<2) - - -/******************************************************************************* - * - * PHAT - Platform Health Assessment Table (ACPI 6.4) - * Version 1 - * - ******************************************************************************/ - -typedef struct acpi_table_phat -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - -} ACPI_TABLE_PHAT; - -/* Common header for PHAT subtables that follow main table */ - -typedef struct acpi_phat_header -{ - UINT16 Type; - UINT16 Length; - UINT8 Revision; - -} ACPI_PHAT_HEADER; - - -/* Values for Type field above */ - -#define ACPI_PHAT_TYPE_FW_VERSION_DATA 0 -#define ACPI_PHAT_TYPE_FW_HEALTH_DATA 1 -#define ACPI_PHAT_TYPE_RESERVED 2 /* 0x02-0xFFFF are reserved */ - -/* - * PHAT subtables, correspond to Type in ACPI_PHAT_HEADER - */ - -/* 0: Firmware Version Data Record */ - -typedef struct acpi_phat_version_data -{ - ACPI_PHAT_HEADER Header; - UINT8 Reserved[3]; - UINT32 ElementCount; - -} ACPI_PHAT_VERSION_DATA; - -typedef struct acpi_phat_version_element -{ - UINT8 Guid[16]; - UINT64 VersionValue; - UINT32 ProducerId; - -} ACPI_PHAT_VERSION_ELEMENT; - - -/* 1: Firmware Health Data Record */ - -typedef struct acpi_phat_health_data -{ - ACPI_PHAT_HEADER Header; - UINT8 Reserved[2]; - UINT8 Health; - UINT8 DeviceGuid[16]; - UINT32 DeviceSpecificOffset; /* Zero if no Device-specific data */ - -} ACPI_PHAT_HEALTH_DATA; - -/* Values for Health field above */ - -#define ACPI_PHAT_ERRORS_FOUND 0 -#define ACPI_PHAT_NO_ERRORS 1 -#define ACPI_PHAT_UNKNOWN_ERRORS 2 -#define ACPI_PHAT_ADVISORY 3 - - -/******************************************************************************* - * - * PMTT - Platform Memory Topology Table (ACPI 5.0) - * Version 1 - * - ******************************************************************************/ - -typedef struct acpi_table_pmtt -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT32 MemoryDeviceCount; - /* - * Immediately followed by: - * MEMORY_DEVICE MemoryDeviceStruct[MemoryDeviceCount]; - */ - -} ACPI_TABLE_PMTT; - - -/* Common header for PMTT subtables that follow main table */ - -typedef struct acpi_pmtt_header -{ - UINT8 Type; - UINT8 Reserved1; - UINT16 Length; - UINT16 Flags; - UINT16 Reserved2; - UINT32 MemoryDeviceCount; /* Zero means no memory device structs follow */ - /* - * Immediately followed by: - * UINT8 TypeSpecificData[] - * MEMORY_DEVICE MemoryDeviceStruct[MemoryDeviceCount]; - */ - -} ACPI_PMTT_HEADER; - -/* Values for Type field above */ - -#define ACPI_PMTT_TYPE_SOCKET 0 -#define ACPI_PMTT_TYPE_CONTROLLER 1 -#define ACPI_PMTT_TYPE_DIMM 2 -#define ACPI_PMTT_TYPE_RESERVED 3 /* 0x03-0xFE are reserved */ -#define ACPI_PMTT_TYPE_VENDOR 0xFF - -/* Values for Flags field above */ - -#define ACPI_PMTT_TOP_LEVEL 0x0001 -#define ACPI_PMTT_PHYSICAL 0x0002 -#define ACPI_PMTT_MEMORY_TYPE 0x000C - - -/* - * PMTT subtables, correspond to Type in acpi_pmtt_header - */ - - -/* 0: Socket Structure */ - -typedef struct acpi_pmtt_socket -{ - ACPI_PMTT_HEADER Header; - UINT16 SocketId; - UINT16 Reserved; - -} ACPI_PMTT_SOCKET; - /* - * Immediately followed by: - * MEMORY_DEVICE MemoryDeviceStruct[MemoryDeviceCount]; - */ - - -/* 1: Memory Controller subtable */ - -typedef struct acpi_pmtt_controller -{ - ACPI_PMTT_HEADER Header; - UINT16 ControllerId; - UINT16 Reserved; - -} ACPI_PMTT_CONTROLLER; - /* - * Immediately followed by: - * MEMORY_DEVICE MemoryDeviceStruct[MemoryDeviceCount]; - */ - - -/* 2: Physical Component Identifier (DIMM) */ - -typedef struct acpi_pmtt_physical_component -{ - ACPI_PMTT_HEADER Header; - UINT32 BiosHandle; - -} ACPI_PMTT_PHYSICAL_COMPONENT; - - -/* 0xFF: Vendor Specific Data */ - -typedef struct acpi_pmtt_vendor_specific -{ - ACPI_PMTT_HEADER Header; - UINT8 TypeUuid[16]; - UINT8 Specific[]; - /* - * Immediately followed by: - * UINT8 VendorSpecificData[]; - * MEMORY_DEVICE MemoryDeviceStruct[MemoryDeviceCount]; - */ - -} ACPI_PMTT_VENDOR_SPECIFIC; - - -/******************************************************************************* - * - * PPTT - Processor Properties Topology Table (ACPI 6.2) - * Version 1 - * - ******************************************************************************/ - -typedef struct acpi_table_pptt -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - -} ACPI_TABLE_PPTT; - -/* Values for Type field above */ - -enum AcpiPpttType -{ - ACPI_PPTT_TYPE_PROCESSOR = 0, - ACPI_PPTT_TYPE_CACHE = 1, - ACPI_PPTT_TYPE_ID = 2, - ACPI_PPTT_TYPE_RESERVED = 3 -}; - - -/* 0: Processor Hierarchy Node Structure */ - -typedef struct acpi_pptt_processor -{ - ACPI_SUBTABLE_HEADER Header; - UINT16 Reserved; - UINT32 Flags; - UINT32 Parent; - UINT32 AcpiProcessorId; - UINT32 NumberOfPrivResources; - -} ACPI_PPTT_PROCESSOR; - -/* Flags */ - -#define ACPI_PPTT_PHYSICAL_PACKAGE (1) -#define ACPI_PPTT_ACPI_PROCESSOR_ID_VALID (1<<1) -#define ACPI_PPTT_ACPI_PROCESSOR_IS_THREAD (1<<2) /* ACPI 6.3 */ -#define ACPI_PPTT_ACPI_LEAF_NODE (1<<3) /* ACPI 6.3 */ -#define ACPI_PPTT_ACPI_IDENTICAL (1<<4) /* ACPI 6.3 */ - - -/* 1: Cache Type Structure */ - -typedef struct acpi_pptt_cache -{ - ACPI_SUBTABLE_HEADER Header; - UINT16 Reserved; - UINT32 Flags; - UINT32 NextLevelOfCache; - UINT32 Size; - UINT32 NumberOfSets; - UINT8 Associativity; - UINT8 Attributes; - UINT16 LineSize; - -} ACPI_PPTT_CACHE; - -/* 1: Cache Type Structure for PPTT version 3 */ - -typedef struct acpi_pptt_cache_v1 -{ - ACPI_SUBTABLE_HEADER Header; - UINT16 Reserved; - UINT32 Flags; - UINT32 NextLevelOfCache; - UINT32 Size; - UINT32 NumberOfSets; - UINT8 Associativity; - UINT8 Attributes; - UINT16 LineSize; - UINT32 CacheId; - -} ACPI_PPTT_CACHE_V1; - - -/* Flags */ - -#define ACPI_PPTT_SIZE_PROPERTY_VALID (1) /* Physical property valid */ -#define ACPI_PPTT_NUMBER_OF_SETS_VALID (1<<1) /* Number of sets valid */ -#define ACPI_PPTT_ASSOCIATIVITY_VALID (1<<2) /* Associativity valid */ -#define ACPI_PPTT_ALLOCATION_TYPE_VALID (1<<3) /* Allocation type valid */ -#define ACPI_PPTT_CACHE_TYPE_VALID (1<<4) /* Cache type valid */ -#define ACPI_PPTT_WRITE_POLICY_VALID (1<<5) /* Write policy valid */ -#define ACPI_PPTT_LINE_SIZE_VALID (1<<6) /* Line size valid */ -#define ACPI_PPTT_CACHE_ID_VALID (1<<7) /* Cache ID valid */ - -/* Masks for Attributes */ - -#define ACPI_PPTT_MASK_ALLOCATION_TYPE (0x03) /* Allocation type */ -#define ACPI_PPTT_MASK_CACHE_TYPE (0x0C) /* Cache type */ -#define ACPI_PPTT_MASK_WRITE_POLICY (0x10) /* Write policy */ - -/* Attributes describing cache */ -#define ACPI_PPTT_CACHE_READ_ALLOCATE (0x0) /* Cache line is allocated on read */ -#define ACPI_PPTT_CACHE_WRITE_ALLOCATE (0x01) /* Cache line is allocated on write */ -#define ACPI_PPTT_CACHE_RW_ALLOCATE (0x02) /* Cache line is allocated on read and write */ -#define ACPI_PPTT_CACHE_RW_ALLOCATE_ALT (0x03) /* Alternate representation of above */ - -#define ACPI_PPTT_CACHE_TYPE_DATA (0x0) /* Data cache */ -#define ACPI_PPTT_CACHE_TYPE_INSTR (1<<2) /* Instruction cache */ -#define ACPI_PPTT_CACHE_TYPE_UNIFIED (2<<2) /* Unified I & D cache */ -#define ACPI_PPTT_CACHE_TYPE_UNIFIED_ALT (3<<2) /* Alternate representation of above */ - -#define ACPI_PPTT_CACHE_POLICY_WB (0x0) /* Cache is write back */ -#define ACPI_PPTT_CACHE_POLICY_WT (1<<4) /* Cache is write through */ - -/* 2: ID Structure */ - -typedef struct acpi_pptt_id -{ - ACPI_SUBTABLE_HEADER Header; - UINT16 Reserved; - UINT32 VendorId; - UINT64 Level1Id; - UINT64 Level2Id; - UINT16 MajorRev; - UINT16 MinorRev; - UINT16 SpinRev; - -} ACPI_PPTT_ID; - - -/******************************************************************************* - * - * PRMT - Platform Runtime Mechanism Table - * Version 1 - * - ******************************************************************************/ - -typedef struct acpi_table_prmt -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - -} ACPI_TABLE_PRMT; - -typedef struct acpi_table_prmt_header -{ - UINT8 PlatformGuid[16]; - UINT32 ModuleInfoOffset; - UINT32 ModuleInfoCount; - -} ACPI_TABLE_PRMT_HEADER; - -typedef struct acpi_prmt_module_header -{ - UINT16 Revision; - UINT16 Length; - -} ACPI_PRMT_MODULE_HEADER; - -typedef struct acpi_prmt_module_info -{ - UINT16 Revision; - UINT16 Length; - UINT8 ModuleGuid[16]; - UINT16 MajorRev; - UINT16 MinorRev; - UINT16 HandlerInfoCount; - UINT32 HandlerInfoOffset; - UINT64 MmioListPointer; - -} ACPI_PRMT_MODULE_INFO; - -typedef struct acpi_prmt_handler_info -{ - UINT16 Revision; - UINT16 Length; - UINT8 HandlerGuid[16]; - UINT64 HandlerAddress; - UINT64 StaticDataBufferAddress; - UINT64 AcpiParamBufferAddress; - -} ACPI_PRMT_HANDLER_INFO; - - -/******************************************************************************* - * - * RASF - RAS Feature Table (ACPI 5.0) - * Version 1 - * - ******************************************************************************/ - -typedef struct acpi_table_rasf -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT8 ChannelId[12]; - -} ACPI_TABLE_RASF; - -/* RASF Platform Communication Channel Shared Memory Region */ - -typedef struct acpi_rasf_shared_memory -{ - UINT32 Signature; - UINT16 Command; - UINT16 Status; - UINT16 Version; - UINT8 Capabilities[16]; - UINT8 SetCapabilities[16]; - UINT16 NumParameterBlocks; - UINT32 SetCapabilitiesStatus; - -} ACPI_RASF_SHARED_MEMORY; - -/* RASF Parameter Block Structure Header */ - -typedef struct acpi_rasf_parameter_block -{ - UINT16 Type; - UINT16 Version; - UINT16 Length; - -} ACPI_RASF_PARAMETER_BLOCK; - -/* RASF Parameter Block Structure for PATROL_SCRUB */ - -typedef struct acpi_rasf_patrol_scrub_parameter -{ - ACPI_RASF_PARAMETER_BLOCK Header; - UINT16 PatrolScrubCommand; - UINT64 RequestedAddressRange[2]; - UINT64 ActualAddressRange[2]; - UINT16 Flags; - UINT8 RequestedSpeed; - -} ACPI_RASF_PATROL_SCRUB_PARAMETER; - -/* Masks for Flags and Speed fields above */ - -#define ACPI_RASF_SCRUBBER_RUNNING 1 -#define ACPI_RASF_SPEED (7<<1) -#define ACPI_RASF_SPEED_SLOW (0<<1) -#define ACPI_RASF_SPEED_MEDIUM (4<<1) -#define ACPI_RASF_SPEED_FAST (7<<1) - -/* Channel Commands */ - -enum AcpiRasfCommands -{ - ACPI_RASF_EXECUTE_RASF_COMMAND = 1 -}; - -/* Platform RAS Capabilities */ - -enum AcpiRasfCapabiliities -{ - ACPI_HW_PATROL_SCRUB_SUPPORTED = 0, - ACPI_SW_PATROL_SCRUB_EXPOSED = 1 -}; - -/* Patrol Scrub Commands */ - -enum AcpiRasfPatrolScrubCommands -{ - ACPI_RASF_GET_PATROL_PARAMETERS = 1, - ACPI_RASF_START_PATROL_SCRUBBER = 2, - ACPI_RASF_STOP_PATROL_SCRUBBER = 3 -}; - -/* Channel Command flags */ - -#define ACPI_RASF_GENERATE_SCI (1<<15) - -/* Status values */ - -enum AcpiRasfStatus -{ - ACPI_RASF_SUCCESS = 0, - ACPI_RASF_NOT_VALID = 1, - ACPI_RASF_NOT_SUPPORTED = 2, - ACPI_RASF_BUSY = 3, - ACPI_RASF_FAILED = 4, - ACPI_RASF_ABORTED = 5, - ACPI_RASF_INVALID_DATA = 6 -}; - -/* Status flags */ - -#define ACPI_RASF_COMMAND_COMPLETE (1) -#define ACPI_RASF_SCI_DOORBELL (1<<1) -#define ACPI_RASF_ERROR (1<<2) -#define ACPI_RASF_STATUS (0x1F<<3) - - -/******************************************************************************* - * - * RAS2 - RAS2 Feature Table (ACPI 6.5) - * Version 1 - * - * - ******************************************************************************/ - -typedef struct acpi_table_ras2 { - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT16 Reserved; - UINT16 NumPccDescs; - -} ACPI_TABLE_RAS2; - -/* RAS2 Platform Communication Channel Descriptor */ - -typedef struct acpi_ras2_pcc_desc { - UINT8 ChannelId; - UINT16 Reserved; - UINT8 FeatureType; - UINT32 Instance; - -} ACPI_RAS2_PCC_DESC; - -/* RAS2 Platform Communication Channel Shared Memory Region */ - -typedef struct acpi_ras2_shmem { - UINT32 Signature; - UINT16 Command; - UINT16 Status; - UINT16 Version; - UINT8 Features[16]; - UINT8 SetCaps[16]; - UINT16 NumParamBlks; - UINT32 SetCapsStatus; - -} ACPI_RAS2_SHMEM; - -/* RAS2 Parameter Block Structure for PATROL_SCRUB */ - -typedef struct acpi_ras2_parameter_block -{ - UINT16 Type; - UINT16 Version; - UINT16 Length; - -} ACPI_RAS2_PARAMETER_BLOCK; - -/* RAS2 Parameter Block Structure for PATROL_SCRUB */ - -typedef struct acpi_ras2_patrol_scrub_param { - ACPI_RAS2_PARAMETER_BLOCK Header; - UINT16 Command; - UINT64 ReqAddrRange[2]; - UINT64 ActlAddrRange[2]; - UINT32 Flags; - UINT32 ScrubParamsOut; - UINT32 ScrubParamsIn; - UINT32 ExtScrubParams; - UINT8 ScrubRateDesc[256]; - -} ACPI_RAS2_PATROL_SCRUB_PARAM; - -/* Masks for Flags field above */ - -#define ACPI_RAS2_SCRUBBER_RUNNING 1 - -/* RAS2 Parameter Block Structure for LA2PA_TRANSLATION */ - -typedef struct acpi_ras2_la2pa_translation_parameter { - ACPI_RAS2_PARAMETER_BLOCK Header; - UINT16 AddrTranslationCommand; - UINT64 SubInstId; - UINT64 LogicalAddress; - UINT64 PhysicalAddress; - UINT32 Status; - -} ACPI_RAS2_LA2PA_TRANSLATION_PARAM; - -/* Channel Commands */ - -enum AcpiRas2Commands -{ - ACPI_RAS2_EXECUTE_RAS2_COMMAND = 1 -}; - -/* Platform RAS2 Features */ - -enum AcpiRas2Features -{ - ACPI_RAS2_PATROL_SCRUB_SUPPORTED = 0, - ACPI_RAS2_LA2PA_TRANSLATION = 1 -}; - -/* RAS2 Patrol Scrub Commands */ - -enum AcpiRas2PatrolScrubCommands -{ - ACPI_RAS2_GET_PATROL_PARAMETERS = 1, - ACPI_RAS2_START_PATROL_SCRUBBER = 2, - ACPI_RAS2_STOP_PATROL_SCRUBBER = 3 -}; - -/* RAS2 LA2PA Translation Commands */ - -enum AcpiRas2La2PaTranslationCommands -{ - ACPI_RAS2_GET_LA2PA_TRANSLATION = 1, -}; - -/* RAS2 LA2PA Translation Status values */ - -enum AcpiRas2La2PaTranslationStatus -{ - ACPI_RAS2_LA2PA_TRANSLATION_SUCCESS = 0, - ACPI_RAS2_LA2PA_TRANSLATION_FAIL = 1, -}; - -/* Channel Command flags */ - -#define ACPI_RAS2_GENERATE_SCI (1<<15) - -/* Status values */ - -enum AcpiRas2Status -{ - ACPI_RAS2_SUCCESS = 0, - ACPI_RAS2_NOT_VALID = 1, - ACPI_RAS2_NOT_SUPPORTED = 2, - ACPI_RAS2_BUSY = 3, - ACPI_RAS2_FAILED = 4, - ACPI_RAS2_ABORTED = 5, - ACPI_RAS2_INVALID_DATA = 6 -}; - -/* Status flags */ - -#define ACPI_RAS2_COMMAND_COMPLETE (1) -#define ACPI_RAS2_SCI_DOORBELL (1<<1) -#define ACPI_RAS2_ERROR (1<<2) -#define ACPI_RAS2_STATUS (0x1F<<3) - - -/******************************************************************************* - * - * RGRT - Regulatory Graphics Resource Table - * Version 1 - * - * Conforms to "ACPI RGRT" available at: - * https://microsoft.github.io/mu/dyn/mu_plus/MsCorePkg/AcpiRGRT/feature_acpi_rgrt/ - * - ******************************************************************************/ - -typedef struct acpi_table_rgrt -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT16 Version; - UINT8 ImageType; - UINT8 Reserved; - UINT8 Image[]; - -} ACPI_TABLE_RGRT; - -/* ImageType values */ - -enum AcpiRgrtImageType -{ - ACPI_RGRT_TYPE_RESERVED0 = 0, - ACPI_RGRT_IMAGE_TYPE_PNG = 1, - ACPI_RGRT_TYPE_RESERVED = 2 /* 2 and greater are reserved */ -}; - - -/******************************************************************************* - * - * RHCT - RISC-V Hart Capabilities Table - * Version 1 - * - ******************************************************************************/ - -typedef struct acpi_table_rhct { - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT32 Flags; /* RHCT flags */ - UINT64 TimeBaseFreq; - UINT32 NodeCount; - UINT32 NodeOffset; -} ACPI_TABLE_RHCT; - -/* RHCT Flags */ - -#define ACPI_RHCT_TIMER_CANNOT_WAKEUP_CPU (1) -/* - * RHCT subtables - */ -typedef struct acpi_rhct_node_header { - UINT16 Type; - UINT16 Length; - UINT16 Revision; -} ACPI_RHCT_NODE_HEADER; - -/* Values for RHCT subtable Type above */ - -enum acpi_rhct_node_type { - ACPI_RHCT_NODE_TYPE_ISA_STRING = 0x0000, - ACPI_RHCT_NODE_TYPE_CMO = 0x0001, - ACPI_RHCT_NODE_TYPE_MMU = 0x0002, - ACPI_RHCT_NODE_TYPE_RESERVED = 0x0003, - ACPI_RHCT_NODE_TYPE_HART_INFO = 0xFFFF, -}; - -/* - * RHCT node specific subtables - */ - -/* ISA string node structure */ -typedef struct acpi_rhct_isa_string { - UINT16 IsaLength; - char Isa[]; -} ACPI_RHCT_ISA_STRING; - -typedef struct acpi_rhct_cmo_node { - UINT8 Reserved; /* Must be zero */ - UINT8 CbomSize; /* CBOM size in powerof 2 */ - UINT8 CbopSize; /* CBOP size in powerof 2 */ - UINT8 CbozSize; /* CBOZ size in powerof 2 */ -} ACPI_RHCT_CMO_NODE; - -typedef struct acpi_rhct_mmu_node { - UINT8 Reserved; /* Must be zero */ - UINT8 MmuType; /* Virtual Address Scheme */ -} ACPI_RHCT_MMU_NODE; - -enum acpi_rhct_mmu_type { - ACPI_RHCT_MMU_TYPE_SV39 = 0, - ACPI_RHCT_MMU_TYPE_SV48 = 1, - ACPI_RHCT_MMU_TYPE_SV57 = 2 -}; - -/* Hart Info node structure */ -typedef struct acpi_rhct_hart_info { - UINT16 NumOffsets; - UINT32 Uid; /* ACPI processor UID */ -} ACPI_RHCT_HART_INFO; - -/******************************************************************************* - * - * RIMT - RISC-V IO Remapping Table - * - * https://github.com/riscv-non-isa/riscv-acpi-rimt - * - ******************************************************************************/ - -typedef struct acpi_table_rimt { - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT32 NumNodes; /* Number of RIMT Nodes */ - UINT32 NodeOffset; /* Offset to RIMT Node Array */ - UINT32 Reserved; -} ACPI_TABLE_RIMT; - -typedef struct acpi_rimt_node { - UINT8 Type; - UINT8 Revision; - UINT16 Length; - UINT16 Reserved; - UINT16 Id; - char NodeData[]; -} ACPI_RIMT_NODE; - -enum acpi_rimt_node_type { - ACPI_RIMT_NODE_TYPE_IOMMU = 0x0, - ACPI_RIMT_NODE_TYPE_PCIE_ROOT_COMPLEX = 0x1, - ACPI_RIMT_NODE_TYPE_PLAT_DEVICE = 0x2, -}; - -typedef struct acpi_rimt_iommu { - UINT8 HardwareId[8]; /* Hardware ID */ - UINT64 BaseAddress; /* Base Address */ - UINT32 Flags; /* Flags */ - UINT32 ProximityDomain; /* Proximity Domain */ - UINT16 PcieSegmentNumber; /* PCIe Segment number */ - UINT16 PcieBdf; /* PCIe B/D/F */ - UINT16 NumInterruptWires; /* Number of interrupt wires */ - UINT16 InterruptWireOffset; /* Interrupt wire array offset */ - UINT64 InterruptWire[]; /* Interrupt wire array */ -} ACPI_RIMT_IOMMU; - -/* IOMMU Node Flags */ -#define ACPI_RIMT_IOMMU_FLAGS_PCIE (1) -#define ACPI_RIMT_IOMMU_FLAGS_PXM_VALID (1 << 1) - -/* Interrupt Wire Structure */ -typedef struct acpi_rimt_iommu_wire_gsi { - UINT32 IrqNum; /* Interrupt Number */ - UINT32 Flags; /* Flags */ -} ACPI_RIMT_IOMMU_WIRE_GSI; - -/* Interrupt Wire Flags */ -#define ACPI_RIMT_GSI_LEVEL_TRIGGERRED (1) -#define ACPI_RIMT_GSI_ACTIVE_HIGH (1 << 1) - -typedef struct acpi_rimt_id_mapping { - UINT32 SourceIdBase; /* Source ID Base */ - UINT32 NumIds; /* Number of IDs */ - UINT32 DestIdBase; /* Destination Device ID Base */ - UINT32 DestOffset; /* Destination IOMMU Offset */ - UINT32 Flags; /* Flags */ -} ACPI_RIMT_ID_MAPPING; - -typedef struct acpi_rimt_pcie_rc { - UINT32 Flags; /* Flags */ - UINT16 Reserved; /* Reserved */ - UINT16 PcieSegmentNumber; /* PCIe Segment number */ - UINT16 IdMappingOffset; /* ID mapping array offset */ - UINT16 NumIdMappings; /* Number of ID mappings */ -} ACPI_RIMT_PCIE_RC; - -/* PCIe Root Complex Node Flags */ -#define ACPI_RIMT_PCIE_ATS_SUPPORTED (1) -#define ACPI_RIMT_PCIE_PRI_SUPPORTED (1 << 1) - -typedef struct acpi_rimt_platform_device { - UINT16 IdMappingOffset; /* ID Mapping array offset */ - UINT16 NumIdMappings; /* Number of ID mappings */ - char DeviceName[]; /* Device Object Name */ -} ACPI_RIMT_PLATFORM_DEVICE; - - -/******************************************************************************* - * - * SBST - Smart Battery Specification Table - * Version 1 - * - ******************************************************************************/ - -typedef struct acpi_table_sbst -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT32 WarningLevel; - UINT32 LowLevel; - UINT32 CriticalLevel; - -} ACPI_TABLE_SBST; - - -/******************************************************************************* - * - * SDEI - Software Delegated Exception Interface Descriptor Table - * - * Conforms to "Software Delegated Exception Interface (SDEI)" ARM DEN0054A, - * May 8th, 2017. Copyright 2017 ARM Ltd. - * - ******************************************************************************/ - -typedef struct acpi_table_sdei -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - -} ACPI_TABLE_SDEI; - - -/******************************************************************************* - * - * SDEV - Secure Devices Table (ACPI 6.2) - * Version 1 - * - ******************************************************************************/ - -typedef struct acpi_table_sdev -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - -} ACPI_TABLE_SDEV; - - -typedef struct acpi_sdev_header -{ - UINT8 Type; - UINT8 Flags; - UINT16 Length; - -} ACPI_SDEV_HEADER; - - -/* Values for subtable type above */ - -enum AcpiSdevType -{ - ACPI_SDEV_TYPE_NAMESPACE_DEVICE = 0, - ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE = 1, - ACPI_SDEV_TYPE_RESERVED = 2 /* 2 and greater are reserved */ -}; - -/* Values for flags above */ - -#define ACPI_SDEV_HANDOFF_TO_UNSECURE_OS (1) -#define ACPI_SDEV_SECURE_COMPONENTS_PRESENT (1<<1) - -/* - * SDEV subtables - */ - -/* 0: Namespace Device Based Secure Device Structure */ - -typedef struct acpi_sdev_namespace -{ - ACPI_SDEV_HEADER Header; - UINT16 DeviceIdOffset; - UINT16 DeviceIdLength; - UINT16 VendorDataOffset; - UINT16 VendorDataLength; - -} ACPI_SDEV_NAMESPACE; - -typedef struct acpi_sdev_secure_component -{ - UINT16 SecureComponentOffset; - UINT16 SecureComponentLength; - -} ACPI_SDEV_SECURE_COMPONENT; - - -/* - * SDEV sub-subtables ("Components") for above - */ -typedef struct acpi_sdev_component -{ - ACPI_SDEV_HEADER Header; - -} ACPI_SDEV_COMPONENT; - - -/* Values for sub-subtable type above */ - -enum AcpiSacType -{ - ACPI_SDEV_TYPE_ID_COMPONENT = 0, - ACPI_SDEV_TYPE_MEM_COMPONENT = 1 -}; - -typedef struct acpi_sdev_id_component -{ - ACPI_SDEV_HEADER Header; - UINT16 HardwareIdOffset; - UINT16 HardwareIdLength; - UINT16 SubsystemIdOffset; - UINT16 SubsystemIdLength; - UINT16 HardwareRevision; - UINT8 HardwareRevPresent; - UINT8 ClassCodePresent; - UINT8 PciBaseClass; - UINT8 PciSubClass; - UINT8 PciProgrammingXface; - -} ACPI_SDEV_ID_COMPONENT; - -typedef struct acpi_sdev_mem_component -{ - ACPI_SDEV_HEADER Header; - UINT32 Reserved; - UINT64 MemoryBaseAddress; - UINT64 MemoryLength; - -} ACPI_SDEV_MEM_COMPONENT; - - -/* 1: PCIe Endpoint Device Based Device Structure */ - -typedef struct acpi_sdev_pcie -{ - ACPI_SDEV_HEADER Header; - UINT16 Segment; - UINT16 StartBus; - UINT16 PathOffset; - UINT16 PathLength; - UINT16 VendorDataOffset; - UINT16 VendorDataLength; - -} ACPI_SDEV_PCIE; - -/* 1a: PCIe Endpoint path entry */ - -typedef struct acpi_sdev_pcie_path -{ - UINT8 Device; - UINT8 Function; - -} ACPI_SDEV_PCIE_PATH; - - -/******************************************************************************* - * - * SVKL - Storage Volume Key Location Table (ACPI 6.4) - * From: "Guest-Host-Communication Interface (GHCI) for Intel - * Trust Domain Extensions (Intel TDX)". - * Version 1 - * - ******************************************************************************/ - -typedef struct acpi_table_svkl -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT32 Count; - -} ACPI_TABLE_SVKL; - -typedef struct acpi_svkl_key -{ - UINT16 Type; - UINT16 Format; - UINT32 Size; - UINT64 Address; - -} ACPI_SVKL_KEY; - -enum acpi_svkl_type -{ - ACPI_SVKL_TYPE_MAIN_STORAGE = 0, - ACPI_SVKL_TYPE_RESERVED = 1 /* 1 and greater are reserved */ -}; - -enum acpi_svkl_format -{ - ACPI_SVKL_FORMAT_RAW_BINARY = 0, - ACPI_SVKL_FORMAT_RESERVED = 1 /* 1 and greater are reserved */ -}; - -/******************************************************************************* - * - * SWFT - SoundWire File Table - * as described in Discovery and Configuration (DisCo) Specification - * for SoundWire® - * Version 1 - * - ******************************************************************************/ - -typedef struct acpi_table_swft -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - -} ACPI_TABLE_SWFT; - -typedef struct acpi_swft_file -{ - UINT16 VendorID; - UINT32 FileID; - UINT16 FileVersion; - UINT32 FileLength; - UINT8 FileData[]; -} ACPI_SWFT_FILE; - -/******************************************************************************* - * - * TDEL - TD-Event Log - * From: "Guest-Host-Communication Interface (GHCI) for Intel - * Trust Domain Extensions (Intel TDX)". - * September 2020 - * - ******************************************************************************/ - -typedef struct acpi_table_tdel -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT32 Reserved; - UINT64 LogAreaMinimumLength; - UINT64 LogAreaStartAddress; - -} ACPI_TABLE_TDEL; - -/* Reset to default packing */ - -#pragma pack() - -#endif /* __ACTBL2_H__ */ diff --git a/drivers/include/acpica/actbl3.h b/drivers/include/acpica/actbl3.h deleted file mode 100644 index 6392359..0000000 --- a/drivers/include/acpica/actbl3.h +++ /dev/null @@ -1,1044 +0,0 @@ -/****************************************************************************** - * - * Name: actbl3.h - ACPI Table Definitions - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef __ACTBL3_H__ -#define __ACTBL3_H__ - - -/******************************************************************************* - * - * Additional ACPI Tables - * - * These tables are not consumed directly by the ACPICA subsystem, but are - * included here to support device drivers and the AML disassembler. - * - ******************************************************************************/ - - -/* - * Values for description table header signatures for tables defined in this - * file. Useful because they make it more difficult to inadvertently type in - * the wrong signature. - */ -#define ACPI_SIG_SLIC "SLIC" /* Software Licensing Description Table */ -#define ACPI_SIG_SLIT "SLIT" /* System Locality Distance Information Table */ -#define ACPI_SIG_SPCR "SPCR" /* Serial Port Console Redirection table */ -#define ACPI_SIG_SPMI "SPMI" /* Server Platform Management Interface table */ -#define ACPI_SIG_SRAT "SRAT" /* System Resource Affinity Table */ -#define ACPI_SIG_STAO "STAO" /* Status Override table */ -#define ACPI_SIG_TCPA "TCPA" /* Trusted Computing Platform Alliance table */ -#define ACPI_SIG_TPM2 "TPM2" /* Trusted Platform Module 2.0 H/W interface table */ -#define ACPI_SIG_UEFI "UEFI" /* Uefi Boot Optimization Table */ -#define ACPI_SIG_VIOT "VIOT" /* Virtual I/O Translation Table */ -#define ACPI_SIG_WAET "WAET" /* Windows ACPI Emulated devices Table */ -#define ACPI_SIG_WDAT "WDAT" /* Watchdog Action Table */ -#define ACPI_SIG_WDDT "WDDT" /* Watchdog Timer Description Table */ -#define ACPI_SIG_WDRT "WDRT" /* Watchdog Resource Table */ -#define ACPI_SIG_WPBT "WPBT" /* Windows Platform Binary Table */ -#define ACPI_SIG_WSMT "WSMT" /* Windows SMM Security Mitigations Table */ -#define ACPI_SIG_XENV "XENV" /* Xen Environment table */ -#define ACPI_SIG_XXXX "XXXX" /* Intermediate AML header for ASL/ASL+ converter */ - -/* - * All tables must be byte-packed to match the ACPI specification, since - * the tables are provided by the system BIOS. - */ -#pragma pack(1) - -/* - * Note: C bitfields are not used for this reason: - * - * "Bitfields are great and easy to read, but unfortunately the C language - * does not specify the layout of bitfields in memory, which means they are - * essentially useless for dealing with packed data in on-disk formats or - * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me, - * this decision was a design error in C. Ritchie could have picked an order - * and stuck with it." Norman Ramsey. - * See http://stackoverflow.com/a/1053662/41661 - */ - - -/******************************************************************************* - * - * SLIC - Software Licensing Description Table - * - * Conforms to "Microsoft Software Licensing Tables (SLIC and MSDM)", - * November 29, 2011. Copyright 2011 Microsoft - * - ******************************************************************************/ - -/* Basic SLIC table is only the common ACPI header */ - -typedef struct acpi_table_slic -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - -} ACPI_TABLE_SLIC; - - -/******************************************************************************* - * - * SLIT - System Locality Distance Information Table - * Version 1 - * - ******************************************************************************/ - -typedef struct acpi_table_slit -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT64 LocalityCount; - UINT8 Entry[1]; /* Real size = localities^2 */ - -} ACPI_TABLE_SLIT; - - -/******************************************************************************* - * - * SPCR - Serial Port Console Redirection table - * Version 4 - * - * Conforms to "Serial Port Console Redirection Table", - * Version 1.10, Jan 5, 2023 - * - ******************************************************************************/ - -typedef struct acpi_table_spcr -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT8 InterfaceType; /* 0=full 16550, 1=subset of 16550 */ - UINT8 Reserved[3]; - ACPI_GENERIC_ADDRESS SerialPort; - UINT8 InterruptType; - UINT8 PcInterrupt; - UINT32 Interrupt; - UINT8 BaudRate; - UINT8 Parity; - UINT8 StopBits; - UINT8 FlowControl; - UINT8 TerminalType; - UINT8 Language; - UINT16 PciDeviceId; - UINT16 PciVendorId; - UINT8 PciBus; - UINT8 PciDevice; - UINT8 PciFunction; - UINT32 PciFlags; - UINT8 PciSegment; - UINT32 UartClkFreq; - UINT32 PreciseBaudrate; - UINT16 NameSpaceStringLength; - UINT16 NameSpaceStringOffset; - char NameSpaceString[]; - -} ACPI_TABLE_SPCR; - -/* Masks for PciFlags field above */ - -#define ACPI_SPCR_DO_NOT_DISABLE (1) - -/* Values for Interface Type: See the definition of the DBG2 table */ - - -/******************************************************************************* - * - * SPMI - Server Platform Management Interface table - * Version 5 - * - * Conforms to "Intelligent Platform Management Interface Specification - * Second Generation v2.0", Document Revision 1.0, February 12, 2004 with - * June 12, 2009 markup. - * - ******************************************************************************/ - -typedef struct acpi_table_spmi -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT8 InterfaceType; - UINT8 Reserved; /* Must be 1 */ - UINT16 SpecRevision; /* Version of IPMI */ - UINT8 InterruptType; - UINT8 GpeNumber; /* GPE assigned */ - UINT8 Reserved1; - UINT8 PciDeviceFlag; - UINT32 Interrupt; - ACPI_GENERIC_ADDRESS IpmiRegister; - UINT8 PciSegment; - UINT8 PciBus; - UINT8 PciDevice; - UINT8 PciFunction; - UINT8 Reserved2; - -} ACPI_TABLE_SPMI; - -/* Values for InterfaceType above */ - -enum AcpiSpmiInterfaceTypes -{ - ACPI_SPMI_NOT_USED = 0, - ACPI_SPMI_KEYBOARD = 1, - ACPI_SPMI_SMI = 2, - ACPI_SPMI_BLOCK_TRANSFER = 3, - ACPI_SPMI_SMBUS = 4, - ACPI_SPMI_RESERVED = 5 /* 5 and above are reserved */ -}; - - -/******************************************************************************* - * - * SRAT - System Resource Affinity Table - * Version 3 - * - ******************************************************************************/ - -typedef struct acpi_table_srat -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT32 TableRevision; /* Must be value '1' */ - UINT64 Reserved; /* Reserved, must be zero */ - -} ACPI_TABLE_SRAT; - -/* Values for subtable type in ACPI_SUBTABLE_HEADER */ - -enum AcpiSratType -{ - ACPI_SRAT_TYPE_CPU_AFFINITY = 0, - ACPI_SRAT_TYPE_MEMORY_AFFINITY = 1, - ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY = 2, - ACPI_SRAT_TYPE_GICC_AFFINITY = 3, - ACPI_SRAT_TYPE_GIC_ITS_AFFINITY = 4, /* ACPI 6.2 */ - ACPI_SRAT_TYPE_GENERIC_AFFINITY = 5, /* ACPI 6.3 */ - ACPI_SRAT_TYPE_GENERIC_PORT_AFFINITY = 6, /* ACPI 6.4 */ - ACPI_SRAT_TYPE_RINTC_AFFINITY = 7, /* ACPI 6.6 */ - ACPI_SRAT_TYPE_RESERVED = 8 /* 8 and greater are reserved */ -}; - -/* - * SRAT Subtables, correspond to Type in ACPI_SUBTABLE_HEADER - */ - -/* 0: Processor Local APIC/SAPIC Affinity */ - -typedef struct acpi_srat_cpu_affinity -{ - ACPI_SUBTABLE_HEADER Header; - UINT8 ProximityDomainLo; - UINT8 ApicId; - UINT32 Flags; - UINT8 LocalSapicEid; - UINT8 ProximityDomainHi[3]; - UINT32 ClockDomain; - -} ACPI_SRAT_CPU_AFFINITY; - -/* Flags */ - -#define ACPI_SRAT_CPU_USE_AFFINITY (1) /* 00: Use affinity structure */ - - -/* 1: Memory Affinity */ - -typedef struct acpi_srat_mem_affinity -{ - ACPI_SUBTABLE_HEADER Header; - UINT32 ProximityDomain; - UINT16 Reserved; /* Reserved, must be zero */ - UINT64 BaseAddress; - UINT64 Length; - UINT32 Reserved1; - UINT32 Flags; - UINT64 Reserved2; /* Reserved, must be zero */ - -} ACPI_SRAT_MEM_AFFINITY; - -/* Flags */ - -#define ACPI_SRAT_MEM_ENABLED (1) /* 00: Use affinity structure */ -#define ACPI_SRAT_MEM_HOT_PLUGGABLE (1<<1) /* 01: Memory region is hot pluggable */ -#define ACPI_SRAT_MEM_NON_VOLATILE (1<<2) /* 02: Memory region is non-volatile */ -#define ACPI_SRAT_MEM_SPEC_PURPOSE (1<<3) /* 03: Memory is intended for specific-purpose usage */ - - -/* 2: Processor Local X2_APIC Affinity (ACPI 4.0) */ - -typedef struct acpi_srat_x2apic_cpu_affinity -{ - ACPI_SUBTABLE_HEADER Header; - UINT16 Reserved; /* Reserved, must be zero */ - UINT32 ProximityDomain; - UINT32 ApicId; - UINT32 Flags; - UINT32 ClockDomain; - UINT32 Reserved2; - -} ACPI_SRAT_X2APIC_CPU_AFFINITY; - -/* Flags for ACPI_SRAT_CPU_AFFINITY and ACPI_SRAT_X2APIC_CPU_AFFINITY */ - -#define ACPI_SRAT_CPU_ENABLED (1) /* 00: Use affinity structure */ - - -/* 3: GICC Affinity (ACPI 5.1) */ - -typedef struct acpi_srat_gicc_affinity -{ - ACPI_SUBTABLE_HEADER Header; - UINT32 ProximityDomain; - UINT32 AcpiProcessorUid; - UINT32 Flags; - UINT32 ClockDomain; - -} ACPI_SRAT_GICC_AFFINITY; - -/* Flags for ACPI_SRAT_GICC_AFFINITY */ - -#define ACPI_SRAT_GICC_ENABLED (1) /* 00: Use affinity structure */ - - -/* 4: GIC ITS Affinity (ACPI 6.2) */ - -typedef struct acpi_srat_gic_its_affinity -{ - ACPI_SUBTABLE_HEADER Header; - UINT32 ProximityDomain; - UINT16 Reserved; - UINT32 ItsId; - -} ACPI_SRAT_GIC_ITS_AFFINITY; - -/* - * Common structure for SRAT subtable types: - * 5: ACPI_SRAT_TYPE_GENERIC_AFFINITY - * 6: ACPI_SRAT_TYPE_GENERIC_PORT_AFFINITY - */ - -#define ACPI_SRAT_DEVICE_HANDLE_SIZE 16 - -typedef struct acpi_srat_generic_affinity -{ - ACPI_SUBTABLE_HEADER Header; - UINT8 Reserved; - UINT8 DeviceHandleType; - UINT32 ProximityDomain; - UINT8 DeviceHandle[ACPI_SRAT_DEVICE_HANDLE_SIZE]; - UINT32 Flags; - UINT32 Reserved1; - -} ACPI_SRAT_GENERIC_AFFINITY; - -/* Flags for ACPI_SRAT_GENERIC_AFFINITY */ - -#define ACPI_SRAT_GENERIC_AFFINITY_ENABLED (1) /* 00: Use affinity structure */ -#define ACPI_SRAT_ARCHITECTURAL_TRANSACTIONS (1<<1) /* ACPI 6.4 */ - -/* 7: RINTC Affinity Structure(ACPI 6.6) */ - -typedef struct acpi_srat_rintc_affinity -{ - ACPI_SUBTABLE_HEADER Header; - UINT16 Reserved; - UINT32 ProximityDomain; - UINT32 AcpiProcessorUid; - UINT32 Flags; - UINT32 ClockDomain; - -} ACPI_SRAT_RINTC_AFFINITY; - -/* Flags for ACPI_SRAT_RINTC_AFFINITY */ - -#define ACPI_SRAT_RINTC_ENABLED (1) /* 00: Use affinity structure */ - -/******************************************************************************* - * - * STAO - Status Override Table (_STA override) - ACPI 6.0 - * Version 1 - * - * Conforms to "ACPI Specification for Status Override Table" - * 6 January 2015 - * - ******************************************************************************/ - -typedef struct acpi_table_stao -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT8 IgnoreUart; - -} ACPI_TABLE_STAO; - - -/******************************************************************************* - * - * TCPA - Trusted Computing Platform Alliance table - * Version 2 - * - * TCG Hardware Interface Table for TPM 1.2 Clients and Servers - * - * Conforms to "TCG ACPI Specification, Family 1.2 and 2.0", - * Version 1.2, Revision 8 - * February 27, 2017 - * - * NOTE: There are two versions of the table with the same signature -- - * the client version and the server version. The common PlatformClass - * field is used to differentiate the two types of tables. - * - ******************************************************************************/ - -typedef struct acpi_table_tcpa_hdr -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT16 PlatformClass; - -} ACPI_TABLE_TCPA_HDR; - -/* - * Values for PlatformClass above. - * This is how the client and server subtables are differentiated - */ -#define ACPI_TCPA_CLIENT_TABLE 0 -#define ACPI_TCPA_SERVER_TABLE 1 - - -typedef struct acpi_table_tcpa_client -{ - UINT32 MinimumLogLength; /* Minimum length for the event log area */ - UINT64 LogAddress; /* Address of the event log area */ - -} ACPI_TABLE_TCPA_CLIENT; - -typedef struct acpi_table_tcpa_server -{ - UINT16 Reserved; - UINT64 MinimumLogLength; /* Minimum length for the event log area */ - UINT64 LogAddress; /* Address of the event log area */ - UINT16 SpecRevision; - UINT8 DeviceFlags; - UINT8 InterruptFlags; - UINT8 GpeNumber; - UINT8 Reserved2[3]; - UINT32 GlobalInterrupt; - ACPI_GENERIC_ADDRESS Address; - UINT32 Reserved3; - ACPI_GENERIC_ADDRESS ConfigAddress; - UINT8 Group; - UINT8 Bus; /* PCI Bus/Segment/Function numbers */ - UINT8 Device; - UINT8 Function; - -} ACPI_TABLE_TCPA_SERVER; - -/* Values for DeviceFlags above */ - -#define ACPI_TCPA_PCI_DEVICE (1) -#define ACPI_TCPA_BUS_PNP (1<<1) -#define ACPI_TCPA_ADDRESS_VALID (1<<2) - -/* Values for InterruptFlags above */ - -#define ACPI_TCPA_INTERRUPT_MODE (1) -#define ACPI_TCPA_INTERRUPT_POLARITY (1<<1) -#define ACPI_TCPA_SCI_VIA_GPE (1<<2) -#define ACPI_TCPA_GLOBAL_INTERRUPT (1<<3) - - -/******************************************************************************* - * - * TPM2 - Trusted Platform Module (TPM) 2.0 Hardware Interface Table - * Version 4 - * - * TCG Hardware Interface Table for TPM 2.0 Clients and Servers - * - * Conforms to "TCG ACPI Specification, Family 1.2 and 2.0", - * Version 1.2, Revision 8 - * February 27, 2017 - * - ******************************************************************************/ - -/* Revision 3 */ - -typedef struct acpi_table_tpm23 -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT32 Reserved; - UINT64 ControlAddress; - UINT32 StartMethod; - -} ACPI_TABLE_TPM23; - -/* Value for StartMethod above */ - -#define ACPI_TPM23_ACPI_START_METHOD 2 - -/* - * Optional trailer for revision 3. If start method is 2, there is a 4 byte - * reserved area of all zeros. - */ -typedef struct acpi_tmp23_trailer -{ - UINT32 Reserved; - -} ACPI_TPM23_TRAILER; - - -/* Revision 4 */ - -typedef struct acpi_table_tpm2 -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT16 PlatformClass; - UINT16 Reserved; - UINT64 ControlAddress; - UINT32 StartMethod; - - /* Platform-specific data follows */ - -} ACPI_TABLE_TPM2; - -/* Values for StartMethod above */ - -#define ACPI_TPM2_NOT_ALLOWED 0 -#define ACPI_TPM2_RESERVED1 1 -#define ACPI_TPM2_START_METHOD 2 -#define ACPI_TPM2_RESERVED3 3 -#define ACPI_TPM2_RESERVED4 4 -#define ACPI_TPM2_RESERVED5 5 -#define ACPI_TPM2_MEMORY_MAPPED 6 -#define ACPI_TPM2_COMMAND_BUFFER 7 -#define ACPI_TPM2_COMMAND_BUFFER_WITH_START_METHOD 8 -#define ACPI_TPM2_RESERVED9 9 -#define ACPI_TPM2_RESERVED10 10 -#define ACPI_TPM2_COMMAND_BUFFER_WITH_ARM_SMC 11 /* V1.2 Rev 8 */ -#define ACPI_TPM2_RESERVED 12 -#define ACPI_TPM2_COMMAND_BUFFER_WITH_PLUTON 13 -#define ACPI_TPM2_CRB_WITH_ARM_FFA 15 - - -/* Optional trailer appears after any StartMethod subtables */ - -typedef struct acpi_tpm2_trailer -{ - UINT8 MethodParameters[12]; - UINT32 MinimumLogLength; /* Minimum length for the event log area */ - UINT64 LogAddress; /* Address of the event log area */ - -} ACPI_TPM2_TRAILER; - - -/* - * Subtables (StartMethod-specific) - */ - -/* 11: Start Method for ARM SMC (V1.2 Rev 8) */ - -typedef struct acpi_tpm2_arm_smc -{ - UINT32 GlobalInterrupt; - UINT8 InterruptFlags; - UINT8 OperationFlags; - UINT16 Reserved; - UINT32 FunctionId; - -} ACPI_TPM2_ARM_SMC; - -/* Values for InterruptFlags above */ - -#define ACPI_TPM2_INTERRUPT_SUPPORT (1) - -/* Values for OperationFlags above */ - -#define ACPI_TPM2_IDLE_SUPPORT (1) - - -/******************************************************************************* - * - * UEFI - UEFI Boot optimization Table - * Version 1 - * - * Conforms to "Unified Extensible Firmware Interface Specification", - * Version 2.3, May 8, 2009 - * - ******************************************************************************/ - -typedef struct acpi_table_uefi -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT8 Identifier[16]; /* UUID identifier */ - UINT16 DataOffset; /* Offset of remaining data in table */ - -} ACPI_TABLE_UEFI; - - -/******************************************************************************* - * - * VIOT - Virtual I/O Translation Table - * Version 1 - * - ******************************************************************************/ - -typedef struct acpi_table_viot -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT16 NodeCount; - UINT16 NodeOffset; - UINT8 Reserved[8]; - -} ACPI_TABLE_VIOT; - -/* VIOT subtable header */ - -typedef struct acpi_viot_header -{ - UINT8 Type; - UINT8 Reserved; - UINT16 Length; - -} ACPI_VIOT_HEADER; - -/* Values for Type field above */ - -enum AcpiViotNodeType -{ - ACPI_VIOT_NODE_PCI_RANGE = 0x01, - ACPI_VIOT_NODE_MMIO = 0x02, - ACPI_VIOT_NODE_VIRTIO_IOMMU_PCI = 0x03, - ACPI_VIOT_NODE_VIRTIO_IOMMU_MMIO = 0x04, - ACPI_VIOT_RESERVED = 0x05 -}; - -/* VIOT subtables */ - -typedef struct acpi_viot_pci_range -{ - ACPI_VIOT_HEADER Header; - UINT32 EndpointStart; - UINT16 SegmentStart; - UINT16 SegmentEnd; - UINT16 BdfStart; - UINT16 BdfEnd; - UINT16 OutputNode; - UINT8 Reserved[6]; - -} ACPI_VIOT_PCI_RANGE; - -typedef struct acpi_viot_mmio -{ - ACPI_VIOT_HEADER Header; - UINT32 Endpoint; - UINT64 BaseAddress; - UINT16 OutputNode; - UINT8 Reserved[6]; - -} ACPI_VIOT_MMIO; - -typedef struct acpi_viot_virtio_iommu_pci -{ - ACPI_VIOT_HEADER Header; - UINT16 Segment; - UINT16 Bdf; - UINT8 Reserved[8]; - -} ACPI_VIOT_VIRTIO_IOMMU_PCI; - -typedef struct acpi_viot_virtio_iommu_mmio -{ - ACPI_VIOT_HEADER Header; - UINT8 Reserved[4]; - UINT64 BaseAddress; - -} ACPI_VIOT_VIRTIO_IOMMU_MMIO; - - -/******************************************************************************* - * - * WAET - Windows ACPI Emulated devices Table - * Version 1 - * - * Conforms to "Windows ACPI Emulated Devices Table", version 1.0, April 6, 2009 - * - ******************************************************************************/ - -typedef struct acpi_table_waet -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT32 Flags; - -} ACPI_TABLE_WAET; - -/* Masks for Flags field above */ - -#define ACPI_WAET_RTC_NO_ACK (1) /* RTC requires no int acknowledge */ -#define ACPI_WAET_TIMER_ONE_READ (1<<1) /* PM timer requires only one read */ - - -/******************************************************************************* - * - * WDAT - Watchdog Action Table - * Version 1 - * - * Conforms to "Hardware Watchdog Timers Design Specification", - * Copyright 2006 Microsoft Corporation. - * - ******************************************************************************/ - -typedef struct acpi_table_wdat -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT32 HeaderLength; /* Watchdog Header Length */ - UINT16 PciSegment; /* PCI Segment number */ - UINT8 PciBus; /* PCI Bus number */ - UINT8 PciDevice; /* PCI Device number */ - UINT8 PciFunction; /* PCI Function number */ - UINT8 Reserved[3]; - UINT32 TimerPeriod; /* Period of one timer count (msec) */ - UINT32 MaxCount; /* Maximum counter value supported */ - UINT32 MinCount; /* Minimum counter value */ - UINT8 Flags; - UINT8 Reserved2[3]; - UINT32 Entries; /* Number of watchdog entries that follow */ - -} ACPI_TABLE_WDAT; - -/* Masks for Flags field above */ - -#define ACPI_WDAT_ENABLED (1) -#define ACPI_WDAT_STOPPED 0x80 - - -/* WDAT Instruction Entries (actions) */ - -typedef struct acpi_wdat_entry -{ - UINT8 Action; - UINT8 Instruction; - UINT16 Reserved; - ACPI_GENERIC_ADDRESS RegisterRegion; - UINT32 Value; /* Value used with Read/Write register */ - UINT32 Mask; /* Bitmask required for this register instruction */ - -} ACPI_WDAT_ENTRY; - -/* Values for Action field above */ - -enum AcpiWdatActions -{ - ACPI_WDAT_RESET = 1, - ACPI_WDAT_GET_CURRENT_COUNTDOWN = 4, - ACPI_WDAT_GET_COUNTDOWN = 5, - ACPI_WDAT_SET_COUNTDOWN = 6, - ACPI_WDAT_GET_RUNNING_STATE = 8, - ACPI_WDAT_SET_RUNNING_STATE = 9, - ACPI_WDAT_GET_STOPPED_STATE = 10, - ACPI_WDAT_SET_STOPPED_STATE = 11, - ACPI_WDAT_GET_REBOOT = 16, - ACPI_WDAT_SET_REBOOT = 17, - ACPI_WDAT_GET_SHUTDOWN = 18, - ACPI_WDAT_SET_SHUTDOWN = 19, - ACPI_WDAT_GET_STATUS = 32, - ACPI_WDAT_SET_STATUS = 33, - ACPI_WDAT_ACTION_RESERVED = 34 /* 34 and greater are reserved */ -}; - -/* Values for Instruction field above */ - -enum AcpiWdatInstructions -{ - ACPI_WDAT_READ_VALUE = 0, - ACPI_WDAT_READ_COUNTDOWN = 1, - ACPI_WDAT_WRITE_VALUE = 2, - ACPI_WDAT_WRITE_COUNTDOWN = 3, - ACPI_WDAT_INSTRUCTION_RESERVED = 4, /* 4 and greater are reserved */ - ACPI_WDAT_PRESERVE_REGISTER = 0x80 /* Except for this value */ -}; - - -/******************************************************************************* - * - * WDDT - Watchdog Descriptor Table - * Version 1 - * - * Conforms to "Using the Intel ICH Family Watchdog Timer (WDT)", - * Version 001, September 2002 - * - ******************************************************************************/ - -typedef struct acpi_table_wddt -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT16 SpecVersion; - UINT16 TableVersion; - UINT16 PciVendorId; - ACPI_GENERIC_ADDRESS Address; - UINT16 MaxCount; /* Maximum counter value supported */ - UINT16 MinCount; /* Minimum counter value supported */ - UINT16 Period; - UINT16 Status; - UINT16 Capability; - -} ACPI_TABLE_WDDT; - -/* Flags for Status field above */ - -#define ACPI_WDDT_AVAILABLE (1) -#define ACPI_WDDT_ACTIVE (1<<1) -#define ACPI_WDDT_TCO_OS_OWNED (1<<2) -#define ACPI_WDDT_USER_RESET (1<<11) -#define ACPI_WDDT_WDT_RESET (1<<12) -#define ACPI_WDDT_POWER_FAIL (1<<13) -#define ACPI_WDDT_UNKNOWN_RESET (1<<14) - -/* Flags for Capability field above */ - -#define ACPI_WDDT_AUTO_RESET (1) -#define ACPI_WDDT_ALERT_SUPPORT (1<<1) - - -/******************************************************************************* - * - * WDRT - Watchdog Resource Table - * Version 1 - * - * Conforms to "Watchdog Timer Hardware Requirements for Windows Server 2003", - * Version 1.01, August 28, 2006 - * - ******************************************************************************/ - -typedef struct acpi_table_wdrt -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - ACPI_GENERIC_ADDRESS ControlRegister; - ACPI_GENERIC_ADDRESS CountRegister; - UINT16 PciDeviceId; - UINT16 PciVendorId; - UINT8 PciBus; /* PCI Bus number */ - UINT8 PciDevice; /* PCI Device number */ - UINT8 PciFunction; /* PCI Function number */ - UINT8 PciSegment; /* PCI Segment number */ - UINT16 MaxCount; /* Maximum counter value supported */ - UINT8 Units; - -} ACPI_TABLE_WDRT; - - -/******************************************************************************* - * - * WPBT - Windows Platform Environment Table (ACPI 6.0) - * Version 1 - * - * Conforms to "Windows Platform Binary Table (WPBT)" 29 November 2011 - * - ******************************************************************************/ - -typedef struct acpi_table_wpbt -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT32 HandoffSize; - UINT64 HandoffAddress; - UINT8 Layout; - UINT8 Type; - UINT16 ArgumentsLength; - -} ACPI_TABLE_WPBT; - -typedef struct acpi_wpbt_unicode -{ - UINT16 *UnicodeString; - -} ACPI_WPBT_UNICODE; - - -/******************************************************************************* - * - * WSMT - Windows SMM Security Mitigations Table - * Version 1 - * - * Conforms to "Windows SMM Security Mitigations Table", - * Version 1.0, April 18, 2016 - * - ******************************************************************************/ - -typedef struct acpi_table_wsmt -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT32 ProtectionFlags; - -} ACPI_TABLE_WSMT; - -/* Flags for ProtectionFlags field above */ - -#define ACPI_WSMT_FIXED_COMM_BUFFERS (1) -#define ACPI_WSMT_COMM_BUFFER_NESTED_PTR_PROTECTION (2) -#define ACPI_WSMT_SYSTEM_RESOURCE_PROTECTION (4) - - -/******************************************************************************* - * - * XENV - Xen Environment Table (ACPI 6.0) - * Version 1 - * - * Conforms to "ACPI Specification for Xen Environment Table" 4 January 2015 - * - ******************************************************************************/ - -typedef struct acpi_table_xenv -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT64 GrantTableAddress; - UINT64 GrantTableSize; - UINT32 EventInterrupt; - UINT8 EventFlags; - -} ACPI_TABLE_XENV; - - -/* Reset to default packing */ - -#pragma pack() - -#endif /* __ACTBL3_H__ */ diff --git a/drivers/include/acpica/actypes.h b/drivers/include/acpica/actypes.h deleted file mode 100644 index 3c95887..0000000 --- a/drivers/include/acpica/actypes.h +++ /dev/null @@ -1,1587 +0,0 @@ -/****************************************************************************** - * - * Name: actypes.h - Common data types for the entire ACPI subsystem - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef __ACTYPES_H__ -#define __ACTYPES_H__ - -/* acpisrc:StructDefs -- for acpisrc conversion */ - -/* - * ACPI_MACHINE_WIDTH must be specified in an OS- or compiler-dependent - * header and must be either 32 or 64. 16-bit ACPICA is no longer - * supported, as of 12/2006. - */ -#ifndef ACPI_MACHINE_WIDTH -#error ACPI_MACHINE_WIDTH not defined -#endif - -/* - * Data type ranges - * Note: These macros are designed to be compiler independent as well as - * working around problems that some 32-bit compilers have with 64-bit - * constants. - */ -#define ACPI_UINT8_MAX (UINT8) (~((UINT8) 0)) /* 0xFF */ -#define ACPI_UINT16_MAX (UINT16)(~((UINT16) 0)) /* 0xFFFF */ -#define ACPI_UINT32_MAX (UINT32)(~((UINT32) 0)) /* 0xFFFFFFFF */ -#define ACPI_UINT64_MAX (UINT64)(~((UINT64) 0)) /* 0xFFFFFFFFFFFFFFFF */ -#define ACPI_ASCII_MAX 0x7F - - -/* - * Architecture-specific ACPICA Subsystem Data Types - * - * The goal of these types is to provide source code portability across - * 16-bit, 32-bit, and 64-bit targets. - * - * 1) The following types are of fixed size for all targets (16/32/64): - * - * BOOLEAN Logical boolean - * - * UINT8 8-bit (1 byte) unsigned value - * UINT16 16-bit (2 byte) unsigned value - * UINT32 32-bit (4 byte) unsigned value - * UINT64 64-bit (8 byte) unsigned value - * - * INT16 16-bit (2 byte) signed value - * INT32 32-bit (4 byte) signed value - * INT64 64-bit (8 byte) signed value - * - * COMPILER_DEPENDENT_UINT64/INT64 - These types are defined in the - * compiler-dependent header(s) and were introduced because there is no - * common 64-bit integer type across the various compilation models, as - * shown in the table below. - * - * Datatype LP64 ILP64 LLP64 ILP32 LP32 16bit - * char 8 8 8 8 8 8 - * short 16 16 16 16 16 16 - * _int32 32 - * int 32 64 32 32 16 16 - * long 64 64 32 32 32 32 - * long long 64 64 - * pointer 64 64 64 32 32 32 - * - * Note: ILP64 and LP32 are currently not supported. - * - * - * 2) These types represent the native word size of the target mode of the - * processor, and may be 16-bit, 32-bit, or 64-bit as required. They are - * usually used for memory allocation, efficient loop counters, and array - * indexes. The types are similar to the size_t type in the C library and - * are required because there is no C type that consistently represents the - * native data width. ACPI_SIZE is needed because there is no guarantee - * that a kernel-level C library is present. - * - * ACPI_SIZE 16/32/64-bit unsigned value - * ACPI_NATIVE_INT 16/32/64-bit signed value - */ - -/******************************************************************************* - * - * Common types for all compilers, all targets - * - ******************************************************************************/ - -#ifndef ACPI_USE_SYSTEM_INTTYPES - -typedef unsigned char BOOLEAN; -typedef unsigned char UINT8; -typedef unsigned short UINT16; -typedef short INT16; -typedef COMPILER_DEPENDENT_UINT64 UINT64; -typedef COMPILER_DEPENDENT_INT64 INT64; - -#endif /* ACPI_USE_SYSTEM_INTTYPES */ - -/* - * Value returned by AcpiOsGetThreadId. There is no standard "thread_id" - * across operating systems or even the various UNIX systems. Since ACPICA - * only needs the thread ID as a unique thread identifier, we use a UINT64 - * as the only common data type - it will accommodate any type of pointer or - * any type of integer. It is up to the host-dependent OSL to cast the - * native thread ID type to a UINT64 (in AcpiOsGetThreadId). - */ -#define ACPI_THREAD_ID UINT64 - - -/******************************************************************************* - * - * Types specific to 64-bit targets - * - ******************************************************************************/ - -#if ACPI_MACHINE_WIDTH == 64 - -#ifndef ACPI_USE_SYSTEM_INTTYPES - -typedef unsigned int UINT32; -typedef int INT32; - -#endif /* ACPI_USE_SYSTEM_INTTYPES */ - - -typedef INT64 ACPI_NATIVE_INT; -typedef UINT64 ACPI_SIZE; -typedef UINT64 ACPI_IO_ADDRESS; -typedef UINT64 ACPI_PHYSICAL_ADDRESS; - -#define ACPI_MAX_PTR ACPI_UINT64_MAX -#define ACPI_SIZE_MAX ACPI_UINT64_MAX -#define ACPI_USE_NATIVE_DIVIDE /* Has native 64-bit integer support */ -#define ACPI_USE_NATIVE_MATH64 /* Has native 64-bit integer support */ - -/* - * In the case of the Itanium Processor Family (IPF), the hardware does not - * support misaligned memory transfers. Set the MISALIGNMENT_NOT_SUPPORTED - * flag to indicate that special precautions must be taken to avoid alignment - * faults. (IA64 or ia64 is currently used by existing compilers to indicate - * IPF.) - * - * Note: EM64T and other X86-64 processors support misaligned transfers, - * so there is no need to define this flag. - */ -#if defined (__IA64__) || defined (__ia64__) -#define ACPI_MISALIGNMENT_NOT_SUPPORTED -#endif - - -/******************************************************************************* - * - * Types specific to 32-bit targets - * - ******************************************************************************/ - -#elif ACPI_MACHINE_WIDTH == 32 - -#ifndef ACPI_USE_SYSTEM_INTTYPES - -typedef unsigned int UINT32; -typedef int INT32; - -#endif /* ACPI_USE_SYSTEM_INTTYPES */ - - -typedef INT32 ACPI_NATIVE_INT; -typedef UINT32 ACPI_SIZE; - -#ifdef ACPI_32BIT_PHYSICAL_ADDRESS - -/* - * OSPMs can define this to shrink the size of the structures for 32-bit - * none PAE environment. ASL compiler may always define this to generate - * 32-bit OSPM compliant tables. - */ -typedef UINT32 ACPI_IO_ADDRESS; -typedef UINT32 ACPI_PHYSICAL_ADDRESS; - -#else /* ACPI_32BIT_PHYSICAL_ADDRESS */ - -/* - * It is reported that, after some calculations, the physical addresses can - * wrap over the 32-bit boundary on 32-bit PAE environment. - * https://bugzilla.kernel.org/show_bug.cgi?id=87971 - */ -typedef UINT64 ACPI_IO_ADDRESS; -typedef UINT64 ACPI_PHYSICAL_ADDRESS; - -#endif /* ACPI_32BIT_PHYSICAL_ADDRESS */ - -#define ACPI_MAX_PTR ACPI_UINT32_MAX -#define ACPI_SIZE_MAX ACPI_UINT32_MAX - -#else - -/* ACPI_MACHINE_WIDTH must be either 64 or 32 */ - -#error unknown ACPI_MACHINE_WIDTH -#endif - - -/******************************************************************************* - * - * OS-dependent types - * - * If the defaults below are not appropriate for the host system, they can - * be defined in the OS-specific header, and this will take precedence. - * - ******************************************************************************/ - -/* Flags for AcpiOsAcquireLock/AcpiOsReleaseLock */ - -#ifndef ACPI_CPU_FLAGS -#define ACPI_CPU_FLAGS ACPI_SIZE -#endif - -/* Object returned from AcpiOsCreateCache */ - -#ifndef ACPI_CACHE_T -#ifdef ACPI_USE_LOCAL_CACHE -#define ACPI_CACHE_T ACPI_MEMORY_LIST -#else -#define ACPI_CACHE_T void * -#endif -#endif - -/* - * Synchronization objects - Mutexes, Semaphores, and SpinLocks - */ -#if (ACPI_MUTEX_TYPE == ACPI_BINARY_SEMAPHORE) -/* - * These macros are used if the host OS does not support a mutex object. - * Map the OSL Mutex interfaces to binary semaphores. - */ -#define ACPI_MUTEX ACPI_SEMAPHORE -#define AcpiOsCreateMutex(OutHandle) AcpiOsCreateSemaphore (1, 1, OutHandle) -#define AcpiOsDeleteMutex(Handle) (void) AcpiOsDeleteSemaphore (Handle) -#define AcpiOsAcquireMutex(Handle,Time) AcpiOsWaitSemaphore (Handle, 1, Time) -#define AcpiOsReleaseMutex(Handle) (void) AcpiOsSignalSemaphore (Handle, 1) -#endif - -/* Configurable types for synchronization objects */ - -#ifndef ACPI_SPINLOCK -#define ACPI_SPINLOCK void * -#endif - -#ifndef ACPI_SEMAPHORE -#define ACPI_SEMAPHORE void * -#endif - -#ifndef ACPI_MUTEX -#define ACPI_MUTEX void * -#endif - - -/******************************************************************************* - * - * Compiler-dependent types - * - * If the defaults below are not appropriate for the host compiler, they can - * be defined in the compiler-specific header, and this will take precedence. - * - ******************************************************************************/ - -/* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */ - -#ifndef ACPI_UINTPTR_T -#define ACPI_UINTPTR_T void * -#endif - -/* - * ACPI_PRINTF_LIKE is used to tag functions as "printf-like" because - * some compilers can catch printf format string problems - */ -#ifndef ACPI_PRINTF_LIKE -#define ACPI_PRINTF_LIKE(c) -#endif - -/* - * Some compilers complain about unused variables. Sometimes we don't want - * to use all the variables (for example, _AcpiModuleName). This allows us - * to tell the compiler in a per-variable manner that a variable - * is unused - */ -#ifndef ACPI_UNUSED_VAR -#define ACPI_UNUSED_VAR -#endif - -/* - * All ACPICA external functions that are available to the rest of the - * kernel are tagged with these macros which can be defined as appropriate - * for the host. - * - * Notes: - * ACPI_EXPORT_SYMBOL_INIT is used for initialization and termination - * interfaces that may need special processing. - * ACPI_EXPORT_SYMBOL is used for all other public external functions. - */ -#ifndef ACPI_EXPORT_SYMBOL_INIT -#define ACPI_EXPORT_SYMBOL_INIT(Symbol) -#endif - -#ifndef ACPI_EXPORT_SYMBOL -#define ACPI_EXPORT_SYMBOL(Symbol) -#endif - -/* - * Compiler/Clibrary-dependent debug initialization. Used for ACPICA - * utilities only. - */ -#ifndef ACPI_DEBUG_INITIALIZE -#define ACPI_DEBUG_INITIALIZE() -#endif - - -/******************************************************************************* - * - * Configuration - * - ******************************************************************************/ - -#ifdef ACPI_NO_MEM_ALLOCATIONS - -#define ACPI_ALLOCATE(a) NULL -#define ACPI_ALLOCATE_ZEROED(a) NULL -#define ACPI_FREE(a) -#define ACPI_MEM_TRACKING(a) - -#else /* ACPI_NO_MEM_ALLOCATIONS */ - -#ifdef ACPI_DBG_TRACK_ALLOCATIONS -/* - * Memory allocation tracking (used by AcpiExec to detect memory leaks) - */ -#define ACPI_MEM_PARAMETERS _COMPONENT, _AcpiModuleName, __LINE__ -#define ACPI_ALLOCATE(a) AcpiUtAllocateAndTrack ((ACPI_SIZE) (a), ACPI_MEM_PARAMETERS) -#define ACPI_ALLOCATE_ZEROED(a) AcpiUtAllocateZeroedAndTrack ((ACPI_SIZE) (a), ACPI_MEM_PARAMETERS) -#define ACPI_FREE(a) AcpiUtFreeAndTrack (a, ACPI_MEM_PARAMETERS) -#define ACPI_MEM_TRACKING(a) a - -#else -/* - * Normal memory allocation directly via the OS services layer - */ -#define ACPI_ALLOCATE(a) AcpiOsAllocate ((ACPI_SIZE) (a)) -#define ACPI_ALLOCATE_ZEROED(a) AcpiOsAllocateZeroed ((ACPI_SIZE) (a)) -#define ACPI_FREE(a) AcpiOsFree (a) -#define ACPI_MEM_TRACKING(a) - -#endif /* ACPI_DBG_TRACK_ALLOCATIONS */ - -#endif /* ACPI_NO_MEM_ALLOCATIONS */ - - -/****************************************************************************** - * - * ACPI Specification constants (Do not change unless the specification - * changes) - * - *****************************************************************************/ - -/* Number of distinct FADT-based GPE register blocks (GPE0 and GPE1) */ - -#define ACPI_MAX_GPE_BLOCKS 2 - -/* Default ACPI register widths */ - -#define ACPI_GPE_REGISTER_WIDTH 8 -#define ACPI_PM1_REGISTER_WIDTH 16 -#define ACPI_PM2_REGISTER_WIDTH 8 -#define ACPI_PM_TIMER_WIDTH 32 -#define ACPI_RESET_REGISTER_WIDTH 8 - -/* Names within the namespace are 4 bytes long */ - -#define ACPI_NAMESEG_SIZE 4 /* Fixed by ACPI spec */ -#define ACPI_PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */ -#define ACPI_PATH_SEPARATOR '.' - -/* Sizes for ACPI table headers */ - -#define ACPI_OEM_ID_SIZE 6 -#define ACPI_OEM_TABLE_ID_SIZE 8 - -/* ACPI/PNP hardware IDs */ - -#define PCI_ROOT_HID_STRING "PNP0A03" -#define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08" - -/* PM Timer ticks per second (HZ) */ - -#define ACPI_PM_TIMER_FREQUENCY 3579545 - - -/******************************************************************************* - * - * Independent types - * - ******************************************************************************/ - -/* Logical defines and NULL */ - -#ifdef FALSE -#undef FALSE -#endif -#define FALSE (1 == 0) - -#ifdef TRUE -#undef TRUE -#endif -#define TRUE (1 == 1) - -#ifndef NULL -#define NULL (void *) 0 -#endif - - -/* - * Miscellaneous types - */ -typedef UINT32 ACPI_STATUS; /* All ACPI Exceptions */ -typedef UINT32 ACPI_NAME; /* 4-byte ACPI name */ -typedef char * ACPI_STRING; /* Null terminated ASCII string */ -typedef void * ACPI_HANDLE; /* Actually a ptr to a NS Node */ - - -/* Time constants for timer calculations */ - -#define ACPI_MSEC_PER_SEC 1000L - -#define ACPI_USEC_PER_MSEC 1000L -#define ACPI_USEC_PER_SEC 1000000L - -#define ACPI_100NSEC_PER_USEC 10L -#define ACPI_100NSEC_PER_MSEC 10000L -#define ACPI_100NSEC_PER_SEC 10000000L - -#define ACPI_NSEC_PER_USEC 1000L -#define ACPI_NSEC_PER_MSEC 1000000L -#define ACPI_NSEC_PER_SEC 1000000000L - -#define ACPI_TIME_AFTER(a, b) ((INT64)((b) - (a)) < 0) - - -/* Owner IDs are used to track namespace nodes for selective deletion */ - -typedef UINT16 ACPI_OWNER_ID; -#define ACPI_OWNER_ID_MAX 0xFFF /* 4095 possible owner IDs */ - - -#define ACPI_INTEGER_BIT_SIZE 64 -#define ACPI_MAX_DECIMAL_DIGITS 20 /* 2^64 = 18,446,744,073,709,551,616 */ -#define ACPI_MAX64_DECIMAL_DIGITS 20 -#define ACPI_MAX32_DECIMAL_DIGITS 10 -#define ACPI_MAX16_DECIMAL_DIGITS 5 -#define ACPI_MAX8_DECIMAL_DIGITS 3 - -/* - * Constants with special meanings - */ -#define ACPI_ROOT_OBJECT ((ACPI_HANDLE) ACPI_TO_POINTER (ACPI_MAX_PTR)) -#define ACPI_WAIT_FOREVER 0xFFFF /* UINT16, as per ACPI spec */ -#define ACPI_DO_NOT_WAIT 0 - -/* - * Obsolete: Acpi integer width. In ACPI version 1 (1996), integers are - * 32 bits. In ACPI version 2 (2000) and later, integers are max 64 bits. - * Note that this pertains to the ACPI integer type only, not to other - * integers used in the implementation of the ACPICA subsystem. - * - * 01/2010: This type is obsolete and has been removed from the entire ACPICA - * code base. It remains here for compatibility with device drivers that use - * the type. However, it will be removed in the future. - */ -typedef UINT64 ACPI_INTEGER; -#define ACPI_INTEGER_MAX ACPI_UINT64_MAX - - -/******************************************************************************* - * - * Commonly used macros - * - ******************************************************************************/ - -/* Data manipulation */ - -#define ACPI_LOBYTE(Integer) ((UINT8) (UINT16)(Integer)) -#define ACPI_HIBYTE(Integer) ((UINT8) (((UINT16)(Integer)) >> 8)) -#define ACPI_LOWORD(Integer) ((UINT16) (UINT32)(Integer)) -#define ACPI_HIWORD(Integer) ((UINT16)(((UINT32)(Integer)) >> 16)) -#define ACPI_LODWORD(Integer64) ((UINT32) (UINT64)(Integer64)) -#define ACPI_HIDWORD(Integer64) ((UINT32)(((UINT64)(Integer64)) >> 32)) - -#define ACPI_SET_BIT(target,bit) ((target) |= (bit)) -#define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit)) -#define ACPI_MIN(a,b) (((a)<(b))?(a):(b)) -#define ACPI_MAX(a,b) (((a)>(b))?(a):(b)) - -/* Size calculation */ - -#define ACPI_ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0])) - -/* Pointer manipulation */ - -#define ACPI_CAST_PTR(t, p) ((t *) (ACPI_UINTPTR_T) (p)) -#define ACPI_CAST_INDIRECT_PTR(t, p) ((t **) (ACPI_UINTPTR_T) (p)) -#define ACPI_ADD_PTR(t, a, b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (UINT8, (a)) + (ACPI_SIZE)(b))) -#define ACPI_SUB_PTR(t, a, b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (UINT8, (a)) - (ACPI_SIZE)(b))) -#define ACPI_PTR_DIFF(a, b) ((ACPI_SIZE) (ACPI_CAST_PTR (UINT8, (a)) - ACPI_CAST_PTR (UINT8, (b)))) - -/* Pointer/Integer type conversions */ - -#define ACPI_TO_POINTER(i) ACPI_CAST_PTR (void, (ACPI_SIZE) (i)) -#ifndef ACPI_TO_INTEGER -#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p, (void *) 0) -#endif -#ifndef ACPI_OFFSET -#define ACPI_OFFSET(d, f) ACPI_PTR_DIFF (&(((d *) 0)->f), (void *) 0) -#endif -#define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i) - -/* Optimizations for 4-character (32-bit) ACPI_NAME manipulation */ - -#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED -#define ACPI_COMPARE_NAMESEG(a,b) (*ACPI_CAST_PTR (UINT32, (a)) == *ACPI_CAST_PTR (UINT32, (b))) -#define ACPI_COPY_NAMESEG(dest,src) (*ACPI_CAST_PTR (UINT32, (dest)) = *ACPI_CAST_PTR (UINT32, (src))) -#else -#define ACPI_COMPARE_NAMESEG(a,b) (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAMESEG_SIZE)) -#define ACPI_COPY_NAMESEG(dest,src) (memcpy (ACPI_CAST_PTR (char, (dest)), ACPI_CAST_PTR (char, (src)), ACPI_NAMESEG_SIZE)) -#endif - -/* Support for the special RSDP signature (8 characters) */ - -#define ACPI_VALIDATE_RSDP_SIG(a) (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_SIG_RSDP, (sizeof(a) < 8) ? ACPI_NAMESEG_SIZE : 8)) -#define ACPI_MAKE_RSDP_SIG(dest) (memcpy (ACPI_CAST_PTR (char, (dest)), ACPI_SIG_RSDP, 8)) - -/* Support for OEMx signature (x can be any character) */ -#define ACPI_IS_OEM_SIG(a) (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_OEM_NAME, 3) &&\ - strnlen (a, ACPI_NAMESEG_SIZE) == ACPI_NAMESEG_SIZE) - -/* - * Algorithm to obtain access bit or byte width. - * Can be used with AccessSize field of ACPI_GENERIC_ADDRESS and - * ACPI_RESOURCE_GENERIC_REGISTER. - */ -#define ACPI_ACCESS_BIT_SHIFT 2 -#define ACPI_ACCESS_BYTE_SHIFT -1 -#define ACPI_ACCESS_BIT_MAX (31 - ACPI_ACCESS_BIT_SHIFT) -#define ACPI_ACCESS_BYTE_MAX (31 - ACPI_ACCESS_BYTE_SHIFT) -#define ACPI_ACCESS_BIT_DEFAULT (8 - ACPI_ACCESS_BIT_SHIFT) -#define ACPI_ACCESS_BYTE_DEFAULT (8 - ACPI_ACCESS_BYTE_SHIFT) -#define ACPI_ACCESS_BIT_WIDTH(size) (1 << ((size) + ACPI_ACCESS_BIT_SHIFT)) -#define ACPI_ACCESS_BYTE_WIDTH(size) (1 << ((size) + ACPI_ACCESS_BYTE_SHIFT)) - -/******************************************************************************* - * - * Miscellaneous constants - * - ******************************************************************************/ - -/* - * Initialization sequence options - */ -#define ACPI_FULL_INITIALIZATION 0x0000 -#define ACPI_NO_FACS_INIT 0x0001 -#define ACPI_NO_ACPI_ENABLE 0x0002 -#define ACPI_NO_HARDWARE_INIT 0x0004 -#define ACPI_NO_EVENT_INIT 0x0008 -#define ACPI_NO_HANDLER_INIT 0x0010 -#define ACPI_NO_OBJECT_INIT 0x0020 -#define ACPI_NO_DEVICE_INIT 0x0040 -#define ACPI_NO_ADDRESS_SPACE_INIT 0x0080 - -/* - * Initialization state - */ -#define ACPI_SUBSYSTEM_INITIALIZE 0x01 -#define ACPI_INITIALIZED_OK 0x02 - -/* - * Power state values - */ -#define ACPI_STATE_UNKNOWN (UINT8) 0xFF - -#define ACPI_STATE_S0 (UINT8) 0 -#define ACPI_STATE_S1 (UINT8) 1 -#define ACPI_STATE_S2 (UINT8) 2 -#define ACPI_STATE_S3 (UINT8) 3 -#define ACPI_STATE_S4 (UINT8) 4 -#define ACPI_STATE_S5 (UINT8) 5 -#define ACPI_S_STATES_MAX ACPI_STATE_S5 -#define ACPI_S_STATE_COUNT 6 - -#define ACPI_STATE_D0 (UINT8) 0 -#define ACPI_STATE_D1 (UINT8) 1 -#define ACPI_STATE_D2 (UINT8) 2 -#define ACPI_STATE_D3_HOT (UINT8) 3 -#define ACPI_STATE_D3_COLD (UINT8) 4 -#define ACPI_STATE_D3 ACPI_STATE_D3_COLD -#define ACPI_D_STATES_MAX ACPI_STATE_D3_COLD -#define ACPI_D_STATE_COUNT 5 - -#define ACPI_STATE_C0 (UINT8) 0 -#define ACPI_STATE_C1 (UINT8) 1 -#define ACPI_STATE_C2 (UINT8) 2 -#define ACPI_STATE_C3 (UINT8) 3 -#define ACPI_C_STATES_MAX ACPI_STATE_C3 -#define ACPI_C_STATE_COUNT 4 - -/* - * Sleep type invalid value - */ -#define ACPI_SLEEP_TYPE_MAX 0x7 -#define ACPI_SLEEP_TYPE_INVALID 0xFF - -/* - * Standard notify values - */ -#define ACPI_NOTIFY_BUS_CHECK (UINT8) 0x00 -#define ACPI_NOTIFY_DEVICE_CHECK (UINT8) 0x01 -#define ACPI_NOTIFY_DEVICE_WAKE (UINT8) 0x02 -#define ACPI_NOTIFY_EJECT_REQUEST (UINT8) 0x03 -#define ACPI_NOTIFY_DEVICE_CHECK_LIGHT (UINT8) 0x04 -#define ACPI_NOTIFY_FREQUENCY_MISMATCH (UINT8) 0x05 -#define ACPI_NOTIFY_BUS_MODE_MISMATCH (UINT8) 0x06 -#define ACPI_NOTIFY_POWER_FAULT (UINT8) 0x07 -#define ACPI_NOTIFY_CAPABILITIES_CHECK (UINT8) 0x08 -#define ACPI_NOTIFY_DEVICE_PLD_CHECK (UINT8) 0x09 -#define ACPI_NOTIFY_RESERVED (UINT8) 0x0A -#define ACPI_NOTIFY_LOCALITY_UPDATE (UINT8) 0x0B -#define ACPI_NOTIFY_SHUTDOWN_REQUEST (UINT8) 0x0C -#define ACPI_NOTIFY_AFFINITY_UPDATE (UINT8) 0x0D -#define ACPI_NOTIFY_MEMORY_UPDATE (UINT8) 0x0E -#define ACPI_NOTIFY_DISCONNECT_RECOVER (UINT8) 0x0F - -#define ACPI_GENERIC_NOTIFY_MAX 0x0F -#define ACPI_SPECIFIC_NOTIFY_MAX 0x84 - -/* - * Types associated with ACPI names and objects. The first group of - * values (up to ACPI_TYPE_EXTERNAL_MAX) correspond to the definition - * of the ACPI ObjectType() operator (See the ACPI Spec). Therefore, - * only add to the first group if the spec changes. - * - * NOTE: Types must be kept in sync with the global AcpiNsProperties - * and AcpiNsTypeNames arrays. - */ -typedef UINT32 ACPI_OBJECT_TYPE; - -#define ACPI_TYPE_ANY 0x00 -#define ACPI_TYPE_INTEGER 0x01 /* Byte/Word/Dword/Zero/One/Ones */ -#define ACPI_TYPE_STRING 0x02 -#define ACPI_TYPE_BUFFER 0x03 -#define ACPI_TYPE_PACKAGE 0x04 /* ByteConst, multiple DataTerm/Constant/SuperName */ -#define ACPI_TYPE_FIELD_UNIT 0x05 -#define ACPI_TYPE_DEVICE 0x06 /* Name, multiple Node */ -#define ACPI_TYPE_EVENT 0x07 -#define ACPI_TYPE_METHOD 0x08 /* Name, ByteConst, multiple Code */ -#define ACPI_TYPE_MUTEX 0x09 -#define ACPI_TYPE_REGION 0x0A -#define ACPI_TYPE_POWER 0x0B /* Name,ByteConst,WordConst,multi Node */ -#define ACPI_TYPE_PROCESSOR 0x0C /* Name,ByteConst,DWordConst,ByteConst,multi NmO */ -#define ACPI_TYPE_THERMAL 0x0D /* Name, multiple Node */ -#define ACPI_TYPE_BUFFER_FIELD 0x0E -#define ACPI_TYPE_DDB_HANDLE 0x0F -#define ACPI_TYPE_DEBUG_OBJECT 0x10 - -#define ACPI_TYPE_EXTERNAL_MAX 0x10 -#define ACPI_NUM_TYPES (ACPI_TYPE_EXTERNAL_MAX + 1) - -/* - * These are object types that do not map directly to the ACPI - * ObjectType() operator. They are used for various internal purposes - * only. If new predefined ACPI_TYPEs are added (via the ACPI - * specification), these internal types must move upwards. (There - * is code that depends on these values being contiguous with the - * external types above.) - */ -#define ACPI_TYPE_LOCAL_REGION_FIELD 0x11 -#define ACPI_TYPE_LOCAL_BANK_FIELD 0x12 -#define ACPI_TYPE_LOCAL_INDEX_FIELD 0x13 -#define ACPI_TYPE_LOCAL_REFERENCE 0x14 /* Arg#, Local#, Name, Debug, RefOf, Index */ -#define ACPI_TYPE_LOCAL_ALIAS 0x15 -#define ACPI_TYPE_LOCAL_METHOD_ALIAS 0x16 -#define ACPI_TYPE_LOCAL_NOTIFY 0x17 -#define ACPI_TYPE_LOCAL_ADDRESS_HANDLER 0x18 -#define ACPI_TYPE_LOCAL_RESOURCE 0x19 -#define ACPI_TYPE_LOCAL_RESOURCE_FIELD 0x1A -#define ACPI_TYPE_LOCAL_SCOPE 0x1B /* 1 Name, multiple ObjectList Nodes */ - -#define ACPI_TYPE_NS_NODE_MAX 0x1B /* Last typecode used within a NS Node */ -#define ACPI_TOTAL_TYPES (ACPI_TYPE_NS_NODE_MAX + 1) - -/* - * These are special object types that never appear in - * a Namespace node, only in an object of ACPI_OPERAND_OBJECT - */ -#define ACPI_TYPE_LOCAL_EXTRA 0x1C -#define ACPI_TYPE_LOCAL_DATA 0x1D - -#define ACPI_TYPE_LOCAL_MAX 0x1D - -/* All types above here are invalid */ - -#define ACPI_TYPE_INVALID 0x1E -#define ACPI_TYPE_NOT_FOUND 0xFF - -#define ACPI_NUM_NS_TYPES (ACPI_TYPE_INVALID + 1) - - -/* - * All I/O - */ -#define ACPI_READ 0 -#define ACPI_WRITE 1 -#define ACPI_IO_MASK 1 - -/* - * Event Types: Fixed & General Purpose - */ -typedef UINT32 ACPI_EVENT_TYPE; - -/* - * Fixed events - */ -#define ACPI_EVENT_PMTIMER 0 -#define ACPI_EVENT_GLOBAL 1 -#define ACPI_EVENT_POWER_BUTTON 2 -#define ACPI_EVENT_SLEEP_BUTTON 3 -#define ACPI_EVENT_RTC 4 -#define ACPI_EVENT_MAX 4 -#define ACPI_NUM_FIXED_EVENTS ACPI_EVENT_MAX + 1 - -/* - * Event Status - Per event - * ------------- - * The encoding of ACPI_EVENT_STATUS is illustrated below. - * Note that a set bit (1) indicates the property is TRUE - * (e.g. if bit 0 is set then the event is enabled). - * +-------------+-+-+-+-+-+-+ - * | Bits 31:6 |5|4|3|2|1|0| - * +-------------+-+-+-+-+-+-+ - * | | | | | | | - * | | | | | | +- Enabled? - * | | | | | +--- Enabled for wake? - * | | | | +----- Status bit set? - * | | | +------- Enable bit set? - * | | +--------- Has a handler? - * | +----------- Masked? - * +----------------- - */ -typedef UINT32 ACPI_EVENT_STATUS; - -#define ACPI_EVENT_FLAG_DISABLED (ACPI_EVENT_STATUS) 0x00 -#define ACPI_EVENT_FLAG_ENABLED (ACPI_EVENT_STATUS) 0x01 -#define ACPI_EVENT_FLAG_WAKE_ENABLED (ACPI_EVENT_STATUS) 0x02 -#define ACPI_EVENT_FLAG_STATUS_SET (ACPI_EVENT_STATUS) 0x04 -#define ACPI_EVENT_FLAG_ENABLE_SET (ACPI_EVENT_STATUS) 0x08 -#define ACPI_EVENT_FLAG_HAS_HANDLER (ACPI_EVENT_STATUS) 0x10 -#define ACPI_EVENT_FLAG_MASKED (ACPI_EVENT_STATUS) 0x20 -#define ACPI_EVENT_FLAG_SET ACPI_EVENT_FLAG_STATUS_SET - -/* Actions for AcpiSetGpe, AcpiGpeWakeup, AcpiHwLowSetGpe */ - -#define ACPI_GPE_ENABLE 0 -#define ACPI_GPE_DISABLE 1 -#define ACPI_GPE_CONDITIONAL_ENABLE 2 - -/* - * GPE info flags - Per GPE - * +---+-+-+-+---+ - * |7:6|5|4|3|2:0| - * +---+-+-+-+---+ - * | | | | | - * | | | | +-- Type of dispatch:to method, handler, notify, or none - * | | | +----- Interrupt type: edge or level triggered - * | | +------- Is a Wake GPE - * | +--------- Has been enabled automatically at init time - * +------------ - */ -#define ACPI_GPE_DISPATCH_NONE (UINT8) 0x00 -#define ACPI_GPE_DISPATCH_METHOD (UINT8) 0x01 -#define ACPI_GPE_DISPATCH_HANDLER (UINT8) 0x02 -#define ACPI_GPE_DISPATCH_NOTIFY (UINT8) 0x03 -#define ACPI_GPE_DISPATCH_RAW_HANDLER (UINT8) 0x04 -#define ACPI_GPE_DISPATCH_MASK (UINT8) 0x07 -#define ACPI_GPE_DISPATCH_TYPE(flags) ((UINT8) ((flags) & ACPI_GPE_DISPATCH_MASK)) - -#define ACPI_GPE_LEVEL_TRIGGERED (UINT8) 0x08 -#define ACPI_GPE_EDGE_TRIGGERED (UINT8) 0x00 -#define ACPI_GPE_XRUPT_TYPE_MASK (UINT8) 0x08 - -#define ACPI_GPE_CAN_WAKE (UINT8) 0x10 -#define ACPI_GPE_AUTO_ENABLED (UINT8) 0x20 -#define ACPI_GPE_INITIALIZED (UINT8) 0x40 - -/* - * Flags for GPE and Lock interfaces - */ -#define ACPI_NOT_ISR 0x1 -#define ACPI_ISR 0x0 - - -/* Notify types */ - -#define ACPI_SYSTEM_NOTIFY 0x1 -#define ACPI_DEVICE_NOTIFY 0x2 -#define ACPI_ALL_NOTIFY (ACPI_SYSTEM_NOTIFY | ACPI_DEVICE_NOTIFY) -#define ACPI_MAX_NOTIFY_HANDLER_TYPE 0x3 -#define ACPI_NUM_NOTIFY_TYPES 2 - -#define ACPI_MAX_SYS_NOTIFY 0x7F -#define ACPI_MAX_DEVICE_SPECIFIC_NOTIFY 0xBF - -#define ACPI_SYSTEM_HANDLER_LIST 0 /* Used as index, must be SYSTEM_NOTIFY -1 */ -#define ACPI_DEVICE_HANDLER_LIST 1 /* Used as index, must be DEVICE_NOTIFY -1 */ - - -/* Address Space (Operation Region) Types */ - -typedef UINT8 ACPI_ADR_SPACE_TYPE; - -#define ACPI_ADR_SPACE_SYSTEM_MEMORY (ACPI_ADR_SPACE_TYPE) 0 -#define ACPI_ADR_SPACE_SYSTEM_IO (ACPI_ADR_SPACE_TYPE) 1 -#define ACPI_ADR_SPACE_PCI_CONFIG (ACPI_ADR_SPACE_TYPE) 2 -#define ACPI_ADR_SPACE_EC (ACPI_ADR_SPACE_TYPE) 3 -#define ACPI_ADR_SPACE_SMBUS (ACPI_ADR_SPACE_TYPE) 4 -#define ACPI_ADR_SPACE_CMOS (ACPI_ADR_SPACE_TYPE) 5 -#define ACPI_ADR_SPACE_PCI_BAR_TARGET (ACPI_ADR_SPACE_TYPE) 6 -#define ACPI_ADR_SPACE_IPMI (ACPI_ADR_SPACE_TYPE) 7 -#define ACPI_ADR_SPACE_GPIO (ACPI_ADR_SPACE_TYPE) 8 -#define ACPI_ADR_SPACE_GSBUS (ACPI_ADR_SPACE_TYPE) 9 -#define ACPI_ADR_SPACE_PLATFORM_COMM (ACPI_ADR_SPACE_TYPE) 10 -#define ACPI_ADR_SPACE_PLATFORM_RT (ACPI_ADR_SPACE_TYPE) 11 - -#define ACPI_NUM_PREDEFINED_REGIONS 12 - -/* - * Special Address Spaces - * - * Note: A Data Table region is a special type of operation region - * that has its own AML opcode. However, internally, the AML - * interpreter simply creates an operation region with an address - * space type of ACPI_ADR_SPACE_DATA_TABLE. - */ -#define ACPI_ADR_SPACE_DATA_TABLE (ACPI_ADR_SPACE_TYPE) 0x7E /* Internal to ACPICA only */ -#define ACPI_ADR_SPACE_FIXED_HARDWARE (ACPI_ADR_SPACE_TYPE) 0x7F - -/* Values for _REG connection code */ - -#define ACPI_REG_DISCONNECT 0 -#define ACPI_REG_CONNECT 1 - -/* - * BitRegister IDs - * - * These values are intended to be used by the hardware interfaces - * and are mapped to individual bitfields defined within the ACPI - * registers. See the AcpiGbl_BitRegisterInfo global table in utglobal.c - * for this mapping. - */ - -/* PM1 Status register */ - -#define ACPI_BITREG_TIMER_STATUS 0x00 -#define ACPI_BITREG_BUS_MASTER_STATUS 0x01 -#define ACPI_BITREG_GLOBAL_LOCK_STATUS 0x02 -#define ACPI_BITREG_POWER_BUTTON_STATUS 0x03 -#define ACPI_BITREG_SLEEP_BUTTON_STATUS 0x04 -#define ACPI_BITREG_RT_CLOCK_STATUS 0x05 -#define ACPI_BITREG_WAKE_STATUS 0x06 -#define ACPI_BITREG_PCIEXP_WAKE_STATUS 0x07 - -/* PM1 Enable register */ - -#define ACPI_BITREG_TIMER_ENABLE 0x08 -#define ACPI_BITREG_GLOBAL_LOCK_ENABLE 0x09 -#define ACPI_BITREG_POWER_BUTTON_ENABLE 0x0A -#define ACPI_BITREG_SLEEP_BUTTON_ENABLE 0x0B -#define ACPI_BITREG_RT_CLOCK_ENABLE 0x0C -#define ACPI_BITREG_PCIEXP_WAKE_DISABLE 0x0D - -/* PM1 Control register */ - -#define ACPI_BITREG_SCI_ENABLE 0x0E -#define ACPI_BITREG_BUS_MASTER_RLD 0x0F -#define ACPI_BITREG_GLOBAL_LOCK_RELEASE 0x10 -#define ACPI_BITREG_SLEEP_TYPE 0x11 -#define ACPI_BITREG_SLEEP_ENABLE 0x12 - -/* PM2 Control register */ - -#define ACPI_BITREG_ARB_DISABLE 0x13 - -#define ACPI_BITREG_MAX 0x13 -#define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1 - - -/* Status register values. A 1 clears a status bit. 0 = no effect */ - -#define ACPI_CLEAR_STATUS 1 - -/* Enable and Control register values */ - -#define ACPI_ENABLE_EVENT 1 -#define ACPI_DISABLE_EVENT 0 - - -/* Sleep function dispatch */ - -typedef ACPI_STATUS (*ACPI_SLEEP_FUNCTION) ( - UINT8 SleepState); - -typedef struct acpi_sleep_functions -{ - ACPI_SLEEP_FUNCTION LegacyFunction; - ACPI_SLEEP_FUNCTION ExtendedFunction; - -} ACPI_SLEEP_FUNCTIONS; - - -/* - * External ACPI object definition - */ - -/* - * Note: Type == ACPI_TYPE_ANY (0) is used to indicate a NULL package - * element or an unresolved named reference. - */ -typedef union acpi_object -{ - ACPI_OBJECT_TYPE Type; /* See definition of AcpiNsType for values */ - struct - { - ACPI_OBJECT_TYPE Type; /* ACPI_TYPE_INTEGER */ - UINT64 Value; /* The actual number */ - } Integer; - - struct - { - ACPI_OBJECT_TYPE Type; /* ACPI_TYPE_STRING */ - UINT32 Length; /* # of bytes in string, excluding trailing null */ - char *Pointer; /* points to the string value */ - } String; - - struct - { - ACPI_OBJECT_TYPE Type; /* ACPI_TYPE_BUFFER */ - UINT32 Length; /* # of bytes in buffer */ - UINT8 *Pointer; /* points to the buffer */ - } Buffer; - - struct - { - ACPI_OBJECT_TYPE Type; /* ACPI_TYPE_PACKAGE */ - UINT32 Count; /* # of elements in package */ - union acpi_object *Elements; /* Pointer to an array of ACPI_OBJECTs */ - } Package; - - struct - { - ACPI_OBJECT_TYPE Type; /* ACPI_TYPE_LOCAL_REFERENCE */ - ACPI_OBJECT_TYPE ActualType; /* Type associated with the Handle */ - ACPI_HANDLE Handle; /* object reference */ - } Reference; - - struct - { - ACPI_OBJECT_TYPE Type; /* ACPI_TYPE_PROCESSOR */ - UINT32 ProcId; - ACPI_IO_ADDRESS PblkAddress; - UINT32 PblkLength; - } Processor; - - struct - { - ACPI_OBJECT_TYPE Type; /* ACPI_TYPE_POWER */ - UINT32 SystemLevel; - UINT32 ResourceOrder; - } PowerResource; - -} ACPI_OBJECT; - - -/* - * List of objects, used as a parameter list for control method evaluation - */ -typedef struct acpi_object_list -{ - UINT32 Count; - ACPI_OBJECT *Pointer; - -} ACPI_OBJECT_LIST; - - -/* - * Miscellaneous common Data Structures used by the interfaces - */ -#define ACPI_NO_BUFFER 0 - -#ifdef ACPI_NO_MEM_ALLOCATIONS - -#define ACPI_ALLOCATE_BUFFER (ACPI_SIZE) (0) -#define ACPI_ALLOCATE_LOCAL_BUFFER (ACPI_SIZE) (0) - -#else /* ACPI_NO_MEM_ALLOCATIONS */ - -#define ACPI_ALLOCATE_BUFFER (ACPI_SIZE) (-1) /* Let ACPICA allocate buffer */ -#define ACPI_ALLOCATE_LOCAL_BUFFER (ACPI_SIZE) (-2) /* For internal use only (enables tracking) */ - -#endif /* ACPI_NO_MEM_ALLOCATIONS */ - -typedef struct acpi_buffer -{ - ACPI_SIZE Length; /* Length in bytes of the buffer */ - void *Pointer; /* pointer to buffer */ - -} ACPI_BUFFER; - - -/* - * NameType for AcpiGetName - */ -#define ACPI_FULL_PATHNAME 0 -#define ACPI_SINGLE_NAME 1 -#define ACPI_FULL_PATHNAME_NO_TRAILING 2 -#define ACPI_NAME_TYPE_MAX 2 - - -/* - * Predefined Namespace items - */ -typedef struct acpi_predefined_names -{ - const char *Name; - UINT8 Type; - char *Val; - -} ACPI_PREDEFINED_NAMES; - - -/* - * Structure and flags for AcpiGetSystemInfo - */ -#define ACPI_SYS_MODE_UNKNOWN 0x0000 -#define ACPI_SYS_MODE_ACPI 0x0001 -#define ACPI_SYS_MODE_LEGACY 0x0002 -#define ACPI_SYS_MODES_MASK 0x0003 - - -/* - * System info returned by AcpiGetSystemInfo() - */ -typedef struct acpi_system_info -{ - UINT32 AcpiCaVersion; - UINT32 Flags; - UINT32 TimerResolution; - UINT32 Reserved1; - UINT32 Reserved2; - UINT32 DebugLevel; - UINT32 DebugLayer; - -} ACPI_SYSTEM_INFO; - - -/* - * System statistics returned by AcpiGetStatistics() - */ -typedef struct acpi_statistics -{ - UINT32 SciCount; - UINT32 GpeCount; - UINT32 FixedEventCount[ACPI_NUM_FIXED_EVENTS]; - UINT32 MethodCount; - -} ACPI_STATISTICS; - - -/* - * Types specific to the OS service interfaces - */ -typedef UINT32 -(ACPI_SYSTEM_XFACE *ACPI_OSD_HANDLER) ( - void *Context); - -typedef void -(ACPI_SYSTEM_XFACE *ACPI_OSD_EXEC_CALLBACK) ( - void *Context); - -/* - * Various handlers and callback procedures - */ -typedef -UINT32 (*ACPI_SCI_HANDLER) ( - void *Context); - -typedef -void (*ACPI_GBL_EVENT_HANDLER) ( - UINT32 EventType, - ACPI_HANDLE Device, - UINT32 EventNumber, - void *Context); - -#define ACPI_EVENT_TYPE_GPE 0 -#define ACPI_EVENT_TYPE_FIXED 1 - -typedef -UINT32 (*ACPI_EVENT_HANDLER) ( - void *Context); - -typedef -UINT32 (*ACPI_GPE_HANDLER) ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber, - void *Context); - -typedef -void (*ACPI_NOTIFY_HANDLER) ( - ACPI_HANDLE Device, - UINT32 Value, - void *Context); - -typedef -void (*ACPI_OBJECT_HANDLER) ( - ACPI_HANDLE Object, - void *Data); - -typedef -ACPI_STATUS (*ACPI_INIT_HANDLER) ( - ACPI_HANDLE Object, - UINT32 Function); - -#define ACPI_INIT_DEVICE_INI 1 - -typedef -ACPI_STATUS (*ACPI_EXCEPTION_HANDLER) ( - ACPI_STATUS AmlStatus, - ACPI_NAME Name, - UINT16 Opcode, - UINT32 AmlOffset, - void *Context); - -/* Table Event handler (Load, LoadTable, etc.) and types */ - -typedef -ACPI_STATUS (*ACPI_TABLE_HANDLER) ( - UINT32 Event, - void *Table, - void *Context); - - -/* Table Event Types */ - -#define ACPI_TABLE_EVENT_LOAD 0x0 -#define ACPI_TABLE_EVENT_UNLOAD 0x1 -#define ACPI_TABLE_EVENT_INSTALL 0x2 -#define ACPI_TABLE_EVENT_UNINSTALL 0x3 -#define ACPI_NUM_TABLE_EVENTS 4 - - -/* Address Spaces (For Operation Regions) */ - -typedef -ACPI_STATUS (*ACPI_ADR_SPACE_HANDLER) ( - UINT32 Function, - ACPI_PHYSICAL_ADDRESS Address, - UINT32 BitWidth, - UINT64 *Value, - void *HandlerContext, - void *RegionContext); - -#define ACPI_DEFAULT_HANDLER NULL - -/* Special Context data for GenericSerialBus/GeneralPurposeIo (ACPI 5.0) */ - -typedef struct acpi_connection_info -{ - UINT8 *Connection; - UINT16 Length; - UINT8 AccessLength; - -} ACPI_CONNECTION_INFO; - -/* Special Context data for PCC Opregion (ACPI 6.3) */ - -typedef struct acpi_pcc_info { - UINT8 SubspaceId; - UINT16 Length; - UINT8 *InternalBuffer; -} ACPI_PCC_INFO; - -/* Special Context data for FFH Opregion (ACPI 6.5) */ - -typedef struct acpi_ffh_info { - UINT64 Offset; - UINT64 Length; -} ACPI_FFH_INFO; - -typedef -ACPI_STATUS (*ACPI_ADR_SPACE_SETUP) ( - ACPI_HANDLE RegionHandle, - UINT32 Function, - void *HandlerContext, - void **RegionContext); - -#define ACPI_REGION_ACTIVATE 0 -#define ACPI_REGION_DEACTIVATE 1 - -typedef -ACPI_STATUS (*ACPI_WALK_CALLBACK) ( - ACPI_HANDLE Object, - UINT32 NestingLevel, - void *Context, - void **ReturnValue); - -typedef -UINT32 (*ACPI_INTERFACE_HANDLER) ( - ACPI_STRING InterfaceName, - UINT32 Supported); - - -/* Interrupt handler return values */ - -#define ACPI_INTERRUPT_NOT_HANDLED 0x00 -#define ACPI_INTERRUPT_HANDLED 0x01 - -/* GPE handler return values */ - -#define ACPI_REENABLE_GPE 0x80 - - -/* Length of 32-bit EISAID values when converted back to a string */ - -#define ACPI_EISAID_STRING_SIZE 8 /* Includes null terminator */ - -/* Length of UUID (string) values */ - -#define ACPI_UUID_LENGTH 16 - -/* Length of 3-byte PCI class code values when converted back to a string */ - -#define ACPI_PCICLS_STRING_SIZE 7 /* Includes null terminator */ - - -/* Structures used for device/processor HID, UID, CID */ - -typedef struct acpi_pnp_device_id -{ - UINT32 Length; /* Length of string + null */ - char *String; - -} ACPI_PNP_DEVICE_ID; - -typedef struct acpi_pnp_device_id_list -{ - UINT32 Count; /* Number of IDs in Ids array */ - UINT32 ListSize; /* Size of list, including ID strings */ - ACPI_PNP_DEVICE_ID Ids[]; /* ID array */ - -} ACPI_PNP_DEVICE_ID_LIST; - -/* - * Structure returned from AcpiGetObjectInfo. - * Optimized for both 32-bit and 64-bit builds. - */ -typedef struct acpi_device_info -{ - UINT32 InfoSize; /* Size of info, including ID strings */ - UINT32 Name; /* ACPI object Name */ - ACPI_OBJECT_TYPE Type; /* ACPI object Type */ - UINT8 ParamCount; /* If a method, required parameter count */ - UINT16 Valid; /* Indicates which optional fields are valid */ - UINT8 Flags; /* Miscellaneous info */ - UINT8 HighestDstates[4]; /* _SxD values: 0xFF indicates not valid */ - UINT8 LowestDstates[5]; /* _SxW values: 0xFF indicates not valid */ - UINT64 Address; /* _ADR value */ - ACPI_PNP_DEVICE_ID HardwareId; /* _HID value */ - ACPI_PNP_DEVICE_ID UniqueId; /* _UID value */ - ACPI_PNP_DEVICE_ID ClassCode; /* _CLS value */ - ACPI_PNP_DEVICE_ID_LIST CompatibleIdList; /* _CID list */ - -} ACPI_DEVICE_INFO; - -/* Values for Flags field above (AcpiGetObjectInfo) */ - -#define ACPI_PCI_ROOT_BRIDGE 0x01 - -/* Flags for Valid field above (AcpiGetObjectInfo) */ - -#define ACPI_VALID_ADR 0x0002 -#define ACPI_VALID_HID 0x0004 -#define ACPI_VALID_UID 0x0008 -#define ACPI_VALID_CID 0x0020 -#define ACPI_VALID_CLS 0x0040 -#define ACPI_VALID_SXDS 0x0100 -#define ACPI_VALID_SXWS 0x0200 - -/* Flags for _STA method */ - -#define ACPI_STA_DEVICE_PRESENT 0x01 -#define ACPI_STA_DEVICE_ENABLED 0x02 -#define ACPI_STA_DEVICE_UI 0x04 -#define ACPI_STA_DEVICE_FUNCTIONING 0x08 -#define ACPI_STA_DEVICE_OK 0x08 /* Synonym */ -#define ACPI_STA_BATTERY_PRESENT 0x10 - - -/* Context structs for address space handlers */ - -typedef struct acpi_pci_id -{ - UINT16 Segment; - UINT16 Bus; - UINT16 Device; - UINT16 Function; - -} ACPI_PCI_ID; - -typedef struct acpi_mem_mapping -{ - ACPI_PHYSICAL_ADDRESS PhysicalAddress; - UINT8 *LogicalAddress; - ACPI_SIZE Length; - struct acpi_mem_mapping *NextMm; - -} ACPI_MEM_MAPPING; - -typedef struct acpi_mem_space_context -{ - UINT32 Length; - ACPI_PHYSICAL_ADDRESS Address; - ACPI_MEM_MAPPING *CurMm; - ACPI_MEM_MAPPING *FirstMm; - -} ACPI_MEM_SPACE_CONTEXT; - -typedef struct acpi_data_table_mapping -{ - void *Pointer; - -} ACPI_DATA_TABLE_MAPPING; - - -/* - * ACPI_MEMORY_LIST is used only if the ACPICA local cache is enabled - */ -typedef struct acpi_memory_list -{ - const char *ListName; - void *ListHead; - UINT16 ObjectSize; - UINT16 MaxDepth; - UINT16 CurrentDepth; - -#ifdef ACPI_DBG_TRACK_ALLOCATIONS - - /* Statistics for debug memory tracking only */ - - UINT32 TotalAllocated; - UINT32 TotalFreed; - UINT32 MaxOccupied; - UINT32 TotalSize; - UINT32 CurrentTotalSize; - UINT32 Requests; - UINT32 Hits; -#endif - -} ACPI_MEMORY_LIST; - - -/* Definitions of trace event types */ - -typedef enum -{ - ACPI_TRACE_AML_METHOD, - ACPI_TRACE_AML_OPCODE, - ACPI_TRACE_AML_REGION - -} ACPI_TRACE_EVENT_TYPE; - - -/* Definitions of _OSI support */ - -#define ACPI_VENDOR_STRINGS 0x01 -#define ACPI_FEATURE_STRINGS 0x02 -#define ACPI_ENABLE_INTERFACES 0x00 -#define ACPI_DISABLE_INTERFACES 0x04 - -#define ACPI_DISABLE_ALL_VENDOR_STRINGS (ACPI_DISABLE_INTERFACES | ACPI_VENDOR_STRINGS) -#define ACPI_DISABLE_ALL_FEATURE_STRINGS (ACPI_DISABLE_INTERFACES | ACPI_FEATURE_STRINGS) -#define ACPI_DISABLE_ALL_STRINGS (ACPI_DISABLE_INTERFACES | ACPI_VENDOR_STRINGS | ACPI_FEATURE_STRINGS) -#define ACPI_ENABLE_ALL_VENDOR_STRINGS (ACPI_ENABLE_INTERFACES | ACPI_VENDOR_STRINGS) -#define ACPI_ENABLE_ALL_FEATURE_STRINGS (ACPI_ENABLE_INTERFACES | ACPI_FEATURE_STRINGS) -#define ACPI_ENABLE_ALL_STRINGS (ACPI_ENABLE_INTERFACES | ACPI_VENDOR_STRINGS | ACPI_FEATURE_STRINGS) - -#define ACPI_OSI_WIN_2000 0x01 -#define ACPI_OSI_WIN_XP 0x02 -#define ACPI_OSI_WIN_XP_SP1 0x03 -#define ACPI_OSI_WINSRV_2003 0x04 -#define ACPI_OSI_WIN_XP_SP2 0x05 -#define ACPI_OSI_WINSRV_2003_SP1 0x06 -#define ACPI_OSI_WIN_VISTA 0x07 -#define ACPI_OSI_WINSRV_2008 0x08 -#define ACPI_OSI_WIN_VISTA_SP1 0x09 -#define ACPI_OSI_WIN_VISTA_SP2 0x0A -#define ACPI_OSI_WIN_7 0x0B -#define ACPI_OSI_WIN_8 0x0C -#define ACPI_OSI_WIN_8_1 0x0D -#define ACPI_OSI_WIN_10 0x0E -#define ACPI_OSI_WIN_10_RS1 0x0F -#define ACPI_OSI_WIN_10_RS2 0x10 -#define ACPI_OSI_WIN_10_RS3 0x11 -#define ACPI_OSI_WIN_10_RS4 0x12 -#define ACPI_OSI_WIN_10_RS5 0x13 -#define ACPI_OSI_WIN_10_19H1 0x14 -#define ACPI_OSI_WIN_10_20H1 0x15 -#define ACPI_OSI_WIN_11 0x16 -#define ACPI_OSI_WIN_11_22H2 0x17 - - -/* Definitions of getopt */ - -#define ACPI_OPT_END -1 - -/* Definitions for explicit fallthrough */ - -#ifndef ACPI_FALLTHROUGH -#define ACPI_FALLTHROUGH do {} while(0) -#endif - -#ifndef ACPI_FLEX_ARRAY -#define ACPI_FLEX_ARRAY(TYPE, NAME) TYPE NAME[0] -#endif - -#ifndef ACPI_NONSTRING -#define ACPI_NONSTRING /* No terminating NUL character */ -#endif - -#endif /* __ACTYPES_H__ */ diff --git a/drivers/include/acpica/acutils.h b/drivers/include/acpica/acutils.h deleted file mode 100644 index 55a0123..0000000 --- a/drivers/include/acpica/acutils.h +++ /dev/null @@ -1,1305 +0,0 @@ -/****************************************************************************** - * - * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef _ACUTILS_H -#define _ACUTILS_H - - -extern const UINT8 AcpiGbl_ResourceAmlSizes[]; -extern const UINT8 AcpiGbl_ResourceAmlSerialBusSizes[]; - -/* Strings used by the disassembler and debugger resource dump routines */ - -#if defined(ACPI_DEBUG_OUTPUT) || defined (ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) - -extern const char *AcpiGbl_BmDecode[]; -extern const char *AcpiGbl_ConfigDecode[]; -extern const char *AcpiGbl_ConsumeDecode[]; -extern const char *AcpiGbl_DecDecode[]; -extern const char *AcpiGbl_HeDecode[]; -extern const char *AcpiGbl_IoDecode[]; -extern const char *AcpiGbl_LlDecode[]; -extern const char *AcpiGbl_MaxDecode[]; -extern const char *AcpiGbl_MemDecode[]; -extern const char *AcpiGbl_MinDecode[]; -extern const char *AcpiGbl_MtpDecode[]; -extern const char *AcpiGbl_PhyDecode[]; -extern const char *AcpiGbl_RngDecode[]; -extern const char *AcpiGbl_RwDecode[]; -extern const char *AcpiGbl_ShrDecode[]; -extern const char *AcpiGbl_SizDecode[]; -extern const char *AcpiGbl_TrsDecode[]; -extern const char *AcpiGbl_TtpDecode[]; -extern const char *AcpiGbl_TypDecode[]; -extern const char *AcpiGbl_PpcDecode[]; -extern const char *AcpiGbl_IorDecode[]; -extern const char *AcpiGbl_DtsDecode[]; -extern const char *AcpiGbl_CtDecode[]; -extern const char *AcpiGbl_SbtDecode[]; -extern const char *AcpiGbl_AmDecode[]; -extern const char *AcpiGbl_SmDecode[]; -extern const char *AcpiGbl_WmDecode[]; -extern const char *AcpiGbl_CphDecode[]; -extern const char *AcpiGbl_CpoDecode[]; -extern const char *AcpiGbl_DpDecode[]; -extern const char *AcpiGbl_EdDecode[]; -extern const char *AcpiGbl_BpbDecode[]; -extern const char *AcpiGbl_SbDecode[]; -extern const char *AcpiGbl_FcDecode[]; -extern const char *AcpiGbl_PtDecode[]; -extern const char *AcpiGbl_PtypDecode[]; -extern const char *AcpiGbl_ClockInputMode[]; -extern const char *AcpiGbl_ClockInputScale[]; -#endif - -/* - * For the iASL compiler case, the output is redirected to stderr so that - * any of the various ACPI errors and warnings do not appear in the output - * files, for either the compiler or disassembler portions of the tool. - */ -#ifdef ACPI_ASL_COMPILER - -#include - -#define ACPI_MSG_REDIRECT_BEGIN \ - FILE *OutputFile = AcpiGbl_OutputFile; \ - AcpiOsRedirectOutput (stderr); - -#define ACPI_MSG_REDIRECT_END \ - AcpiOsRedirectOutput (OutputFile); - -#else -/* - * non-iASL case - no redirection, nothing to do - */ -#define ACPI_MSG_REDIRECT_BEGIN -#define ACPI_MSG_REDIRECT_END -#endif - -/* - * Common error message prefixes - */ -#ifndef ACPI_MSG_ERROR -#define ACPI_MSG_ERROR "ACPI Error: " -#endif -#ifndef ACPI_MSG_WARNING -#define ACPI_MSG_WARNING "ACPI Warning: " -#endif -#ifndef ACPI_MSG_INFO -#define ACPI_MSG_INFO "ACPI: " -#endif - -#ifndef ACPI_MSG_BIOS_ERROR -#define ACPI_MSG_BIOS_ERROR "Firmware Error (ACPI): " -#endif -#ifndef ACPI_MSG_BIOS_WARNING -#define ACPI_MSG_BIOS_WARNING "Firmware Warning (ACPI): " -#endif - -/* - * Common message suffix - */ -#define ACPI_MSG_SUFFIX \ - AcpiOsPrintf (" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, ModuleName, LineNumber) - -/* Flags to indicate implicit or explicit string-to-integer conversion */ - -#define ACPI_IMPLICIT_CONVERSION TRUE -#define ACPI_NO_IMPLICIT_CONVERSION FALSE - -/* Types for Resource descriptor entries */ - -#define ACPI_INVALID_RESOURCE 0 -#define ACPI_FIXED_LENGTH 1 -#define ACPI_VARIABLE_LENGTH 2 -#define ACPI_SMALL_VARIABLE_LENGTH 3 - -typedef -ACPI_STATUS (*ACPI_WALK_AML_CALLBACK) ( - UINT8 *Aml, - UINT32 Length, - UINT32 Offset, - UINT8 ResourceIndex, - void **Context); - -typedef -ACPI_STATUS (*ACPI_PKG_CALLBACK) ( - UINT8 ObjectType, - ACPI_OPERAND_OBJECT *SourceObject, - ACPI_GENERIC_STATE *State, - void *Context); - -typedef struct acpi_pkg_info -{ - UINT8 *FreeSpace; - ACPI_SIZE Length; - UINT32 ObjectSpace; - UINT32 NumPackages; - -} ACPI_PKG_INFO; - -/* Object reference counts */ - -#define REF_INCREMENT (UINT16) 0 -#define REF_DECREMENT (UINT16) 1 - -/* AcpiUtDumpBuffer */ - -#define DB_BYTE_DISPLAY 0x01 -#define DB_WORD_DISPLAY 0x02 -#define DB_DWORD_DISPLAY 0x04 -#define DB_QWORD_DISPLAY 0x08 -#define DB_DISPLAY_DATA_ONLY 0x10 - - -/* - * utascii - ASCII utilities - */ -BOOLEAN -AcpiUtValidNameseg ( - char *Signature); - -BOOLEAN -AcpiUtValidNameChar ( - char Character, - UINT32 Position); - -void -AcpiUtCheckAndRepairAscii ( - UINT8 *Name, - char *RepairedName, - UINT32 Count); - - -/* - * utcksum - Checksum utilities - */ -UINT8 -AcpiUtGenerateChecksum ( - void *Table, - UINT32 Length, - UINT8 OriginalChecksum); - -UINT8 -AcpiUtChecksum ( - UINT8 *Buffer, - UINT32 Length); - -ACPI_STATUS -AcpiUtVerifyCdatChecksum ( - ACPI_TABLE_CDAT *CdatTable, - UINT32 Length); - -ACPI_STATUS -AcpiUtVerifyChecksum ( - ACPI_TABLE_HEADER *Table, - UINT32 Length); - - -/* - * utnonansi - Non-ANSI C library functions - */ -void -AcpiUtStrupr ( - char *SrcString); - -void -AcpiUtStrlwr ( - char *SrcString); - -int -AcpiUtStricmp ( - char *String1, - char *String2); - - -/* - * utstrsuppt - string-to-integer conversion support functions - */ -ACPI_STATUS -AcpiUtConvertOctalString ( - char *String, - UINT64 *ReturnValue); - -ACPI_STATUS -AcpiUtConvertDecimalString ( - char *String, - UINT64 *ReturnValuePtr); - -ACPI_STATUS -AcpiUtConvertHexString ( - char *String, - UINT64 *ReturnValuePtr); - -char -AcpiUtRemoveWhitespace ( - char **String); - -char -AcpiUtRemoveLeadingZeros ( - char **String); - -BOOLEAN -AcpiUtDetectHexPrefix ( - char **String); - -void -AcpiUtRemoveHexPrefix ( - char **String); - -BOOLEAN -AcpiUtDetectOctalPrefix ( - char **String); - - -/* - * utstrtoul64 - string-to-integer conversion functions - */ -ACPI_STATUS -AcpiUtStrtoul64 ( - char *String, - UINT64 *RetInteger); - -UINT64 -AcpiUtExplicitStrtoul64 ( - char *String); - -UINT64 -AcpiUtImplicitStrtoul64 ( - char *String); - - -/* - * utglobal - Global data structures and procedures - */ -ACPI_STATUS -AcpiUtInitGlobals ( - void); - -const char * -AcpiUtGetMutexName ( - UINT32 MutexId); - -#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) - -const char * -AcpiUtGetNotifyName ( - UINT32 NotifyValue, - ACPI_OBJECT_TYPE Type); -#endif - -const char * -AcpiUtGetTypeName ( - ACPI_OBJECT_TYPE Type); - -const char * -AcpiUtGetNodeName ( - void *Object); - -const char * -AcpiUtGetDescriptorName ( - void *Object); - -const char * -AcpiUtGetReferenceName ( - ACPI_OPERAND_OBJECT *Object); - -const char * -AcpiUtGetObjectTypeName ( - ACPI_OPERAND_OBJECT *ObjDesc); - -const char * -AcpiUtGetRegionName ( - UINT8 SpaceId); - -const char * -AcpiUtGetEventName ( - UINT32 EventId); - -const char * -AcpiUtGetArgumentTypeName ( - UINT32 ArgType); - -char -AcpiUtHexToAsciiChar ( - UINT64 Integer, - UINT32 Position); - -ACPI_STATUS -AcpiUtAsciiToHexByte ( - char *TwoAsciiChars, - UINT8 *ReturnByte); - -UINT8 -AcpiUtAsciiCharToHex ( - int HexChar); - -BOOLEAN -AcpiUtValidObjectType ( - ACPI_OBJECT_TYPE Type); - - -/* - * utinit - miscellaneous initialization and shutdown - */ -ACPI_STATUS -AcpiUtHardwareInitialize ( - void); - -void -AcpiUtSubsystemShutdown ( - void); - - -/* - * utcopy - Object construction and conversion interfaces - */ -ACPI_STATUS -AcpiUtBuildSimpleObject( - ACPI_OPERAND_OBJECT *Obj, - ACPI_OBJECT *UserObj, - UINT8 *DataSpace, - UINT32 *BufferSpaceUsed); - -ACPI_STATUS -AcpiUtBuildPackageObject ( - ACPI_OPERAND_OBJECT *Obj, - UINT8 *Buffer, - UINT32 *SpaceUsed); - -ACPI_STATUS -AcpiUtCopyIobjectToEobject ( - ACPI_OPERAND_OBJECT *Obj, - ACPI_BUFFER *RetBuffer); - -ACPI_STATUS -AcpiUtCopyEobjectToIobject ( - ACPI_OBJECT *Obj, - ACPI_OPERAND_OBJECT **InternalObj); - -ACPI_STATUS -AcpiUtCopyISimpleToIsimple ( - ACPI_OPERAND_OBJECT *SourceObj, - ACPI_OPERAND_OBJECT *DestObj); - -ACPI_STATUS -AcpiUtCopyIobjectToIobject ( - ACPI_OPERAND_OBJECT *SourceDesc, - ACPI_OPERAND_OBJECT **DestDesc, - ACPI_WALK_STATE *WalkState); - - -/* - * utcreate - Object creation - */ -ACPI_STATUS -AcpiUtUpdateObjectReference ( - ACPI_OPERAND_OBJECT *Object, - UINT16 Action); - - -/* - * utdebug - Debug interfaces - */ -void -AcpiUtInitStackPtrTrace ( - void); - -void -AcpiUtTrackStackPtr ( - void); - -void -AcpiUtTrace ( - UINT32 LineNumber, - const char *FunctionName, - const char *ModuleName, - UINT32 ComponentId); - -void -AcpiUtTracePtr ( - UINT32 LineNumber, - const char *FunctionName, - const char *ModuleName, - UINT32 ComponentId, - const void *Pointer); - -void -AcpiUtTraceU32 ( - UINT32 LineNumber, - const char *FunctionName, - const char *ModuleName, - UINT32 ComponentId, - UINT32 Integer); - -void -AcpiUtTraceStr ( - UINT32 LineNumber, - const char *FunctionName, - const char *ModuleName, - UINT32 ComponentId, - const char *String); - -void -AcpiUtExit ( - UINT32 LineNumber, - const char *FunctionName, - const char *ModuleName, - UINT32 ComponentId); - -void -AcpiUtStatusExit ( - UINT32 LineNumber, - const char *FunctionName, - const char *ModuleName, - UINT32 ComponentId, - ACPI_STATUS Status); - -void -AcpiUtValueExit ( - UINT32 LineNumber, - const char *FunctionName, - const char *ModuleName, - UINT32 ComponentId, - UINT64 Value); - -void -AcpiUtPtrExit ( - UINT32 LineNumber, - const char *FunctionName, - const char *ModuleName, - UINT32 ComponentId, - UINT8 *Ptr); - -void -AcpiUtStrExit ( - UINT32 LineNumber, - const char *FunctionName, - const char *ModuleName, - UINT32 ComponentId, - const char *String); - -void -AcpiUtDebugDumpBuffer ( - UINT8 *Buffer, - UINT32 Count, - UINT32 Display, - UINT32 ComponentId); - -void -AcpiUtDumpBuffer ( - UINT8 *Buffer, - UINT32 Count, - UINT32 Display, - UINT32 Offset); - -#ifdef ACPI_APPLICATION -void -AcpiUtDumpBufferToFile ( - ACPI_FILE File, - UINT8 *Buffer, - UINT32 Count, - UINT32 Display, - UINT32 BaseOffset); -#endif - -void -AcpiUtReportError ( - char *ModuleName, - UINT32 LineNumber); - -void -AcpiUtReportInfo ( - char *ModuleName, - UINT32 LineNumber); - -void -AcpiUtReportWarning ( - char *ModuleName, - UINT32 LineNumber); - - -/* - * utdelete - Object deletion and reference counts - */ -void -AcpiUtAddReference ( - ACPI_OPERAND_OBJECT *Object); - -void -AcpiUtRemoveReference ( - ACPI_OPERAND_OBJECT *Object); - -void -AcpiUtDeleteInternalPackageObject ( - ACPI_OPERAND_OBJECT *Object); - -void -AcpiUtDeleteInternalSimpleObject ( - ACPI_OPERAND_OBJECT *Object); - -void -AcpiUtDeleteInternalObjectList ( - ACPI_OPERAND_OBJECT **ObjList); - - -/* - * uteval - object evaluation - */ -ACPI_STATUS -AcpiUtEvaluateObject ( - ACPI_NAMESPACE_NODE *PrefixNode, - const char *Path, - UINT32 ExpectedReturnBtypes, - ACPI_OPERAND_OBJECT **ReturnDesc); - -ACPI_STATUS -AcpiUtEvaluateNumericObject ( - const char *ObjectName, - ACPI_NAMESPACE_NODE *DeviceNode, - UINT64 *Value); - -ACPI_STATUS -AcpiUtExecute_STA ( - ACPI_NAMESPACE_NODE *DeviceNode, - UINT32 *StatusFlags); - -ACPI_STATUS -AcpiUtExecutePowerMethods ( - ACPI_NAMESPACE_NODE *DeviceNode, - const char **MethodNames, - UINT8 MethodCount, - UINT8 *OutValues); - - -/* - * utids - device ID support - */ -ACPI_STATUS -AcpiUtExecute_HID ( - ACPI_NAMESPACE_NODE *DeviceNode, - ACPI_PNP_DEVICE_ID **ReturnId); - -ACPI_STATUS -AcpiUtExecute_UID ( - ACPI_NAMESPACE_NODE *DeviceNode, - ACPI_PNP_DEVICE_ID **ReturnId); - -ACPI_STATUS -AcpiUtExecute_CID ( - ACPI_NAMESPACE_NODE *DeviceNode, - ACPI_PNP_DEVICE_ID_LIST **ReturnCidList); - -ACPI_STATUS -AcpiUtExecute_CLS ( - ACPI_NAMESPACE_NODE *DeviceNode, - ACPI_PNP_DEVICE_ID **ReturnId); - - -/* - * utlock - reader/writer locks - */ -ACPI_STATUS -AcpiUtCreateRwLock ( - ACPI_RW_LOCK *Lock); - -void -AcpiUtDeleteRwLock ( - ACPI_RW_LOCK *Lock); - -ACPI_STATUS -AcpiUtAcquireReadLock ( - ACPI_RW_LOCK *Lock); - -ACPI_STATUS -AcpiUtReleaseReadLock ( - ACPI_RW_LOCK *Lock); - -ACPI_STATUS -AcpiUtAcquireWriteLock ( - ACPI_RW_LOCK *Lock); - -void -AcpiUtReleaseWriteLock ( - ACPI_RW_LOCK *Lock); - - -/* - * utobject - internal object create/delete/cache routines - */ -ACPI_OPERAND_OBJECT * -AcpiUtCreateInternalObjectDbg ( - const char *ModuleName, - UINT32 LineNumber, - UINT32 ComponentId, - ACPI_OBJECT_TYPE Type); - -void * -AcpiUtAllocateObjectDescDbg ( - const char *ModuleName, - UINT32 LineNumber, - UINT32 ComponentId); - -#define AcpiUtCreateInternalObject(t) AcpiUtCreateInternalObjectDbg (_AcpiModuleName,__LINE__,_COMPONENT,t) -#define AcpiUtAllocateObjectDesc() AcpiUtAllocateObjectDescDbg (_AcpiModuleName,__LINE__,_COMPONENT) - -void -AcpiUtDeleteObjectDesc ( - ACPI_OPERAND_OBJECT *Object); - -BOOLEAN -AcpiUtValidInternalObject ( - void *Object); - -ACPI_OPERAND_OBJECT * -AcpiUtCreatePackageObject ( - UINT32 Count); - -ACPI_OPERAND_OBJECT * -AcpiUtCreateIntegerObject ( - UINT64 Value); - -ACPI_OPERAND_OBJECT * -AcpiUtCreateBufferObject ( - ACPI_SIZE BufferSize); - -ACPI_OPERAND_OBJECT * -AcpiUtCreateStringObject ( - ACPI_SIZE StringSize); - -ACPI_STATUS -AcpiUtGetObjectSize( - ACPI_OPERAND_OBJECT *Obj, - ACPI_SIZE *ObjLength); - - -/* - * utosi - Support for the _OSI predefined control method - */ -ACPI_STATUS -AcpiUtInitializeInterfaces ( - void); - -ACPI_STATUS -AcpiUtInterfaceTerminate ( - void); - -ACPI_STATUS -AcpiUtInstallInterface ( - ACPI_STRING InterfaceName); - -ACPI_STATUS -AcpiUtRemoveInterface ( - ACPI_STRING InterfaceName); - -ACPI_STATUS -AcpiUtUpdateInterfaces ( - UINT8 Action); - -ACPI_INTERFACE_INFO * -AcpiUtGetInterface ( - ACPI_STRING InterfaceName); - -ACPI_STATUS -AcpiUtOsiImplementation ( - ACPI_WALK_STATE *WalkState); - - -/* - * utpredef - support for predefined names - */ -const ACPI_PREDEFINED_INFO * -AcpiUtGetNextPredefinedMethod ( - const ACPI_PREDEFINED_INFO *ThisName); - -const ACPI_PREDEFINED_INFO * -AcpiUtMatchPredefinedMethod ( - char *Name); - -void -AcpiUtGetExpectedReturnTypes ( - char *Buffer, - UINT32 ExpectedBtypes); - -#if (defined ACPI_ASL_COMPILER || defined ACPI_HELP_APP) -const ACPI_PREDEFINED_INFO * -AcpiUtMatchResourceName ( - char *Name); - -void -AcpiUtDisplayPredefinedMethod ( - char *Buffer, - const ACPI_PREDEFINED_INFO *ThisName, - BOOLEAN MultiLine); - -UINT32 -AcpiUtGetResourceBitWidth ( - char *Buffer, - UINT16 Types); -#endif - - -/* - * utstate - Generic state creation/cache routines - */ -void -AcpiUtPushGenericState ( - ACPI_GENERIC_STATE **ListHead, - ACPI_GENERIC_STATE *State); - -ACPI_GENERIC_STATE * -AcpiUtPopGenericState ( - ACPI_GENERIC_STATE **ListHead); - - -ACPI_GENERIC_STATE * -AcpiUtCreateGenericState ( - void); - -ACPI_THREAD_STATE * -AcpiUtCreateThreadState ( - void); - -ACPI_GENERIC_STATE * -AcpiUtCreateUpdateState ( - ACPI_OPERAND_OBJECT *Object, - UINT16 Action); - -ACPI_GENERIC_STATE * -AcpiUtCreatePkgState ( - void *InternalObject, - void *ExternalObject, - UINT32 Index); - -ACPI_STATUS -AcpiUtCreateUpdateStateAndPush ( - ACPI_OPERAND_OBJECT *Object, - UINT16 Action, - ACPI_GENERIC_STATE **StateList); - -ACPI_GENERIC_STATE * -AcpiUtCreateControlState ( - void); - -void -AcpiUtDeleteGenericState ( - ACPI_GENERIC_STATE *State); - - -/* - * utmath - */ -ACPI_STATUS -AcpiUtDivide ( - UINT64 InDividend, - UINT64 InDivisor, - UINT64 *OutQuotient, - UINT64 *OutRemainder); - -ACPI_STATUS -AcpiUtShortDivide ( - UINT64 InDividend, - UINT32 Divisor, - UINT64 *OutQuotient, - UINT32 *OutRemainder); - -ACPI_STATUS -AcpiUtShortMultiply ( - UINT64 InMultiplicand, - UINT32 Multiplier, - UINT64 *Outproduct); - -ACPI_STATUS -AcpiUtShortShiftLeft ( - UINT64 Operand, - UINT32 Count, - UINT64 *OutResult); - -ACPI_STATUS -AcpiUtShortShiftRight ( - UINT64 Operand, - UINT32 Count, - UINT64 *OutResult); - - -/* - * utmisc - */ -const ACPI_EXCEPTION_INFO * -AcpiUtValidateException ( - ACPI_STATUS Status); - -BOOLEAN -AcpiUtIsPciRootBridge ( - char *Id); - -#if (defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP || defined ACPI_NAMES_APP) -BOOLEAN -AcpiUtIsAmlTable ( - ACPI_TABLE_HEADER *Table); -#endif - -ACPI_STATUS -AcpiUtWalkPackageTree ( - ACPI_OPERAND_OBJECT *SourceObject, - void *TargetObject, - ACPI_PKG_CALLBACK WalkCallback, - void *Context); - -/* Values for Base above (16=Hex, 10=Decimal) */ - -#define ACPI_ANY_BASE 0 - - -UINT32 -AcpiUtDwordByteSwap ( - UINT32 Value); - -void -AcpiUtSetIntegerWidth ( - UINT8 Revision); - -#ifdef ACPI_DEBUG_OUTPUT -void -AcpiUtDisplayInitPathname ( - UINT8 Type, - ACPI_NAMESPACE_NODE *ObjHandle, - const char *Path); -#endif - - -/* - * utownerid - Support for Table/Method Owner IDs - */ -ACPI_STATUS -AcpiUtAllocateOwnerId ( - ACPI_OWNER_ID *OwnerId); - -void -AcpiUtReleaseOwnerId ( - ACPI_OWNER_ID *OwnerId); - - -/* - * utresrc - */ -ACPI_STATUS -AcpiUtWalkAmlResources ( - ACPI_WALK_STATE *WalkState, - UINT8 *Aml, - ACPI_SIZE AmlLength, - ACPI_WALK_AML_CALLBACK UserFunction, - void **Context); - -ACPI_STATUS -AcpiUtValidateResource ( - ACPI_WALK_STATE *WalkState, - void *Aml, - UINT8 *ReturnIndex); - -UINT32 -AcpiUtGetDescriptorLength ( - void *Aml); - -UINT16 -AcpiUtGetResourceLength ( - void *Aml); - -UINT8 -AcpiUtGetResourceHeaderLength ( - void *Aml); - -UINT8 -AcpiUtGetResourceType ( - void *Aml); - -ACPI_STATUS -AcpiUtGetResourceEndTag ( - ACPI_OPERAND_OBJECT *ObjDesc, - UINT8 **EndTag); - - -/* - * utstring - String and character utilities - */ -void -AcpiUtPrintString ( - char *String, - UINT16 MaxLength); - -#if defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP -void -UtConvertBackslashes ( - char *Pathname); -#endif - -void -AcpiUtRepairName ( - char *Name); - -#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION) || defined (ACPI_DEBUG_OUTPUT) -BOOLEAN -AcpiUtSafeStrcpy ( - char *Dest, - ACPI_SIZE DestSize, - char *Source); - -void -AcpiUtSafeStrncpy ( - char *Dest, - char *Source, - ACPI_SIZE DestSize); - -BOOLEAN -AcpiUtSafeStrcat ( - char *Dest, - ACPI_SIZE DestSize, - char *Source); - -BOOLEAN -AcpiUtSafeStrncat ( - char *Dest, - ACPI_SIZE DestSize, - char *Source, - ACPI_SIZE MaxTransferLength); -#endif - - -/* - * utmutex - mutex support - */ -ACPI_STATUS -AcpiUtMutexInitialize ( - void); - -void -AcpiUtMutexTerminate ( - void); - -ACPI_STATUS -AcpiUtAcquireMutex ( - ACPI_MUTEX_HANDLE MutexId); - -ACPI_STATUS -AcpiUtReleaseMutex ( - ACPI_MUTEX_HANDLE MutexId); - - -/* - * utalloc - memory allocation and object caching - */ -ACPI_STATUS -AcpiUtCreateCaches ( - void); - -ACPI_STATUS -AcpiUtDeleteCaches ( - void); - -ACPI_STATUS -AcpiUtValidateBuffer ( - ACPI_BUFFER *Buffer); - -ACPI_STATUS -AcpiUtInitializeBuffer ( - ACPI_BUFFER *Buffer, - ACPI_SIZE RequiredLength); - -#ifdef ACPI_DBG_TRACK_ALLOCATIONS -void * -AcpiUtAllocateAndTrack ( - ACPI_SIZE Size, - UINT32 Component, - const char *Module, - UINT32 Line); - -void * -AcpiUtAllocateZeroedAndTrack ( - ACPI_SIZE Size, - UINT32 Component, - const char *Module, - UINT32 Line); - -void -AcpiUtFreeAndTrack ( - void *Address, - UINT32 Component, - const char *Module, - UINT32 Line); - -void -AcpiUtDumpAllocationInfo ( - void); - -void -AcpiUtDumpAllocations ( - UINT32 Component, - const char *Module); - -ACPI_STATUS -AcpiUtCreateList ( - const char *ListName, - UINT16 ObjectSize, - ACPI_MEMORY_LIST **ReturnCache); - -#endif /* ACPI_DBG_TRACK_ALLOCATIONS */ - - -/* - * utaddress - address range check - */ -ACPI_STATUS -AcpiUtAddAddressRange ( - ACPI_ADR_SPACE_TYPE SpaceId, - ACPI_PHYSICAL_ADDRESS Address, - UINT32 Length, - ACPI_NAMESPACE_NODE *RegionNode); - -void -AcpiUtRemoveAddressRange ( - ACPI_ADR_SPACE_TYPE SpaceId, - ACPI_NAMESPACE_NODE *RegionNode); - -UINT32 -AcpiUtCheckAddressRange ( - ACPI_ADR_SPACE_TYPE SpaceId, - ACPI_PHYSICAL_ADDRESS Address, - UINT32 Length, - BOOLEAN Warn); - -void -AcpiUtDeleteAddressLists ( - void); - - -/* - * utxferror - various error/warning output functions - */ -ACPI_PRINTF_LIKE(5) -void ACPI_INTERNAL_VAR_XFACE -AcpiUtPredefinedWarning ( - const char *ModuleName, - UINT32 LineNumber, - char *Pathname, - UINT16 NodeFlags, - const char *Format, - ...); - -ACPI_PRINTF_LIKE(5) -void ACPI_INTERNAL_VAR_XFACE -AcpiUtPredefinedInfo ( - const char *ModuleName, - UINT32 LineNumber, - char *Pathname, - UINT16 NodeFlags, - const char *Format, - ...); - -ACPI_PRINTF_LIKE(5) -void ACPI_INTERNAL_VAR_XFACE -AcpiUtPredefinedBiosError ( - const char *ModuleName, - UINT32 LineNumber, - char *Pathname, - UINT16 NodeFlags, - const char *Format, - ...); - -void -AcpiUtPrefixedNamespaceError ( - const char *ModuleName, - UINT32 LineNumber, - ACPI_GENERIC_STATE *PrefixScope, - const char *InternalName, - ACPI_STATUS LookupStatus); - -void -AcpiUtMethodError ( - const char *ModuleName, - UINT32 LineNumber, - const char *Message, - ACPI_NAMESPACE_NODE *Node, - const char *Path, - ACPI_STATUS LookupStatus); - - -/* - * Utility functions for ACPI names and IDs - */ -const AH_PREDEFINED_NAME * -AcpiAhMatchPredefinedName ( - char *Nameseg); - -const AH_DEVICE_ID * -AcpiAhMatchHardwareId ( - char *Hid); - -const char * -AcpiAhMatchUuid ( - UINT8 *Data); - - -/* - * utuuid -- UUID support functions - */ -#if (defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP || defined ACPI_HELP_APP) -void -AcpiUtConvertStringToUuid ( - char *InString, - UINT8 *UuidBuffer); - -ACPI_STATUS -AcpiUtConvertUuidToString ( - char *UuidBuffer, - char *OutString); -#endif - -#endif /* _ACUTILS_H */ diff --git a/drivers/include/acpica/acuuid.h b/drivers/include/acpica/acuuid.h deleted file mode 100644 index a950972..0000000 --- a/drivers/include/acpica/acuuid.h +++ /dev/null @@ -1,222 +0,0 @@ -/****************************************************************************** - * - * Name: acuuid.h - ACPI-related UUID/GUID definitions - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef __ACUUID_H__ -#define __ACUUID_H__ - -/* - * Note1: UUIDs and GUIDs are defined to be identical in ACPI. - * - * Note2: This file is standalone and should remain that way. - */ - -/* Controllers */ - -#define UUID_GPIO_CONTROLLER "4f248f40-d5e2-499f-834c-27758ea1cd3f" -#define UUID_USB_CONTROLLER "ce2ee385-00e6-48cb-9f05-2edb927c4899" -#define UUID_SATA_CONTROLLER "e4db149b-fcfe-425b-a6d8-92357d78fc7f" - -/* Devices */ - -#define UUID_PCI_HOST_BRIDGE "33db4d5b-1ff7-401c-9657-7441c03dd766" -#define UUID_I2C_DEVICE "3cdff6f7-4267-4555-ad05-b30a3d8938de" -#define UUID_POWER_BUTTON "dfbcf3c5-e7a5-44e6-9c1f-29c76f6e059c" -#define UUID_MEMORY_DEVICE "03b19910-f473-11dd-87af-0800200c9a66" -#define UUID_GENERIC_BUTTONS_DEVICE "fa6bd625-9ce8-470d-a2c7-b3ca36c4282e" -#define UUID_NVDIMM_ROOT_DEVICE "2f10e7a4-9e91-11e4-89d3-123b93f75cba" -#define UUID_CONTROL_METHOD_BATTERY "f18fc78b-0f15-4978-b793-53f833a1d35b" - -/* Interfaces */ - -#define UUID_DEVICE_LABELING "e5c937d0-3553-4d7a-9117-ea4d19c3434d" -#define UUID_PHYSICAL_PRESENCE "3dddfaa6-361b-4eb4-a424-8d10089d1653" - -/* TPM */ -#define UUID_HARDWARE_INFORMATION "cf8e16a5-c1e8-4e25-b712-4f54a96702c8" -#define UUID_START_METHOD "6bbf6cab-5463-4714-b7cd-f0203c0368d4" -#define UUID_MEMORY_CLEAR "376054ed-cc13-4675-901c-4756d7f2d45d" - -/* NVDIMM - NFIT table */ - -#define UUID_NFIT_DIMM "4309ac30-0d11-11e4-9191-0800200c9a66" -#define UUID_VOLATILE_MEMORY "7305944f-fdda-44e3-b16c-3f22d252e5d0" -#define UUID_PERSISTENT_MEMORY "66f0d379-b4f3-4074-ac43-0d3318b78cdb" -#define UUID_CONTROL_REGION "92f701f6-13b4-405d-910b-299367e8234c" -#define UUID_DATA_REGION "91af0530-5d86-470e-a6b0-0a2db9408249" -#define UUID_VOLATILE_VIRTUAL_DISK "77ab535a-45fc-624b-5560-f7b281d1f96e" -#define UUID_VOLATILE_VIRTUAL_CD "3d5abd30-4175-87ce-6d64-d2ade523c4bb" -#define UUID_PERSISTENT_VIRTUAL_DISK "5cea02c9-4d07-69d3-269f-4496fbe096f9" -#define UUID_PERSISTENT_VIRTUAL_CD "08018188-42cd-bb48-100f-5387d53ded3d" -#define UUID_NFIT_DIMM_N_MSFT "1ee68b36-d4bd-4a1a-9a16-4f8e53d46e05" -#define UUID_NFIT_DIMM_N_HPE1 "9002c334-acf3-4c0e-9642-a235f0d53bc6" -#define UUID_NFIT_DIMM_N_HPE2 "5008664b-b758-41a0-a03c-27c2f2d04f7e" -#define UUID_NFIT_DIMM_N_HYPERV "5746c5f2-a9a2-4264-ad0e-e4ddc9e09e80" - -/* Processor Properties (ACPI 6.2) */ - -#define UUID_CACHE_PROPERTIES "6DC63E77-257E-4E78-A973-A21F2796898D" -#define UUID_PHYSICAL_PROPERTY "DDE4D59A-AA42-4349-B407-EA40F57D9FB7" - -/* Miscellaneous */ - -#define UUID_PLATFORM_CAPABILITIES "0811b06e-4a27-44f9-8d60-3cbbc22e7b48" -#define UUID_DYNAMIC_ENUMERATION "d8c1a3a6-be9b-4c9b-91bf-c3cb81fc5daf" -#define UUID_BATTERY_THERMAL_LIMIT "4c2067e3-887d-475c-9720-4af1d3ed602e" -#define UUID_THERMAL_EXTENSIONS "14d399cd-7a27-4b18-8fb4-7cb7b9f4e500" -#define UUID_DEVICE_PROPERTIES "daffd814-6eba-4d8c-8a91-bc9bbf4aa301" -#define UUID_DEVICE_GRAPHS "ab02a46b-74c7-45a2-bd68-f7d344ef2153" -#define UUID_HIERARCHICAL_DATA_EXTENSION "dbb8e3e6-5886-4ba6-8795-1319f52a966b" -#define UUID_CORESIGHT_GRAPH "3ecbc8b6-1d0e-4fb3-8107-e627f805c6cd" -#define UUID_USB4_CAPABILITIES "23a0d13a-26ab-486c-9c5f-0ffa525a575a" -#define UUID_1ST_FUNCTION_ID "893f00a6-660c-494e-bcfd-3043f4fb67c0" -#define UUID_2ND_FUNCTION_ID "107ededd-d381-4fd7-8da9-08e9a6c79644" -#define UUID_FAN_TRIP_POINTS "a7611840-99fe-41ae-a488-35c75926c8eb" -#endif /* __ACUUID_H__ */ diff --git a/drivers/include/acpica/amlcode.h b/drivers/include/acpica/amlcode.h deleted file mode 100644 index 6bb5919..0000000 --- a/drivers/include/acpica/amlcode.h +++ /dev/null @@ -1,618 +0,0 @@ -/****************************************************************************** - * - * Name: amlcode.h - Definitions for AML, as included in "definition blocks" - * Declarations and definitions contained herein are derived - * directly from the ACPI specification. - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef __AMLCODE_H__ -#define __AMLCODE_H__ - -/* primary opcodes */ - -#define AML_ZERO_OP (UINT16) 0x00 -#define AML_ONE_OP (UINT16) 0x01 -#define AML_ALIAS_OP (UINT16) 0x06 -#define AML_NAME_OP (UINT16) 0x08 -#define AML_BYTE_OP (UINT16) 0x0a -#define AML_WORD_OP (UINT16) 0x0b -#define AML_DWORD_OP (UINT16) 0x0c -#define AML_STRING_OP (UINT16) 0x0d -#define AML_QWORD_OP (UINT16) 0x0e /* ACPI 2.0 */ -#define AML_SCOPE_OP (UINT16) 0x10 -#define AML_BUFFER_OP (UINT16) 0x11 -#define AML_PACKAGE_OP (UINT16) 0x12 -#define AML_VARIABLE_PACKAGE_OP (UINT16) 0x13 /* ACPI 2.0 */ -#define AML_METHOD_OP (UINT16) 0x14 -#define AML_EXTERNAL_OP (UINT16) 0x15 /* ACPI 6.0 */ -#define AML_DUAL_NAME_PREFIX (UINT16) 0x2e -#define AML_MULTI_NAME_PREFIX (UINT16) 0x2f -#define AML_EXTENDED_PREFIX (UINT16) 0x5b -#define AML_ROOT_PREFIX (UINT16) 0x5c -#define AML_PARENT_PREFIX (UINT16) 0x5e -#define AML_FIRST_LOCAL_OP (UINT16) 0x60 /* Used for Local op # calculations */ -#define AML_LOCAL0 (UINT16) 0x60 -#define AML_LOCAL1 (UINT16) 0x61 -#define AML_LOCAL2 (UINT16) 0x62 -#define AML_LOCAL3 (UINT16) 0x63 -#define AML_LOCAL4 (UINT16) 0x64 -#define AML_LOCAL5 (UINT16) 0x65 -#define AML_LOCAL6 (UINT16) 0x66 -#define AML_LOCAL7 (UINT16) 0x67 -#define AML_FIRST_ARG_OP (UINT16) 0x68 /* Used for Arg op # calculations */ -#define AML_ARG0 (UINT16) 0x68 -#define AML_ARG1 (UINT16) 0x69 -#define AML_ARG2 (UINT16) 0x6a -#define AML_ARG3 (UINT16) 0x6b -#define AML_ARG4 (UINT16) 0x6c -#define AML_ARG5 (UINT16) 0x6d -#define AML_ARG6 (UINT16) 0x6e -#define AML_STORE_OP (UINT16) 0x70 -#define AML_REF_OF_OP (UINT16) 0x71 -#define AML_ADD_OP (UINT16) 0x72 -#define AML_CONCATENATE_OP (UINT16) 0x73 -#define AML_SUBTRACT_OP (UINT16) 0x74 -#define AML_INCREMENT_OP (UINT16) 0x75 -#define AML_DECREMENT_OP (UINT16) 0x76 -#define AML_MULTIPLY_OP (UINT16) 0x77 -#define AML_DIVIDE_OP (UINT16) 0x78 -#define AML_SHIFT_LEFT_OP (UINT16) 0x79 -#define AML_SHIFT_RIGHT_OP (UINT16) 0x7a -#define AML_BIT_AND_OP (UINT16) 0x7b -#define AML_BIT_NAND_OP (UINT16) 0x7c -#define AML_BIT_OR_OP (UINT16) 0x7d -#define AML_BIT_NOR_OP (UINT16) 0x7e -#define AML_BIT_XOR_OP (UINT16) 0x7f -#define AML_BIT_NOT_OP (UINT16) 0x80 -#define AML_FIND_SET_LEFT_BIT_OP (UINT16) 0x81 -#define AML_FIND_SET_RIGHT_BIT_OP (UINT16) 0x82 -#define AML_DEREF_OF_OP (UINT16) 0x83 -#define AML_CONCATENATE_TEMPLATE_OP (UINT16) 0x84 /* ACPI 2.0 */ -#define AML_MOD_OP (UINT16) 0x85 /* ACPI 2.0 */ -#define AML_NOTIFY_OP (UINT16) 0x86 -#define AML_SIZE_OF_OP (UINT16) 0x87 -#define AML_INDEX_OP (UINT16) 0x88 -#define AML_MATCH_OP (UINT16) 0x89 -#define AML_CREATE_DWORD_FIELD_OP (UINT16) 0x8a -#define AML_CREATE_WORD_FIELD_OP (UINT16) 0x8b -#define AML_CREATE_BYTE_FIELD_OP (UINT16) 0x8c -#define AML_CREATE_BIT_FIELD_OP (UINT16) 0x8d -#define AML_OBJECT_TYPE_OP (UINT16) 0x8e -#define AML_CREATE_QWORD_FIELD_OP (UINT16) 0x8f /* ACPI 2.0 */ -#define AML_LOGICAL_AND_OP (UINT16) 0x90 -#define AML_LOGICAL_OR_OP (UINT16) 0x91 -#define AML_LOGICAL_NOT_OP (UINT16) 0x92 -#define AML_LOGICAL_EQUAL_OP (UINT16) 0x93 -#define AML_LOGICAL_GREATER_OP (UINT16) 0x94 -#define AML_LOGICAL_LESS_OP (UINT16) 0x95 -#define AML_TO_BUFFER_OP (UINT16) 0x96 /* ACPI 2.0 */ -#define AML_TO_DECIMAL_STRING_OP (UINT16) 0x97 /* ACPI 2.0 */ -#define AML_TO_HEX_STRING_OP (UINT16) 0x98 /* ACPI 2.0 */ -#define AML_TO_INTEGER_OP (UINT16) 0x99 /* ACPI 2.0 */ -#define AML_TO_STRING_OP (UINT16) 0x9c /* ACPI 2.0 */ -#define AML_COPY_OBJECT_OP (UINT16) 0x9d /* ACPI 2.0 */ -#define AML_MID_OP (UINT16) 0x9e /* ACPI 2.0 */ -#define AML_CONTINUE_OP (UINT16) 0x9f /* ACPI 2.0 */ -#define AML_IF_OP (UINT16) 0xa0 -#define AML_ELSE_OP (UINT16) 0xa1 -#define AML_WHILE_OP (UINT16) 0xa2 -#define AML_NOOP_OP (UINT16) 0xa3 -#define AML_RETURN_OP (UINT16) 0xa4 -#define AML_BREAK_OP (UINT16) 0xa5 -#define AML_COMMENT_OP (UINT16) 0xa9 -#define AML_BREAKPOINT_OP (UINT16) 0xcc -#define AML_ONES_OP (UINT16) 0xff - - -/* - * Combination opcodes (actually two one-byte opcodes) - * Used by the disassembler and iASL compiler - */ -#define AML_LOGICAL_GREATER_EQUAL_OP (UINT16) 0x9295 /* LNot (LLess) */ -#define AML_LOGICAL_LESS_EQUAL_OP (UINT16) 0x9294 /* LNot (LGreater) */ -#define AML_LOGICAL_NOT_EQUAL_OP (UINT16) 0x9293 /* LNot (LEqual) */ - - -/* Prefixed (2-byte) opcodes (with AML_EXTENDED_PREFIX) */ - -#define AML_EXTENDED_OPCODE (UINT16) 0x5b00 /* Prefix for 2-byte opcodes */ - -#define AML_MUTEX_OP (UINT16) 0x5b01 -#define AML_EVENT_OP (UINT16) 0x5b02 -#define AML_SHIFT_RIGHT_BIT_OP (UINT16) 0x5b10 /* Obsolete, not in ACPI spec */ -#define AML_SHIFT_LEFT_BIT_OP (UINT16) 0x5b11 /* Obsolete, not in ACPI spec */ -#define AML_CONDITIONAL_REF_OF_OP (UINT16) 0x5b12 -#define AML_CREATE_FIELD_OP (UINT16) 0x5b13 -#define AML_LOAD_TABLE_OP (UINT16) 0x5b1f /* ACPI 2.0 */ -#define AML_LOAD_OP (UINT16) 0x5b20 -#define AML_STALL_OP (UINT16) 0x5b21 -#define AML_SLEEP_OP (UINT16) 0x5b22 -#define AML_ACQUIRE_OP (UINT16) 0x5b23 -#define AML_SIGNAL_OP (UINT16) 0x5b24 -#define AML_WAIT_OP (UINT16) 0x5b25 -#define AML_RESET_OP (UINT16) 0x5b26 -#define AML_RELEASE_OP (UINT16) 0x5b27 -#define AML_FROM_BCD_OP (UINT16) 0x5b28 -#define AML_TO_BCD_OP (UINT16) 0x5b29 -#define AML_UNLOAD_OP (UINT16) 0x5b2a -#define AML_REVISION_OP (UINT16) 0x5b30 -#define AML_DEBUG_OP (UINT16) 0x5b31 -#define AML_FATAL_OP (UINT16) 0x5b32 -#define AML_TIMER_OP (UINT16) 0x5b33 /* ACPI 3.0 */ -#define AML_REGION_OP (UINT16) 0x5b80 -#define AML_FIELD_OP (UINT16) 0x5b81 -#define AML_DEVICE_OP (UINT16) 0x5b82 -#define AML_PROCESSOR_OP (UINT16) 0x5b83 -#define AML_POWER_RESOURCE_OP (UINT16) 0x5b84 -#define AML_THERMAL_ZONE_OP (UINT16) 0x5b85 -#define AML_INDEX_FIELD_OP (UINT16) 0x5b86 -#define AML_BANK_FIELD_OP (UINT16) 0x5b87 -#define AML_DATA_REGION_OP (UINT16) 0x5b88 /* ACPI 2.0 */ - - -/* - * Opcodes for "Field" operators - */ -#define AML_FIELD_OFFSET_OP (UINT8) 0x00 -#define AML_FIELD_ACCESS_OP (UINT8) 0x01 -#define AML_FIELD_CONNECTION_OP (UINT8) 0x02 /* ACPI 5.0 */ -#define AML_FIELD_EXT_ACCESS_OP (UINT8) 0x03 /* ACPI 5.0 */ - - -/* - * Internal opcodes - * Use only "Unknown" AML opcodes, don't attempt to use - * any valid ACPI ASCII values (A-Z, 0-9, '-') - */ -#define AML_INT_NAMEPATH_OP (UINT16) 0x002d -#define AML_INT_NAMEDFIELD_OP (UINT16) 0x0030 -#define AML_INT_RESERVEDFIELD_OP (UINT16) 0x0031 -#define AML_INT_ACCESSFIELD_OP (UINT16) 0x0032 -#define AML_INT_BYTELIST_OP (UINT16) 0x0033 -#define AML_INT_METHODCALL_OP (UINT16) 0x0035 -#define AML_INT_RETURN_VALUE_OP (UINT16) 0x0036 -#define AML_INT_EVAL_SUBTREE_OP (UINT16) 0x0037 -#define AML_INT_CONNECTION_OP (UINT16) 0x0038 -#define AML_INT_EXTACCESSFIELD_OP (UINT16) 0x0039 - -#define ARG_NONE 0x0 - -/* - * Argument types for the AML Parser - * Each field in the ArgTypes UINT32 is 5 bits, allowing for a maximum of 6 arguments. - * There can be up to 31 unique argument types - * Zero is reserved as end-of-list indicator - */ -#define ARGP_BYTEDATA 0x01 -#define ARGP_BYTELIST 0x02 -#define ARGP_CHARLIST 0x03 -#define ARGP_DATAOBJ 0x04 -#define ARGP_DATAOBJLIST 0x05 -#define ARGP_DWORDDATA 0x06 -#define ARGP_FIELDLIST 0x07 -#define ARGP_NAME 0x08 -#define ARGP_NAMESTRING 0x09 -#define ARGP_OBJLIST 0x0A -#define ARGP_PKGLENGTH 0x0B -#define ARGP_SUPERNAME 0x0C -#define ARGP_TARGET 0x0D -#define ARGP_TERMARG 0x0E -#define ARGP_TERMLIST 0x0F -#define ARGP_WORDDATA 0x10 -#define ARGP_QWORDDATA 0x11 -#define ARGP_SIMPLENAME 0x12 /* NameString | LocalTerm | ArgTerm */ -#define ARGP_NAME_OR_REF 0x13 /* For ObjectType only */ -#define ARGP_MAX 0x13 -#define ARGP_COMMENT 0x14 - -/* - * Resolved argument types for the AML Interpreter - * Each field in the ArgTypes UINT32 is 5 bits, allowing for a maximum of 6 arguments. - * There can be up to 31 unique argument types (0 is end-of-arg-list indicator) - * - * Note1: These values are completely independent from the ACPI_TYPEs - * i.e., ARGI_INTEGER != ACPI_TYPE_INTEGER - * - * Note2: If and when 5 bits becomes insufficient, it would probably be best - * to convert to a 6-byte array of argument types, allowing 8 bits per argument. - */ - -/* Single, simple types */ - -#define ARGI_ANYTYPE 0x01 /* Don't care */ -#define ARGI_PACKAGE 0x02 -#define ARGI_EVENT 0x03 -#define ARGI_MUTEX 0x04 -#define ARGI_DDBHANDLE 0x05 - -/* Interchangeable types (via implicit conversion) */ - -#define ARGI_INTEGER 0x06 -#define ARGI_STRING 0x07 -#define ARGI_BUFFER 0x08 -#define ARGI_BUFFER_OR_STRING 0x09 /* Used by MID op only */ -#define ARGI_COMPUTEDATA 0x0A /* Buffer, String, or Integer */ - -/* Reference objects */ - -#define ARGI_INTEGER_REF 0x0B -#define ARGI_OBJECT_REF 0x0C -#define ARGI_DEVICE_REF 0x0D -#define ARGI_REFERENCE 0x0E -#define ARGI_TARGETREF 0x0F /* Target, subject to implicit conversion */ -#define ARGI_FIXED_TARGET 0x10 /* Target, no implicit conversion */ -#define ARGI_SIMPLE_TARGET 0x11 /* Name, Local, Arg -- no implicit conversion */ -#define ARGI_STORE_TARGET 0x12 /* Target for store is TARGETREF + package objects */ - -/* Multiple/complex types */ - -#define ARGI_DATAOBJECT 0x13 /* Buffer, String, package or reference to a Node - Used only by SizeOf operator*/ -#define ARGI_COMPLEXOBJ 0x14 /* Buffer, String, or package (Used by INDEX op only) */ -#define ARGI_REF_OR_STRING 0x15 /* Reference or String (Used by DEREFOF op only) */ -#define ARGI_REGION_OR_BUFFER 0x16 /* Used by LOAD op only */ -#define ARGI_DATAREFOBJ 0x17 - -/* Note: types above can expand to 0x1F maximum */ - -#define ARGI_INVALID_OPCODE 0xFFFFFFFF - - -/* - * Some of the flags and types below are of the form: - * - * AML_FLAGS_EXEC_#A_#T,#R, or - * AML_TYPE_EXEC_#A_#T,#R where: - * - * #A is the number of required arguments - * #T is the number of target operands - * #R indicates whether there is a return value - * - * These types are used for the top-level dispatch of the AML - * opcode. They group similar operators that can share common - * front-end code before dispatch to the final code that implements - * the operator. - */ - -/* - * Opcode information flags - */ -#define AML_LOGICAL 0x0001 -#define AML_LOGICAL_NUMERIC 0x0002 -#define AML_MATH 0x0004 -#define AML_CREATE 0x0008 -#define AML_FIELD 0x0010 -#define AML_DEFER 0x0020 -#define AML_NAMED 0x0040 -#define AML_NSNODE 0x0080 -#define AML_NSOPCODE 0x0100 -#define AML_NSOBJECT 0x0200 -#define AML_HAS_RETVAL 0x0400 -#define AML_HAS_TARGET 0x0800 -#define AML_HAS_ARGS 0x1000 -#define AML_CONSTANT 0x2000 -#define AML_NO_OPERAND_RESOLVE 0x4000 - -/* Convenient flag groupings of the flags above */ - -#define AML_FLAGS_EXEC_0A_0T_1R AML_HAS_RETVAL -#define AML_FLAGS_EXEC_1A_0T_0R AML_HAS_ARGS /* Monadic1 */ -#define AML_FLAGS_EXEC_1A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL /* Monadic2 */ -#define AML_FLAGS_EXEC_1A_1T_0R AML_HAS_ARGS | AML_HAS_TARGET -#define AML_FLAGS_EXEC_1A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* Monadic2R */ -#define AML_FLAGS_EXEC_2A_0T_0R AML_HAS_ARGS /* Dyadic1 */ -#define AML_FLAGS_EXEC_2A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL /* Dyadic2 */ -#define AML_FLAGS_EXEC_2A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* Dyadic2R */ -#define AML_FLAGS_EXEC_2A_2T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL -#define AML_FLAGS_EXEC_3A_0T_0R AML_HAS_ARGS -#define AML_FLAGS_EXEC_3A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL -#define AML_FLAGS_EXEC_6A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL - - -/* - * The opcode Type is used in a dispatch table, do not change - * or add anything new without updating the table. - */ -#define AML_TYPE_EXEC_0A_0T_1R 0x00 /* 0 Args, 0 Target, 1 RetVal */ -#define AML_TYPE_EXEC_1A_0T_0R 0x01 /* 1 Args, 0 Target, 0 RetVal */ -#define AML_TYPE_EXEC_1A_0T_1R 0x02 /* 1 Args, 0 Target, 1 RetVal */ -#define AML_TYPE_EXEC_1A_1T_0R 0x03 /* 1 Args, 1 Target, 0 RetVal */ -#define AML_TYPE_EXEC_1A_1T_1R 0x04 /* 1 Args, 1 Target, 1 RetVal */ -#define AML_TYPE_EXEC_2A_0T_0R 0x05 /* 2 Args, 0 Target, 0 RetVal */ -#define AML_TYPE_EXEC_2A_0T_1R 0x06 /* 2 Args, 0 Target, 1 RetVal */ -#define AML_TYPE_EXEC_2A_1T_1R 0x07 /* 2 Args, 1 Target, 1 RetVal */ -#define AML_TYPE_EXEC_2A_2T_1R 0x08 /* 2 Args, 2 Target, 1 RetVal */ -#define AML_TYPE_EXEC_3A_0T_0R 0x09 /* 3 Args, 0 Target, 0 RetVal */ -#define AML_TYPE_EXEC_3A_1T_1R 0x0A /* 3 Args, 1 Target, 1 RetVal */ -#define AML_TYPE_EXEC_6A_0T_1R 0x0B /* 6 Args, 0 Target, 1 RetVal */ -/* End of types used in dispatch table */ - -#define AML_TYPE_LITERAL 0x0C -#define AML_TYPE_CONSTANT 0x0D -#define AML_TYPE_METHOD_ARGUMENT 0x0E -#define AML_TYPE_LOCAL_VARIABLE 0x0F -#define AML_TYPE_DATA_TERM 0x10 - -/* Generic for an op that returns a value */ - -#define AML_TYPE_METHOD_CALL 0x11 - -/* Miscellaneous types */ - -#define AML_TYPE_CREATE_FIELD 0x12 -#define AML_TYPE_CREATE_OBJECT 0x13 -#define AML_TYPE_CONTROL 0x14 -#define AML_TYPE_NAMED_NO_OBJ 0x15 -#define AML_TYPE_NAMED_FIELD 0x16 -#define AML_TYPE_NAMED_SIMPLE 0x17 -#define AML_TYPE_NAMED_COMPLEX 0x18 -#define AML_TYPE_RETURN 0x19 -#define AML_TYPE_UNDEFINED 0x1A -#define AML_TYPE_BOGUS 0x1B - -/* AML Package Length encodings */ - -#define ACPI_AML_PACKAGE_TYPE1 0x40 -#define ACPI_AML_PACKAGE_TYPE2 0x4000 -#define ACPI_AML_PACKAGE_TYPE3 0x400000 -#define ACPI_AML_PACKAGE_TYPE4 0x40000000 - -/* - * Opcode classes - */ -#define AML_CLASS_EXECUTE 0x00 -#define AML_CLASS_CREATE 0x01 -#define AML_CLASS_ARGUMENT 0x02 -#define AML_CLASS_NAMED_OBJECT 0x03 -#define AML_CLASS_CONTROL 0x04 -#define AML_CLASS_ASCII 0x05 -#define AML_CLASS_PREFIX 0x06 -#define AML_CLASS_INTERNAL 0x07 -#define AML_CLASS_RETURN_VALUE 0x08 -#define AML_CLASS_METHOD_CALL 0x09 -#define AML_CLASS_UNKNOWN 0x0A - - -/* Comparison operation codes for MatchOp operator */ - -typedef enum -{ - MATCH_MTR = 0, - MATCH_MEQ = 1, - MATCH_MLE = 2, - MATCH_MLT = 3, - MATCH_MGE = 4, - MATCH_MGT = 5 - -} AML_MATCH_OPERATOR; - -#define MAX_MATCH_OPERATOR 5 - - -/* - * FieldFlags - * - * This byte is extracted from the AML and includes three separate - * pieces of information about the field: - * 1) The field access type - * 2) The field update rule - * 3) The lock rule for the field - * - * Bits 00 - 03 : AccessType (AnyAcc, ByteAcc, etc.) - * 04 : LockRule (1 == Lock) - * 05 - 06 : UpdateRule - */ -#define AML_FIELD_ACCESS_TYPE_MASK 0x0F -#define AML_FIELD_LOCK_RULE_MASK 0x10 -#define AML_FIELD_UPDATE_RULE_MASK 0x60 - - -/* 1) Field Access Types */ - -typedef enum -{ - AML_FIELD_ACCESS_ANY = 0x00, - AML_FIELD_ACCESS_BYTE = 0x01, - AML_FIELD_ACCESS_WORD = 0x02, - AML_FIELD_ACCESS_DWORD = 0x03, - AML_FIELD_ACCESS_QWORD = 0x04, /* ACPI 2.0 */ - AML_FIELD_ACCESS_BUFFER = 0x05 /* ACPI 2.0 */ - -} AML_ACCESS_TYPE; - - -/* 2) Field Lock Rules */ - -typedef enum -{ - AML_FIELD_LOCK_NEVER = 0x00, - AML_FIELD_LOCK_ALWAYS = 0x10 - -} AML_LOCK_RULE; - - -/* 3) Field Update Rules */ - -typedef enum -{ - AML_FIELD_UPDATE_PRESERVE = 0x00, - AML_FIELD_UPDATE_WRITE_AS_ONES = 0x20, - AML_FIELD_UPDATE_WRITE_AS_ZEROS = 0x40 - -} AML_UPDATE_RULE; - - -/* - * Field Access Attributes. - * This byte is extracted from the AML via the - * AccessAs keyword - */ -typedef enum -{ - AML_FIELD_ATTRIB_QUICK = 0x02, - AML_FIELD_ATTRIB_SEND_RECEIVE = 0x04, - AML_FIELD_ATTRIB_BYTE = 0x06, - AML_FIELD_ATTRIB_WORD = 0x08, - AML_FIELD_ATTRIB_BLOCK = 0x0A, - AML_FIELD_ATTRIB_BYTES = 0x0B, - AML_FIELD_ATTRIB_PROCESS_CALL = 0x0C, - AML_FIELD_ATTRIB_BLOCK_PROCESS_CALL = 0x0D, - AML_FIELD_ATTRIB_RAW_BYTES = 0x0E, - AML_FIELD_ATTRIB_RAW_PROCESS_BYTES = 0x0F - -} AML_ACCESS_ATTRIBUTE; - - -/* Bit fields in the AML MethodFlags byte */ - -#define AML_METHOD_ARG_COUNT 0x07 -#define AML_METHOD_SERIALIZED 0x08 -#define AML_METHOD_SYNC_LEVEL 0xF0 - - -#endif /* __AMLCODE_H__ */ diff --git a/drivers/include/acpica/amlresrc.h b/drivers/include/acpica/amlresrc.h deleted file mode 100644 index 4482ed3..0000000 --- a/drivers/include/acpica/amlresrc.h +++ /dev/null @@ -1,900 +0,0 @@ -/****************************************************************************** - * - * Module Name: amlresrc.h - AML resource descriptors - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -/* acpisrc:StructDefs -- for acpisrc conversion */ - -#ifndef __AMLRESRC_H -#define __AMLRESRC_H - - -/* - * Resource descriptor tags, as defined in the ACPI specification. - * Used to symbolically reference fields within a descriptor. - */ -#define ACPI_RESTAG_ADDRESS "_ADR" -#define ACPI_RESTAG_ALIGNMENT "_ALN" -#define ACPI_RESTAG_ADDRESSSPACE "_ASI" -#define ACPI_RESTAG_ACCESSSIZE "_ASZ" -#define ACPI_RESTAG_TYPESPECIFICATTRIBUTES "_ATT" -#define ACPI_RESTAG_BASEADDRESS "_BAS" -#define ACPI_RESTAG_BUSMASTER "_BM_" /* Master(1), Slave(0) */ -#define ACPI_RESTAG_DEBOUNCETIME "_DBT" -#define ACPI_RESTAG_DECODE "_DEC" -#define ACPI_RESTAG_DEVICEPOLARITY "_DPL" -#define ACPI_RESTAG_DMA "_DMA" -#define ACPI_RESTAG_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */ -#define ACPI_RESTAG_DRIVESTRENGTH "_DRS" -#define ACPI_RESTAG_ENDIANNESS "_END" -#define ACPI_RESTAG_FLOWCONTROL "_FLC" -#define ACPI_RESTAG_FUNCTION "_FUN" -#define ACPI_RESTAG_GRANULARITY "_GRA" -#define ACPI_RESTAG_INTERRUPT "_INT" -#define ACPI_RESTAG_INTERRUPTLEVEL "_LL_" /* ActiveLo(1), ActiveHi(0) */ -#define ACPI_RESTAG_INTERRUPTSHARE "_SHR" /* Shareable(1), NoShare(0) */ -#define ACPI_RESTAG_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */ -#define ACPI_RESTAG_IORESTRICTION "_IOR" -#define ACPI_RESTAG_LENGTH "_LEN" -#define ACPI_RESTAG_LINE "_LIN" -#define ACPI_RESTAG_LOCALPORT "_PRT" -#define ACPI_RESTAG_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */ -#define ACPI_RESTAG_MEMTYPE "_MEM" /* NonCache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */ -#define ACPI_RESTAG_MAXADDR "_MAX" -#define ACPI_RESTAG_MINADDR "_MIN" -#define ACPI_RESTAG_MAXTYPE "_MAF" -#define ACPI_RESTAG_MINTYPE "_MIF" -#define ACPI_RESTAG_MODE "_MOD" -#define ACPI_RESTAG_PARITY "_PAR" -#define ACPI_RESTAG_PHASE "_PHA" -#define ACPI_RESTAG_PHYTYPE "_PHY" -#define ACPI_RESTAG_PIN "_PIN" -#define ACPI_RESTAG_PINCONFIG "_PPI" -#define ACPI_RESTAG_PINCONFIG_TYPE "_TYP" -#define ACPI_RESTAG_PINCONFIG_VALUE "_VAL" -#define ACPI_RESTAG_POLARITY "_POL" -#define ACPI_RESTAG_REGISTERBITOFFSET "_RBO" -#define ACPI_RESTAG_REGISTERBITWIDTH "_RBW" -#define ACPI_RESTAG_RANGETYPE "_RNG" -#define ACPI_RESTAG_READWRITETYPE "_RW_" /* ReadOnly(0), Writeable (1) */ -#define ACPI_RESTAG_LENGTH_RX "_RXL" -#define ACPI_RESTAG_LENGTH_TX "_TXL" -#define ACPI_RESTAG_SLAVEMODE "_SLV" -#define ACPI_RESTAG_SPEED "_SPE" -#define ACPI_RESTAG_STOPBITS "_STB" -#define ACPI_RESTAG_TRANSLATION "_TRA" -#define ACPI_RESTAG_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */ -#define ACPI_RESTAG_TYPE "_TTP" /* Translation(1), Static (0) */ -#define ACPI_RESTAG_XFERTYPE "_SIZ" /* 8(0), 8And16(1), 16(2) */ -#define ACPI_RESTAG_VENDORDATA "_VEN" -#define ACPI_RESTAG_FQN "_FQN" -#define ACPI_RESTAG_FQD "_FQD" - - -/* Default sizes for "small" resource descriptors */ - -#define ASL_RDESC_IRQ_SIZE 0x02 -#define ASL_RDESC_DMA_SIZE 0x02 -#define ASL_RDESC_ST_DEPEND_SIZE 0x00 -#define ASL_RDESC_END_DEPEND_SIZE 0x00 -#define ASL_RDESC_IO_SIZE 0x07 -#define ASL_RDESC_FIXED_IO_SIZE 0x03 -#define ASL_RDESC_FIXED_DMA_SIZE 0x05 -#define ASL_RDESC_END_TAG_SIZE 0x01 - - -typedef struct asl_resource_node -{ - UINT32 BufferLength; - void *Buffer; - struct asl_resource_node *Next; - -} ASL_RESOURCE_NODE; - -typedef struct asl_resource_info -{ - ACPI_PARSE_OBJECT *DescriptorTypeOp; /* Resource descriptor parse node */ - ACPI_PARSE_OBJECT *MappingOp; /* Used for mapfile support */ - UINT32 CurrentByteOffset; /* Offset in resource template */ - -} ASL_RESOURCE_INFO; - - -/* Macros used to generate AML resource length fields */ - -#define ACPI_AML_SIZE_LARGE(r) (sizeof (r) - sizeof (AML_RESOURCE_LARGE_HEADER)) -#define ACPI_AML_SIZE_SMALL(r) (sizeof (r) - sizeof (AML_RESOURCE_SMALL_HEADER)) - -/* - * Resource descriptors defined in the ACPI specification. - * - * Packing/alignment must be BYTE because these descriptors - * are used to overlay the raw AML byte stream. - */ -#pragma pack(1) - -/* - * SMALL descriptors - */ -#define AML_RESOURCE_SMALL_HEADER_COMMON \ - UINT8 DescriptorType; - -typedef struct aml_resource_small_header -{ - AML_RESOURCE_SMALL_HEADER_COMMON - -} AML_RESOURCE_SMALL_HEADER; - - -typedef struct aml_resource_irq -{ - AML_RESOURCE_SMALL_HEADER_COMMON - UINT16 IrqMask; - UINT8 Flags; - -} AML_RESOURCE_IRQ; - - -typedef struct aml_resource_irq_noflags -{ - AML_RESOURCE_SMALL_HEADER_COMMON - UINT16 IrqMask; - -} AML_RESOURCE_IRQ_NOFLAGS; - - -typedef struct aml_resource_dma -{ - AML_RESOURCE_SMALL_HEADER_COMMON - UINT8 DmaChannelMask; - UINT8 Flags; - -} AML_RESOURCE_DMA; - - -typedef struct aml_resource_start_dependent -{ - AML_RESOURCE_SMALL_HEADER_COMMON - UINT8 Flags; - -} AML_RESOURCE_START_DEPENDENT; - - -typedef struct aml_resource_start_dependent_noprio -{ - AML_RESOURCE_SMALL_HEADER_COMMON - -} AML_RESOURCE_START_DEPENDENT_NOPRIO; - - -typedef struct aml_resource_end_dependent -{ - AML_RESOURCE_SMALL_HEADER_COMMON - -} AML_RESOURCE_END_DEPENDENT; - - -typedef struct aml_resource_io -{ - AML_RESOURCE_SMALL_HEADER_COMMON - UINT8 Flags; - UINT16 Minimum; - UINT16 Maximum; - UINT8 Alignment; - UINT8 AddressLength; - -} AML_RESOURCE_IO; - - -typedef struct aml_resource_fixed_io -{ - AML_RESOURCE_SMALL_HEADER_COMMON - UINT16 Address; - UINT8 AddressLength; - -} AML_RESOURCE_FIXED_IO; - - -typedef struct aml_resource_vendor_small -{ - AML_RESOURCE_SMALL_HEADER_COMMON - -} AML_RESOURCE_VENDOR_SMALL; - - -typedef struct aml_resource_end_tag -{ - AML_RESOURCE_SMALL_HEADER_COMMON - UINT8 Checksum; - -} AML_RESOURCE_END_TAG; - - -typedef struct aml_resource_fixed_dma -{ - AML_RESOURCE_SMALL_HEADER_COMMON - UINT16 RequestLines; - UINT16 Channels; - UINT8 Width; - -} AML_RESOURCE_FIXED_DMA; - - -/* - * LARGE descriptors - */ -#define AML_RESOURCE_LARGE_HEADER_COMMON \ - UINT8 DescriptorType;\ - UINT16 ResourceLength; - -typedef struct aml_resource_large_header -{ - AML_RESOURCE_LARGE_HEADER_COMMON - -} AML_RESOURCE_LARGE_HEADER; - - -/* General Flags for address space resource descriptors */ - -#define ACPI_RESOURCE_FLAG_DEC 2 -#define ACPI_RESOURCE_FLAG_MIF 4 -#define ACPI_RESOURCE_FLAG_MAF 8 - -typedef struct aml_resource_memory24 -{ - AML_RESOURCE_LARGE_HEADER_COMMON - UINT8 Flags; - UINT16 Minimum; - UINT16 Maximum; - UINT16 Alignment; - UINT16 AddressLength; - -} AML_RESOURCE_MEMORY24; - - -typedef struct aml_resource_vendor_large -{ - AML_RESOURCE_LARGE_HEADER_COMMON - -} AML_RESOURCE_VENDOR_LARGE; - - -typedef struct aml_resource_memory32 -{ - AML_RESOURCE_LARGE_HEADER_COMMON - UINT8 Flags; - UINT32 Minimum; - UINT32 Maximum; - UINT32 Alignment; - UINT32 AddressLength; - -} AML_RESOURCE_MEMORY32; - - -typedef struct aml_resource_fixed_memory32 -{ - AML_RESOURCE_LARGE_HEADER_COMMON - UINT8 Flags; - UINT32 Address; - UINT32 AddressLength; - -} AML_RESOURCE_FIXED_MEMORY32; - - -#define AML_RESOURCE_ADDRESS_COMMON \ - UINT8 ResourceType; \ - UINT8 Flags; \ - UINT8 SpecificFlags; - - -typedef struct aml_resource_address -{ - AML_RESOURCE_LARGE_HEADER_COMMON - AML_RESOURCE_ADDRESS_COMMON - -} AML_RESOURCE_ADDRESS; - - -typedef struct aml_resource_extended_address64 -{ - AML_RESOURCE_LARGE_HEADER_COMMON - AML_RESOURCE_ADDRESS_COMMON - UINT8 RevisionID; - UINT8 Reserved; - UINT64 Granularity; - UINT64 Minimum; - UINT64 Maximum; - UINT64 TranslationOffset; - UINT64 AddressLength; - UINT64 TypeSpecific; - -} AML_RESOURCE_EXTENDED_ADDRESS64; - -#define AML_RESOURCE_EXTENDED_ADDRESS_REVISION 1 /* ACPI 3.0 */ - - -typedef struct aml_resource_address64 -{ - AML_RESOURCE_LARGE_HEADER_COMMON - AML_RESOURCE_ADDRESS_COMMON - UINT64 Granularity; - UINT64 Minimum; - UINT64 Maximum; - UINT64 TranslationOffset; - UINT64 AddressLength; - -} AML_RESOURCE_ADDRESS64; - - -typedef struct aml_resource_address32 -{ - AML_RESOURCE_LARGE_HEADER_COMMON - AML_RESOURCE_ADDRESS_COMMON - UINT32 Granularity; - UINT32 Minimum; - UINT32 Maximum; - UINT32 TranslationOffset; - UINT32 AddressLength; - -} AML_RESOURCE_ADDRESS32; - - -typedef struct aml_resource_address16 -{ - AML_RESOURCE_LARGE_HEADER_COMMON - AML_RESOURCE_ADDRESS_COMMON - UINT16 Granularity; - UINT16 Minimum; - UINT16 Maximum; - UINT16 TranslationOffset; - UINT16 AddressLength; - -} AML_RESOURCE_ADDRESS16; - - -typedef struct aml_resource_extended_irq -{ - AML_RESOURCE_LARGE_HEADER_COMMON - UINT8 Flags; - UINT8 InterruptCount; - union { - UINT32 Interrupt; - ACPI_FLEX_ARRAY(UINT32, Interrupts); - }; - /* ResSourceIndex, ResSource optional fields follow */ - -} AML_RESOURCE_EXTENDED_IRQ; - - -typedef struct aml_resource_generic_register -{ - AML_RESOURCE_LARGE_HEADER_COMMON - UINT8 AddressSpaceId; - UINT8 BitWidth; - UINT8 BitOffset; - UINT8 AccessSize; /* ACPI 3.0, was previously Reserved */ - UINT64 Address; - -} AML_RESOURCE_GENERIC_REGISTER; - - -/* Common descriptor for GpioInt and GpioIo (ACPI 5.0) */ - -typedef struct aml_resource_gpio -{ - AML_RESOURCE_LARGE_HEADER_COMMON - UINT8 RevisionId; - UINT8 ConnectionType; - UINT16 Flags; - UINT16 IntFlags; - UINT8 PinConfig; - UINT16 DriveStrength; - UINT16 DebounceTimeout; - UINT16 PinTableOffset; - UINT8 ResSourceIndex; - UINT16 ResSourceOffset; - UINT16 VendorOffset; - UINT16 VendorLength; - /* - * Optional fields follow immediately: - * 1) PIN list (Words) - * 2) Resource Source String - * 3) Vendor Data bytes - */ - -} AML_RESOURCE_GPIO; - -#define AML_RESOURCE_GPIO_REVISION 1 /* ACPI 5.0 */ - -/* Values for ConnectionType above */ - -#define AML_RESOURCE_GPIO_TYPE_INT 0 -#define AML_RESOURCE_GPIO_TYPE_IO 1 -#define AML_RESOURCE_MAX_GPIOTYPE 1 - - -/* Common preamble for all serial descriptors (ACPI 5.0) */ - -#define AML_RESOURCE_SERIAL_COMMON \ - UINT8 RevisionId; \ - UINT8 ResSourceIndex; \ - UINT8 Type; \ - UINT8 Flags; \ - UINT16 TypeSpecificFlags; \ - UINT8 TypeRevisionId; \ - UINT16 TypeDataLength; \ - -/* Values for the type field above */ - -#define AML_RESOURCE_I2C_SERIALBUSTYPE 1 -#define AML_RESOURCE_SPI_SERIALBUSTYPE 2 -#define AML_RESOURCE_UART_SERIALBUSTYPE 3 -#define AML_RESOURCE_CSI2_SERIALBUSTYPE 4 -#define AML_RESOURCE_MAX_SERIALBUSTYPE 4 -#define AML_RESOURCE_VENDOR_SERIALBUSTYPE 192 /* Vendor defined is 0xC0-0xFF (NOT SUPPORTED) */ - -typedef struct aml_resource_common_serialbus -{ - AML_RESOURCE_LARGE_HEADER_COMMON - AML_RESOURCE_SERIAL_COMMON - -} AML_RESOURCE_COMMON_SERIALBUS; - - -typedef struct aml_resource_csi2_serialbus -{ - AML_RESOURCE_LARGE_HEADER_COMMON - AML_RESOURCE_SERIAL_COMMON - - /* - * Optional fields follow immediately: - * 1) Vendor Data bytes - * 2) Resource Source String - */ - -} AML_RESOURCE_CSI2_SERIALBUS; - -#define AML_RESOURCE_CSI2_REVISION 1 /* ACPI 6.4 */ -#define AML_RESOURCE_CSI2_TYPE_REVISION 1 /* ACPI 6.4 */ -#define AML_RESOURCE_CSI2_MIN_DATA_LEN 0 /* ACPI 6.4 */ - -typedef struct aml_resource_i2c_serialbus -{ - AML_RESOURCE_LARGE_HEADER_COMMON - AML_RESOURCE_SERIAL_COMMON - UINT32 ConnectionSpeed; - UINT16 SlaveAddress; - /* - * Optional fields follow immediately: - * 1) Vendor Data bytes - * 2) Resource Source String - */ - -} AML_RESOURCE_I2C_SERIALBUS; - -#define AML_RESOURCE_I2C_REVISION 1 /* ACPI 5.0 */ -#define AML_RESOURCE_I2C_TYPE_REVISION 1 /* ACPI 5.0 */ -#define AML_RESOURCE_I2C_MIN_DATA_LEN 6 - -typedef struct aml_resource_spi_serialbus -{ - AML_RESOURCE_LARGE_HEADER_COMMON - AML_RESOURCE_SERIAL_COMMON - UINT32 ConnectionSpeed; - UINT8 DataBitLength; - UINT8 ClockPhase; - UINT8 ClockPolarity; - UINT16 DeviceSelection; - /* - * Optional fields follow immediately: - * 1) Vendor Data bytes - * 2) Resource Source String - */ - -} AML_RESOURCE_SPI_SERIALBUS; - -#define AML_RESOURCE_SPI_REVISION 1 /* ACPI 5.0 */ -#define AML_RESOURCE_SPI_TYPE_REVISION 1 /* ACPI 5.0 */ -#define AML_RESOURCE_SPI_MIN_DATA_LEN 9 - -typedef struct aml_resource_uart_serialbus -{ - AML_RESOURCE_LARGE_HEADER_COMMON - AML_RESOURCE_SERIAL_COMMON - UINT32 DefaultBaudRate; - UINT16 RxFifoSize; - UINT16 TxFifoSize; - UINT8 Parity; - UINT8 LinesEnabled; - /* - * Optional fields follow immediately: - * 1) Vendor Data bytes - * 2) Resource Source String - */ - -} AML_RESOURCE_UART_SERIALBUS; - -#define AML_RESOURCE_UART_REVISION 1 /* ACPI 5.0 */ -#define AML_RESOURCE_UART_TYPE_REVISION 1 /* ACPI 5.0 */ -#define AML_RESOURCE_UART_MIN_DATA_LEN 10 - -typedef struct aml_resource_pin_function -{ - AML_RESOURCE_LARGE_HEADER_COMMON - UINT8 RevisionId; - UINT16 Flags; - UINT8 PinConfig; - UINT16 FunctionNumber; - UINT16 PinTableOffset; - UINT8 ResSourceIndex; - UINT16 ResSourceOffset; - UINT16 VendorOffset; - UINT16 VendorLength; - /* - * Optional fields follow immediately: - * 1) PIN list (Words) - * 2) Resource Source String - * 3) Vendor Data bytes - */ - -} AML_RESOURCE_PIN_FUNCTION; - -#define AML_RESOURCE_PIN_FUNCTION_REVISION 1 /* ACPI 6.2 */ - -typedef struct aml_resource_pin_config -{ - AML_RESOURCE_LARGE_HEADER_COMMON - UINT8 RevisionId; - UINT16 Flags; - UINT8 PinConfigType; - UINT32 PinConfigValue; - UINT16 PinTableOffset; - UINT8 ResSourceIndex; - UINT16 ResSourceOffset; - UINT16 VendorOffset; - UINT16 VendorLength; - /* - * Optional fields follow immediately: - * 1) PIN list (Words) - * 2) Resource Source String - * 3) Vendor Data bytes - */ - -} AML_RESOURCE_PIN_CONFIG; - -#define AML_RESOURCE_CLOCK_INPUT_REVISION 1 /* ACPI 6.5 */ - -typedef struct aml_resource_clock_input -{ - AML_RESOURCE_LARGE_HEADER_COMMON - UINT8 RevisionId; - UINT16 Flags; - UINT16 FrequencyDivisor; - UINT32 FrequencyNumerator; - /* - * Optional fields follow immediately: - * 1) Resource Source index - * 2) Resource Source String - */ -} AML_RESOURCE_CLOCK_INPUT; - - -#define AML_RESOURCE_PIN_CONFIG_REVISION 1 /* ACPI 6.2 */ - -typedef struct aml_resource_pin_group -{ - AML_RESOURCE_LARGE_HEADER_COMMON - UINT8 RevisionId; - UINT16 Flags; - UINT16 PinTableOffset; - UINT16 LabelOffset; - UINT16 VendorOffset; - UINT16 VendorLength; - /* - * Optional fields follow immediately: - * 1) PIN list (Words) - * 2) Resource Label String - * 3) Vendor Data bytes - */ - -} AML_RESOURCE_PIN_GROUP; - -#define AML_RESOURCE_PIN_GROUP_REVISION 1 /* ACPI 6.2 */ - -typedef struct aml_resource_pin_group_function -{ - AML_RESOURCE_LARGE_HEADER_COMMON - UINT8 RevisionId; - UINT16 Flags; - UINT16 FunctionNumber; - UINT8 ResSourceIndex; - UINT16 ResSourceOffset; - UINT16 ResSourceLabelOffset; - UINT16 VendorOffset; - UINT16 VendorLength; - /* - * Optional fields follow immediately: - * 1) Resource Source String - * 2) Resource Source Label String - * 3) Vendor Data bytes - */ - -} AML_RESOURCE_PIN_GROUP_FUNCTION; - -#define AML_RESOURCE_PIN_GROUP_FUNCTION_REVISION 1 /* ACPI 6.2 */ - -typedef struct aml_resource_pin_group_config -{ - AML_RESOURCE_LARGE_HEADER_COMMON - UINT8 RevisionId; - UINT16 Flags; - UINT8 PinConfigType; - UINT32 PinConfigValue; - UINT8 ResSourceIndex; - UINT16 ResSourceOffset; - UINT16 ResSourceLabelOffset; - UINT16 VendorOffset; - UINT16 VendorLength; - /* - * Optional fields follow immediately: - * 1) Resource Source String - * 2) Resource Source Label String - * 3) Vendor Data bytes - */ - -} AML_RESOURCE_PIN_GROUP_CONFIG; - -#define AML_RESOURCE_PIN_GROUP_CONFIG_REVISION 1 /* ACPI 6.2 */ - -/* Union of all resource descriptors, so we can allocate the worst case */ - -typedef union aml_resource -{ - /* Descriptor headers */ - - UINT8 DescriptorType; - AML_RESOURCE_SMALL_HEADER SmallHeader; - AML_RESOURCE_LARGE_HEADER LargeHeader; - - /* Small resource descriptors */ - - AML_RESOURCE_IRQ Irq; - AML_RESOURCE_DMA Dma; - AML_RESOURCE_START_DEPENDENT StartDpf; - AML_RESOURCE_END_DEPENDENT EndDpf; - AML_RESOURCE_IO Io; - AML_RESOURCE_FIXED_IO FixedIo; - AML_RESOURCE_FIXED_DMA FixedDma; - AML_RESOURCE_VENDOR_SMALL VendorSmall; - AML_RESOURCE_END_TAG EndTag; - - /* Large resource descriptors */ - - AML_RESOURCE_MEMORY24 Memory24; - AML_RESOURCE_GENERIC_REGISTER GenericReg; - AML_RESOURCE_VENDOR_LARGE VendorLarge; - AML_RESOURCE_MEMORY32 Memory32; - AML_RESOURCE_FIXED_MEMORY32 FixedMemory32; - AML_RESOURCE_ADDRESS16 Address16; - AML_RESOURCE_ADDRESS32 Address32; - AML_RESOURCE_ADDRESS64 Address64; - AML_RESOURCE_EXTENDED_ADDRESS64 ExtAddress64; - AML_RESOURCE_EXTENDED_IRQ ExtendedIrq; - AML_RESOURCE_GPIO Gpio; - AML_RESOURCE_I2C_SERIALBUS I2cSerialBus; - AML_RESOURCE_SPI_SERIALBUS SpiSerialBus; - AML_RESOURCE_UART_SERIALBUS UartSerialBus; - AML_RESOURCE_CSI2_SERIALBUS Csi2SerialBus; - AML_RESOURCE_COMMON_SERIALBUS CommonSerialBus; - AML_RESOURCE_PIN_FUNCTION PinFunction; - AML_RESOURCE_PIN_CONFIG PinConfig; - AML_RESOURCE_PIN_GROUP PinGroup; - AML_RESOURCE_PIN_GROUP_FUNCTION PinGroupFunction; - AML_RESOURCE_PIN_GROUP_CONFIG PinGroupConfig; - AML_RESOURCE_CLOCK_INPUT ClockInput; - - /* Utility overlays */ - - AML_RESOURCE_ADDRESS Address; - UINT32 DwordItem; - UINT16 WordItem; - UINT8 ByteItem; - -} AML_RESOURCE; - -/* restore default alignment */ - -#pragma pack() - -/* Interfaces used by both the disassembler and compiler */ - -void -MpSaveGpioInfo ( - ACPI_PARSE_OBJECT *Op, - AML_RESOURCE *Resource, - UINT32 PinCount, - UINT16 *PinList, - char *DeviceName); - -void -MpSaveSerialInfo ( - ACPI_PARSE_OBJECT *Op, - AML_RESOURCE *Resource, - char *DeviceName); - -char * -MpGetHidFromParseTree ( - ACPI_NAMESPACE_NODE *HidNode); - -char * -MpGetHidViaNamestring ( - char *DeviceName); - -char * -MpGetConnectionInfo ( - ACPI_PARSE_OBJECT *Op, - UINT32 PinIndex, - ACPI_NAMESPACE_NODE **TargetNode, - char **TargetName); - -char * -MpGetParentDeviceHid ( - ACPI_PARSE_OBJECT *Op, - ACPI_NAMESPACE_NODE **TargetNode, - char **ParentDeviceName); - -char * -MpGetDdnValue ( - char *DeviceName); - -char * -MpGetHidValue ( - ACPI_NAMESPACE_NODE *DeviceNode); - -#endif diff --git a/drivers/include/acpica/platform/acenv.h b/drivers/include/acpica/platform/acenv.h deleted file mode 100644 index eac9027..0000000 --- a/drivers/include/acpica/platform/acenv.h +++ /dev/null @@ -1,472 +0,0 @@ -/****************************************************************************** - * - * Name: acenv.h - Host and compiler configuration - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -/* Copyright (C) 2025-2026 Ebrahim Aleem -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see -*/ - -#ifndef __ACENV_H__ -#define __ACENV_H__ - -/* - * Environment configuration. The purpose of this file is to interface ACPICA - * to the local environment. This includes compiler-specific, OS-specific, - * and machine-specific configuration. - */ - -/* Types for ACPI_MUTEX_TYPE */ - -#define ACPI_BINARY_SEMAPHORE 0 -#define ACPI_OSL_MUTEX 1 - -/* Types for DEBUGGER_THREADING */ - -#define DEBUGGER_SINGLE_THREADED 0 -#define DEBUGGER_MULTI_THREADED 1 - - -/****************************************************************************** - * - * Configuration for ACPI tools and utilities - * - *****************************************************************************/ - -/* Common application configuration. All single threaded except for AcpiExec. */ - -#if (defined ACPI_ASL_COMPILER) || \ - (defined ACPI_BIN_APP) || \ - (defined ACPI_DUMP_APP) || \ - (defined ACPI_HELP_APP) || \ - (defined ACPI_NAMES_APP) || \ - (defined ACPI_SRC_APP) || \ - (defined ACPI_XTRACT_APP) || \ - (defined ACPI_EXAMPLE_APP) || \ - (defined ACPI_EFI_HELLO) -#define ACPI_APPLICATION -#define ACPI_SINGLE_THREADED -#define USE_NATIVE_ALLOCATE_ZEROED -#endif - -/* iASL configuration */ - -#ifdef ACPI_ASL_COMPILER -#define ACPI_DEBUG_OUTPUT -#define ACPI_CONSTANT_EVAL_ONLY -#define ACPI_LARGE_NAMESPACE_NODE -#define ACPI_DATA_TABLE_DISASSEMBLY -#define ACPI_32BIT_PHYSICAL_ADDRESS -#define ACPI_DISASSEMBLER 1 -#endif - -/* AcpiExec configuration. Multithreaded with full AML debugger */ - -#ifdef ACPI_EXEC_APP -#define ACPI_APPLICATION -#define ACPI_FULL_DEBUG -#define ACPI_MUTEX_DEBUG -#define ACPI_DBG_TRACK_ALLOCATIONS -#endif - -/* AcpiHelp configuration. Error messages disabled. */ - -#ifdef ACPI_HELP_APP -#define ACPI_NO_ERROR_MESSAGES -#endif - -/* AcpiNames configuration. Debug output enabled. */ - -#ifdef ACPI_NAMES_APP -#define ACPI_DEBUG_OUTPUT -#endif - -/* AcpiExec/AcpiNames/Example configuration. Native RSDP used. */ - -#if (defined ACPI_EXEC_APP) || \ - (defined ACPI_EXAMPLE_APP) || \ - (defined ACPI_NAMES_APP) -#define ACPI_USE_NATIVE_RSDP_POINTER -#endif - -/* AcpiDump configuration. Native mapping used if provided by the host */ - -#ifdef ACPI_DUMP_APP -#define ACPI_USE_NATIVE_MEMORY_MAPPING -#endif - -/* AcpiNames/Example configuration. Hardware disabled */ - -#if (defined ACPI_EXAMPLE_APP) || \ - (defined ACPI_NAMES_APP) -#define ACPI_REDUCED_HARDWARE 1 -#endif - -/* Linkable ACPICA library. Two versions, one with full debug. */ - -#ifdef ACPI_LIBRARY -#define ACPI_USE_LOCAL_CACHE -#define ACPI_DEBUGGER 1 -#define ACPI_DISASSEMBLER 1 - -#ifdef _DEBUG -#define ACPI_DEBUG_OUTPUT -#endif -#endif - -/* Common for all ACPICA applications */ - -#ifdef ACPI_APPLICATION -#define ACPI_USE_LOCAL_CACHE -#endif - -/* Common debug/disassembler support */ - -#ifdef ACPI_FULL_DEBUG -#define ACPI_DEBUG_OUTPUT -#define ACPI_DEBUGGER 1 -#define ACPI_DISASSEMBLER 1 -#endif - -/* - * acpisrc CR\LF support - * Unix file line endings do not include the carriage return. - * If the acpisrc utility is being built using a microsoft compiler, it means - * that it will be running on a windows machine which means that the output is - * expected to have CR/LF newlines. If the acpisrc utility is built with - * anything else, it will likely run on a system with LF newlines. This flag - * tells the acpisrc utility that newlines will be in the LF format. - */ -#if defined(ACPI_SRC_APP) && !defined(_MSC_VER) -#define ACPI_SRC_OS_LF_ONLY 1 -#else -#define ACPI_SRC_OS_LF_ONLY 0 -#endif - -/*! [Begin] no source code translation */ - -/****************************************************************************** - * - * Host configuration files. The compiler configuration files are included - * first. - * - *****************************************************************************/ - -/* hard code to include acmodulos.h */ - -#include "acmodulos.h" - -/*! [End] no source code translation !*/ - - -/****************************************************************************** - * - * Setup defaults for the required symbols that were not defined in one of - * the host/compiler files above. - * - *****************************************************************************/ - -/* 64-bit data types */ - -#ifndef COMPILER_DEPENDENT_INT64 -#define COMPILER_DEPENDENT_INT64 long long -#endif - -#ifndef COMPILER_DEPENDENT_UINT64 -#define COMPILER_DEPENDENT_UINT64 unsigned long long -#endif - -/* Type of mutex supported by host. Default is binary semaphores. */ - -#ifndef ACPI_MUTEX_TYPE -#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE -#endif - -/* Global Lock acquire/release */ - -#ifndef ACPI_ACQUIRE_GLOBAL_LOCK -#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acquired) Acquired = 1 -#endif - -#ifndef ACPI_RELEASE_GLOBAL_LOCK -#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Pending) Pending = 0 -#endif - -/* NULL/invalid value to use for destroyed or not-yet-created semaphores. */ - -#ifndef ACPI_SEMAPHORE_NULL -#define ACPI_SEMAPHORE_NULL NULL -#endif - -/* Flush CPU cache - used when going to sleep. Wbinvd or similar. */ - -#ifndef ACPI_FLUSH_CPU_CACHE -#define ACPI_FLUSH_CPU_CACHE() -#endif - -/* "inline" keywords - configurable since inline is not standardized */ - -#ifndef ACPI_INLINE -#define ACPI_INLINE -#endif - -/* Use ordered initialization if compiler doesn't support designated. */ -#ifndef ACPI_STRUCT_INIT -#define ACPI_STRUCT_INIT(field, value) value -#endif - -/* - * Configurable calling conventions: - * - * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads) - * ACPI_EXTERNAL_XFACE - External ACPI interfaces - * ACPI_INTERNAL_XFACE - Internal ACPI interfaces - * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces - */ -#ifndef ACPI_SYSTEM_XFACE -#define ACPI_SYSTEM_XFACE -#endif - -#ifndef ACPI_EXTERNAL_XFACE -#define ACPI_EXTERNAL_XFACE -#endif - -#ifndef ACPI_INTERNAL_XFACE -#define ACPI_INTERNAL_XFACE -#endif - -#ifndef ACPI_INTERNAL_VAR_XFACE -#define ACPI_INTERNAL_VAR_XFACE -#endif - - -/* - * Debugger threading model - * Use single threaded if the entire subsystem is contained in an application - * Use multiple threaded when the subsystem is running in the kernel. - * - * By default the model is single threaded if ACPI_APPLICATION is set, - * multi-threaded if ACPI_APPLICATION is not set. - */ -#ifndef DEBUGGER_THREADING -#if !defined (ACPI_APPLICATION) || defined (ACPI_EXEC_APP) -#define DEBUGGER_THREADING DEBUGGER_MULTI_THREADED - -#else -#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED -#endif -#endif /* !DEBUGGER_THREADING */ - - -/****************************************************************************** - * - * C library configuration - * - *****************************************************************************/ - -/* - * ACPI_USE_SYSTEM_CLIBRARY - Define this if linking to an actual C library. - * Otherwise, local versions of string/memory functions will be used. - * ACPI_USE_STANDARD_HEADERS - Define this if linking to a C library and - * the standard header files may be used. Defining this implies that - * ACPI_USE_SYSTEM_CLIBRARY has been defined. - * - * The ACPICA subsystem only uses low level C library functions that do not - * call operating system services and may therefore be inlined in the code. - * - * It may be necessary to tailor these include files to the target - * generation environment. - */ - -/* Use the standard C library headers. We want to keep these to a minimum. */ - -#ifdef ACPI_USE_STANDARD_HEADERS - -/* Use the standard headers from the standard locations */ - -#include -#include -#include -#if defined (ACPI_APPLICATION) || defined(ACPI_LIBRARY) -#include -#include -#include -#include -#include -#endif - -#endif /* ACPI_USE_STANDARD_HEADERS */ - -#ifdef ACPI_APPLICATION -#define ACPI_FILE FILE * -#define ACPI_FILE_OUT stdout -#define ACPI_FILE_ERR stderr -#else -#define ACPI_FILE void * -#define ACPI_FILE_OUT NULL -#define ACPI_FILE_ERR NULL -#endif /* ACPI_APPLICATION */ - -#ifndef ACPI_INIT_FUNCTION -#define ACPI_INIT_FUNCTION -#endif - -#endif /* __ACENV_H__ */ diff --git a/drivers/include/acpica/platform/acenvex.h b/drivers/include/acpica/platform/acenvex.h deleted file mode 100644 index e963261..0000000 --- a/drivers/include/acpica/platform/acenvex.h +++ /dev/null @@ -1,190 +0,0 @@ -/****************************************************************************** - * - * Name: acenvex.h - Extra host and compiler configuration - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef __ACENVEX_H__ -#define __ACENVEX_H__ - -/*! [Begin] no source code translation */ - -/****************************************************************************** - * - * Extra host configuration files. All ACPICA headers are included before - * including these files. - * - *****************************************************************************/ - -#if defined(_LINUX) || defined(__linux__) -#include "aclinuxex.h" - -#elif defined(__DragonFly__) -#include "acdragonflyex.h" - -/* - * EFI applications can be built with -nostdlib, in this case, it must be - * included after including all other host environmental definitions, in - * order to override the definitions. - */ -#elif defined(_AED_EFI) || defined(_GNU_EFI) || defined(_EDK2_EFI) -#include "acefiex.h" - -#endif - -#if defined(__GNUC__) && !defined(__INTEL_COMPILER) -#include "acgccex.h" - -#elif defined(_MSC_VER) -#include "acmsvcex.h" - -#endif - -/*! [End] no source code translation !*/ - -#endif /* __ACENVEX_H__ */ diff --git a/drivers/include/acpica/platform/acgcc.h b/drivers/include/acpica/platform/acgcc.h deleted file mode 100644 index ab0d418..0000000 --- a/drivers/include/acpica/platform/acgcc.h +++ /dev/null @@ -1,235 +0,0 @@ -/****************************************************************************** - * - * Name: acgcc.h - GCC specific defines, etc. - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef __ACGCC_H__ -#define __ACGCC_H__ - -/* - * Use compiler specific is a good practice for even when - * -nostdinc is specified (i.e., ACPI_USE_STANDARD_HEADERS undefined. - */ -#ifndef va_arg -#ifdef ACPI_USE_BUILTIN_STDARG -typedef __builtin_va_list va_list; -#define va_start(v, l) __builtin_va_start(v, l) -#define va_end(v) __builtin_va_end(v) -#define va_arg(v, l) __builtin_va_arg(v, l) -#define va_copy(d, s) __builtin_va_copy(d, s) -#else -#include -#endif -#endif - -#define ACPI_INLINE __inline__ - -/* Function name is used for debug output. Non-ANSI, compiler-dependent */ - -#define ACPI_GET_FUNCTION_NAME __func__ - -/* - * This macro is used to tag functions as "printf-like" because - * some compilers (like GCC) can catch printf format string problems. - */ -#define ACPI_PRINTF_LIKE(c) __attribute__ ((__format__ (__printf__, c, c+1))) - -/* - * Some compilers complain about unused variables. Sometimes we don't want to - * use all the variables (for example, _AcpiModuleName). This allows us - * to tell the compiler warning in a per-variable manner that a variable - * is unused. - */ -#define ACPI_UNUSED_VAR __attribute__ ((unused)) - -/* GCC supports __VA_ARGS__ in macros */ - -#define COMPILER_VA_MACRO 1 - -/* GCC supports native multiply/shift on 32-bit platforms */ - -#define ACPI_USE_NATIVE_MATH64 - -/* GCC did not support __has_attribute until 5.1. */ - -#ifndef __has_attribute -#define __has_attribute(x) 0 -#endif - -/* - * Explicitly mark intentional explicit fallthrough to silence - * -Wimplicit-fallthrough in GCC 7.1+. - */ - -#if __has_attribute(__fallthrough__) -#define ACPI_FALLTHROUGH __attribute__((__fallthrough__)) -#endif - -/* - * Flexible array members are not allowed to be part of a union under - * C99, but this is not for any technical reason. Work around the - * limitation. - */ -#ifndef __cplusplus -#define ACPI_FLEX_ARRAY(TYPE, NAME) \ - struct { \ - struct { } __Empty_ ## NAME; \ - TYPE NAME[]; \ - } -#endif - -/* - * Explicitly mark strings that lack a terminating NUL character so - * that ACPICA can be built with -Wunterminated-string-initialization. - */ -#if __has_attribute(__nonstring__) -#define ACPI_NONSTRING __attribute__((__nonstring__)) -#endif - -#endif /* __ACGCC_H__ */ diff --git a/drivers/include/acpica/platform/acgccex.h b/drivers/include/acpica/platform/acgccex.h deleted file mode 100644 index bb3b55c..0000000 --- a/drivers/include/acpica/platform/acgccex.h +++ /dev/null @@ -1,166 +0,0 @@ -/****************************************************************************** - * - * Name: acgccex.h - Extra GCC specific defines, etc. - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#ifndef __ACGCCEX_H__ -#define __ACGCCEX_H__ - -/* - * Some versions of gcc implement strchr() with a buggy macro. So, - * undef it here. Prevents error messages of this form (usually from the - * file getopt.c): - * - * error: logical '&&' with non-zero constant will always evaluate as true - */ -#ifdef strchr -#undef strchr -#endif - -#endif /* __ACGCCEX_H__ */ diff --git a/drivers/include/acpica/platform/acmodulos.h b/drivers/include/acpica/platform/acmodulos.h deleted file mode 100644 index 3902e70..0000000 --- a/drivers/include/acpica/platform/acmodulos.h +++ /dev/null @@ -1,234 +0,0 @@ -/****************************************************************************** - * - * Name: acmodulos.h - ModulOS platform specific interface - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -/* Copyright (C) 2025-2026 Ebrahim Aleem -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see -*/ - -#ifndef DRIVERS_ACPICA_PLATFORM_ACMODULOS_H -#define DRIVERS_ACPICA_PLATFORM_ACMODULOS_H - -#include -#include -#include - -#include - -#ifdef ACPI_USE_STANDARD_HEADERS -#undef ACPI_USE_STANDARD_HEADERS -#endif /* ACPI_USE_STANDARD_HEADERS */ - -#define ACPI_USE_LOCAL_CACHE -#define ACPI_USE_DO_WHILE_0 - -#ifndef ACPI_INLINE -#define ACPI_INLINE static inline -#endif /* ACPI_INLINE */ - -#ifndef ACPI_UNUSED_VAR -#define ACPI_UNUSED_VAR -#endif /* ACPI_UNUSED_VAR */ - -#define ACPI_MSG_ERROR "ERROR: ACPICA: " -#define ACPI_MSG_WARNING "WARNING: ACPICA: " -#define ACPI_MSG_INFO "INFO: ACPICA: " -#define ACPI_MSG_DEBUG "DEBUG: ACPICA: " - -#define ACPI_USE_NATIVE_MATH64 - -#define ACPI_CPU_FLAGS uint64_t - -#define ACPI_UINTPTR_T uintptr_t -#define ACPI_TO_INTEGER(p) ((uintptr_t)(p)) - -#define ACPI_MACHINE_WIDTH 64 -#define COMPILER_DEPENDENT_INT64 int64_t -#define COMPILER_DEPENDENT_UINT64 uint64_t - -#define ACPI_USE_NATIVE_DIVIDE -#define ACPI_USE_NATIVE_MATH64 - -static uint8_t _stub(void) { - return 0; -} - -#define ACPI_FLUSH_CPU_CACHE() cpu_wbinvd(); - -#define ACPI_ACQUIRE_GLOBAL_LOCK(facsPtr, acc) acc = _stub() //TODO: sync -#define ACPI_RELEASE_GLOBAL_LOCK(facsPtr, pen) pen = _stub() - -#define ACPI_DIV_64_BY_32(n, n_hi, n_lo, d32, q32, r32) \ - do { \ - q32 = n / d32; \ - r32 = n % d32; \ - } while (0) - -#define ACPI_SHIFT_RIGHT_64(n, n_hi, n_lo) \ - do { \ - n >>= 1; \ - } while (0) - -#define ACPI_SEMAPHORE uint64_t* -#define ACPI_SPINLOCK uint8_t* - -#endif /* DRIVERS_ACPICA_PLATFORM_ACMODULOS_H */ diff --git a/drivers/include/acpica_osl/acpica_include.h b/drivers/include/acpica_osl/acpica_include.h deleted file mode 100644 index 08ebe1f..0000000 --- a/drivers/include/acpica_osl/acpica_include.h +++ /dev/null @@ -1,47 +0,0 @@ -/* acpica_include.h - ACPICA Subsystem include wrapper for clang */ -/* Copyright (C) 2025-2026 Ebrahim Aleem -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY without even the implied warranty of { -* } -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see -*/ - -#ifndef DRIVERS_ACPICA_OSL_ACPICA_INCLUDE -#define DRIVERS_ACPICA_OSL_ACPICA_INCLUDE -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wall" -#pragma clang diagnostic ignored "-Wextra" -#pragma clang diagnostic ignored "-pedantic" -#pragma clang diagnostic ignored "-Wshadow" -#pragma clang diagnostic ignored "-Wpointer-arith" -#pragma clang diagnostic ignored "-Wwrite-strings" -#pragma clang diagnostic ignored "-Wmissing-prototypes" -#pragma clang diagnostic ignored "-Wmissing-declarations" -#pragma clang diagnostic ignored "-Wredundant-decls" -#pragma clang diagnostic ignored "-Wnested-externs" -#pragma clang diagnostic ignored "-Winline" -#pragma clang diagnostic ignored "-Wconversion" -#pragma clang diagnostic ignored "-Wstrict-prototypes" -#pragma clang diagnostic ignored "-Wunused-parameter" -#pragma clang diagnostic ignored "-Wduplicate-decl-specifier" -#pragma clang diagnostic ignored "-Wzero-length-array" -#pragma clang diagnostic ignored "-Wflexible-array-extensions" -#pragma clang diagnostic ignored "-Wincompatible-pointer-types-discards-qualifiers" -#pragma clang diagnostic ignored "-Wunused-parameter" -#pragma clang diagnostic ignored "-Wint-conversion" -#include -#include -#pragma clang diagnostic pop - -#endif - /* DRIVERS_ACPICA_OSL_ACPICA_INCLUDE */ diff --git a/drivers/include/acpica_osl/osl.h b/drivers/include/acpica_osl/osl.h deleted file mode 100644 index 3925a4e..0000000 --- a/drivers/include/acpica_osl/osl.h +++ /dev/null @@ -1,21 +0,0 @@ -/* osl.h - ACPICA Modulos OSL interface */ -/* Copyright (C) 2025-2026 Ebrahim Aleem -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see -*/ - -#ifndef DRIVERS_ACPICA_OSL_OSL_H -#define DRIVERS_ACPICA_OSL_OSL_H - -#endif /* DRIVERS_ACPICA_OSL_OSL_H */ diff --git a/drivers/pcie/pcie_init.c b/drivers/pcie/pcie_init.c index ce4a954..7db9e35 100644 --- a/drivers/pcie/pcie_init.c +++ b/drivers/pcie/pcie_init.c @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include diff --git a/kernel/Makefile b/kernel/Makefile index ad1fca9..c95b483 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -21,6 +21,10 @@ OBJ_DIR := $(OBJ_DIR)/kernel $(call add_directory,core,CORE) $(call add_directory,lib,LIB) +$(call add_directory,apic,APIC) +$(call add_directory,ioapic,IOAPIC) +$(call add_directory,pic_8259,PIC_8259) +$(call add_directory,acpi,ACPI) ifdef BUILD_KERNEL_GRAPHICSBASE $(call add_directory,graphicsbase,GRAPHICSBASE) diff --git a/drivers/acpi/sci.S b/kernel/acpi/sci.S similarity index 100% rename from drivers/acpi/sci.S rename to kernel/acpi/sci.S diff --git a/drivers/acpi/sci_dispatch.c b/kernel/acpi/sci_dispatch.c similarity index 96% rename from drivers/acpi/sci_dispatch.c rename to kernel/acpi/sci_dispatch.c index 32cb4c0..1353df8 100644 --- a/drivers/acpi/sci_dispatch.c +++ b/kernel/acpi/sci_dispatch.c @@ -17,7 +17,7 @@ #include -#include +#include void acpi_sci_dispatch(void) { logging_log_warning("Got SCI. No ISR implemented. Ignoring interrupt"); diff --git a/drivers/acpi/tables.c b/kernel/acpi/tables.c similarity index 97% rename from drivers/acpi/tables.c rename to kernel/acpi/tables.c index 376701f..6689a8e 100644 --- a/drivers/acpi/tables.c +++ b/kernel/acpi/tables.c @@ -19,16 +19,16 @@ #include -#include -#include -#include -#include -#include -#include - -#include -#include -#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include #define V1_TABLE_SIZE 20 diff --git a/drivers/apic/apic_init.c b/kernel/apic/apic_init.c similarity index 95% rename from drivers/apic/apic_init.c rename to kernel/apic/apic_init.c index d337450..6d160cd 100644 --- a/drivers/apic/apic_init.c +++ b/kernel/apic/apic_init.c @@ -23,23 +23,23 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include #define APIC_BASE_MASK 0xFFFFFFFFFF000 diff --git a/drivers/apic/apic_regs.c b/kernel/apic/apic_regs.c similarity index 100% rename from drivers/apic/apic_regs.c rename to kernel/apic/apic_regs.c diff --git a/drivers/apic/ipi.c b/kernel/apic/ipi.c similarity index 95% rename from drivers/apic/ipi.c rename to kernel/apic/ipi.c index 1b18e54..68dd5e8 100644 --- a/drivers/apic/ipi.c +++ b/kernel/apic/ipi.c @@ -21,13 +21,13 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include -#include +#include #define ICR_LEVEL 0x8000u #define ICR_ASSERT 0x4000u diff --git a/drivers/apic/isr.S b/kernel/apic/isr.S similarity index 100% rename from drivers/apic/isr.S rename to kernel/apic/isr.S diff --git a/drivers/apic/isr_dispatch.c b/kernel/apic/isr_dispatch.c similarity index 96% rename from drivers/apic/isr_dispatch.c rename to kernel/apic/isr_dispatch.c index eb2d63c..e80fde0 100644 --- a/drivers/apic/isr_dispatch.c +++ b/kernel/apic/isr_dispatch.c @@ -20,9 +20,9 @@ #include #include -#include +#include -#include +#include #define ESR_IRA 0x80 #define ESR_RIV 0x40 diff --git a/kernel/core/cpu_instr.S b/kernel/core/cpu_instr.S index 4f2c763..c1c2df3 100644 --- a/kernel/core/cpu_instr.S +++ b/kernel/core/cpu_instr.S @@ -59,7 +59,6 @@ jmp cpu_halt_loop .globl cpu_trap cpu_trap: -// setting a breakpoint here will catch traps ret .globl cpu_read_cr2 @@ -71,3 +70,13 @@ ret cpu_wbinvd: wbinvd ret + +.globl cpu_get_cr3 +cpu_get_cr3: +movq %cr3, %rax +ret + +.globl cpu_set_cr3 +cpu_set_cr3: +movq %rdi, %cr3 +ret diff --git a/kernel/elf/elf.c b/kernel/core/elf.c similarity index 55% rename from kernel/elf/elf.c rename to kernel/core/elf.c index 152580d..53a008c 100644 --- a/kernel/elf/elf.c +++ b/kernel/core/elf.c @@ -17,11 +17,15 @@ #include -#include - +#include #include #include #include +#include +#include +#include +#include +#include #include @@ -42,6 +46,8 @@ #define ET_EXEC 2 +#define EM_X86_64 62 + #define SHT_NULL 0 #define SHT_PROGBITS 1 @@ -61,6 +67,9 @@ #define PF_W 2 #define PF_R 4 +#define INIT_USERLAND_RFL 0x200 +#define INIT_USERLAND_RSP 0x800000000000 + typedef uint64_t Elf64_Addr; typedef uint64_t Elf64_Off; typedef uint16_t Elf64_Half; @@ -118,15 +127,87 @@ _Static_assert(sizeof(Elf64_Phdr) == 56, "Bad ELF program header size"); static const uint8_t elf_magic[4] = {0x7f, 'E', 'L', 'F'}; +static uint8_t check_valid(struct fs_handle_t* file, Elf64_Ehdr* header) { + return + fs_seek(file, 0) != FILE_OK || /* file ok seek */ + fs_read(file, header, sizeof(*header)) != sizeof(*header) || /* file ok read */ + kmemcmp(elf_magic, &header->e_ident[EI_MAG0], sizeof(elf_magic)) || /* magic */ + header->e_ident[EI_CLASS] != ELFCLASS64 || /* 64 bit */ + header->e_ident[EI_DATA] != ELFDATA2LSB || /* little endian */ + header->e_ident[EI_OSABI] != ELFOSABI_SYSV || /* sys V */ + header->e_type != ET_EXEC || /* executable */ + header->e_machine != EM_X86_64; /* amd64 */ +} + uint8_t elf_is_elf(struct fs_handle_t* file) { Elf64_Ehdr header; - return - fs_seek(file, 0) == FILE_OK && /* file ok seek */ - fs_read(file, &header, sizeof(header)) == sizeof(header) && /* file ok read */ - !kmemcmp(elf_magic, &header.e_ident[EI_MAG0], sizeof(elf_magic)) && /* magic */ - header.e_ident[EI_CLASS] == ELFCLASS64 && /* 64 bit */ - header.e_ident[EI_DATA] == ELFDATA2LSB && /* little endian */ - header.e_ident[EI_OSABI] == ELFOSABI_SYSV && /* sys V */ - header.e_type == ET_EXEC; /* executable */ + return check_valid(file, &header); +} + +struct pcb_t* elf_load(struct fs_handle_t* file, uint64_t pid) { + Elf64_Ehdr header; + uint64_t stack_paddr, stack_vaddr, rsp; + + if (check_valid(file, &header)) { + return 0; + } + + if (process_create_guarded_stack(&stack_vaddr, &stack_paddr, &rsp)) { + logging_log_error("Failed to allocate stack"); + return 0; + } + + struct pcb_t* pcb = kmalloc(sizeof(struct pcb_t)); + + pcb->rax = + pcb->rbx = + pcb->rcx = + //pcb->rdx = (parameter passing) + pcb->rbp = + //pcb->rsi = (parameter passing) + //pcb->rdi = (parameter passing) + pcb->r8 = + pcb->r9 = + pcb->r10 = + pcb->r11 = + pcb->r12 = + pcb->r13 = + pcb->r14 = + pcb->r15 = 0; + + + pcb->saved_usr_rsp = INIT_USERLAND_RSP; + + pcb->init_k_rsp_paddr = stack_paddr; + pcb->init_k_rsp_vaddr = stack_vaddr; + pcb->rsp = rsp; + + pcb->k_rsp_lo = rsp & 0xFFFFFFFF; + pcb->k_rsp_hi = rsp >> 32; + + pcb->rflags = INIT_USERLAND_RFL; + + pcb->rdi = header.e_entry; // rip + pcb->rsi = INIT_USERLAND_RFL; // rflags + pcb->rdx = pcb->saved_usr_rsp; // rsp + + pcb->rip = (uint64_t)syscall_return; + pcb->cs = GDT_KERNEL_CS; + pcb->ss = GDT_KERNEL_SS; + + pcb->sched_cntr = SCHED_READY; + pcb->pid = pid; + + pcb->cr3 = paging_create_pml4(); + if (!pcb->cr3) { + logging_log_error("Failed to create pml4 for process"); + kfree(pcb); + return 0; + } + + //TODO: initialize pages and copy data and setup stack + + + return pcb; } diff --git a/kernel/core/kentry.c b/kernel/core/kentry.c index c821d03..6e23772 100644 --- a/kernel/core/kentry.c +++ b/kernel/core/kentry.c @@ -38,12 +38,14 @@ #include #endif /* MEM_TEST */ -#include -#include -#include -#include -#include -#include +#include +#include +#include + +#include + +#include + #include #include @@ -74,6 +76,7 @@ void kentry(void) { tss_init((void*)paging_ident((uint64_t)boot_context.gdt)); process_init(init_stack_vaddr, init_stack_paddr); idt_init(); + paging_ensure_mapped(); scheduler_init(); logging_log_debug("TSS and IDT init done"); @@ -103,10 +106,6 @@ void kentry(void) { pcie_enumerate(); logging_log_debug("Early PCIE init done"); - logging_log_debug("ACPICA init"); - acpica_init(); - logging_log_debug("ACPICA init done"); - logging_log_info("Boot Complete ModulOS"); logging_log_info("Begining AP bootstrap sequence"); diff --git a/kernel/core/paging.c b/kernel/core/paging.c index cfac405..1cdf16d 100644 --- a/kernel/core/paging.c +++ b/kernel/core/paging.c @@ -28,7 +28,7 @@ #include -#include +#include #define PAGE_PS 0x80 @@ -42,13 +42,16 @@ #define AVL_GUARD 0x800 +#define PML4_CONSISTENT_START 256 +#define PML4_CONSISTENT_END 512 + extern uint64_t kernel_pml4[512]; static uint8_t paging_lock; -static enum page_size_t page_walk(uint64_t vaddr, uint64_t** access) { +static enum page_size_t page_walk(uint64_t vaddr, uint64_t** access, uint64_t* pml4) { uint64_t entry; - *access = (uint64_t*)paging_ident((uint64_t)&kernel_pml4[0]); + *access = (uint64_t*)paging_ident((uint64_t)pml4); entry = (*access)[GET_PML4_INDEX(vaddr)]; *access = &(*access)[GET_PML4_INDEX(vaddr)]; @@ -85,13 +88,13 @@ static enum page_size_t page_walk(uint64_t vaddr, uint64_t** access) { static uint64_t* increase_granularity(uint64_t vaddr, uint64_t* access, enum page_size_t lvl, enum page_size_t page_size) { for (; lvl > page_size; lvl--) { - *access = mm_alloc_p(0x1000); + *access = mm_alloc_p(PAGE_SIZE_4K); if (!access) { return 0; } *access |= PAGE_PRESENT | PAGE_RW; access = (uint64_t*)paging_ident((*access & PAGE_ADDR_MASK)); - kmemset(access, 0, 0x1000); + kmemset(access, 0, PAGE_SIZE_4K); switch (lvl) { case _PAGE_512G: @@ -113,17 +116,42 @@ void paging_init(void) { lock_init(&paging_lock); } -uint64_t paging_map(uint64_t vaddr, uint64_t paddr, uint16_t flg, enum page_size_t page_size) { +void paging_ensure_mapped(void) { + uint64_t addr; + + for (uint16_t i = PML4_CONSISTENT_START; i < PML4_CONSISTENT_END; i++) { + if (kernel_pml4[i] & PAGE_PRESENT) { + continue; + } + + addr = mm_alloc_p(PAGE_SIZE_4K); + + if (!addr) { + logging_log_error("Failed to map consistency page"); + panic(PANIC_NO_MEM); + } + + kernel_pml4[i] = addr | PAGE_PRESENT; + + addr = paging_ident(addr); + kmemset((void*)addr, 0, PAGE_SIZE_4K); + } +} + +uint64_t paging_map_proc(uint64_t vaddr, uint64_t paddr, uint16_t flg, enum page_size_t page_size, uint64_t* pml4) { uint64_t* access; - enum page_size_t lvl = page_walk(vaddr, &access); + lock_acquire(&paging_lock); + enum page_size_t lvl = page_walk(vaddr, &access, pml4); if (lvl < page_size) { + lock_release(&paging_lock); logging_log_error("Cannot override page of finer granularity from 0x%lx-0x%lx (%u) to 0x%lx-0x%lx (%u)", vaddr, *access - IDENT_BASE, (uint32_t)lvl, vaddr, paddr | flg, (uint32_t)page_size); return *access - IDENT_BASE; } if (*access & PAGE_PRESENT) { + lock_release(&paging_lock); logging_log_error("Cannot override page from 0x%lx-0x%lx (%u) to 0x%lx-0x%lx (%u)", vaddr, *access, (uint32_t)lvl, vaddr, paddr | flg, (uint32_t)page_size); return *access; @@ -131,6 +159,7 @@ uint64_t paging_map(uint64_t vaddr, uint64_t paddr, uint16_t flg, enum page_size access = increase_granularity(vaddr, access, lvl, page_size); if (!access) { + lock_release(&paging_lock); return 0; } @@ -139,20 +168,28 @@ uint64_t paging_map(uint64_t vaddr, uint64_t paddr, uint16_t flg, enum page_size } *access = paddr | flg; + lock_release(&paging_lock); return paddr; } +uint64_t paging_map(uint64_t vaddr, uint64_t paddr, uint16_t flg, enum page_size_t page_size) { + return paging_map_proc(vaddr, paddr, flg, page_size, kernel_pml4); +} + void paging_unmap(uint64_t vaddr, enum page_size_t page_size) { uint64_t* access; - enum page_size_t lvl = page_walk(vaddr, &access); + lock_acquire(&paging_lock); + enum page_size_t lvl = page_walk(vaddr, &access, kernel_pml4); if (lvl != page_size) { + lock_release(&paging_lock); logging_log_error("Cannot unmap page of different granularity"); return; } *access = 0; + lock_release(&paging_lock); apic_tlb_shootdown(vaddr); } @@ -163,7 +200,7 @@ uint64_t paging_ident(uint64_t paddr) { void paging_install_guard(uint64_t vaddr) { uint64_t* access; lock_acquire(&paging_lock); - enum page_size_t lvl = page_walk(vaddr, &access); + enum page_size_t lvl = page_walk(vaddr, &access, kernel_pml4); if (*access & PAGE_PRESENT) { logging_log_error("Cannot install page guard over mapped page"); @@ -183,7 +220,7 @@ void paging_install_guard(uint64_t vaddr) { void paging_remove_guard(uint64_t vaddr) { uint64_t* access; lock_acquire(&paging_lock); - enum page_size_t lvl = page_walk(vaddr, &access); + enum page_size_t lvl = page_walk(vaddr, &access, kernel_pml4); if (lvl != PAGE_4K || !(*access & AVL_GUARD)) { logging_log_error("Attempted to remove guard from ungaurded page @ 0x%x", vaddr); @@ -196,10 +233,31 @@ void paging_remove_guard(uint64_t vaddr) { uint8_t paging_check_guard(uint64_t vaddr) { uint64_t* access, access_value; lock_acquire(&paging_lock); - enum page_size_t lvl = page_walk(vaddr, &access); + enum page_size_t lvl = page_walk(vaddr, &access, kernel_pml4); access_value = *access; lock_release(&paging_lock); return lvl == PAGE_4K && (access_value & AVL_GUARD); } + +uint64_t paging_create_pml4(void) { + uint64_t* access; + uint64_t pml4 = mm_alloc_p(PAGE_SIZE_4K); + uint16_t i; + + if (!pml4) { + return 0; + } + + access = (uint64_t*)paging_ident(pml4); + + kmemset(access, 0, PAGE_SIZE_4K); + + // copy upper half top level pages + for (i = PML4_CONSISTENT_START; i < PML4_CONSISTENT_END; i++) { + access[i] = kernel_pml4[i]; + } + + return pml4; +} diff --git a/kernel/core/process.c b/kernel/core/process.c index e9414be..fca2005 100644 --- a/kernel/core/process.c +++ b/kernel/core/process.c @@ -29,7 +29,9 @@ #include #include -#include +#include + +#include #define INIT_RFLG 0x200 #define INIT_STACK_SIZE 0x4000 @@ -39,6 +41,8 @@ static uint64_t next_pid; static uint8_t lock_proc; +extern uint8_t kernel_pml4; + __attribute__((noreturn)) static void function_setup(process_function_t func, void* cntx) { func(cntx); process_kill_current(); @@ -63,8 +67,8 @@ uint64_t process_get_pid(void) { void process_init_ap(uint64_t init_rsp_vaddr, uint64_t init_rsp_paddr) { struct pcb_t* pcb = kmalloc(sizeof(struct pcb_t)); - pcb->init_rsp_vaddr = init_rsp_vaddr; - pcb->init_rsp_paddr = init_rsp_paddr; + pcb->init_k_rsp_vaddr = init_rsp_vaddr; + pcb->init_k_rsp_paddr = init_rsp_paddr; pcb->init_k_rsp_vaddr = pcb->init_k_rsp_paddr = 0; pcb->sched_cntr = SCHED_SKIP; @@ -73,32 +77,14 @@ void process_init_ap(uint64_t init_rsp_vaddr, uint64_t init_rsp_paddr) { } struct pcb_t* process_from_vaddr(uint64_t vaddr) { + uint64_t stack_paddr, stack_vaddr, rsp; struct pcb_t* pcb; - uint64_t stack_vaddr; - uint64_t stack_paddr; - stack_vaddr = mm_alloc_v(INIT_STACK_SIZE + PAGE_SIZE_4K); // extra guard page - if (!stack_vaddr) { + if (process_create_guarded_stack(&stack_vaddr, &stack_paddr, &rsp)) { logging_log_error("Failed to allocate stack"); - panic(PANIC_NO_MEM); + return 0; } - stack_paddr = mm_alloc_p(INIT_STACK_SIZE); - if (!stack_paddr) { - mm_free_v(stack_vaddr, INIT_STACK_SIZE + PAGE_SIZE_4K); - logging_log_error("Failed to allocate stack"); - panic(PANIC_NO_MEM); - } - - _Static_assert(INIT_STACK_SIZE == 4 * PAGE_SIZE_4K, "stack size must be page size multiple of four"); - // add for increased stack size - paging_map(stack_vaddr + 1 * PAGE_SIZE_4K, stack_paddr + 0 * PAGE_SIZE_4K, PAGE_PRESENT | PAGE_RW, PAGE_4K); - paging_map(stack_vaddr + 2 * PAGE_SIZE_4K, stack_paddr + 1 * PAGE_SIZE_4K, PAGE_PRESENT | PAGE_RW, PAGE_4K); - paging_map(stack_vaddr + 3 * PAGE_SIZE_4K, stack_paddr + 2 * PAGE_SIZE_4K, PAGE_PRESENT | PAGE_RW, PAGE_4K); - paging_map(stack_vaddr + 4 * PAGE_SIZE_4K, stack_paddr + 3 * PAGE_SIZE_4K, PAGE_PRESENT | PAGE_RW, PAGE_4K); - // leave last page unmapped as guard - paging_install_guard(stack_vaddr); - pcb = kmalloc(sizeof(struct pcb_t)); pcb->rax = @@ -117,12 +103,11 @@ struct pcb_t* process_from_vaddr(uint64_t vaddr) { pcb->r14 = pcb->r15 = 0; - pcb->rsp = stack_vaddr + PAGE_SIZE_4K * 5; - pcb->init_rsp_vaddr = stack_vaddr; - pcb->init_rsp_paddr = stack_paddr; + pcb->rsp = rsp; + pcb->init_k_rsp_vaddr = stack_vaddr; + pcb->init_k_rsp_paddr = stack_paddr; - pcb->init_k_rsp_vaddr = - pcb->init_k_rsp_paddr = 0; + pcb->saved_usr_rsp = 0; pcb->k_rsp_lo = 0; pcb->k_rsp_hi = 0; @@ -134,6 +119,8 @@ struct pcb_t* process_from_vaddr(uint64_t vaddr) { pcb->sched_cntr = SCHED_READY; + pcb->cr3 = (uint64_t)&kernel_pml4; + pcb->pid = assign_pid(); return pcb; @@ -152,7 +139,6 @@ void process_kill_current(void) { lock_acquire(&lock_proc); struct pcb_t* pcb = proc_data_get()->current_process; pcb->sched_cntr = SCHED_KILL; - logging_log_debug("Killed %ld", pcb->pid); lock_release(&lock_proc); cpu_wait_loop(); @@ -160,14 +146,18 @@ void process_kill_current(void) { void process_discard(struct pcb_t* pcb) { _Static_assert(INIT_STACK_SIZE == 4 * PAGE_SIZE_4K, "stack size must be page size multiple of four"); - paging_unmap(pcb->init_rsp_vaddr + 1 * PAGE_SIZE_4K, PAGE_4K); - paging_unmap(pcb->init_rsp_vaddr + 2 * PAGE_SIZE_4K, PAGE_4K); - paging_unmap(pcb->init_rsp_vaddr + 3 * PAGE_SIZE_4K, PAGE_4K); - paging_unmap(pcb->init_rsp_vaddr + 4 * PAGE_SIZE_4K, PAGE_4K); - paging_remove_guard(pcb->init_rsp_vaddr); + paging_unmap(pcb->init_k_rsp_vaddr + 1 * PAGE_SIZE_4K, PAGE_4K); + paging_unmap(pcb->init_k_rsp_vaddr + 2 * PAGE_SIZE_4K, PAGE_4K); + paging_unmap(pcb->init_k_rsp_vaddr + 3 * PAGE_SIZE_4K, PAGE_4K); + paging_unmap(pcb->init_k_rsp_vaddr + 4 * PAGE_SIZE_4K, PAGE_4K); + paging_remove_guard(pcb->init_k_rsp_vaddr); + + mm_free_v(pcb->init_k_rsp_vaddr, INIT_STACK_SIZE + PAGE_SIZE_4K); + mm_free_p(pcb->init_k_rsp_paddr, INIT_STACK_SIZE); - mm_free_v(pcb->init_rsp_vaddr, INIT_STACK_SIZE + PAGE_SIZE_4K); - mm_free_p(pcb->init_rsp_paddr, INIT_STACK_SIZE); + //TODO: reap lower pml4 mapped pages + + logging_log_debug("Killed %ld", pcb->pid); kfree(pcb); } @@ -197,3 +187,36 @@ void process_preempt_entry(struct preempt_frame_t* context) { scheduler_run(); } + +uint8_t process_create_guarded_stack(uint64_t* init_vaddr, uint64_t* init_paddr, uint64_t* stack) { + uint64_t stack_vaddr; + uint64_t stack_paddr; + + stack_vaddr = mm_alloc_v(INIT_STACK_SIZE + PAGE_SIZE_4K); // extra guard page + if (!stack_vaddr) { + return 0; + } + + stack_paddr = mm_alloc_p(INIT_STACK_SIZE); + if (!stack_paddr) { + mm_free_v(stack_vaddr, INIT_STACK_SIZE + PAGE_SIZE_4K); + return 0; + } + + _Static_assert(INIT_STACK_SIZE == 4 * PAGE_SIZE_4K, "stack size must be four pages (16KiB)"); + // add for increased stack size + paging_map(stack_vaddr + 1 * PAGE_SIZE_4K, stack_paddr + 0 * PAGE_SIZE_4K, PAGE_PRESENT | PAGE_RW, PAGE_4K); + paging_map(stack_vaddr + 2 * PAGE_SIZE_4K, stack_paddr + 1 * PAGE_SIZE_4K, PAGE_PRESENT | PAGE_RW, PAGE_4K); + paging_map(stack_vaddr + 3 * PAGE_SIZE_4K, stack_paddr + 2 * PAGE_SIZE_4K, PAGE_PRESENT | PAGE_RW, PAGE_4K); + paging_map(stack_vaddr + 4 * PAGE_SIZE_4K, stack_paddr + 3 * PAGE_SIZE_4K, PAGE_PRESENT | PAGE_RW, PAGE_4K); + // leave last page unmapped as guard + paging_install_guard(stack_vaddr); + + kmemset((uint8_t*)stack_vaddr + 1 * PAGE_SIZE_4K, 0, 4 * PAGE_SIZE_4K); + + *init_vaddr = stack_vaddr; + *init_paddr = stack_paddr; + *stack = stack_vaddr + PAGE_SIZE_4K * 5; + + return 1; +} diff --git a/kernel/core/scheduler.c b/kernel/core/scheduler.c index e0da3d8..6e2847a 100644 --- a/kernel/core/scheduler.c +++ b/kernel/core/scheduler.c @@ -25,7 +25,7 @@ #include #include -#include +#include static uint8_t lock_sched; static volatile struct pcb_t* active_queue; @@ -91,5 +91,7 @@ void scheduler_run(void) { cpu_cli(); apic_write_reg(APIC_REG_EOI, APIC_EOI); + + cpu_set_cr3(run->cr3); process_resume(run); } diff --git a/kernel/lib/kmemset.S b/kernel/core/syscall.S similarity index 77% rename from kernel/lib/kmemset.S rename to kernel/core/syscall.S index 964f410..b1aa77e 100644 --- a/kernel/lib/kmemset.S +++ b/kernel/core/syscall.S @@ -1,5 +1,5 @@ -/* kmemset.S - library memset routines */ -/* Copyright (C) 2025-2026 Ebrahim Aleem +/* process.S - kernel system call */ +/* Copyright (C) 2026 Ebrahim Aleem * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,13 +15,10 @@ * along with this program. If not, see */ -.section .text +.globl syscall_return +syscall_return: +movq %rdi, %rcx // rip +movq %rsi, %r11 // rflags +movq %rdx, %rsp // rsp -.globl kmemset -kmemset: -pushq %rdi -movq %rsi, %rax -movq %rdx, %rcx -rep stosb -popq %rax -ret +sysret diff --git a/drivers/include/acpi/sci.h b/kernel/include/acpi/sci.h similarity index 89% rename from drivers/include/acpi/sci.h rename to kernel/include/acpi/sci.h index e01f76d..c6f463f 100644 --- a/drivers/include/acpi/sci.h +++ b/kernel/include/acpi/sci.h @@ -15,9 +15,9 @@ * along with this program. If not, see */ -#ifndef DRIVERS_ACPI_SCI_H -#define DRIVERS_ACPI_SCI_H +#ifndef KERNEL_ACPI_SCI_H +#define KERNEL_ACPI_SCI_H extern void sci_isr(void); -#endif /* DRIVERS_ACPI_SCI_H */ +#endif /* KERNEL_ACPI_SCI_H */ diff --git a/drivers/include/acpi/sci_dispatch.h b/kernel/include/acpi/sci_dispatch.h similarity index 87% rename from drivers/include/acpi/sci_dispatch.h rename to kernel/include/acpi/sci_dispatch.h index 0f157e4..11af118 100644 --- a/drivers/include/acpi/sci_dispatch.h +++ b/kernel/include/acpi/sci_dispatch.h @@ -15,9 +15,9 @@ * along with this program. If not, see */ -#ifndef DRIVERS_ACPI_SCI_DISPATCH_H -#define DRIVERS_ACPI_SCI_DISPATCH_H +#ifndef KERNEL_ACPI_SCI_DISPATCH_H +#define KERNEL_ACPI_SCI_DISPATCH_H extern void acpi_sci_dispatch(void); -#endif /* DRIVERS_ACPI_SCI_DISPATCH_H */ +#endif /* KERNEL_ACPI_SCI_DISPATCH_H */ diff --git a/drivers/include/acpi/tables.h b/kernel/include/acpi/tables.h similarity index 97% rename from drivers/include/acpi/tables.h rename to kernel/include/acpi/tables.h index 15f72e4..a1e4449 100644 --- a/drivers/include/acpi/tables.h +++ b/kernel/include/acpi/tables.h @@ -15,8 +15,8 @@ * along with this program. If not, see */ -#ifndef DRIVERS_ACPI_TABLES_H -#define DRIVERS_ACPI_TABLES_H +#ifndef KERNEL_ACPI_TABLES_H +#define KERNEL_ACPI_TABLES_H #include @@ -122,4 +122,4 @@ extern uint16_t acpi_get_sci_int(void); extern void acpi_get_hpet_bases(uint64_t* bases); #endif /* HPET */ -#endif /* DRIVERS_ACPI_TABLES_H */ +#endif /* KERNEL_ACPI_TABLES_H */ diff --git a/drivers/include/apic/apic_init.h b/kernel/include/apic/apic_init.h similarity index 90% rename from drivers/include/apic/apic_init.h rename to kernel/include/apic/apic_init.h index ad77bdd..2146ba7 100644 --- a/drivers/include/apic/apic_init.h +++ b/kernel/include/apic/apic_init.h @@ -15,8 +15,8 @@ * along with this program. If not, see */ -#ifndef DRIVERS_APIC_APIC_INIT_H -#define DRIVERS_APIC_APIC_INIT_H +#ifndef KERNEL_APIC_APIC_INIT_H +#define KERNEL_APIC_APIC_INIT_H #include @@ -34,4 +34,4 @@ extern uint8_t apic_get_bsp_id(void); extern void apic_start_ap(void); -#endif /* DRIVERS_APIC_APIC_INIT_H */ +#endif /* KERNEL_APIC_APIC_INIT_H */ diff --git a/drivers/include/apic/apic_regs.h b/kernel/include/apic/apic_regs.h similarity index 95% rename from drivers/include/apic/apic_regs.h rename to kernel/include/apic/apic_regs.h index e5524b0..31cd960 100644 --- a/drivers/include/apic/apic_regs.h +++ b/kernel/include/apic/apic_regs.h @@ -15,8 +15,8 @@ * along with this program. If not, see */ -#ifndef DRIVERS_APIC_APIC_REGS_H -#define DRIVERS_APIC_APIC_REGS_H +#ifndef KERNEL_APIC_APIC_REGS_H +#define KERNEL_APIC_APIC_REGS_H #include @@ -50,4 +50,4 @@ extern uint32_t apic_read_reg(enum apic_reg_t reg); extern void apic_write_lve(enum apic_reg_t reg, uint8_t v, uint8_t flg, uint8_t msk); -#endif /* DRIVERS_APIC_APIC_REGS_H */ +#endif /* KERNEL_APIC_APIC_REGS_H */ diff --git a/drivers/include/apic/ipi.h b/kernel/include/apic/ipi.h similarity index 93% rename from drivers/include/apic/ipi.h rename to kernel/include/apic/ipi.h index 6d6e99e..fc7ca22 100644 --- a/drivers/include/apic/ipi.h +++ b/kernel/include/apic/ipi.h @@ -15,8 +15,8 @@ * along with this program. If not, see */ -#ifndef DRIVERS_APIC_IPI_H -#define DRIVERS_APIC_IPI_H +#ifndef KERNEL_APIC_IPI_H +#define KERNEL_APIC_IPI_H #include @@ -35,4 +35,4 @@ extern void apic_tlb_shootdown_dispatch(void); extern void apic_register_barrier(uint8_t apic_id); -#endif /* DRIVERS_APIC_IPI_H */ +#endif /* KERNEL_APIC_IPI_H */ diff --git a/drivers/include/apic/isr.h b/kernel/include/apic/isr.h similarity index 90% rename from drivers/include/apic/isr.h rename to kernel/include/apic/isr.h index 9701eaf..38dca65 100644 --- a/drivers/include/apic/isr.h +++ b/kernel/include/apic/isr.h @@ -15,8 +15,8 @@ * along with this program. If not, see */ -#ifndef DRIVERS_APIC_ISR_H -#define DRIVERS_APIC_ISR_H +#ifndef KERNEL_APIC_ISR_H +#define KERNEL_APIC_ISR_H extern void apic_isr_timer(void) __attribute__((noreturn)); @@ -24,4 +24,4 @@ extern void apic_isr_error(void); extern void apic_isr_tlb_shootdown(void); -#endif /* DRIVERS_APIC_ISR_H */ +#endif /* KERNEL_APIC_ISR_H */ diff --git a/drivers/include/apic/isr_dispatch.h b/kernel/include/apic/isr_dispatch.h similarity index 87% rename from drivers/include/apic/isr_dispatch.h rename to kernel/include/apic/isr_dispatch.h index a4e4ae2..e7354e3 100644 --- a/drivers/include/apic/isr_dispatch.h +++ b/kernel/include/apic/isr_dispatch.h @@ -15,9 +15,9 @@ * along with this program. If not, see */ -#ifndef DRIVERS_APIC_ISR_DISPATCH_H -#define DRIVERS_APIC_ISR_DISPATCH_H +#ifndef KERNEL_APIC_ISR_DISPATCH_H +#define KERNEL_APIC_ISR_DISPATCH_H extern void apic_error_dispatch(void); -#endif /* DIRVERS_APIC_ISR_DISPATCH_H */ +#endif /* KERNEL_APIC_ISR_DISPATCH_H */ diff --git a/kernel/include/core/cpu_instr.h b/kernel/include/core/cpu_instr.h index 46de151..bf414d8 100644 --- a/kernel/include/core/cpu_instr.h +++ b/kernel/include/core/cpu_instr.h @@ -42,4 +42,8 @@ extern uint64_t cpu_read_cr2(void); extern void cpu_wbinvd(void); +extern uint64_t cpu_get_cr3(void); + +extern void cpu_set_cr3(uint64_t cr3); + #endif /* KERNEL_CORE_CPU_INSTR_H */ diff --git a/kernel/include/elf/elf.h b/kernel/include/core/elf.h similarity index 84% rename from kernel/include/elf/elf.h rename to kernel/include/core/elf.h index b68b276..803f23f 100644 --- a/kernel/include/elf/elf.h +++ b/kernel/include/core/elf.h @@ -15,8 +15,8 @@ * along with this program. If not, see */ -#ifndef KERNEL_ELF_ELF_H -#define KERNEL_ELF_ELF_H +#ifndef KERNEL_CORE_ELF_H +#define KERNEL_CORE_ELF_H #include @@ -25,4 +25,6 @@ extern uint8_t elf_is_elf(struct fs_handle_t* file); -#endif /* KERNEL_ELF_ELF_H */ +extern struct pcb_t* elf_load(struct fs_handle_t* file, uint64_t pid); + +#endif /* KERNEL_CORE_ELF_H */ diff --git a/kernel/include/core/kentry.h b/kernel/include/core/kentry.h index 0f6f1c1..cd53561 100644 --- a/kernel/include/core/kentry.h +++ b/kernel/include/core/kentry.h @@ -23,7 +23,7 @@ #include -#include +#include #ifdef GRAPHICSBASE #include diff --git a/kernel/include/core/paging.h b/kernel/include/core/paging.h index a1e2122..bc4cdf0 100644 --- a/kernel/include/core/paging.h +++ b/kernel/include/core/paging.h @@ -43,6 +43,10 @@ enum page_size_t { extern void paging_init(void); +extern void paging_ensure_mapped(void); + +extern uint64_t paging_map_proc(uint64_t vaddr, uint64_t paddr, uint16_t flg, enum page_size_t page_size, uint64_t* pml4); + extern uint64_t paging_map(uint64_t vaddr, uint64_t paddr, uint16_t flg, enum page_size_t page_size); extern void paging_unmap(uint64_t vaddr, enum page_size_t page_size); extern uint64_t paging_ident(uint64_t paddr); @@ -51,4 +55,6 @@ extern void paging_install_guard(uint64_t vaddr); extern void paging_remove_guard(uint64_t vaddr); extern uint8_t paging_check_guard(uint64_t vaddr); +extern uint64_t paging_create_pml4(void); + #endif /* KERNEL_CORE_PAGING_H */ diff --git a/kernel/include/core/process.h b/kernel/include/core/process.h index ee2a369..a97f59e 100644 --- a/kernel/include/core/process.h +++ b/kernel/include/core/process.h @@ -19,6 +19,7 @@ #define KERNEL_CORE_PROCESS_H #include +#include #include @@ -51,11 +52,14 @@ struct pcb_t { uint64_t pid; uint32_t k_rsp_lo; uint32_t k_rsp_hi; - uint64_t init_rsp_vaddr; - uint64_t init_rsp_paddr; + uint64_t saved_usr_rsp; uint64_t init_k_rsp_vaddr; uint64_t init_k_rsp_paddr; + struct process_memory_region_t* mem; + + uint64_t cr3; + struct pcb_t* next; enum { @@ -110,4 +114,6 @@ extern void process_discard(struct pcb_t* pcb); extern void process_preempt_entry(struct preempt_frame_t* context) __attribute__((noreturn)); +extern uint8_t process_create_guarded_stack(uint64_t* init_vaddr, uint64_t* init_paddr, uint64_t* stack); + #endif /* KERNEL_CORE_PROCESS_H */ diff --git a/kernel/lib/kmemcpy.S b/kernel/include/core/syscall.h similarity index 70% rename from kernel/lib/kmemcpy.S rename to kernel/include/core/syscall.h index 5dd6123..b57f731 100644 --- a/kernel/lib/kmemcpy.S +++ b/kernel/include/core/syscall.h @@ -1,5 +1,5 @@ -/* kmemcpy.S - library memcpy routine */ -/* Copyright (C) 2025-2026 Ebrahim Aleem +/* process.h - kernel system call interface */ +/* Copyright (C) 2026 Ebrahim Aleem * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,12 +15,11 @@ * along with this program. If not, see */ -.section .text +#ifndef KERNEL_CORE_SYSCALL_H +#define KERNEL_CORE_SYSCALL_H -.globl kmemcpy -kmemcpy: -movq %rdi, %rax -movq %rdx, %rcx -rep movsb -ret +#include +extern void syscall_return(uint64_t rip, uint64_t rfl, uint64_t rsp); + +#endif /* KERNEL_CORE_SYSCALL_H */ diff --git a/drivers/include/ioapic/ioapic_init.h b/kernel/include/ioapic/ioapic_init.h similarity index 90% rename from drivers/include/ioapic/ioapic_init.h rename to kernel/include/ioapic/ioapic_init.h index 90c48c9..ca0c8b0 100644 --- a/drivers/include/ioapic/ioapic_init.h +++ b/kernel/include/ioapic/ioapic_init.h @@ -15,8 +15,8 @@ * along with this program. If not, see */ -#ifndef DRIVERS_IOAPIC_IOAPIC_INIT_H -#define DRIVERS_IOAPIC_IOAPIC_INIT_H +#ifndef KERNEL_IOAPIC_IOAPIC_INIT_H +#define KERNEL_IOAPIC_IOAPIC_INIT_H #include @@ -32,4 +32,4 @@ extern void ioapic_init(void); extern void ioapic_conf_gsi(uint64_t gsi, uint8_t v, uint32_t flg, uint8_t dest); -#endif /* DRIVERS_IOAPIC_IOAPIC_INIT_H */ +#endif /* KERNEL_IOAPIC_IOAPIC_INIT_H */ diff --git a/drivers/include/ioapic/routing.h b/kernel/include/ioapic/routing.h similarity index 89% rename from drivers/include/ioapic/routing.h rename to kernel/include/ioapic/routing.h index 22ad9d8..2a9adb6 100644 --- a/drivers/include/ioapic/routing.h +++ b/kernel/include/ioapic/routing.h @@ -15,8 +15,8 @@ * along with this program. If not, see */ -#ifndef DRIVERS_IOAPIC_ROUTING_H -#define DRIVERS_IOAPIC_ROUTING_H +#ifndef KERNEL_IOAPIC_ROUTING_H +#define KERNEL_IOAPIC_ROUTING_H #include @@ -24,4 +24,4 @@ extern void ioapic_routing_init(uint64_t num_gsi); extern uint64_t ioapic_routing_legacy_gsi(uint8_t isa_irq); -#endif /* DRIVERS_IOAPIC_ROUTING_H */ +#endif /* KERNEL_IOAPIC_ROUTING_H */ diff --git a/kernel/include/lib/kmemcmp.h b/kernel/include/lib/kmemcmp.h index 3c481c5..149d051 100644 --- a/kernel/include/lib/kmemcmp.h +++ b/kernel/include/lib/kmemcmp.h @@ -21,6 +21,6 @@ #include #include -extern int64_t kmemcmp(const void* l, const void* r, size_t c); +extern int kmemcmp(const void* l, const void* r, size_t c); #endif /* KERNEL_LIB_KMEMCMP_H */ diff --git a/drivers/include/pic_8259/isr.h b/kernel/include/pic_8259/isr.h similarity index 89% rename from drivers/include/pic_8259/isr.h rename to kernel/include/pic_8259/isr.h index b44e3fa..c7260e7 100644 --- a/drivers/include/pic_8259/isr.h +++ b/kernel/include/pic_8259/isr.h @@ -15,10 +15,10 @@ * along with this program. If not, see */ -#ifndef DRIVERS_PIC_8259_ISR_H -#define DRIVERS_PIC_8259_ISR_H +#ifndef KERNEL_PIC_8259_ISR_H +#define KERNEL_PIC_8259_ISR_H extern void pic_spurious_master(void); extern void pic_spurious_slave(void); -#endif /* DRIVERS_PIC_8259_ISR_H */ +#endif /* KERNEL_PIC_8259_ISR_H */ diff --git a/drivers/include/pic_8259/pic.h b/kernel/include/pic_8259/pic.h similarity index 88% rename from drivers/include/pic_8259/pic.h rename to kernel/include/pic_8259/pic.h index e6b7dfb..347a326 100644 --- a/drivers/include/pic_8259/pic.h +++ b/kernel/include/pic_8259/pic.h @@ -15,9 +15,9 @@ * along with this program. If not, see */ -#ifndef DRIVERS_PIC_8259_PIC_H -#define DRIVERS_PIC_8259_PIC_H +#ifndef KERNEL_PIC_8259_PIC_H +#define KERNEL_PIC_8259_PIC_H extern void pic_disab(void); -#endif /* DRIVERS_PIC_8259_PIC_H */ +#endif /* KERNEL_PIC_8259_PIC_H */ diff --git a/drivers/ioapic/ioapic_init.c b/kernel/ioapic/ioapic_init.c similarity index 95% rename from drivers/ioapic/ioapic_init.c rename to kernel/ioapic/ioapic_init.c index a1eab5d..1037ad3 100644 --- a/drivers/ioapic/ioapic_init.c +++ b/kernel/ioapic/ioapic_init.c @@ -22,12 +22,12 @@ #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #define IOAPIC_OFF_IOREGSEL 0x00 #define IOAPIC_OFF_IOWIN 0x10 diff --git a/drivers/ioapic/routing.c b/kernel/ioapic/routing.c similarity index 97% rename from drivers/ioapic/routing.c rename to kernel/ioapic/routing.c index e48eac4..d297958 100644 --- a/drivers/ioapic/routing.c +++ b/kernel/ioapic/routing.c @@ -15,18 +15,19 @@ * along with this program. If not, see */ -#include "ioapic/ioapic_init.h" #include #include +#include #include #include -#include -#include -#include -#include +#include +#include +#include + +#include #define NUM_LEGACY 16 diff --git a/kernel/lib/kmemcmp.S b/kernel/lib/kmemcmp.S deleted file mode 100644 index 65a1ef7..0000000 --- a/kernel/lib/kmemcmp.S +++ /dev/null @@ -1,31 +0,0 @@ -/* kmemcmp.S - library memcmp routines */ -/* Copyright (C) 2025-2026 Ebrahim Aleem -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see -*/ - -.section .text - -.globl kmemcmp -kmemcmp: -xorq %rax, %rax -movq %rdx, %rcx -test %rdx, %rdx // clear zf -repe cmpsb -jz .ret -movb -1(%rdi), %al -movzbq -1(%rsi), %rcx -subq %rcx, %rax -.ret: -ret diff --git a/kernel/lib/kmemcmp.c b/kernel/lib/kmemcmp.c new file mode 100644 index 0000000..91ed926 --- /dev/null +++ b/kernel/lib/kmemcmp.c @@ -0,0 +1,42 @@ +/* kmemcmp.c - library memcmp implementation */ +/* Copyright (C) 2026 Ebrahim Aleem +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see +*/ + +#include +#include + +#include + +int memcmp(const void* l, const void* r, size_t c) __attribute__((weak)); + +int memcmp(const void* l, const void* r, size_t c) { + const uint8_t* p1 = l; + const uint8_t* p2 = r; + + while (c && *p1 == *p2) { + p1++; + p2++; + c--; + } + + if (c) { + return (int)(*p1 - *p2); + } + + return 0; +} + +int kmemcmp(const void*l, const void* r, size_t c) __attribute__((alias("memcmp"))); diff --git a/drivers/include/acpica_osl/init.h b/kernel/lib/kmemcpy.c similarity index 56% rename from drivers/include/acpica_osl/init.h rename to kernel/lib/kmemcpy.c index 6ee6b11..8c65b43 100644 --- a/drivers/include/acpica_osl/init.h +++ b/kernel/lib/kmemcpy.c @@ -1,5 +1,5 @@ -/* init.h - acpica subsystem initialization interface */ -/* Copyright (C) 2025-2026 Ebrahim Aleem +/* kmemcpy.c - library memcpy implementation */ +/* Copyright (C) 2026 Ebrahim Aleem * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,9 +15,24 @@ * along with this program. If not, see */ -#ifndef DRIVERS_ACPICA_OSL_INIT_H -#define DRIVERS_ACPICA_OSL_INIT_H +#include +#include -extern void acpica_init(void); +#include -#endif /* DRIVERS_ACPICA_OSL_INIT_H */ +void* memcpy(void* dest, const void* src, size_t c) __attribute__((weak)); + +void* memcpy(void* dest, const void* src, size_t c) { + const uint8_t* p1 = src; + uint8_t* p2 = dest; + + for (size_t i = 0; i < c; i++) { + *p2 = *p1; + p1++; + p2++; + } + + return dest; +} + +void* kmemcpy(void* dest, const void* src, size_t c) __attribute__((alias("memcpy"))); diff --git a/drivers/include/acpica_osl/namespace.h b/kernel/lib/kmemset.c similarity index 59% rename from drivers/include/acpica_osl/namespace.h rename to kernel/lib/kmemset.c index fd73a42..3ce760b 100644 --- a/drivers/include/acpica_osl/namespace.h +++ b/kernel/lib/kmemset.c @@ -1,5 +1,5 @@ -/* namespace.h - acpica subsystem namespace init interface */ -/* Copyright (C) 2025-2026 Ebrahim Aleem +/* kmemset.c - library memset implementation */ +/* Copyright (C) 2026 Ebrahim Aleem * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,12 +15,21 @@ * along with this program. If not, see */ -#ifndef DRIVERS_ACPICA_OSL_PCI_H -#define DRIVERS_ACPICA_OSL_PCI_H +#include +#include -struct pci_routing_handle_t; +#include -extern void acpica_index_all(void); +void* memset(void* ptr, uint64_t v, size_t c) __attribute__((weak)); -#endif /* DRIVERS_ACPICA_OSL_PCI_H */ +void* memset(void* ptr, uint64_t v, size_t c) { + uint8_t* p = ptr; + for (size_t i = 0; i < c; i++) { + p[i] = (uint8_t)v; + } + + return ptr; +} + +void* kmemset(void* ptr, uint64_t v, size_t c) __attribute__((alias("memset"))); diff --git a/drivers/pic_8259/isr.S b/kernel/pic_8259/isr.S similarity index 100% rename from drivers/pic_8259/isr.S rename to kernel/pic_8259/isr.S diff --git a/drivers/pic_8259/pic.c b/kernel/pic_8259/pic.c similarity index 95% rename from drivers/pic_8259/pic.c rename to kernel/pic_8259/pic.c index 81d983f..4c6736c 100644 --- a/drivers/pic_8259/pic.c +++ b/kernel/pic_8259/pic.c @@ -15,11 +15,11 @@ * along with this program. If not, see */ -#include "pic_8259/isr.h" #include +#include -#include -#include +#include +#include #define PIC1_CMD 0x20 #define PIC1_DATA 0x21 From 667df989eaa8c8877a908a3f0d89722163760ccf Mon Sep 17 00:00:00 2001 From: Ebrahim Aleem Date: Sun, 12 Apr 2026 11:02:18 -0700 Subject: [PATCH 4/6] minimal elf loading --- boot/multiboot2/boot.S | 5 +++ kernel/core/ap.S | 4 +- kernel/core/elf.c | 83 +++++++++++++++++++++++++++++++++++- kernel/core/paging.c | 8 +++- kernel/core/process.c | 2 +- kernel/include/core/paging.h | 8 +++- 6 files changed, 103 insertions(+), 7 deletions(-) diff --git a/boot/multiboot2/boot.S b/boot/multiboot2/boot.S index a69fec4..fd11497 100644 --- a/boot/multiboot2/boot.S +++ b/boot/multiboot2/boot.S @@ -54,6 +54,9 @@ #define EFER 0xC0000080 #define LME 0x100 +#define SYS 0x1 +#define NXE 0x800 + #define PG (1 << 31) #define KERNEL_PAGE_FLAGS (1 + 2) @@ -186,7 +189,9 @@ _start: movl $EFER, %ecx /* EFER */ rdmsr + orl $SYS, %eax /* syscall enable */ orl $LME, %eax /* LME */ + orl $NXE, %eax /* execute disable bit */ wrmsr movl %cr0, %eax diff --git a/kernel/core/ap.S b/kernel/core/ap.S index 981e8eb..8b14e8b 100644 --- a/kernel/core/ap.S +++ b/kernel/core/ap.S @@ -77,7 +77,9 @@ movl %edi, %cr3 // enter compat movl $0xC0000080, %ecx rdmsr -orl $0x100, %eax +orl $0x100, %eax /* system call enable */ +orl $0x001, %eax /* LME */ +orl $0x800, %eax /* NXE */ wrmsr movl %cr0, %ecx diff --git a/kernel/core/elf.c b/kernel/core/elf.c index 53a008c..0487f98 100644 --- a/kernel/core/elf.c +++ b/kernel/core/elf.c @@ -26,8 +26,10 @@ #include #include #include +#include #include +#include #define EI_MAG0 0 #define EI_CLASS 4 @@ -69,6 +71,8 @@ #define INIT_USERLAND_RFL 0x200 #define INIT_USERLAND_RSP 0x800000000000 +#define INIT_USERLAND_SB 0x7FFFFF800000 +#define INIT_STACK_SIZE PAGE_SIZE_4K * 8 typedef uint64_t Elf64_Addr; typedef uint64_t Elf64_Off; @@ -205,9 +209,86 @@ struct pcb_t* elf_load(struct fs_handle_t* file, uint64_t pid) { kfree(pcb); return 0; } + + Elf64_Phdr pheader; - //TODO: initialize pages and copy data and setup stack + Elf64_Off ph_off = header.e_phoff; + Elf64_Off img_off; + uint64_t paddr; + uint16_t page_flags; + + uint64_t old_cr3 = cpu_get_cr3(); + + cpu_set_cr3(pcb->cr3); + + for (img_off = INIT_USERLAND_RSP - INIT_STACK_SIZE; img_off < INIT_USERLAND_RSP; img_off += PAGE_SIZE_4K) { + paddr = mm_alloc_p(PAGE_SIZE_4K); + + if (!paddr) { + cpu_set_cr3(old_cr3); + paging_free_userspace((uint64_t*)pcb->cr3); + kfree(pcb); + return 0; + } + + paging_map_proc(img_off, paddr, PAGE_PRESENT | PAGE_RW | PAGE_XD, PAGE_4K, (uint64_t*)pcb->cr3); + kmemset((void*)img_off, 0, PAGE_SIZE_4K); + } + + for (Elf64_Half i = 0; i < header.e_phnum; i++) { + fs_seek(file, ph_off); + fs_read(file, &pheader, sizeof(pheader)); + + if (pheader.p_type != PT_LOAD) { + // TODO: support other pt types + continue; + } + + if (pheader.p_vaddr + pheader.p_memsz >= INIT_USERLAND_SB) { + // image stack collision + kfree(pcb); + cpu_set_cr3(old_cr3); + return 0; + } + + if (pheader.p_vaddr % PAGE_SIZE_4K) { + kfree(pcb); + cpu_set_cr3(old_cr3); + return 0; + } + + page_flags = PAGE_PRESENT | PAGE_US; + + if (pheader.p_flags & PF_W) { + page_flags |= PAGE_RW; + } + + if (!(pheader.p_flags & PF_X)) { + page_flags |= PAGE_XD; + } + + for (img_off = 0; img_off < pheader.p_memsz; img_off += PAGE_SIZE_4K) { + paddr = mm_alloc_p(PAGE_SIZE_4K); + + if (!paddr) { + cpu_set_cr3(old_cr3); + paging_free_userspace((uint64_t*)pcb->cr3); + kfree(pcb); + return 0; + } + + paging_map_proc(pheader.p_vaddr + img_off, paddr, page_flags, PAGE_4K, (uint64_t*)pcb->cr3); + } + + fs_seek(file, pheader.p_offset); + fs_read(file, (void*)pheader.p_vaddr, pheader.p_filesz); + kmemset((void*)(pheader.p_vaddr + pheader.p_memsz - pheader.p_filesz), 0, pheader.p_memsz - pheader.p_filesz); + + ph_off += header.e_phentsize; + } + + cpu_set_cr3(old_cr3); return pcb; } diff --git a/kernel/core/paging.c b/kernel/core/paging.c index 1cdf16d..4a3debb 100644 --- a/kernel/core/paging.c +++ b/kernel/core/paging.c @@ -138,7 +138,7 @@ void paging_ensure_mapped(void) { } } -uint64_t paging_map_proc(uint64_t vaddr, uint64_t paddr, uint16_t flg, enum page_size_t page_size, uint64_t* pml4) { +uint64_t paging_map_proc(uint64_t vaddr, uint64_t paddr, uint64_t flg, enum page_size_t page_size, uint64_t* pml4) { uint64_t* access; lock_acquire(&paging_lock); enum page_size_t lvl = page_walk(vaddr, &access, pml4); @@ -172,7 +172,7 @@ uint64_t paging_map_proc(uint64_t vaddr, uint64_t paddr, uint16_t flg, enum page return paddr; } -uint64_t paging_map(uint64_t vaddr, uint64_t paddr, uint16_t flg, enum page_size_t page_size) { +uint64_t paging_map(uint64_t vaddr, uint64_t paddr, uint64_t flg, enum page_size_t page_size) { return paging_map_proc(vaddr, paddr, flg, page_size, kernel_pml4); } @@ -261,3 +261,7 @@ uint64_t paging_create_pml4(void) { return pml4; } + +void paging_free_userspace(uint64_t* pml4) { + //TODO: implement +} diff --git a/kernel/core/process.c b/kernel/core/process.c index fca2005..94f6ec0 100644 --- a/kernel/core/process.c +++ b/kernel/core/process.c @@ -155,7 +155,7 @@ void process_discard(struct pcb_t* pcb) { mm_free_v(pcb->init_k_rsp_vaddr, INIT_STACK_SIZE + PAGE_SIZE_4K); mm_free_p(pcb->init_k_rsp_paddr, INIT_STACK_SIZE); - //TODO: reap lower pml4 mapped pages + paging_free_userspace((uint64_t*)pcb->cr3); logging_log_debug("Killed %ld", pcb->pid); diff --git a/kernel/include/core/paging.h b/kernel/include/core/paging.h index bc4cdf0..14019fa 100644 --- a/kernel/include/core/paging.h +++ b/kernel/include/core/paging.h @@ -23,6 +23,8 @@ #define PAGE_PRESENT 0x1 #define PAGE_RW 0x2 +#define PAGE_US 0x4 +#define PAGE_XD 0x8000000000000000 #define PAT_MMIO_4K 0x98 #define PAT_MMIO_2M 0x1018 @@ -45,9 +47,9 @@ extern void paging_init(void); extern void paging_ensure_mapped(void); -extern uint64_t paging_map_proc(uint64_t vaddr, uint64_t paddr, uint16_t flg, enum page_size_t page_size, uint64_t* pml4); +extern uint64_t paging_map_proc(uint64_t vaddr, uint64_t paddr, uint64_t flg, enum page_size_t page_size, uint64_t* pml4); -extern uint64_t paging_map(uint64_t vaddr, uint64_t paddr, uint16_t flg, enum page_size_t page_size); +extern uint64_t paging_map(uint64_t vaddr, uint64_t paddr, uint64_t flg, enum page_size_t page_size); extern void paging_unmap(uint64_t vaddr, enum page_size_t page_size); extern uint64_t paging_ident(uint64_t paddr); @@ -57,4 +59,6 @@ extern uint8_t paging_check_guard(uint64_t vaddr); extern uint64_t paging_create_pml4(void); +extern void paging_free_userspace(uint64_t* pml4); + #endif /* KERNEL_CORE_PAGING_H */ From fdbc404906f7024f531010341650feabc54ec768 Mon Sep 17 00:00:00 2001 From: Ebrahim Aleem Date: Sun, 12 Apr 2026 15:31:27 -0700 Subject: [PATCH 5/6] execute elf in userland --- Makefile | 14 +++- boot/multiboot2/boot.S | 12 +-- drivers/ext2/ext2.c | 28 ++++++- kernel/apic/apic_init.c | 11 ++- kernel/core/elf.c | 146 ++++++++++++++++++++++++++-------- kernel/core/kentry.c | 8 ++ kernel/core/paging.c | 23 +++++- kernel/core/process.c | 18 +++-- kernel/core/syscall.S | 2 +- kernel/include/core/gdt.h | 8 +- kernel/include/core/msr.h | 1 + kernel/include/core/paging.h | 10 ++- kernel/include/core/process.h | 2 + kernel/ioapic/ioapic_init.c | 46 ++++++++--- scripts/Makefile.kcflags | 7 +- userland/Makefile | 34 ++++++++ userland/test/Makefile | 46 +++++++++++ userland/test/test.S | 9 +++ 18 files changed, 345 insertions(+), 80 deletions(-) create mode 100644 userland/Makefile create mode 100644 userland/test/Makefile create mode 100644 userland/test/test.S diff --git a/Makefile b/Makefile index 47577aa..b53d735 100644 --- a/Makefile +++ b/Makefile @@ -56,7 +56,7 @@ export CC := clang export AR := llvm-ar export STRIP := llvm-strip -SUBDIRS := kernel boot drivers test +SUBDIRS := kernel boot drivers test userland KERNEL_TARGETS := \ $(OBJ_DIR)/kernel.a BOOT_TARGETS := \ @@ -68,6 +68,8 @@ TEST_TARGETS := \ $(OBJ_DIR)/test_lib.a \ $(OBJ_DIR)/test_testsuite.a +USERLAND_TARGETS := $(OBJ_DIR)/userland_files/ + export RUNTIME_DRIVERS_TARGETS := \ $(OBJ_DIR)/drivers/driver_list.txt @@ -78,6 +80,8 @@ COPY_DOC_TO := $(OBJ_DIR)/rootfs/usr/share/doc/ModulOS/ COPY_DRIVERS_TO := $(OBJ_DIR)/rootfs/lib/drivers/ +COPY_USERLAND_TO := $(OBJ_DIR)/rootfs/ + SRC := $(shell find . -type f \( -name "*.c" -o -name "*.S" -o -name "*.h" \)) include $(SRC_TREE_ROOT)/scripts/Makefile.kcflags @@ -118,6 +122,7 @@ $(KERNEL_TARGETS): kernel $(BOOT_TARGETS): boot $(DRIVERS_TARGETS): drivers $(RUNTIME_DRIVERS_TARGETS): drivers +$(USERLAND_TARGETS): userland $(TEST_TARGETS): test @@ -132,6 +137,9 @@ copy-doc: COPYING LICENSES | $(COPY_DOC_TO) copy-runtime-drivers: $(RUNTIME_DRIVERS_TARGETS) | $(COPY_DRIVERS_TO) cp -r $^ $| +.PHONY: copy-userland +copy-userland: $(USERLAND_TARGETS) | $(COPY_USERLAND_TO) + cp -r $^/* $| $(OBJ_DIR)/stub.img: | $(OBJ_DIR)/ truncate -s 4G $@ @@ -147,7 +155,7 @@ $(OBJ_DIR)/stub-esp.dummy: $(OBJ_DIR)/stub.img $(OBJ_DIR)/modulos $(OBJ_DIR)/esp # 54525952 is for 52MiB offset (512 * 1024 * 1024) # 1034240 is for 52MiB initial (4MiB align + 48MiB ESP) and 4MiB tail for gpt -$(OBJ_DIR)/stub-fs.dummy: $(OBJ_DIR)/stub.img copy-runtime-drivers copy-doc +$(OBJ_DIR)/stub-fs.dummy: $(OBJ_DIR)/stub.img copy-runtime-drivers copy-userland copy-doc yes | mke2fs -L rootfs -E offset=54525952 -d $(OBJ_DIR)/rootfs/ -t ext2 \ -b 4096 $< 1034240 touch $@ @@ -168,4 +176,4 @@ $(OBJ_DIR)/modulos-dbg: $(OBJ_DIR)/modulos.ld \ $(OBJ_DIR)/boot.a \ $(OBJ_DIR)/kernel.a \ $(OBJ_DIR)/drivers.a - $(CC) -o $@ $(LTO) $(LD_FLAGS) -fuse-ld=lld -T $^ + $(CC) -o $@ $(LD_FLAGS) -fuse-ld=lld -T $^ diff --git a/boot/multiboot2/boot.S b/boot/multiboot2/boot.S index fd11497..8dc2eba 100644 --- a/boot/multiboot2/boot.S +++ b/boot/multiboot2/boot.S @@ -264,19 +264,19 @@ gdt: .byte 0x92 /* access: P */ .byte 0x00 /* limit 16:19 flag: */ .byte 0x00 /* base 24:31 */ - gdt.ucodeseg: + gdt.udataseg: .short 0x0000 /* limit 0:15 */ .short 0x0000 /* base 0:15 */ .byte 0x00 /* base 16:23 */ - .byte 0xF8 /* access: DPL=3 P */ - .byte 0x20 /* limit 16:19 flag: L */ + .byte 0xF2 /* access: P */ + .byte 0x00 /* limit 16:19 flag: */ .byte 0x00 /* base 24:31 */ - gdt.udataseg: + gdt.ucodeseg: .short 0x0000 /* limit 0:15 */ .short 0x0000 /* base 0:15 */ .byte 0x00 /* base 16:23 */ - .byte 0x92 /* access: P */ - .byte 0x00 /* limit 16:19 flag: */ + .byte 0xF8 /* access: DPL=3 P */ + .byte 0x20 /* limit 16:19 flag: L */ .byte 0x00 /* base 24:31 */ gdt.tss: .quad 0 diff --git a/drivers/ext2/ext2.c b/drivers/ext2/ext2.c index fb75fdc..cedee64 100644 --- a/drivers/ext2/ext2.c +++ b/drivers/ext2/ext2.c @@ -26,6 +26,9 @@ #include #include #include +#include +#include +#include #include #include @@ -683,14 +686,31 @@ uint8_t ext2_attempt_init(struct disk_t* disk, uint64_t start_lba, uint64_t end_ if (!root_handle) { logging_log_error("Failed to open root directory"); } + else { + if ((sts = fs_stat(root_handle, &stat_buf)) != FILE_OK) { + logging_log_error("Failed to stat root directory %u", (uint32_t)sts); + } + else { + logging_log_debug("Root directory %u (%u)", stat_buf.size, stat_buf.type); + } - if ((sts = fs_stat(root_handle, &stat_buf)) != FILE_OK) { - logging_log_error("Failed to stat root directory %u", (uint32_t)sts); + fs_close(root_handle); } - logging_log_debug("Root directory %u (%u)", stat_buf.size, stat_buf.type); - fs_close(root_handle); + struct fs_handle_t* test_file = fs_open("/test"); + if (!test_file) { + logging_log_error("Failed to open test file"); + } + else { + struct pcb_t* test_pcb = elf_load(test_file, process_assign_pid()); + if (!test_pcb) { + logging_log_error("Failed to load test file"); + } + fs_close(test_file); + + scheduler_schedule(test_pcb); + } } //TODO: mount other volumes diff --git a/kernel/apic/apic_init.c b/kernel/apic/apic_init.c index 6d160cd..aac77e5 100644 --- a/kernel/apic/apic_init.c +++ b/kernel/apic/apic_init.c @@ -103,8 +103,15 @@ volatile struct gdt_ptr_64_t** ap_gdt_ptr_64; uint8_t* ap_init_locks; void apic_init(void) { - apic_base = msr_read(MSR_APIC_BASE) & APIC_BASE_MASK; - if (!paging_map(apic_base, apic_base, + uint64_t apic_base_paddr = msr_read(MSR_APIC_BASE) & APIC_BASE_MASK; + apic_base = mm_alloc_v(PAGE_SIZE_4K); + + if (!apic_base) { + logging_log_error("Failed to map in apic"); + panic(PANIC_NO_MEM); + } + + if (!paging_map(apic_base, apic_base_paddr, PAGE_PRESENT | PAGE_RW | PAT_MMIO_4K, PAGE_4K)) { logging_log_error("Failed to map memory for LAPIC"); panic(PANIC_PAGING); diff --git a/kernel/core/elf.c b/kernel/core/elf.c index 0487f98..27664f1 100644 --- a/kernel/core/elf.c +++ b/kernel/core/elf.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -129,6 +130,13 @@ typedef struct { _Static_assert(sizeof(Elf64_Phdr) == 56, "Bad ELF program header size"); +struct mem_reg_t { + uint64_t base; + uint64_t top; + uint64_t perms; + struct mem_reg_t* next; +}; + static const uint8_t elf_magic[4] = {0x7f, 'E', 'L', 'F'}; static uint8_t check_valid(struct fs_handle_t* file, Elf64_Ehdr* header) { @@ -216,29 +224,17 @@ struct pcb_t* elf_load(struct fs_handle_t* file, uint64_t pid) { Elf64_Off img_off; uint64_t paddr; - uint16_t page_flags; - - uint64_t old_cr3 = cpu_get_cr3(); - - cpu_set_cr3(pcb->cr3); - - for (img_off = INIT_USERLAND_RSP - INIT_STACK_SIZE; img_off < INIT_USERLAND_RSP; img_off += PAGE_SIZE_4K) { - paddr = mm_alloc_p(PAGE_SIZE_4K); - - if (!paddr) { - cpu_set_cr3(old_cr3); - paging_free_userspace((uint64_t*)pcb->cr3); - kfree(pcb); - return 0; - } + uint64_t page_flags; - paging_map_proc(img_off, paddr, PAGE_PRESENT | PAGE_RW | PAGE_XD, PAGE_4K, (uint64_t*)pcb->cr3); - kmemset((void*)img_off, 0, PAGE_SIZE_4K); - } + struct mem_reg_t* mem_regs = 0; + struct mem_reg_t* j; + struct mem_reg_t* temp; + // first pass to determine memory layout for (Elf64_Half i = 0; i < header.e_phnum; i++) { fs_seek(file, ph_off); fs_read(file, &pheader, sizeof(pheader)); + ph_off += header.e_phentsize; if (pheader.p_type != PT_LOAD) { // TODO: support other pt types @@ -246,15 +242,9 @@ struct pcb_t* elf_load(struct fs_handle_t* file, uint64_t pid) { } if (pheader.p_vaddr + pheader.p_memsz >= INIT_USERLAND_SB) { - // image stack collision + // stack collision kfree(pcb); - cpu_set_cr3(old_cr3); - return 0; - } - - if (pheader.p_vaddr % PAGE_SIZE_4K) { - kfree(pcb); - cpu_set_cr3(old_cr3); + pcb = 0; return 0; } @@ -268,26 +258,120 @@ struct pcb_t* elf_load(struct fs_handle_t* file, uint64_t pid) { page_flags |= PAGE_XD; } - for (img_off = 0; img_off < pheader.p_memsz; img_off += PAGE_SIZE_4K) { + uint64_t base = pheader.p_vaddr; + uint64_t top = pheader.p_vaddr + pheader.p_memsz; + + base -= base % PAGE_SIZE_4K; + + if (top % PAGE_SIZE_4K) { + top += PAGE_SIZE_4K - (top % PAGE_SIZE_4K); + } + + struct mem_reg_t** insert = &mem_regs; + for (j = mem_regs; j; j = j->next) { + if (base < j->base) { + break; + } + + insert = &j->next; + } + + // insert in order + + j = (*insert); + *insert = kmalloc(sizeof(struct mem_reg_t)); + (*insert)->base = base; + (*insert)->top = top; + (*insert)->perms = page_flags; + (*insert)->next = j; + } + + // detect overlaping memory + for (j = mem_regs; j && j->next; j = j->next) { + if (j->top > j->next->base) { + if (j->perms != j->next->perms) { + // overlap + kfree(pcb); + return 0; + } + + // merge + j->top = j->top > j->next->top ? j->top : j->next->top; + temp = j->next; + j->next = j->next->next; + kfree(temp); + } + } + + uint64_t old_cr3 = proc_data_get()->current_process->cr3; + proc_data_get()->current_process->cr3 = pcb->cr3; + + cpu_set_cr3(pcb->cr3); + + // map in memory for copying + for (j = mem_regs; j; j = j->next) { + for (uint64_t off = 0; off < j->top - j->base; off += PAGE_SIZE_4K) { paddr = mm_alloc_p(PAGE_SIZE_4K); if (!paddr) { - cpu_set_cr3(old_cr3); paging_free_userspace((uint64_t*)pcb->cr3); kfree(pcb); - return 0; + pcb = 0; + goto restore_cr3; } - paging_map_proc(pheader.p_vaddr + img_off, paddr, page_flags, PAGE_4K, (uint64_t*)pcb->cr3); + paging_map_proc(j->base + off, paddr, PAGE_PRESENT | PAGE_RW, PAGE_4K, (uint64_t*)pcb->cr3); + } + } + + // map in stack + for (img_off = INIT_USERLAND_RSP - INIT_STACK_SIZE; img_off < INIT_USERLAND_RSP; img_off += PAGE_SIZE_4K) { + paddr = mm_alloc_p(PAGE_SIZE_4K); + + if (!paddr) { + paging_free_userspace((uint64_t*)pcb->cr3); + kfree(pcb); + pcb = 0; + goto restore_cr3; + } + + paging_map_proc(img_off, paddr, PAGE_PRESENT | PAGE_RW | PAGE_US | PAGE_XD, PAGE_4K, (uint64_t*)pcb->cr3); + kmemset((void*)img_off, 0, PAGE_SIZE_4K); + } + + // copy in executable + ph_off = header.e_phoff; + for (Elf64_Half i = 0; i < header.e_phnum; i++) { + fs_seek(file, ph_off); + fs_read(file, &pheader, sizeof(pheader)); + ph_off += header.e_phentsize; + + if (pheader.p_type != PT_LOAD) { + // TODO: support other pt types + continue; } fs_seek(file, pheader.p_offset); fs_read(file, (void*)pheader.p_vaddr, pheader.p_filesz); kmemset((void*)(pheader.p_vaddr + pheader.p_memsz - pheader.p_filesz), 0, pheader.p_memsz - pheader.p_filesz); + } - ph_off += header.e_phentsize; + // update page permissions + for (j = mem_regs; j; j = j->next) { + for (uint64_t off = 0; off < j->top - j->base; off += PAGE_SIZE_4K) { + paging_update_perms(j->base + off, j->perms, PAGE_4K, (uint64_t*)pcb->cr3); + } + } + +restore_cr3: + + while (mem_regs) { + temp = mem_regs->next; + kfree(mem_regs); + mem_regs = temp; } + proc_data_get()->current_process->cr3 = old_cr3; cpu_set_cr3(old_cr3); return pcb; diff --git a/kernel/core/kentry.c b/kernel/core/kentry.c index 6e23772..7f46028 100644 --- a/kernel/core/kentry.c +++ b/kernel/core/kentry.c @@ -31,6 +31,8 @@ #include #include #include +#include +#include #include @@ -78,6 +80,10 @@ void kentry(void) { idt_init(); paging_ensure_mapped(); scheduler_init(); + + + msr_write(MSR_STAR, ((GDT_USER_CS - 0x10) << 48) | (GDT_KERNEL_CS << 32)); + logging_log_debug("TSS and IDT init done"); logging_log_debug("ACPI init"); @@ -128,6 +134,8 @@ void kapentry(uint64_t arb_id) { proc_data_set_id((uint8_t)arb_id); proc_data_get()->arb_id = (uint8_t)arb_id; + msr_write(MSR_STAR, ((GDT_USER_CS - 0x10) << 48) | (GDT_KERNEL_CS << 32)); + alloc_init(); logging_log_debug("AP TSS and IDT init"); diff --git a/kernel/core/paging.c b/kernel/core/paging.c index 4a3debb..5be78b1 100644 --- a/kernel/core/paging.c +++ b/kernel/core/paging.c @@ -92,7 +92,7 @@ static uint64_t* increase_granularity(uint64_t vaddr, uint64_t* access, enum pag if (!access) { return 0; } - *access |= PAGE_PRESENT | PAGE_RW; + *access |= PAGE_PRESENT | PAGE_RW | PAGE_US; access = (uint64_t*)paging_ident((*access & PAGE_ADDR_MASK)); kmemset(access, 0, PAGE_SIZE_4K); @@ -131,7 +131,7 @@ void paging_ensure_mapped(void) { panic(PANIC_NO_MEM); } - kernel_pml4[i] = addr | PAGE_PRESENT; + kernel_pml4[i] = addr | PAGE_PRESENT | PAGE_RW; addr = paging_ident(addr); kmemset((void*)addr, 0, PAGE_SIZE_4K); @@ -176,6 +176,25 @@ uint64_t paging_map(uint64_t vaddr, uint64_t paddr, uint64_t flg, enum page_size return paging_map_proc(vaddr, paddr, flg, page_size, kernel_pml4); } +uint8_t paging_update_perms(uint64_t vaddr, uint64_t flg, enum page_size_t page_size, uint64_t* pml4) { + uint64_t* access; + + lock_acquire(&paging_lock); + enum page_size_t lvl = page_walk(vaddr, &access, pml4); + + if (lvl != page_size) { + lock_release(&paging_lock); + logging_log_error("Cannot update page perms of different granularity"); + return 1; + } + + *access &= ~(PAGE_PRESENT | PAGE_RW | PAGE_US | PAGE_XD); + *access |= flg; + lock_release(&paging_lock); + + return 0; +} + void paging_unmap(uint64_t vaddr, enum page_size_t page_size) { uint64_t* access; lock_acquire(&paging_lock); diff --git a/kernel/core/process.c b/kernel/core/process.c index 94f6ec0..b616568 100644 --- a/kernel/core/process.c +++ b/kernel/core/process.c @@ -54,7 +54,7 @@ void process_init(uint64_t init_rsp_vaddr, uint64_t init_rsp_paddr) { process_init_ap(init_rsp_vaddr, init_rsp_paddr); } -static uint64_t assign_pid(void) { +uint64_t process_assign_pid(void) { lock_acquire(&lock_proc); const uint64_t ret = next_pid++; lock_release(&lock_proc); @@ -69,11 +69,9 @@ void process_init_ap(uint64_t init_rsp_vaddr, uint64_t init_rsp_paddr) { struct pcb_t* pcb = kmalloc(sizeof(struct pcb_t)); pcb->init_k_rsp_vaddr = init_rsp_vaddr; pcb->init_k_rsp_paddr = init_rsp_paddr; - pcb->init_k_rsp_vaddr = - pcb->init_k_rsp_paddr = 0; pcb->sched_cntr = SCHED_SKIP; proc_data_get()->current_process = pcb; - proc_data_get()->current_process->pid = assign_pid(); + proc_data_get()->current_process->pid = process_assign_pid(); } struct pcb_t* process_from_vaddr(uint64_t vaddr) { @@ -121,7 +119,7 @@ struct pcb_t* process_from_vaddr(uint64_t vaddr) { pcb->cr3 = (uint64_t)&kernel_pml4; - pcb->pid = assign_pid(); + pcb->pid = process_assign_pid(); return pcb; } @@ -129,6 +127,10 @@ struct pcb_t* process_from_vaddr(uint64_t vaddr) { struct pcb_t* process_from_func(process_function_t func, void* cntx) { struct pcb_t* pcb = process_from_vaddr((uint64_t)function_setup); + if (!pcb) { + return 0; + } + pcb->rdi = (uint64_t)func; pcb->rsi = (uint64_t)cntx; @@ -194,13 +196,13 @@ uint8_t process_create_guarded_stack(uint64_t* init_vaddr, uint64_t* init_paddr, stack_vaddr = mm_alloc_v(INIT_STACK_SIZE + PAGE_SIZE_4K); // extra guard page if (!stack_vaddr) { - return 0; + return 1; } stack_paddr = mm_alloc_p(INIT_STACK_SIZE); if (!stack_paddr) { mm_free_v(stack_vaddr, INIT_STACK_SIZE + PAGE_SIZE_4K); - return 0; + return 1; } _Static_assert(INIT_STACK_SIZE == 4 * PAGE_SIZE_4K, "stack size must be four pages (16KiB)"); @@ -218,5 +220,5 @@ uint8_t process_create_guarded_stack(uint64_t* init_vaddr, uint64_t* init_paddr, *init_paddr = stack_paddr; *stack = stack_vaddr + PAGE_SIZE_4K * 5; - return 1; + return 0; } diff --git a/kernel/core/syscall.S b/kernel/core/syscall.S index b1aa77e..eb3dfcb 100644 --- a/kernel/core/syscall.S +++ b/kernel/core/syscall.S @@ -21,4 +21,4 @@ movq %rdi, %rcx // rip movq %rsi, %r11 // rflags movq %rdx, %rsp // rsp -sysret +sysretq diff --git a/kernel/include/core/gdt.h b/kernel/include/core/gdt.h index 2a3fd75..b29703f 100644 --- a/kernel/include/core/gdt.h +++ b/kernel/include/core/gdt.h @@ -43,10 +43,10 @@ #define GDT_UDATA_INDEX 4 #define GDT_TSS_INDEX 5 -#define GDT_KERNEL_CS 0x8 -#define GDT_KERNEL_SS 0x10 -#define GDT_USER_CS 0x18 -#define GDT_USER_SS 0x20 +#define GDT_KERNEL_CS 0x8uLL +#define GDT_KERNEL_SS 0x10uLL +#define GDT_USER_SS 0x18uLL +#define GDT_USER_CS 0x20uLL struct gdt_ptr_64_t { uint16_t limit; diff --git a/kernel/include/core/msr.h b/kernel/include/core/msr.h index d4187ac..440b0ae 100644 --- a/kernel/include/core/msr.h +++ b/kernel/include/core/msr.h @@ -21,6 +21,7 @@ #include #define MSR_APIC_BASE 0x0000001B +#define MSR_STAR 0xC0000081 extern void msr_write(uint64_t msr, uint64_t val); diff --git a/kernel/include/core/paging.h b/kernel/include/core/paging.h index 14019fa..6149559 100644 --- a/kernel/include/core/paging.h +++ b/kernel/include/core/paging.h @@ -21,10 +21,10 @@ #include #include -#define PAGE_PRESENT 0x1 -#define PAGE_RW 0x2 -#define PAGE_US 0x4 -#define PAGE_XD 0x8000000000000000 +#define PAGE_PRESENT 0x1uLL +#define PAGE_RW 0x2uLL +#define PAGE_US 0x4uLL +#define PAGE_XD 0x8000000000000000uLL #define PAT_MMIO_4K 0x98 #define PAT_MMIO_2M 0x1018 @@ -49,6 +49,8 @@ extern void paging_ensure_mapped(void); extern uint64_t paging_map_proc(uint64_t vaddr, uint64_t paddr, uint64_t flg, enum page_size_t page_size, uint64_t* pml4); +extern uint8_t paging_update_perms(uint64_t vaddr, uint64_t flg, enum page_size_t page_size, uint64_t* pml4); + extern uint64_t paging_map(uint64_t vaddr, uint64_t paddr, uint64_t flg, enum page_size_t page_size); extern void paging_unmap(uint64_t vaddr, enum page_size_t page_size); extern uint64_t paging_ident(uint64_t paddr); diff --git a/kernel/include/core/process.h b/kernel/include/core/process.h index a97f59e..8fa479b 100644 --- a/kernel/include/core/process.h +++ b/kernel/include/core/process.h @@ -98,6 +98,8 @@ typedef void (*process_function_t)(void* cntx); extern uint64_t process_get_pid(void); +extern uint64_t process_assign_pid(void); + extern void process_init(uint64_t init_rsp_vaddr, uint64_t init_rsp_paddr); extern void process_init_ap(uint64_t init_rsp_vaddr, uint64_t init_rsp_paddr); diff --git a/kernel/ioapic/ioapic_init.c b/kernel/ioapic/ioapic_init.c index 1037ad3..f5e44be 100644 --- a/kernel/ioapic/ioapic_init.c +++ b/kernel/ioapic/ioapic_init.c @@ -26,9 +26,11 @@ #include #include #include -#include +#include #include +#include + #define IOAPIC_OFF_IOREGSEL 0x00 #define IOAPIC_OFF_IOWIN 0x10 @@ -58,8 +60,15 @@ void ioapic_init(void) { acpi_parse_madt_ics((void*)&ioapic, &handle, MADT_ICS_IO_APIC)) { logging_log_info("Initializing IO APIC 0x%lX", (uint64_t)ioapic->IOAPICID); - const uint64_t ioapic_base = ioapic->IOAPICAddress; - if (!paging_map(ioapic_base, ioapic_base, PAGE_PRESENT | PAGE_RW | PAT_MMIO_4K, PAGE_4K)) { + const uint64_t ioapic_base_paddr = ioapic->IOAPICAddress; + const uint64_t ioapic_base = mm_alloc_v(PAGE_SIZE_4K); + + if (!ioapic_base) { + logging_log_error("Failed to map in ioapic"); + panic(PANIC_NO_MEM); + } + + if (!paging_map(ioapic_base, ioapic_base_paddr, PAGE_PRESENT | PAGE_RW | PAT_MMIO_4K, PAGE_4K)) { logging_log_error("Failed to map memory for IOAPIC"); panic(PANIC_PAGING); } @@ -74,15 +83,8 @@ void ioapic_init(void) { gsi_max = lcl_max_gsi; } - // unlikely, but map extra pages if needed - for (uint64_t mapping_base = ioapic_base + PAGE_SIZE_4K; - mapping_base < ioapic_base + IOAPIC_REDIR_ST + num_redir * 2; - mapping_base += PAGE_SIZE_4K) { - if (!paging_map(mapping_base, mapping_base, PAGE_PRESENT | PAGE_RW | PAT_MMIO_4K, PAGE_4K)) { - logging_log_error("Failed to map memory for IOAPIC"); - panic(PANIC_PAGING); - } - } + paging_unmap(ioapic_base, PAGE_4K); + mm_free_v(ioapic_base, PAGE_SIZE_4K); } // map all gsis back to ioapics (second pass after knowing gsi_max) @@ -94,12 +96,30 @@ void ioapic_init(void) { handle != 0; acpi_parse_madt_ics((void*)&ioapic, &handle, MADT_ICS_IO_APIC)) { - const uint64_t ioapic_base = ioapic->IOAPICAddress; + const uint64_t ioapic_base_paddr = ioapic->IOAPICAddress; + const uint64_t ioapic_base = mm_alloc_v(PAGE_SIZE_4K); + + if (!ioapic_base) { + logging_log_error("Failed to map in ioapic"); + panic(PANIC_NO_MEM); + } + + if (!paging_map(ioapic_base, ioapic_base_paddr, PAGE_PRESENT | PAGE_RW | PAT_MMIO_4K, PAGE_4K)) { + logging_log_error("Failed to map memory for IOAPIC"); + panic(PANIC_PAGING); + } *(volatile uint32_t*)(ioapic_base + IOAPIC_OFF_IOREGSEL) = IOAPIC_IOAPICVER; const uint64_t num_redir = 1 + (MAX_REDIR_ENTRY_MSK & (*(volatile uint32_t*)(ioapic_base + IOAPIC_OFF_IOWIN) >> MAX_REDIR_ENTRY_SHF)); + if (IOAPIC_REDIR_ST + num_redir * 2 > PAGE_SIZE_4K) { + logging_log_error("IOAPIC takes more than one page"); + panic(PANIC_APIC); + } + + *(volatile uint32_t*)(ioapic_base + IOAPIC_OFF_IOREGSEL) = IOAPIC_IOAPICVER; + for (uint64_t i = 0; i < num_redir; i++) { redir_index[i].ioapic_base = ioapic_base; redir_index[i].gsi_base = ioapic->GlobalSystemInterruptBase; diff --git a/scripts/Makefile.kcflags b/scripts/Makefile.kcflags index a0e0b87..9adf275 100644 --- a/scripts/Makefile.kcflags +++ b/scripts/Makefile.kcflags @@ -22,7 +22,7 @@ ifndef DEBUG CWARN := $(CWARN) -Werror endif -LD_FLAGS := -std=c23 -mcmodel=kernel -fno-pie -mno-red-zone -mno-mmx -mno-sse -mno-sse2 \ +LD_USR_FLAGS := -std=c23 -fno-pie -mno-mmx -mno-sse -mno-sse2 \ -fomit-frame-pointer -nodefaultlibs -nostdlib -mcmodel=kernel \ -ffreestanding -fno-unwind-tables -fno-exceptions -fno-rtti \ -fno-semantic-interposition -fvisibility=hidden \ @@ -30,8 +30,11 @@ LD_FLAGS := -std=c23 -mcmodel=kernel -fno-pie -mno-red-zone -mno-mmx -mno-sse -m -static -D_MODULOS $(CDEBUG) ifndef DEBUG - LD_FLAGS := $(LD_FLAGS) -flto=thin + LD_USR_FLAGS := $(LD_FLAGS) -flto=thin endif +LD_FLAGS := $(LD_USR_FLAGS) -mcmodel=kernel -mno-red-zone + + CFLAGS := $(CWARN) $(LD_FLAGS) $(DEFINES) -I include/ -I $(SRC_TREE_ROOT)/include/ -MMD -MP -c diff --git a/userland/Makefile b/userland/Makefile new file mode 100644 index 0000000..4261cb4 --- /dev/null +++ b/userland/Makefile @@ -0,0 +1,34 @@ +# Makefile - userland build toolchain +# Copyright (C) 2026 Ebrahim Aleem +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see + +export SRC_TREE_ROOT := ../$(SRC_TREE_ROOT) +include $(SRC_TREE_ROOT)/scripts/Makefile.header + +export OBJ_DIR := $(OBJ_DIR)/userland + +SUBTARGETS := test + +.PHONY: all +all: build + +.PHONY: build +build: $(OBJ_DIR)/../userland_files/ + +$(OBJ_DIR)/../userland_files/: $(SUBTARGETS) + +.PHONY: $(SUBTARGETS) +$(SUBTARGETS): + $(MAKE) -C $@ build diff --git a/userland/test/Makefile b/userland/test/Makefile new file mode 100644 index 0000000..9a2eee5 --- /dev/null +++ b/userland/test/Makefile @@ -0,0 +1,46 @@ +# Makefile - userland test executable build toolchain +# Copyright (C) 2026 Ebrahim Aleem +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see + +SRC_TREE_ROOT := ../$(SRC_TREE_ROOT) +include $(SRC_TREE_ROOT)/scripts/Makefile.header + +USERLAND_DIR := $(OBJ_DIR)/../userland_files/ +OBJ_DIR := $(OBJ_DIR)/test/ + +LCL_TARGETS := \ + $(USERLAND_DIR)/hello_world.txt \ + $(USERLAND_DIR)/test + +include $(SRC_TREE_ROOT)/scripts/Makefile.kcflags + +%/: + -mkdir -p $@ + +.PHONY: all +all: build + +.PHONY: build +build: $(LCL_TARGETS) + +$(USERLAND_DIR)/hello_world.txt: | $(USERLAND_DIR) + echo Hello, World! > $@ + +$(USERLAND_DIR)/test: $(OBJ_DIR)/test.o | $(USERLAND_DIR) + $(CC) -o $@ $(LD_USR_FLAGS) -fuse-ld=lld $^ + +$(OBJ_DIR)/test.o: test.S | $(OBJ_DIR) + $(CC) $(LD_USR_FLAGS) -c -o $@ $< + diff --git a/userland/test/test.S b/userland/test/test.S new file mode 100644 index 0000000..24d5fc3 --- /dev/null +++ b/userland/test/test.S @@ -0,0 +1,9 @@ + +.section .text + +.globl _start +_start: +movq $0xdeadbeef, %rax +pushq %rax +hang: +jmp hang From 1d263290c1fde4657bd5b8cdc7fe38c7c701e470 Mon Sep 17 00:00:00 2001 From: Ebrahim Aleem Date: Sun, 12 Apr 2026 16:46:14 -0700 Subject: [PATCH 6/6] process cleanup --- Makefile | 3 ++- drivers/ahci/ahci.c | 5 +---- drivers/pcie/pcie_init.c | 2 ++ drivers/serial/serial_print.c | 14 ++++++++++---- kernel/core/cpu_instr.S | 3 +++ kernel/core/kentry.c | 2 ++ kernel/core/paging.c | 31 +++++++++++++++++++++++++++++-- kernel/core/process.c | 9 +++++---- kernel/include/lib/kmemset.h | 2 +- kernel/lib/kmemset.c | 6 +++--- scripts/Makefile.header | 4 ++++ scripts/Makefile.kcflags | 2 +- test/lib/test.c | 2 +- 13 files changed, 64 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index b53d735..1dc75bb 100644 --- a/Makefile +++ b/Makefile @@ -17,8 +17,9 @@ # Debug options -export DEBUG = 1 +#export DEBUG = 1 export DEBUG_LOGGING = 1 +export SMP_ENABLE = 1 # Global options diff --git a/drivers/ahci/ahci.c b/drivers/ahci/ahci.c index bcea8c2..12b7880 100644 --- a/drivers/ahci/ahci.c +++ b/drivers/ahci/ahci.c @@ -496,7 +496,6 @@ static void port_identify(struct ahci_t* ahci, uint32_t port) { uint32_t paddr_identity; volatile uint16_t* identity; uint8_t model[41]; - uint64_t lba48; paddr_identity = (uint32_t)mm_alloc_pmax(PAGE_SIZE_4K, 0, ~0u); if (!paddr_identity) { @@ -564,9 +563,7 @@ static void port_identify(struct ahci_t* ahci, uint32_t port) { } model[40] = 0; - lba48 = *(uint64_t*)&identity[100]; - - logging_log_debug("Found ATA drive %s 0x%lx", &model[0], lba48); + logging_log_debug("Found ATA drive %s 0x%lx", &model[0], *(uint64_t*)&identity[100]); paging_unmap((uint64_t)identity, PAGE_4K); diff --git a/drivers/pcie/pcie_init.c b/drivers/pcie/pcie_init.c index 7db9e35..738c20b 100644 --- a/drivers/pcie/pcie_init.c +++ b/drivers/pcie/pcie_init.c @@ -55,8 +55,10 @@ static void enumerate_bus(uint16_t seg, uint8_t bus); static void configure_function(uint16_t seg, uint8_t bus, uint8_t dev, uint8_t func) { DISABLE_INT(seg, bus, dev, func); +#if defined(DEBUG) || defined(DEBUG_LOGGING) const uint16_t vendor_id = VENDOR_ID(seg, bus, dev, func); const uint16_t device_id = DEVICE_ID(seg, bus, dev, func); +#endif /* defined(DEBUG) || defined(DEBUG_LOGGING) */ const uint8_t class_code = CLASS_CODE(seg, bus, dev, func); const uint8_t subclass = SUBCLASS(seg, bus, dev, func); const uint8_t prog_if = PROG_IF(seg, bus, dev, func); diff --git a/drivers/serial/serial_print.c b/drivers/serial/serial_print.c index 446e677..e96452a 100644 --- a/drivers/serial/serial_print.c +++ b/drivers/serial/serial_print.c @@ -109,12 +109,18 @@ static void serial_com12(uint8_t b) { } static void serial_printf(const char* s, void (*printer)(uint8_t), va_list args) { + uint8_t flg; + uint64_t width; + uint64_t precision; + const char* str; + + for (; *s != 0; s++) { switch (*s) { case '%': - uint8_t flg = 0; - uint64_t width = 0; - uint64_t precision = 0; + flg = 0; + width = 0; + precision = 0; next_specifier: s++; switch (*s) { @@ -132,7 +138,7 @@ static void serial_printf(const char* s, void (*printer)(uint8_t), va_list args) CHOSE_SIZE(uint, 16, upper) break; case 's': - const char* str = va_arg(args, const char*); + str = va_arg(args, const char*); if ((flg & FLG_LM) == FLG_LM) { for (; width && *str; width--) { printer((uint8_t)*(str++)); diff --git a/kernel/core/cpu_instr.S b/kernel/core/cpu_instr.S index c1c2df3..e84e36a 100644 --- a/kernel/core/cpu_instr.S +++ b/kernel/core/cpu_instr.S @@ -78,5 +78,8 @@ ret .globl cpu_set_cr3 cpu_set_cr3: +testq %rdi, %rdi +jz skip_cr3 movq %rdi, %cr3 +skip_cr3: ret diff --git a/kernel/core/kentry.c b/kernel/core/kentry.c index 7f46028..d061da4 100644 --- a/kernel/core/kentry.c +++ b/kernel/core/kentry.c @@ -120,7 +120,9 @@ void kentry(void) { &ap_bootstrap_start, (uint64_t)&ap_bootstrap_end - (uint64_t)&ap_bootstrap_start); +#ifdef SMP_ENABLE apic_start_ap(); +#endif /* SMP_ENABLE */ logging_log_info("AP bootstrap sequence done"); diff --git a/kernel/core/paging.c b/kernel/core/paging.c index 5be78b1..d48287a 100644 --- a/kernel/core/paging.c +++ b/kernel/core/paging.c @@ -262,6 +262,7 @@ uint8_t paging_check_guard(uint64_t vaddr) { uint64_t paging_create_pml4(void) { uint64_t* access; + uint64_t* k_access; uint64_t pml4 = mm_alloc_p(PAGE_SIZE_4K); uint16_t i; @@ -270,17 +271,43 @@ uint64_t paging_create_pml4(void) { } access = (uint64_t*)paging_ident(pml4); + k_access = (uint64_t*)paging_ident((uint64_t)&kernel_pml4[0]); kmemset(access, 0, PAGE_SIZE_4K); // copy upper half top level pages for (i = PML4_CONSISTENT_START; i < PML4_CONSISTENT_END; i++) { - access[i] = kernel_pml4[i]; + access[i] = k_access[i]; } return pml4; } +static void free_pages(uint64_t entry, enum page_size_t lvl) { + uint64_t* access = (uint64_t*)paging_ident((entry & PAGE_ADDR_MASK)); + + for (uint16_t i = 0; i < 512; i++) { + if (access[i] & PAGE_PRESENT) { + if (lvl == PAGE_4K || (access[i] & PAGE_PS)) { + mm_free_v(access[i] & PAGE_ADDR_MASK, PAGE_SIZE_4K); + } + else { + free_pages(access[i], lvl-1); + } + } + } + + mm_free_p(entry * PAGE_ADDR_MASK, PAGE_SIZE_4K); +} + void paging_free_userspace(uint64_t* pml4) { - //TODO: implement + uint64_t* access = (uint64_t*)paging_ident((uint64_t)pml4); + + for (uint16_t i = 0; i < PML4_CONSISTENT_START; i++) { + if (access[i] & PAGE_PRESENT) { + free_pages(access[i], _PAGE_512G); // lvl being the size of each entry, not entry itself + } + } + + mm_free_p((uint64_t)pml4, PAGE_SIZE_4K); } diff --git a/kernel/core/process.c b/kernel/core/process.c index b616568..5d88f8f 100644 --- a/kernel/core/process.c +++ b/kernel/core/process.c @@ -41,8 +41,6 @@ static uint64_t next_pid; static uint8_t lock_proc; -extern uint8_t kernel_pml4; - __attribute__((noreturn)) static void function_setup(process_function_t func, void* cntx) { func(cntx); process_kill_current(); @@ -72,6 +70,7 @@ void process_init_ap(uint64_t init_rsp_vaddr, uint64_t init_rsp_paddr) { pcb->sched_cntr = SCHED_SKIP; proc_data_get()->current_process = pcb; proc_data_get()->current_process->pid = process_assign_pid(); + proc_data_get()->current_process->cr3 = 0; } struct pcb_t* process_from_vaddr(uint64_t vaddr) { @@ -117,7 +116,7 @@ struct pcb_t* process_from_vaddr(uint64_t vaddr) { pcb->sched_cntr = SCHED_READY; - pcb->cr3 = (uint64_t)&kernel_pml4; + pcb->cr3 = 0; pcb->pid = process_assign_pid(); @@ -157,7 +156,9 @@ void process_discard(struct pcb_t* pcb) { mm_free_v(pcb->init_k_rsp_vaddr, INIT_STACK_SIZE + PAGE_SIZE_4K); mm_free_p(pcb->init_k_rsp_paddr, INIT_STACK_SIZE); - paging_free_userspace((uint64_t*)pcb->cr3); + if (pcb->cr3) { + paging_free_userspace((uint64_t*)pcb->cr3); + } logging_log_debug("Killed %ld", pcb->pid); diff --git a/kernel/include/lib/kmemset.h b/kernel/include/lib/kmemset.h index 91cce32..8083e0b 100644 --- a/kernel/include/lib/kmemset.h +++ b/kernel/include/lib/kmemset.h @@ -21,6 +21,6 @@ #include #include -extern void* kmemset(void* ptr, uint64_t v, size_t c); +extern void* kmemset(void* ptr, int32_t v, size_t c); #endif /* KERNEL_LIB_KMEMSET_H */ diff --git a/kernel/lib/kmemset.c b/kernel/lib/kmemset.c index 3ce760b..c3c6cbb 100644 --- a/kernel/lib/kmemset.c +++ b/kernel/lib/kmemset.c @@ -20,9 +20,9 @@ #include -void* memset(void* ptr, uint64_t v, size_t c) __attribute__((weak)); +void* memset(void* ptr, int32_t v, size_t c) __attribute__((weak)); -void* memset(void* ptr, uint64_t v, size_t c) { +void* memset(void* ptr, int32_t v, size_t c) { uint8_t* p = ptr; for (size_t i = 0; i < c; i++) { @@ -32,4 +32,4 @@ void* memset(void* ptr, uint64_t v, size_t c) { return ptr; } -void* kmemset(void* ptr, uint64_t v, size_t c) __attribute__((alias("memset"))); +void* kmemset(void* ptr, int32_t v, size_t c) __attribute__((alias("memset"))); diff --git a/scripts/Makefile.header b/scripts/Makefile.header index c99f961..e9b4cb3 100644 --- a/scripts/Makefile.header +++ b/scripts/Makefile.header @@ -39,3 +39,7 @@ endif ifdef DEBUG_LOGGING CDEBUG := $(CDEBUG) -DDEBUG_LOGGING endif + +ifdef SMP_ENABLE +DEFINES := $(DEFINES) -DSMP_ENABLE +endif diff --git a/scripts/Makefile.kcflags b/scripts/Makefile.kcflags index 9adf275..b9017ea 100644 --- a/scripts/Makefile.kcflags +++ b/scripts/Makefile.kcflags @@ -30,7 +30,7 @@ LD_USR_FLAGS := -std=c23 -fno-pie -mno-mmx -mno-sse -mno-sse2 \ -static -D_MODULOS $(CDEBUG) ifndef DEBUG - LD_USR_FLAGS := $(LD_FLAGS) -flto=thin + LD_USR_FLAGS := $(LD_USR_FLAGS) -flto=thin endif LD_FLAGS := $(LD_USR_FLAGS) -mcmodel=kernel -mno-red-zone diff --git a/test/lib/test.c b/test/lib/test.c index d180e56..983890a 100644 --- a/test/lib/test.c +++ b/test/lib/test.c @@ -37,7 +37,7 @@ TEST_NAME("libary test suite") TEST("kmemset") { char* actual = malloc(MEM_TEST_SIZE); - for (uint64_t i = 0; i < 256; i += (i % 7) + 1) { + for (int32_t i = 0; i < 256; i += (i % 7) + 1) { ASSERT_TRUE(actual == kmemset(actual, i, MEM_TEST_SIZE), "kernel memset return value changed"); }