30#define do_verify_checksum(var, header, type) \
31 var = container_of(header, type, sdt_header); \
32 if (!verify_sdt_checksum(&(var)->sdt_header)) \
33 mos_panic(#type " checksum error");
46 if (offset >= item_npages)
73 mos_panic(
"failed to allocate pages for ACPI table");
92 mos_panic(
"failed to allocate pages for ACPI table");
103 for (
u32 i = 0; i < tableHeader->
length; i++)
104 sum += ((
char *) tableHeader)[i];
121 pr_dinfo2(x86_acpi,
"DSDT at %p, size %u", (
void *) dsdt, dsdt->
length);
143 for (
size_t i = 0; i < num_headers; i++)
161 for (
size_t i = 0; i < num_headers; i++)
175 pr_dinfo2(x86_acpi,
"initializing ACPI with RSDP at %p", (
void *) rsdp);
182 for (
ptr_t addr = start; addr < start +
size; addr += 0x10)
186 pr_dinfo2(x86_acpi,
"ACPI: RSDP magic at %p", (
void *) addr);
192 sum += ((
u8 *) rsdp)[i];
196 pr_info2(
"ACPI: RSDP checksum failed");
static bool acpi_sysfs_munmap(sysfs_file_t *f, vmap_t *vmap, bool *unmapped)
static sysfs_dir_t __sysfs_acpi
static void register_sysfs_acpi_node(const char table_name[4], const acpi_sdt_header_t *header)
#define do_verify_checksum(var, header, type)
static void do_iterate_sdts(const acpi_rsdp_t *rsdp)
void acpi_parse_rsdt(const acpi_rsdp_t *rsdp)
static sysfs_item_t acpi_sysfs_items[]
should_inline bool verify_sdt_checksum(const acpi_sdt_header_t *tableHeader)
static void do_handle_sdt_header(const acpi_sdt_header_t *const header)
static void register_sysfs_acpi_rsdp(const acpi_rsdp_t *rsdp)
static bool acpi_sysfs_mmap(sysfs_file_t *f, vmap_t *vmap, off_t offset)
const acpi_rsdp_t * acpi_find_rsdp(ptr_t start, size_t size)
#define ACPI_SIGNATURE_RSDP
#define ACPI_SIGNATURE_MADT
#define ACPI_SIGNATURE_FADT
#define MOS_ASSERT_X(cond, msg,...)
MOSAPI s32 strncmp(const char *str1, const char *str2, size_t n)
MOSAPI char * strndup(const char *src, size_t n)
#define phyframe_va(frame)
phyframe_t * mm_get_free_pages(size_t npages)
#define pmm_ref(thing, npages)
#define phyframe_pfn(frame)
const acpi_madt_t * x86_acpi_madt
#define ALIGN_UP_TO_PAGE(addr)
#define container_of(ptr, type, member)
#define mos_panic(fmt,...)
static void * memcpy(void *s1, const void *s2, size_t n)
#define pr_info2(fmt,...)
#define pr_dinfo2(feat, fmt,...)
acpi_sdt_header_t sdt_header
acpi_sdt_header_t sdt_header
bool(* mmap)(sysfs_file_t *file, vmap_t *vmap, off_t offset)
bool(* munmap)(sysfs_file_t *file, vmap_t *vmap, bool *unmapped)
struct sysfs_item_t::@8::@10 mem
void sysfs_register_file(sysfs_dir_t *sysfs_dir, sysfs_item_t *item)
Register an entry in a sysfs directory.
sysfs_item_t * sysfs_file_get_item(sysfs_file_t *file)
@ SYSFS_MEM
memory-backed file
#define SYSFS_AUTOREGISTER(sysfs_name, sysfs_items)
void mm_do_map(pgd_t top, ptr_t vaddr, pfn_t pfn, size_t n_pages, vm_flags flags, bool do_refcount)
void mm_do_unmap(pgd_t top, ptr_t vaddr, size_t n_pages, bool do_unref)
unsigned long long ptr64_t