All of lore.kernel.org
 help / color / mirror / Atom feed
* PATCH: remove unused PCI root bridge resource stuff
@ 2003-08-06 22:44 Bjorn Helgaas
  0 siblings, 0 replies; 4+ messages in thread
From: Bjorn Helgaas @ 2003-08-06 22:44 UTC (permalink / raw)
  To: linux-ia64

This patch against the current 2.4 tree removes a bunch of
ill-advised code I added to get _TRA information from PCI
root bridges.

This was the wrong approach because for one thing, it only
handled one MEM window and one IO window, and root bridges
may have several of each.

This patch can be applied for both 2.4 and 2.5.  ia64 was the
only user of this code, and we no longer need it.  The current
approach we use is to walk the _CRS in pcibios_scan_root(),
as shown here:

http://lia64.bkbits.net:8080/linux-ia64-2.4/anno/arch/ia64/kernel/pci.c@1.21?nav=index.html|src/.|src/arch|src/arch/ia64|src/arch/ia64/kernel

#### AUTHOR bjorn.helgaas@hp.com
#### COMMENT START
### Comments for ChangeSet
ACPI: Remove acpi_pci_get_translations() and support.  pcibios_scan_root()
	should walk the _CRS if necessary.
### Comments for include/acpi/acpi_drivers.h
(acpi_pci_get_translations): Removed.
### Comments for drivers/acpi/pci_root.c
(acpi_pci_get_translations)
(acpi_pci_root_bus_tra)
(acpi_pci_evaluate_crs): Removed.
#### COMMENT END

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.1066  -> 1.1067 
#	drivers/acpi/pci_root.c	1.5     -> 1.6    
#	include/acpi/acpi_drivers.h	1.5     -> 1.6    
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/08/06	bjorn.helgaas@hp.com	1.1067
# ACPI: Remove acpi_pci_get_translations() and support.  pcibios_scan_root()
# 	should walk the _CRS if necessary.
# --------------------------------------------
#
diff -Nru a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
--- a/drivers/acpi/pci_root.c	Wed Aug  6 17:29:00 2003
+++ b/drivers/acpi/pci_root.c	Wed Aug  6 17:29:00 2003
@@ -61,8 +61,6 @@
 	acpi_handle		handle;
 	struct acpi_pci_id	id;
 	struct pci_bus		*bus;
-	u64			mem_tra;
-	u64			io_tra;
 };
 
 struct list_head		acpi_pci_roots;
@@ -114,97 +112,6 @@
 	}
 }
 
-void
-acpi_pci_get_translations (
-	struct acpi_pci_id	*id,
-	u64			*mem_tra,
-	u64			*io_tra)
-{
-	struct list_head	*node = NULL;
-	struct acpi_pci_root	*entry;
-
-	/* TBD: Locking */
-	list_for_each(node, &acpi_pci_roots) {
-		entry = list_entry(node, struct acpi_pci_root, node);
-		if ((id->segment = entry->id.segment)
-			&& (id->bus = entry->id.bus)) {
-			*mem_tra = entry->mem_tra;
-			*io_tra = entry->io_tra;
-			return;
-		}
-	}
-
-	*mem_tra = 0;
-	*io_tra = 0;
-}
-
-
-static u64
-acpi_pci_root_bus_tra (
-       struct acpi_resource	*resource,
-       int			type)
-{
-	struct acpi_resource_address16 *address16;
-	struct acpi_resource_address32 *address32;
-	struct acpi_resource_address64 *address64;
-
-	while (1) {
-		switch (resource->id) {
-		case ACPI_RSTYPE_END_TAG:
-			return 0;
-
-		case ACPI_RSTYPE_ADDRESS16:
-			address16 = (struct acpi_resource_address16 *) &resource->data;
-			if (type = address16->resource_type) {
-				return address16->address_translation_offset;
-			}
-			break;
-
-		case ACPI_RSTYPE_ADDRESS32:
-			address32 = (struct acpi_resource_address32 *) &resource->data;
-			if (type = address32->resource_type) {
-				return address32->address_translation_offset;
-			}
-			break;
-
-		case ACPI_RSTYPE_ADDRESS64:
-			address64 = (struct acpi_resource_address64 *) &resource->data;
-			if (type = address64->resource_type) {
-				return address64->address_translation_offset;
-			}
-			break;
-		}
-		resource = ACPI_PTR_ADD (struct acpi_resource,
-				resource, resource->length);
-	}
-
-	return 0;
-}
-
-
-static int
-acpi_pci_evaluate_crs (
-	struct acpi_pci_root	*root)
-{
-	acpi_status		status;
-	struct acpi_buffer	buffer = {ACPI_ALLOCATE_BUFFER, NULL};
-
-	ACPI_FUNCTION_TRACE("acpi_pci_evaluate_crs");
-
-	status = acpi_get_current_resources (root->handle, &buffer);
-	if (ACPI_FAILURE(status))
-		return_VALUE(-ENODEV);
-
-	root->io_tra = acpi_pci_root_bus_tra ((struct acpi_resource *)
-			buffer.pointer, ACPI_IO_RANGE);
-	root->mem_tra = acpi_pci_root_bus_tra ((struct acpi_resource *)
-			buffer.pointer, ACPI_MEMORY_RANGE);
-
-	acpi_os_free(buffer.pointer);
-	return_VALUE(0);
-}
-
-
 static int
 acpi_pci_root_add (
 	struct acpi_device	*device)
@@ -287,10 +194,8 @@
 	root->id.function = device->pnp.bus_address & 0xFFFF;
 
 	/*
-	 * Evaluate _CRS to get root bridge resources
 	 * TBD: Need PCI interface for enumeration/configuration of roots.
 	 */
- 	acpi_pci_evaluate_crs(root);
 
  	/* TBD: Locking */
  	list_add_tail(&root->node, &acpi_pci_roots);
diff -Nru a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h
--- a/include/acpi/acpi_drivers.h	Wed Aug  6 17:29:00 2003
+++ b/include/acpi/acpi_drivers.h	Wed Aug  6 17:29:00 2003
@@ -162,7 +162,6 @@
 
 int acpi_pci_root_init (void);
 void acpi_pci_root_exit (void);
-void acpi_pci_get_translations (struct acpi_pci_id* id, u64* mem_tra, u64* io_tra);
 
 /* ACPI PCI Interrupt Link (pci_link.c) */
 


^ permalink raw reply	[flat|nested] 4+ messages in thread
* PATCH: remove unused PCI root bridge resource stuff
@ 2003-08-06 22:44 Bjorn Helgaas
       [not found] ` <200308061644.53928.bjorn.helgaas-VXdhtT5mjnY@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Bjorn Helgaas @ 2003-08-06 22:44 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: linux-ia64-u79uwXL29TY76Z2rM5mHXA

This patch against the current 2.4 tree removes a bunch of
ill-advised code I added to get _TRA information from PCI
root bridges.

This was the wrong approach because for one thing, it only
handled one MEM window and one IO window, and root bridges
may have several of each.

This patch can be applied for both 2.4 and 2.5.  ia64 was the
only user of this code, and we no longer need it.  The current
approach we use is to walk the _CRS in pcibios_scan_root(),
as shown here:

http://lia64.bkbits.net:8080/linux-ia64-2.4/anno/arch/ia64/kernel/pci.c-2AEWtv2qSSY@public.gmane.org?nav=index.html|src/.|src/arch|src/arch/ia64|src/arch/ia64/kernel

#### AUTHOR bjorn.helgaas-VXdhtT5mjnY@public.gmane.org
#### COMMENT START
### Comments for ChangeSet
ACPI: Remove acpi_pci_get_translations() and support.  pcibios_scan_root()
	should walk the _CRS if necessary.
### Comments for include/acpi/acpi_drivers.h
(acpi_pci_get_translations): Removed.
### Comments for drivers/acpi/pci_root.c
(acpi_pci_get_translations)
(acpi_pci_root_bus_tra)
(acpi_pci_evaluate_crs): Removed.
#### COMMENT END

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.1066  -> 1.1067 
#	drivers/acpi/pci_root.c	1.5     -> 1.6    
#	include/acpi/acpi_drivers.h	1.5     -> 1.6    
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/08/06	bjorn.helgaas-VXdhtT5mjnY@public.gmane.org	1.1067
# ACPI: Remove acpi_pci_get_translations() and support.  pcibios_scan_root()
# 	should walk the _CRS if necessary.
# --------------------------------------------
#
diff -Nru a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
--- a/drivers/acpi/pci_root.c	Wed Aug  6 17:29:00 2003
+++ b/drivers/acpi/pci_root.c	Wed Aug  6 17:29:00 2003
@@ -61,8 +61,6 @@
 	acpi_handle		handle;
 	struct acpi_pci_id	id;
 	struct pci_bus		*bus;
-	u64			mem_tra;
-	u64			io_tra;
 };
 
 struct list_head		acpi_pci_roots;
@@ -114,97 +112,6 @@
 	}
 }
 
-void
-acpi_pci_get_translations (
-	struct acpi_pci_id	*id,
-	u64			*mem_tra,
-	u64			*io_tra)
-{
-	struct list_head	*node = NULL;
-	struct acpi_pci_root	*entry;
-
-	/* TBD: Locking */
-	list_for_each(node, &acpi_pci_roots) {
-		entry = list_entry(node, struct acpi_pci_root, node);
-		if ((id->segment == entry->id.segment)
-			&& (id->bus == entry->id.bus)) {
-			*mem_tra = entry->mem_tra;
-			*io_tra = entry->io_tra;
-			return;
-		}
-	}
-
-	*mem_tra = 0;
-	*io_tra = 0;
-}
-
-
-static u64
-acpi_pci_root_bus_tra (
-       struct acpi_resource	*resource,
-       int			type)
-{
-	struct acpi_resource_address16 *address16;
-	struct acpi_resource_address32 *address32;
-	struct acpi_resource_address64 *address64;
-
-	while (1) {
-		switch (resource->id) {
-		case ACPI_RSTYPE_END_TAG:
-			return 0;
-
-		case ACPI_RSTYPE_ADDRESS16:
-			address16 = (struct acpi_resource_address16 *) &resource->data;
-			if (type == address16->resource_type) {
-				return address16->address_translation_offset;
-			}
-			break;
-
-		case ACPI_RSTYPE_ADDRESS32:
-			address32 = (struct acpi_resource_address32 *) &resource->data;
-			if (type == address32->resource_type) {
-				return address32->address_translation_offset;
-			}
-			break;
-
-		case ACPI_RSTYPE_ADDRESS64:
-			address64 = (struct acpi_resource_address64 *) &resource->data;
-			if (type == address64->resource_type) {
-				return address64->address_translation_offset;
-			}
-			break;
-		}
-		resource = ACPI_PTR_ADD (struct acpi_resource,
-				resource, resource->length);
-	}
-
-	return 0;
-}
-
-
-static int
-acpi_pci_evaluate_crs (
-	struct acpi_pci_root	*root)
-{
-	acpi_status		status;
-	struct acpi_buffer	buffer = {ACPI_ALLOCATE_BUFFER, NULL};
-
-	ACPI_FUNCTION_TRACE("acpi_pci_evaluate_crs");
-
-	status = acpi_get_current_resources (root->handle, &buffer);
-	if (ACPI_FAILURE(status))
-		return_VALUE(-ENODEV);
-
-	root->io_tra = acpi_pci_root_bus_tra ((struct acpi_resource *)
-			buffer.pointer, ACPI_IO_RANGE);
-	root->mem_tra = acpi_pci_root_bus_tra ((struct acpi_resource *)
-			buffer.pointer, ACPI_MEMORY_RANGE);
-
-	acpi_os_free(buffer.pointer);
-	return_VALUE(0);
-}
-
-
 static int
 acpi_pci_root_add (
 	struct acpi_device	*device)
@@ -287,10 +194,8 @@
 	root->id.function = device->pnp.bus_address & 0xFFFF;
 
 	/*
-	 * Evaluate _CRS to get root bridge resources
 	 * TBD: Need PCI interface for enumeration/configuration of roots.
 	 */
- 	acpi_pci_evaluate_crs(root);
 
  	/* TBD: Locking */
  	list_add_tail(&root->node, &acpi_pci_roots);
diff -Nru a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h
--- a/include/acpi/acpi_drivers.h	Wed Aug  6 17:29:00 2003
+++ b/include/acpi/acpi_drivers.h	Wed Aug  6 17:29:00 2003
@@ -162,7 +162,6 @@
 
 int acpi_pci_root_init (void);
 void acpi_pci_root_exit (void);
-void acpi_pci_get_translations (struct acpi_pci_id* id, u64* mem_tra, u64* io_tra);
 
 /* ACPI PCI Interrupt Link (pci_link.c) */
 

-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-09-23 17:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-06 22:44 PATCH: remove unused PCI root bridge resource stuff Bjorn Helgaas
  -- strict thread matches above, loose matches on Subject: below --
2003-08-06 22:44 Bjorn Helgaas
     [not found] ` <200308061644.53928.bjorn.helgaas-VXdhtT5mjnY@public.gmane.org>
2003-09-17 17:50   ` Bjorn Helgaas
     [not found]     ` <200309171150.34360.bjorn.helgaas-VXdhtT5mjnY@public.gmane.org>
2003-09-23 17:15       ` Bjorn Helgaas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.