summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/tbinstal.c
diff options
context:
space:
mode:
authornjl <njl@FreeBSD.org>2003-12-09 02:45:16 +0000
committernjl <njl@FreeBSD.org>2003-12-09 02:45:16 +0000
commit2a9caa496cc3521e5c9352c255b827c90efb3839 (patch)
tree24e5ad5d8b4fb5681ddaa34c6ae30814c80ffe56 /sys/contrib/dev/acpica/tbinstal.c
parentdc49a5b908c59c6ae7c8b069908225dd6c21c041 (diff)
downloadFreeBSD-src-2a9caa496cc3521e5c9352c255b827c90efb3839.zip
FreeBSD-src-2a9caa496cc3521e5c9352c255b827c90efb3839.tar.gz
Import ACPI-CA 20031203
Diffstat (limited to 'sys/contrib/dev/acpica/tbinstal.c')
-rw-r--r--sys/contrib/dev/acpica/tbinstal.c65
1 files changed, 44 insertions, 21 deletions
diff --git a/sys/contrib/dev/acpica/tbinstal.c b/sys/contrib/dev/acpica/tbinstal.c
index 4471e80..691ef71 100644
--- a/sys/contrib/dev/acpica/tbinstal.c
+++ b/sys/contrib/dev/acpica/tbinstal.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: tbinstal - ACPI table installation and removal
- * $Revision: 69 $
+ * $Revision: 72 $
*
*****************************************************************************/
@@ -358,23 +358,45 @@ AcpiTbInitTableDescriptor (
{
return_ACPI_STATUS (AE_ALREADY_EXISTS);
}
- }
- /*
- * Link the new table in to the list of tables of this type.
- * Just insert at the start of the list, order unimportant.
- *
- * TableDesc->Prev is already NULL from calloc()
- */
- TableDesc->Next = ListHead->Next;
- ListHead->Next = TableDesc;
+ TableDesc->Next = ListHead->Next;
+ ListHead->Next = TableDesc;
- if (TableDesc->Next)
- {
- TableDesc->Next->Prev = TableDesc;
+ if (TableDesc->Next)
+ {
+ TableDesc->Next->Prev = TableDesc;
+ }
+
+ ListHead->Count++;
}
+ else
+ {
+ /*
+ * Link the new table in to the list of tables of this type.
+ * Insert at the end of the list, order IS IMPORTANT.
+ *
+ * TableDesc->Prev & Next are already NULL from calloc()
+ */
+ ListHead->Count++;
- ListHead->Count++;
+ if (!ListHead->Next)
+ {
+ ListHead->Next = TableDesc;
+ }
+ else
+ {
+ TableDesc->Next = ListHead->Next;
+
+ while (TableDesc->Next->Next)
+ {
+ TableDesc->Next = TableDesc->Next->Next;
+ }
+
+ TableDesc->Next->Next = TableDesc;
+ TableDesc->Prev = TableDesc->Next;
+ TableDesc->Next = NULL;
+ }
+ }
/* Finish initialization of the table descriptor */
@@ -421,7 +443,7 @@ AcpiTbInitTableDescriptor (
void
AcpiTbDeleteAllTables (void)
{
- ACPI_TABLE_TYPE Type;
+ ACPI_TABLE_TYPE Type;
/*
@@ -450,7 +472,7 @@ AcpiTbDeleteAllTables (void)
void
AcpiTbDeleteTablesByType (
- ACPI_TABLE_TYPE Type)
+ ACPI_TABLE_TYPE Type)
{
ACPI_TABLE_DESC *TableDesc;
UINT32 Count;
@@ -500,15 +522,16 @@ AcpiTbDeleteTablesByType (
break;
}
- /* Free the table */
- /* Get the head of the list */
-
+ /*
+ * Free the table
+ * 1) Get the head of the list
+ */
TableDesc = AcpiGbl_TableLists[Type].Next;
Count = AcpiGbl_TableLists[Type].Count;
/*
- * Walk the entire list, deleting both the allocated tables
- * and the table descriptors
+ * 2) Walk the entire list, deleting both the allocated tables
+ * and the table descriptors
*/
for (i = 0; i < Count; i++)
{
OpenPOWER on IntegriCloud