Date: Sun, 13 Feb 2011 19:24:04 +0000 (UTC) From: Marcel Moolenaar <marcel@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r218660 - head/sys/dev/acpica/Osd Message-ID: <201102131924.p1DJO4YG049223@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: marcel Date: Sun Feb 13 19:24:04 2011 New Revision: 218660 URL: http://svn.freebsd.org/changeset/base/218660 Log: Use the preload_fetch_addr() and preload_fetch_size() convenience functions to obtain the address and size of the overriding DSDT. Sponsored by: Juniper Networks. Modified: head/sys/dev/acpica/Osd/OsdTable.c Modified: head/sys/dev/acpica/Osd/OsdTable.c ============================================================================== --- head/sys/dev/acpica/Osd/OsdTable.c Sun Feb 13 19:15:42 2011 (r218659) +++ head/sys/dev/acpica/Osd/OsdTable.c Sun Feb 13 19:24:04 2011 (r218660) @@ -68,29 +68,31 @@ AcpiOsTableOverride(ACPI_TABLE_HEADER *E ACPI_TABLE_HEADER **NewTable) { char modname[] = "acpi_dsdt"; - caddr_t acpi_table, p, s; + caddr_t acpi_table; + ACPI_TABLE_HEADER *hdr; + size_t sz; if (ExistingTable == NULL || NewTable == NULL) return (AE_BAD_PARAMETER); + *NewTable = NULL; #ifdef notyet for (int i = 0; i < ACPI_NAME_SIZE; i++) modname[i + 5] = tolower(ExistingTable->Signature[i]); #else /* If we're not overriding the DSDT, just return. */ - if (strncmp(ExistingTable->Signature, ACPI_SIG_DSDT, ACPI_NAME_SIZE) != 0) { - *NewTable = NULL; + if (strncmp(ExistingTable->Signature, ACPI_SIG_DSDT, ACPI_NAME_SIZE) != 0) return (AE_OK); - } #endif - if ((acpi_table = preload_search_by_type(modname)) != NULL && - (p = preload_search_info(acpi_table, MODINFO_ADDR)) != NULL && - (s = preload_search_info(acpi_table, MODINFO_SIZE)) != NULL && - *(size_t *)s != 0) - *NewTable = *(ACPI_TABLE_HEADER **)p; - else - *NewTable = NULL; + acpi_table = preload_search_by_type(modname); + if (acpi_table == NULL) + return (AE_OK); + + hdr = preload_fetch_addr(acpi_table); + sz = preload_fetch_size(acpi_table); + if (hdr != NULL && sz != 0) + *NewTable = hdr; return (AE_OK); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201102131924.p1DJO4YG049223>