From b9961a4e198466fe6fe1cba14efe6bb2e7f4e2ee Mon Sep 17 00:00:00 2001 From: jruoho Date: Tue, 20 Apr 2010 04:53:22 +0000 Subject: Instruct ACPICA to dynamically allocate the table descriptions in AcpiInitializeTables() instead of pushing 128 statically allocated descriptors. This will eliminate also the need to call AcpiReallocateRootTable(). The rationale for the statically allocated table descriptors is to allow initialization without virtual/dynamic memory. Later these should be copied to dynamic memory via AcpiReallocateRootTable(). But since in NetBSD both functions were called in the very same acpi_probe(), this dance was completely unnecessary. --- sys/dev/acpi/acpi.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c index 7051ebc74e6..a292a58aa33 100644 --- a/sys/dev/acpi/acpi.c +++ b/sys/dev/acpi/acpi.c @@ -1,4 +1,4 @@ -/* $NetBSD: acpi.c,v 1.177 2010/04/18 14:07:16 jruoho Exp $ */ +/* $NetBSD: acpi.c,v 1.178 2010/04/20 04:53:22 jruoho Exp $ */ /*- * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.177 2010/04/18 14:07:16 jruoho Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.178 2010/04/20 04:53:22 jruoho Exp $"); #include "opt_acpi.h" #include "opt_pcifixup.h" @@ -114,8 +114,6 @@ MALLOC_DECLARE(M_ACPI); static int acpi_dbgr = 0x00; #endif -static ACPI_TABLE_DESC acpi_initial_tables[128]; - /* * This is a flag we set when the ACPI subsystem is active. Machine * dependent code may wish to skip other steps (such as attaching @@ -244,6 +242,9 @@ acpi_probe(void) acpi_osd_debugger(); #endif + CTASSERT(TRUE == true); + CTASSERT(FALSE == false); + AcpiGbl_AllMethodsSerialized = false; AcpiGbl_EnableInterpreterSlack = true; @@ -256,20 +257,17 @@ acpi_probe(void) goto fail; } - rv = AcpiInitializeTables(acpi_initial_tables, 128, 0); + /* + * Allocate space for RSDT/XSDT and DSDT, + * but allow resizing if more tables exist. + */ + rv = AcpiInitializeTables(NULL, 2, true); if (ACPI_FAILURE(rv)) { func = "AcpiInitializeTables()"; goto fail; } - rv = AcpiReallocateRootTable(); - - if (ACPI_FAILURE(rv)) { - func = "AcpiReallocateRootTable()"; - goto fail; - } - #ifdef ACPI_DEBUGGER if (acpi_dbgr & ACPI_DBGR_TABLES) acpi_osd_debugger(); -- cgit