diff options
author | Damien Zammit <damien@zamaudio.com> | 2018-11-21 07:32:40 -0500 |
---|---|---|
committer | Damien Zammit <damien@zamaudio.com> | 2018-11-24 01:20:08 -0500 |
commit | 7fec54630e8c17d5714c3d48ab41b7fb22ad65d5 (patch) | |
tree | 51e424e9f238f57709081fc9f3a6700edf39cca9 | |
parent | 82dbba62d3a021c749711677bd1fac6805aa4289 (diff) |
Add ability to acpi translator to r/w directly to registers for shutdown
-rw-r--r-- | acpi/acpi.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/acpi/acpi.c b/acpi/acpi.c index 63066aaf..ad0c55ca 100644 --- a/acpi/acpi.c +++ b/acpi/acpi.c @@ -30,7 +30,7 @@ #include "acpi.h" -int +static int mmap_phys_acpi_header(uintptr_t base_addr, struct acpi_header **ptr_to_header, void **virt_addr, int fd) { @@ -263,28 +263,19 @@ acpi_get_tables(struct acpi_table **tables) munmap(virt_addr2, ESCD_SIZE); continue; } - uint32_t datalen = next->length - sizeof(*next); - void *data = (void *)((uintptr_t)next + sizeof(*next)); + size_t datalen = next->length - sizeof(*next); + void *data = (void *)next + sizeof(*next); + struct acpi_table *t = *tables + cur_tab; - /* We now have a pointer to the data, - * its length and header. + /* We now have a special pointer in data to the table, + * its length and header, which will only disappear + * when this process dies. */ - struct acpi_table *t = *tables + cur_tab; memcpy(&t->h, next, sizeof(*next)); - t->datalen = 0; - t->data = malloc(datalen); - if (!t->data) { - munmap(virt_addr2, ESCD_SIZE); - munmap(virt_addr, ESCD_SIZE); - return ENOMEM; - } t->datalen = datalen; - memcpy(t->data, data, datalen); + t->data = data; cur_tab++; - munmap(virt_addr2, ESCD_SIZE); } - munmap(virt_addr, ESCD_SIZE); - return 0; } |