patch-2.4.0-prerelease linux/drivers/acpi/resources/rscreate.c

Next file: linux/drivers/acpi/resources/rsdump.c
Previous file: linux/drivers/acpi/resources/rscalc.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test12/linux/drivers/acpi/resources/rscreate.c linux/drivers/acpi/resources/rscreate.c
@@ -1,11 +1,11 @@
-/******************************************************************************
+/*******************************************************************************
  *
  * Module Name: rscreate - Acpi_rs_create_resource_list
  *                         Acpi_rs_create_pci_routing_table
  *                         Acpi_rs_create_byte_stream
- *              $Revision: 16 $
+ *              $Revision: 22 $
  *
- *****************************************************************************/
+ ******************************************************************************/
 
 /*
  *  Copyright (C) 2000 R. Byron Moore
@@ -182,11 +182,12 @@
 		 * contain a u32 Address, a u8 Pin, a Name and a u8
 		 * Source_index.
 		 */
-		top_object_list = package_object->package.elements;
+		top_object_list     = package_object->package.elements;
+		number_of_elements  = package_object->package.count;
+		user_prt            = (PCI_ROUTING_TABLE *) buffer;
 
-		number_of_elements = package_object->package.count;
 
-		user_prt = (PCI_ROUTING_TABLE *) buffer;
+		buffer = ROUND_PTR_UP_TO_8 (buffer, u8);
 
 		for (index = 0; index < number_of_elements; index++) {
 			/*
@@ -198,6 +199,7 @@
 			buffer += user_prt->length;
 			user_prt = (PCI_ROUTING_TABLE *) buffer;
 
+
 			/*
 			 * Fill in the Length field with the information we
 			 * have at this point.
@@ -237,7 +239,7 @@
 
 			if (ACPI_TYPE_NUMBER == (*sub_object_list)->common.type) {
 				user_prt->data.pin =
-						(*sub_object_list)->number.value;
+						(u32) (*sub_object_list)->number.value;
 			}
 
 			else {
@@ -257,8 +259,6 @@
 				 * Add to the Length field the length of the string
 				 */
 				user_prt->length += (*sub_object_list)->string.length;
-				user_prt->length =
-					ROUND_UP_TO_32_bITS (user_prt->length);
 			}
 
 			else {
@@ -280,6 +280,10 @@
 				}
 			}
 
+			/* Now align the current length */
+
+			user_prt->length = ROUND_UP_TO_64_bITS (user_prt->length);
+
 			/*
 			 * Dereference the Source Index
 			 */
@@ -287,7 +291,7 @@
 
 			if (ACPI_TYPE_NUMBER == (*sub_object_list)->common.type) {
 				user_prt->data.source_index =
-						(*sub_object_list)->number.value;
+						(u32) (*sub_object_list)->number.value;
 			}
 
 			else {
@@ -314,7 +318,6 @@
 	*output_buffer_length = buffer_size_needed;
 
 	return (AE_OK);
-
 }
 
 
@@ -393,6 +396,5 @@
 	}
 
 	return (AE_OK);
-
 }
 

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