patch-2.4.6 linux/drivers/acpi/tables/tbconvrt.c

Next file: linux/drivers/acpi/tables/tbget.c
Previous file: linux/drivers/acpi/tables/Makefile
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.5/linux/drivers/acpi/tables/tbconvrt.c linux/drivers/acpi/tables/tbconvrt.c
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: tbconvrt - ACPI Table conversion utilities
- *              $Revision: 19 $
+ *              $Revision: 23 $
  *
  *****************************************************************************/
 
@@ -30,34 +30,13 @@
 #include "actbl.h"
 
 
-#define _COMPONENT          TABLE_MANAGER
+#define _COMPONENT          ACPI_TABLES
 	 MODULE_NAME         ("tbconvrt")
 
 
-/*
- * Build a GAS structure from earlier ACPI table entries (V1.0 and 0.71 extensions)
- *
- * 1) Address space
- * 2) Length in bytes -- convert to length in bits
- * 3) Bit offset is zero
- * 4) Reserved field is zero
- * 5) Expand address to 64 bits
- */
-#define ASL_BUILD_GAS_FROM_ENTRY(a,b,c,d)   {a.address_space_id = (u8) d;\
-			   a.register_bit_width = (u8) MUL_8 (b);\
-			   a.register_bit_offset = 0;\
-			   a.reserved = 0;\
-			   ACPI_STORE_ADDRESS (a.address,c);}
-
-
-/* ACPI V1.0 entries -- address space is always I/O */
-
-#define ASL_BUILD_GAS_FROM_V1_ENTRY(a,b,c)  ASL_BUILD_GAS_FROM_ENTRY(a,b,c,ADDRESS_SPACE_SYSTEM_IO)
-
-
 /*******************************************************************************
  *
- * FUNCTION:    Acpi_tb_convert_to_xsdt
+ * FUNCTION:    Acpi_tb_get_table_count
  *
  * PARAMETERS:
  *
@@ -67,20 +46,17 @@
  *
  ******************************************************************************/
 
-ACPI_STATUS
-acpi_tb_convert_to_xsdt (
-	ACPI_TABLE_DESC         *table_info,
-	u32                     *number_of_tables)
+u32
+acpi_tb_get_table_count (
+	RSDP_DESCRIPTOR         *RSDP,
+	ACPI_TABLE_HEADER       *RSDT)
 {
-	u32                     table_size;
 	u32                     pointer_size;
-	u32                     i;
-	XSDT_DESCRIPTOR         *new_table;
 
 
 #ifndef _IA64
 
-	if (acpi_gbl_RSDP->revision < 2) {
+	if (RSDP->revision < 2) {
 		pointer_size = sizeof (u32);
 	}
 
@@ -97,9 +73,34 @@
 	 * is architecture-dependent.
 	 */
 
-	table_size = table_info->pointer->length;
-	*number_of_tables = (table_size -
-			   sizeof (ACPI_TABLE_HEADER)) / pointer_size;
+	return ((RSDT->length - sizeof (ACPI_TABLE_HEADER)) / pointer_size);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_tb_convert_to_xsdt
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_tb_convert_to_xsdt (
+	ACPI_TABLE_DESC         *table_info,
+	u32                     *number_of_tables)
+{
+	u32                     table_size;
+	u32                     i;
+	XSDT_DESCRIPTOR         *new_table;
+
+
+	*number_of_tables = acpi_tb_get_table_count (acpi_gbl_RSDP, table_info->pointer);
+
 
 	/* Compute size of the converted XSDT */
 
@@ -108,7 +109,7 @@
 
 	/* Allocate an XSDT */
 
-	new_table = acpi_cm_callocate (table_size);
+	new_table = acpi_ut_callocate (table_size);
 	if (!new_table) {
 		return (AE_NO_MEMORY);
 	}
@@ -193,7 +194,7 @@
 	/* Acpi_gbl_FADT is valid */
 	/* Allocate and zero the 2.0 buffer */
 
-	FADT2 = acpi_cm_callocate (sizeof (FADT_DESCRIPTOR_REV2));
+	FADT2 = acpi_ut_callocate (sizeof (FADT_DESCRIPTOR_REV2));
 	if (FADT2 == NULL) {
 		return (AE_NO_MEMORY);
 	}
@@ -501,7 +502,7 @@
 
 	/* Allocate a common FACS */
 
-	common_facs = acpi_cm_callocate (sizeof (ACPI_COMMON_FACS));
+	common_facs = acpi_ut_callocate (sizeof (ACPI_COMMON_FACS));
 	if (!common_facs) {
 		return (AE_NO_MEMORY);
 	}

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)