Skip to contentSkip to conversation

2/4 pci segments

PATCH In review Alex Williamson 3 participants 7 messages Apr 3, 2003

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 2/4 pci segments

Patch 2 is an update to the PCI segment support that Bjorn posted
around 2.5.19ish. Also against 2.5.64 + 030307. Thanks,

Alex

--
Alex Williamson HP Linux & Open Source Lab

arch/ia64/kernel/acpi.c +68 -2
diff -urN linux-2.5.64/arch/ia64/kernel/acpi.c linux-work/arch/ia64/kernel/acpi.c
@@ -109,8 +109,6 @@
 	return "sn2";
 # elif defined (CONFIG_IA64_DIG)
 	return "dig";
-# elif defined (CONFIG_IA64_HP_ZX1)
-	return "hpzx1";
 # else
 #	error Unknown platform.  Fix acpi.c.
 # endif
@@ -176,6 +174,73 @@
 	kfree(buf->pointer);
 }
 
+void
+acpi_get_crs_addr (struct acpi_buffer *buf, int type, u64 *base, u64 *size, u64 *tra)
+{
+	int offset = 0;
+	struct acpi_resource_address16 *addr16;
+	struct acpi_resource_address32 *addr32;
+	struct acpi_resource_address64 *addr64;
+
+	for (;;) {
+		struct acpi_resource *res = acpi_get_crs_next(buf, &offset);
+		if (!res)
+			return;
+		switch (res->id) {
+			case ACPI_RSTYPE_ADDRESS16:
+				addr16 = (struct acpi_resource_address16 *) &res->data;
+
+				if (type == addr16->resource_type) {
+					*base = addr16->min_address_range;
+					*size = addr16->address_length;
+					*tra = addr16->address_translation_offset;
+					return;
+				}
+				break;
+			case ACPI_RSTYPE_ADDRESS32:
+				addr32 = (struct acpi_resource_address32 *) &res->data;
+				if (type == addr32->resource_type) {
+					*base = addr32->min_address_range;
+					*size = addr32->address_length;
+					*tra = addr32->address_translation_offset;
+					return;
+				}
+				break;
+			case ACPI_RSTYPE_ADDRESS64:
+				addr64 = (struct acpi_resource_address64 *) &res->data;
+				if (type == addr64->resource_type) {
+					*base = addr64->min_address_range;
+					*size = addr64->address_length;
+					*tra = addr64->address_translation_offset;
+					return;
+				}
+				break;
+		}
+	}
+}
+
+int
+acpi_get_addr_space(void *obj, u8 type, u64 *base, u64 *length, u64 *tra)
+{
+	acpi_status status;
+	struct acpi_buffer buf;
+
+	*base = 0;
+	*length = 0;
+	*tra = 0;
+
+	status = acpi_get_crs((acpi_handle)obj, &buf);
+	if (ACPI_FAILURE(status)) {
+		printk(KERN_ERR PREFIX "Unable to get _CRS data on object\n");
+		return status;
+	}
+
+	acpi_get_crs_addr(&buf, type, base, length, tra);
+
+	acpi_dispose_crs(&buf);
+
+	return AE_OK;
+}
 #endif /* CONFIG_ACPI */
 
 #ifdef CONFIG_ACPI_BOOT
@@ -808,6 +873,7 @@
 
 	list_for_each(node, &acpi_prt.entries) {
 		entry = (struct acpi_prt_entry *)node;
+		vector[i].segment = entry->id.segment;
 		vector[i].bus    = entry->id.bus;
 		vector[i].pci_id = ((u32) entry->id.device << 16) | 0xffff;
 		vector[i].pin    = entry->pin;
arch/ia64/pci/pci.c +96 -22

171 lines not on this page · raw message

drivers/acpi/pci_root.c +2 -1
diff -urN linux-2.5.64/drivers/acpi/pci_root.c linux-work/drivers/acpi/pci_root.c
@@ -265,7 +265,8 @@
 	 * PCI namespace does not get created until this call is made (and 
 	 * thus the root bridge's pci_dev does not exist).
 	 */
-	root->bus = pcibios_scan_root(root->id.bus);
+	root->bus = pcibios_scan_root(root->handle,
+	                              root->id.segment, root->id.bus);
 	if (!root->bus) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 
 			"Bus %02x:%02x not present in PCI namespace\n", 
include/asm-ia64/acpi.h +2 -0
diff -urN linux-2.5.64/include/asm-ia64/acpi.h linux-work/include/asm-ia64/acpi.h
@@ -100,7 +100,9 @@
 int acpi_request_vector (u32 int_type);
 int acpi_get_prt (struct pci_vector_struct **vectors, int *count);
 int acpi_get_interrupt_model (int *type);
+int acpi_register_irq (u32 gsi, u32 polarity, u32 trigger);
 int acpi_irq_to_vector (u32 irq);
+int acpi_get_addr_space (void *obj, u8 type, u64 *base, u64 *length,u64 *tra);
 
 #ifdef CONFIG_ACPI_NUMA
 #include <asm/numa.h>
include/asm-ia64/pci.h +13 -2
diff -urN linux-2.5.64/include/asm-ia64/pci.h linux-work/include/asm-ia64/pci.h
@@ -21,7 +21,7 @@
 #define PCIBIOS_MIN_MEM		0x10000000
 
 void pcibios_config_init(void);
-struct pci_bus * pcibios_scan_root(int bus);
+struct pci_bus * pcibios_scan_root(void *acpi_handle, int segment, int bus);
 
 struct pci_dev;
 
@@ -58,7 +58,6 @@
 #define pci_unmap_sg			platform_pci_unmap_sg
 #define pci_dma_sync_single		platform_pci_dma_sync_single
 #define pci_dma_sync_sg			platform_pci_dma_sync_sg
-#define sg_dma_address			platform_pci_dma_address
 #define pci_dma_supported		platform_pci_dma_supported
 
 /* pci_unmap_{single,page} is not a nop, thus... */
@@ -92,9 +91,21 @@
 #define pci_controller_num(PDEV)	(0)
 
 #define sg_dma_len(sg)		((sg)->dma_length)
+#define sg_dma_address(sg)	((sg)->dma_address)
 
 #define HAVE_PCI_MMAP
 extern int pci_mmap_page_range (struct pci_dev *dev, struct vm_area_struct *vma,
 				enum pci_mmap_state mmap_state, int write_combine);
+
+struct pci_controller {
+	void *acpi_handle;
+	void *iommu;
+	int segment;
+
+	u64 mem_offset;
+};
+
+#define PCI_CONTROLLER(busdev) ((struct pci_controller *) busdev->sysdata)
+#define PCI_SEGMENT(busdev)    (PCI_CONTROLLER(busdev)->segment)
 
 #endif /* _ASM_IA64_PCI_H */
include/asm-ia64/system.h +1 -0
diff -urN linux-2.5.64/include/asm-ia64/system.h linux-work/include/asm-ia64/system.h
@@ -31,6 +31,7 @@
 #include <linux/types.h>
 
 struct pci_vector_struct {
+	__u16 segment;	/* PCI Segment number */
 	__u16 bus;	/* PCI Bus number */
 	__u32 pci_id;	/* ACPI split 16 bits device, 16 bits function (see section 6.1.1) */
 	__u8 pin;	/* PCI PIN (0 = A, 1 = B, 2 = C, 3 = D) */
#1 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Alex Williamson

What's up with this hunk?

return "sn2";

 # elif defined (CONFIG_IA64_DIG)
 	return "dig";
-# elif defined (CONFIG_IA64_HP_ZX1)
-	return "hpzx1";
 # else
 #	error Unknown platform.  Fix acpi.c.
 # endif
	--david
#2 lore raw
In reply to Alex Williamson

Removing a dup, this is what it looks like in the 2.5.64 tree:

# if defined (CONFIG_IA64_HP_SIM)
        return "hpsim";
# elif defined (CONFIG_IA64_HP_ZX1)
        return "hpzx1";
# elif defined (CONFIG_IA64_SGI_SN1)
        return "sn1";
# elif defined (CONFIG_IA64_SGI_SN2)
        return "sn2";
# elif defined (CONFIG_IA64_DIG)
        return "dig";
# elif defined (CONFIG_IA64_HP_ZX1)
        return "hpzx1";

Thanks,

Alex

Quoted 8 lines · David Mosberger
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines · Alex Williamson

What's up with this hunk?

        return "sn2";
 # elif defined (CONFIG_IA64_DIG)
        return "dig";

arch/ia64/kernel/acpi.c

Quoted 7 lines
arch/ia64/kernel/acpi.c +0 -2
-# elif defined (CONFIG_IA64_HP_ZX1)
-       return "hpzx1";
 # else
 #      error Unknown platform.  Fix acpi.c.
 # endif
 
        --david

--
Alex Williamson HP Linux & Open Source Lab

#3 lore raw
In reply to Alex Williamson

Removing a dup, this is what it looks like in the 2.5.64 tree:

# if defined (CONFIG_IA64_HP_SIM)
        return "hpsim";
# elif defined (CONFIG_IA64_HP_ZX1)
        return "hpzx1";
# elif defined (CONFIG_IA64_SGI_SN1)
        return "sn1";
# elif defined (CONFIG_IA64_SGI_SN2)
        return "sn2";
# elif defined (CONFIG_IA64_DIG)
        return "dig";
# elif defined (CONFIG_IA64_HP_ZX1)
        return "hpzx1";

Thanks,

Alex

Quoted 8 lines · David Mosberger
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines · Alex Williamson

What's up with this hunk?

        return "sn2";
 # elif defined (CONFIG_IA64_DIG)
        return "dig";

arch/ia64/kernel/acpi.c

Quoted 7 lines
arch/ia64/kernel/acpi.c +0 -2
-# elif defined (CONFIG_IA64_HP_ZX1)
-       return "hpzx1";
 # else
 #      error Unknown platform.  Fix acpi.c.
 # endif
 
        --david

--
Alex Williamson HP Linux & Open Source Lab

#4 lore raw
In reply to Alex Williamson

Removing a dup, this is what it looks like in the 2.5.64 tree:

# if defined (CONFIG_IA64_HP_SIM)
        return "hpsim";
# elif defined (CONFIG_IA64_HP_ZX1)
        return "hpzx1";
# elif defined (CONFIG_IA64_SGI_SN1)
        return "sn1";
# elif defined (CONFIG_IA64_SGI_SN2)
        return "sn2";
# elif defined (CONFIG_IA64_DIG)
        return "dig";
# elif defined (CONFIG_IA64_HP_ZX1)
        return "hpzx1";

Thanks,

Alex

Quoted 8 lines · David Mosberger
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines · Alex Williamson

What's up with this hunk?

        return "sn2";
 # elif defined (CONFIG_IA64_DIG)
        return "dig";

arch/ia64/kernel/acpi.c

Quoted 7 lines
arch/ia64/kernel/acpi.c +0 -2
-# elif defined (CONFIG_IA64_HP_ZX1)
-       return "hpzx1";
 # else
 #      error Unknown platform.  Fix acpi.c.
 # endif
 
        --david

--
Alex Williamson HP Linux & Open Source Lab

#5 lore raw
In reply to Alex Williamson

arch/ia64/kernel/acpi.c line 114

Quoted 12 lines · David Mosberger
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Alex Williamson

What's up with this hunk?

arch/ia64/kernel/acpi.c +0 -2
 	return "sn2";
 # elif defined (CONFIG_IA64_DIG)
 	return "dig";
-# elif defined (CONFIG_IA64_HP_ZX1)
-	return "hpzx1";
 # else
 #	error Unknown platform.  Fix acpi.c.
 # endif

it's mentioned twice. merge bug from 2.4.17 or so, iirc.

Signature · 3 lines
"It's not Hollywood.  War is real, war is primarily not about defeat or
victory, it is about death.  I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk