Matthew Garrett 447e3a6
diff -ur linux-3.6.0-0.rc2.git2.1.fc18.x86_64/arch/x86/boot/compressed/eboot.c ../kernel-3.5.fc18.bak/linux-3.6.0-0.rc2.git2.1.fc18.x86_64/arch/x86/boot/compressed/eboot.c
Matthew Garrett 447e3a6
--- linux-3.6.0-0.rc2.git2.1.fc18.x86_64/arch/x86/boot/compressed/eboot.c	2012-08-22 15:26:32.485522068 -0400
Matthew Garrett 447e3a6
+++ ../kernel-3.5.fc18.bak/linux-3.6.0-0.rc2.git2.1.fc18.x86_64/arch/x86/boot/compressed/eboot.c	2012-08-22 15:25:40.529244868 -0400
Matthew Garrett 447e3a6
@@ -8,6 +8,7 @@
Matthew Garrett 447e3a6
  * ----------------------------------------------------------------------- */
Matthew Garrett 447e3a6
 
Matthew Garrett 447e3a6
 #include <linux/efi.h>
Matthew Garrett 447e3a6
+#include <linux/pci.h>
Matthew Garrett 447e3a6
 #include <asm/efi.h>
Matthew Garrett 447e3a6
 #include <asm/setup.h>
Matthew Garrett 447e3a6
 #include <asm/desc.h>
Matthew Garrett 447e3a6
@@ -243,6 +244,121 @@
Matthew Garrett 447e3a6
 	*size = len;
Matthew Garrett 447e3a6
 }
Matthew Garrett 447e3a6
 
Matthew Garrett 447e3a6
+static efi_status_t setup_efi_pci(struct boot_params *params)
Matthew Garrett 447e3a6
+{
Matthew Garrett 447e3a6
+	efi_pci_io_protocol *pci;
Matthew Garrett 447e3a6
+	efi_status_t status;
Matthew Garrett 447e3a6
+	void **pci_handle;
Matthew Garrett 447e3a6
+	efi_guid_t pci_proto = EFI_PCI_IO_PROTOCOL_GUID;
Matthew Garrett 447e3a6
+	unsigned long nr_pci, size = 0;
Matthew Garrett 447e3a6
+	int i;
Matthew Garrett 447e3a6
+	struct setup_data *data;
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+	data = (struct setup_data *)params->hdr.setup_data;
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+	while (data && data->next)
Matthew Garrett 447e3a6
+		data = (struct setup_data *)data->next;
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+	status = efi_call_phys5(sys_table->boottime->locate_handle,
Matthew Garrett 447e3a6
+				EFI_LOCATE_BY_PROTOCOL, &pci_proto,
Matthew Garrett 447e3a6
+				NULL, &size, pci_handle);
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+	if (status == EFI_BUFFER_TOO_SMALL) {
Matthew Garrett 447e3a6
+		status = efi_call_phys3(sys_table->boottime->allocate_pool,
Matthew Garrett 447e3a6
+					EFI_LOADER_DATA, size, &pci_handle);
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+		if (status != EFI_SUCCESS)
Matthew Garrett 447e3a6
+			return status;
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+		status = efi_call_phys5(sys_table->boottime->locate_handle,
Matthew Garrett 447e3a6
+					EFI_LOCATE_BY_PROTOCOL, &pci_proto,
Matthew Garrett 447e3a6
+					NULL, &size, pci_handle);
Matthew Garrett 447e3a6
+	}
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+	if (status != EFI_SUCCESS)
Matthew Garrett 447e3a6
+		goto free_handle;
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+	nr_pci = size / sizeof(void *);
Matthew Garrett 447e3a6
+	for (i = 0; i < nr_pci; i++) {
Matthew Garrett 447e3a6
+		void *h = pci_handle[i];
Matthew Garrett 447e3a6
+		uint64_t attributes;
Matthew Garrett 447e3a6
+		struct pci_setup_rom *rom;
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+		status = efi_call_phys3(sys_table->boottime->handle_protocol,
Matthew Garrett 447e3a6
+					h, &pci_proto, &pci;;
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+		if (status != EFI_SUCCESS)
Matthew Garrett 447e3a6
+			continue;
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+		if (!pci)
Matthew Garrett 447e3a6
+			continue;
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+		status = efi_call_phys4(pci->attributes, pci,
Matthew Garrett 447e3a6
+					EfiPciIoAttributeOperationGet, 0,
Matthew Garrett 447e3a6
+					&attributes);
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+		if (status != EFI_SUCCESS)
Matthew Garrett 447e3a6
+			continue;
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+		if (!attributes & EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM)
Matthew Garrett 447e3a6
+			continue;
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+		if (!pci->romimage || !pci->romsize)
Matthew Garrett 447e3a6
+			continue;
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+		size = pci->romsize + sizeof(*rom);
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+		status = efi_call_phys3(sys_table->boottime->allocate_pool,
Matthew Garrett 447e3a6
+				EFI_LOADER_DATA, size, &rom;;
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+		if (status != EFI_SUCCESS)
Matthew Garrett 447e3a6
+			continue;
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+		rom->data.type = SETUP_PCI;
Matthew Garrett 447e3a6
+		rom->data.len = size - sizeof(struct setup_data);
Matthew Garrett 447e3a6
+		rom->data.next = NULL;
Matthew Garrett 447e3a6
+		rom->pcilen = pci->romsize;
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+		status = efi_call_phys5(pci->pci.read, pci,
Matthew Garrett 447e3a6
+					EfiPciIoWidthUint16, PCI_VENDOR_ID,
Matthew Garrett 447e3a6
+					1, &(rom->vendor));
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+		if (status != EFI_SUCCESS)
Matthew Garrett 447e3a6
+			goto free_struct;
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+		status = efi_call_phys5(pci->pci.read, pci,
Matthew Garrett 447e3a6
+					EfiPciIoWidthUint16, PCI_DEVICE_ID,
Matthew Garrett 447e3a6
+					1, &(rom->devid));
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+		if (status != EFI_SUCCESS)
Matthew Garrett 447e3a6
+			goto free_struct;
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+		status = efi_call_phys5(pci->get_location, pci,
Matthew Garrett 447e3a6
+					&(rom->segment), &(rom->bus),
Matthew Garrett 447e3a6
+					&(rom->device), &(rom->function));
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+		if (status != EFI_SUCCESS)
Matthew Garrett 447e3a6
+			goto free_struct;
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+		memcpy(rom->romdata, pci->romimage, pci->romsize);
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+		if (data)
Matthew Garrett 447e3a6
+			data->next = (uint64_t)rom;
Matthew Garrett 447e3a6
+		else
Matthew Garrett 447e3a6
+			params->hdr.setup_data = (uint64_t)rom;
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+		data = (struct setup_data *)rom;
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+		continue;
Matthew Garrett 447e3a6
+	free_struct:
Matthew Garrett 447e3a6
+		efi_call_phys1(sys_table->boottime->free_pool, rom);
Matthew Garrett 447e3a6
+	}
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+free_handle:
Matthew Garrett 447e3a6
+	efi_call_phys1(sys_table->boottime->free_pool, pci_handle);
Matthew Garrett 447e3a6
+	return status;
Matthew Garrett 447e3a6
+}
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
 /*
Matthew Garrett 447e3a6
  * See if we have Graphics Output Protocol
Matthew Garrett 447e3a6
  */
Matthew Garrett 447e3a6
@@ -1052,6 +1171,8 @@
Matthew Garrett 447e3a6
 
Matthew Garrett 447e3a6
 	setup_graphics(boot_params);
Matthew Garrett 447e3a6
 
Matthew Garrett 447e3a6
+	setup_efi_pci(boot_params);
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
 	status = efi_call_phys3(sys_table->boottime->allocate_pool,
Matthew Garrett 447e3a6
 				EFI_LOADER_DATA, sizeof(*gdt),
Matthew Garrett 447e3a6
 				(void **)&gdt;;
Matthew Garrett 447e3a6
diff -ur linux-3.6.0-0.rc2.git2.1.fc18.x86_64/arch/x86/include/asm/bootparam.h ../kernel-3.5.fc18.bak/linux-3.6.0-0.rc2.git2.1.fc18.x86_64/arch/x86/include/asm/bootparam.h
Matthew Garrett 447e3a6
--- linux-3.6.0-0.rc2.git2.1.fc18.x86_64/arch/x86/include/asm/bootparam.h	2012-08-22 15:26:32.485522068 -0400
Matthew Garrett 447e3a6
+++ ../kernel-3.5.fc18.bak/linux-3.6.0-0.rc2.git2.1.fc18.x86_64/arch/x86/include/asm/bootparam.h	2012-08-22 15:25:40.530244882 -0400
Matthew Garrett 447e3a6
@@ -13,6 +13,7 @@
Matthew Garrett 447e3a6
 #define SETUP_NONE			0
Matthew Garrett 447e3a6
 #define SETUP_E820_EXT			1
Matthew Garrett 447e3a6
 #define SETUP_DTB			2
Matthew Garrett 447e3a6
+#define SETUP_PCI			3
Matthew Garrett 447e3a6
 
Matthew Garrett 447e3a6
 /* extensible setup data list node */
Matthew Garrett 447e3a6
 struct setup_data {
Matthew Garrett 447e3a6
diff -ur linux-3.6.0-0.rc2.git2.1.fc18.x86_64/arch/x86/include/asm/pci.h ../kernel-3.5.fc18.bak/linux-3.6.0-0.rc2.git2.1.fc18.x86_64/arch/x86/include/asm/pci.h
Matthew Garrett 447e3a6
--- linux-3.6.0-0.rc2.git2.1.fc18.x86_64/arch/x86/include/asm/pci.h	2012-07-21 16:58:29.000000000 -0400
Matthew Garrett 447e3a6
+++ ../kernel-3.5.fc18.bak/linux-3.6.0-0.rc2.git2.1.fc18.x86_64/arch/x86/include/asm/pci.h	2012-08-22 15:25:40.530244882 -0400
Matthew Garrett 447e3a6
@@ -171,4 +171,16 @@
Matthew Garrett 447e3a6
 }
Matthew Garrett 447e3a6
 #endif
Matthew Garrett 447e3a6
 
Matthew Garrett 447e3a6
+struct pci_setup_rom {
Matthew Garrett 447e3a6
+	struct setup_data data;
Matthew Garrett 447e3a6
+	uint16_t vendor;
Matthew Garrett 447e3a6
+	uint16_t devid;
Matthew Garrett 447e3a6
+	uint64_t pcilen;
Matthew Garrett 447e3a6
+	unsigned long segment;
Matthew Garrett 447e3a6
+	unsigned long bus;
Matthew Garrett 447e3a6
+	unsigned long device;
Matthew Garrett 447e3a6
+	unsigned long function;
Matthew Garrett 447e3a6
+	uint8_t romdata[0];
Matthew Garrett 447e3a6
+};
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
 #endif /* _ASM_X86_PCI_H */
Matthew Garrett 447e3a6
diff -ur linux-3.6.0-0.rc2.git2.1.fc18.x86_64/arch/x86/pci/common.c ../kernel-3.5.fc18.bak/linux-3.6.0-0.rc2.git2.1.fc18.x86_64/arch/x86/pci/common.c
Matthew Garrett 447e3a6
--- linux-3.6.0-0.rc2.git2.1.fc18.x86_64/arch/x86/pci/common.c	2012-08-22 15:24:45.477951182 -0400
Matthew Garrett 447e3a6
+++ ../kernel-3.5.fc18.bak/linux-3.6.0-0.rc2.git2.1.fc18.x86_64/arch/x86/pci/common.c	2012-08-22 15:25:40.530244882 -0400
Matthew Garrett 447e3a6
@@ -17,6 +17,7 @@
Matthew Garrett 447e3a6
 #include <asm/io.h>
Matthew Garrett 447e3a6
 #include <asm/smp.h>
Matthew Garrett 447e3a6
 #include <asm/pci_x86.h>
Matthew Garrett 447e3a6
+#include <asm/setup.h>
Matthew Garrett 447e3a6
 
Matthew Garrett 447e3a6
 unsigned int pci_probe = PCI_PROBE_BIOS | PCI_PROBE_CONF1 | PCI_PROBE_CONF2 |
Matthew Garrett 447e3a6
 				PCI_PROBE_MMCONF;
Matthew Garrett 447e3a6
@@ -608,6 +609,38 @@
Matthew Garrett 447e3a6
 	return (pci_probe & PCI_ASSIGN_ALL_BUSSES) ? 1 : 0;
Matthew Garrett 447e3a6
 }
Matthew Garrett 447e3a6
 
Matthew Garrett 447e3a6
+int pcibios_add_device(struct pci_dev *dev)
Matthew Garrett 447e3a6
+{
Matthew Garrett 447e3a6
+	struct setup_data *data;
Matthew Garrett 447e3a6
+	struct pci_setup_rom *rom;
Matthew Garrett 447e3a6
+	u64 pa_data;
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+	if (boot_params.hdr.version < 0x0209)
Matthew Garrett 447e3a6
+		return 0;
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+	pa_data = boot_params.hdr.setup_data;
Matthew Garrett 447e3a6
+	while (pa_data) {
Matthew Garrett 447e3a6
+		data = phys_to_virt(pa_data);
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+		if (data->type == SETUP_PCI) {
Matthew Garrett 447e3a6
+			rom = (struct pci_setup_rom *)data;
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+			if ((pci_domain_nr(dev->bus) == rom->segment) &&
Matthew Garrett 447e3a6
+			    (dev->bus->number == rom->bus) &&
Matthew Garrett 447e3a6
+			    (PCI_SLOT(dev->devfn) == rom->device) &&
Matthew Garrett 447e3a6
+			    (PCI_FUNC(dev->devfn) == rom->function) &&
Matthew Garrett 447e3a6
+			    (dev->vendor == rom->vendor) &&
Matthew Garrett 447e3a6
+			    (dev->device == rom->devid)) {
Matthew Garrett 447e3a6
+				dev->rom = (void *)(pa_data +
Matthew Garrett 447e3a6
+				      offsetof(struct pci_setup_rom, romdata));
Matthew Garrett 447e3a6
+				dev->romlen = rom->pcilen;
Matthew Garrett 447e3a6
+			}
Matthew Garrett 447e3a6
+		}
Matthew Garrett 447e3a6
+		pa_data = data->next;
Matthew Garrett 447e3a6
+	}
Matthew Garrett 447e3a6
+	return 0;
Matthew Garrett 447e3a6
+}
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
 int pcibios_enable_device(struct pci_dev *dev, int mask)
Matthew Garrett 447e3a6
 {
Matthew Garrett 447e3a6
 	int err;
Matthew Garrett 447e3a6
diff -ur linux-3.6.0-0.rc2.git2.1.fc18.x86_64/drivers/pci/bus.c ../kernel-3.5.fc18.bak/linux-3.6.0-0.rc2.git2.1.fc18.x86_64/drivers/pci/bus.c
Matthew Garrett 447e3a6
--- linux-3.6.0-0.rc2.git2.1.fc18.x86_64/drivers/pci/bus.c	2012-08-22 15:24:47.425961575 -0400
Matthew Garrett 447e3a6
+++ ../kernel-3.5.fc18.bak/linux-3.6.0-0.rc2.git2.1.fc18.x86_64/drivers/pci/bus.c	2012-08-22 15:26:20.147456241 -0400
Matthew Garrett 447e3a6
@@ -166,6 +166,11 @@
Matthew Garrett 447e3a6
 	int retval;
Matthew Garrett 447e3a6
 
Matthew Garrett 447e3a6
 	pci_fixup_device(pci_fixup_final, dev);
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+	retval = pcibios_add_device(dev);
Matthew Garrett 447e3a6
+	if (retval)
Matthew Garrett 447e3a6
+		return retval;
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
 	retval = device_add(&dev->dev);
Matthew Garrett 447e3a6
 	if (retval)
Matthew Garrett 447e3a6
 		return retval;
Matthew Garrett 447e3a6
diff -ur linux-3.6.0-0.rc2.git2.1.fc18.x86_64/drivers/pci/pci.c ../kernel-3.5.fc18.bak/linux-3.6.0-0.rc2.git2.1.fc18.x86_64/drivers/pci/pci.c
Matthew Garrett 447e3a6
--- linux-3.6.0-0.rc2.git2.1.fc18.x86_64/drivers/pci/pci.c	2012-08-22 15:24:47.432961612 -0400
Matthew Garrett 447e3a6
+++ ../kernel-3.5.fc18.bak/linux-3.6.0-0.rc2.git2.1.fc18.x86_64/drivers/pci/pci.c	2012-08-22 15:25:40.531244893 -0400
Matthew Garrett 447e3a6
@@ -1385,6 +1385,19 @@
Matthew Garrett 447e3a6
 		dr->pinned = 1;
Matthew Garrett 447e3a6
 }
Matthew Garrett 447e3a6
 
Matthew Garrett 447e3a6
+/*
Matthew Garrett 447e3a6
+ * pcibios_add_device - provide arch specific hooks when adding device dev
Matthew Garrett 447e3a6
+ * @dev: the PCI device being added
Matthew Garrett 447e3a6
+ *
Matthew Garrett 447e3a6
+ * Permits the platform to provide architecture specific functionality when
Matthew Garrett 447e3a6
+ * devices are added. This is the default implementation. Architecture
Matthew Garrett 447e3a6
+ * implementations can override this.
Matthew Garrett 447e3a6
+ */
Matthew Garrett 447e3a6
+int __attribute__ ((weak)) pcibios_add_device (struct pci_dev *dev)
Matthew Garrett 447e3a6
+{
Matthew Garrett 447e3a6
+	return 0;
Matthew Garrett 447e3a6
+}
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
 /**
Matthew Garrett 447e3a6
  * pcibios_disable_device - disable arch specific PCI resources for device dev
Matthew Garrett 447e3a6
  * @dev: the PCI device to disable
Matthew Garrett 447e3a6
diff -ur linux-3.6.0-0.rc2.git2.1.fc18.x86_64/drivers/pci/rom.c ../kernel-3.5.fc18.bak/linux-3.6.0-0.rc2.git2.1.fc18.x86_64/drivers/pci/rom.c
Matthew Garrett 447e3a6
--- linux-3.6.0-0.rc2.git2.1.fc18.x86_64/drivers/pci/rom.c	2012-07-21 16:58:29.000000000 -0400
Matthew Garrett 447e3a6
+++ ../kernel-3.5.fc18.bak/linux-3.6.0-0.rc2.git2.1.fc18.x86_64/drivers/pci/rom.c	2012-08-22 15:25:40.531244893 -0400
Matthew Garrett 447e3a6
@@ -126,6 +126,12 @@
Matthew Garrett 447e3a6
 		/* primary video rom always starts here */
Matthew Garrett 447e3a6
 		start = (loff_t)0xC0000;
Matthew Garrett 447e3a6
 		*size = 0x20000; /* cover C000:0 through E000:0 */
Matthew Garrett 447e3a6
+	/*
Matthew Garrett 447e3a6
+	 * Some devices may provide ROMs via a source other than the BAR
Matthew Garrett 447e3a6
+	 */
Matthew Garrett 447e3a6
+	} else if (pdev->rom && pdev->romlen) {
Matthew Garrett 447e3a6
+		*size = pdev->romlen;
Matthew Garrett 447e3a6
+		return phys_to_virt(pdev->rom);
Matthew Garrett 447e3a6
 	} else {
Matthew Garrett 447e3a6
 		if (res->flags &
Matthew Garrett 447e3a6
 			(IORESOURCE_ROM_COPY | IORESOURCE_ROM_BIOS_COPY)) {
Matthew Garrett 447e3a6
@@ -219,7 +225,8 @@
Matthew Garrett 447e3a6
 	if (res->flags & (IORESOURCE_ROM_COPY | IORESOURCE_ROM_BIOS_COPY))
Matthew Garrett 447e3a6
 		return;
Matthew Garrett 447e3a6
 
Matthew Garrett 447e3a6
-	iounmap(rom);
Matthew Garrett 447e3a6
+	if (!pdev->rom || !pdev->romlen)
Matthew Garrett 447e3a6
+		iounmap(rom);
Matthew Garrett 447e3a6
 
Matthew Garrett 447e3a6
 	/* Disable again before continuing, leave enabled if pci=rom */
Matthew Garrett 447e3a6
 	if (!(res->flags & (IORESOURCE_ROM_ENABLE | IORESOURCE_ROM_SHADOW)))
Matthew Garrett 447e3a6
diff -ur linux-3.6.0-0.rc2.git2.1.fc18.x86_64/include/linux/efi.h ../kernel-3.5.fc18.bak/linux-3.6.0-0.rc2.git2.1.fc18.x86_64/include/linux/efi.h
Matthew Garrett 447e3a6
--- linux-3.6.0-0.rc2.git2.1.fc18.x86_64/include/linux/efi.h	2012-08-22 15:24:49.550972911 -0400
Matthew Garrett 447e3a6
+++ ../kernel-3.5.fc18.bak/linux-3.6.0-0.rc2.git2.1.fc18.x86_64/include/linux/efi.h	2012-08-22 15:25:40.533244906 -0400
Matthew Garrett 447e3a6
@@ -196,6 +196,77 @@
Matthew Garrett 447e3a6
 	void *create_event_ex;
Matthew Garrett 447e3a6
 } efi_boot_services_t;
Matthew Garrett 447e3a6
 
Matthew Garrett 447e3a6
+typedef enum {
Matthew Garrett 447e3a6
+	EfiPciIoWidthUint8,
Matthew Garrett 447e3a6
+	EfiPciIoWidthUint16,
Matthew Garrett 447e3a6
+	EfiPciIoWidthUint32,
Matthew Garrett 447e3a6
+	EfiPciIoWidthUint64,
Matthew Garrett 447e3a6
+	EfiPciIoWidthFifoUint8,
Matthew Garrett 447e3a6
+	EfiPciIoWidthFifoUint16,
Matthew Garrett 447e3a6
+	EfiPciIoWidthFifoUint32,
Matthew Garrett 447e3a6
+	EfiPciIoWidthFifoUint64,
Matthew Garrett 447e3a6
+	EfiPciIoWidthFillUint8,
Matthew Garrett 447e3a6
+	EfiPciIoWidthFillUint16,
Matthew Garrett 447e3a6
+	EfiPciIoWidthFillUint32,
Matthew Garrett 447e3a6
+	EfiPciIoWidthFillUint64,
Matthew Garrett 447e3a6
+	EfiPciIoWidthMaximum
Matthew Garrett 447e3a6
+} EFI_PCI_IO_PROTOCOL_WIDTH;
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+typedef enum {
Matthew Garrett 447e3a6
+	EfiPciIoAttributeOperationGet,
Matthew Garrett 447e3a6
+	EfiPciIoAttributeOperationSet,
Matthew Garrett 447e3a6
+	EfiPciIoAttributeOperationEnable,
Matthew Garrett 447e3a6
+	EfiPciIoAttributeOperationDisable,
Matthew Garrett 447e3a6
+	EfiPciIoAttributeOperationSupported,
Matthew Garrett 447e3a6
+    EfiPciIoAttributeOperationMaximum
Matthew Garrett 447e3a6
+} EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION;
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+typedef struct {
Matthew Garrett 447e3a6
+	void *read;
Matthew Garrett 447e3a6
+	void *write;
Matthew Garrett 447e3a6
+} efi_pci_io_protocol_access_t;
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+typedef struct {
Matthew Garrett 447e3a6
+	void *poll_mem;
Matthew Garrett 447e3a6
+	void *poll_io;
Matthew Garrett 447e3a6
+	efi_pci_io_protocol_access_t mem;
Matthew Garrett 447e3a6
+	efi_pci_io_protocol_access_t io;
Matthew Garrett 447e3a6
+	efi_pci_io_protocol_access_t pci;
Matthew Garrett 447e3a6
+	void *copy_mem;
Matthew Garrett 447e3a6
+	void *map;
Matthew Garrett 447e3a6
+	void *unmap;
Matthew Garrett 447e3a6
+	void *allocate_buffer;
Matthew Garrett 447e3a6
+	void *free_buffer;
Matthew Garrett 447e3a6
+	void *flush;
Matthew Garrett 447e3a6
+	void *get_location;
Matthew Garrett 447e3a6
+	void *attributes;
Matthew Garrett 447e3a6
+	void *get_bar_attributes;
Matthew Garrett 447e3a6
+	void *set_bar_attributes;
Matthew Garrett 447e3a6
+	uint64_t romsize;
Matthew Garrett 447e3a6
+	void *romimage;
Matthew Garrett 447e3a6
+} efi_pci_io_protocol;
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
+#define EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO 0x0001
Matthew Garrett 447e3a6
+#define EFI_PCI_IO_ATTRIBUTE_ISA_IO 0x0002
Matthew Garrett 447e3a6
+#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO 0x0004
Matthew Garrett 447e3a6
+#define EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY 0x0008
Matthew Garrett 447e3a6
+#define EFI_PCI_IO_ATTRIBUTE_VGA_IO 0x0010
Matthew Garrett 447e3a6
+#define EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO 0x0020
Matthew Garrett 447e3a6
+#define EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO 0x0040
Matthew Garrett 447e3a6
+#define EFI_PCI_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE 0x0080
Matthew Garrett 447e3a6
+#define EFI_PCI_IO_ATTRIBUTE_IO 0x0100
Matthew Garrett 447e3a6
+#define EFI_PCI_IO_ATTRIBUTE_MEMORY 0x0200
Matthew Garrett 447e3a6
+#define EFI_PCI_IO_ATTRIBUTE_BUS_MASTER 0x0400
Matthew Garrett 447e3a6
+#define EFI_PCI_IO_ATTRIBUTE_MEMORY_CACHED 0x0800
Matthew Garrett 447e3a6
+#define EFI_PCI_IO_ATTRIBUTE_MEMORY_DISABLE 0x1000
Matthew Garrett 447e3a6
+#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_DEVICE 0x2000
Matthew Garrett 447e3a6
+#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM 0x4000
Matthew Garrett 447e3a6
+#define EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE 0x8000
Matthew Garrett 447e3a6
+#define EFI_PCI_IO_ATTRIBUTE_ISA_IO_16 0x10000
Matthew Garrett 447e3a6
+#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16 0x20000
Matthew Garrett 447e3a6
+#define EFI_PCI_IO_ATTRIBUTE_VGA_IO_16 0x40000
Matthew Garrett 447e3a6
+
Matthew Garrett 447e3a6
 /*
Matthew Garrett 447e3a6
  * Types and defines for EFI ResetSystem
Matthew Garrett 447e3a6
  */
Matthew Garrett 447e3a6
diff -ur linux-3.6.0-0.rc2.git2.1.fc18.x86_64/include/linux/pci.h ../kernel-3.5.fc18.bak/linux-3.6.0-0.rc2.git2.1.fc18.x86_64/include/linux/pci.h
Matthew Garrett 447e3a6
--- linux-3.6.0-0.rc2.git2.1.fc18.x86_64/include/linux/pci.h	2012-08-22 15:24:48.703968392 -0400
Matthew Garrett 447e3a6
+++ ../kernel-3.5.fc18.bak/linux-3.6.0-0.rc2.git2.1.fc18.x86_64/include/linux/pci.h	2012-08-22 15:25:40.534244910 -0400
Matthew Garrett 447e3a6
@@ -355,6 +355,8 @@
Matthew Garrett 447e3a6
 	};
Matthew Garrett 447e3a6
 	struct pci_ats	*ats;	/* Address Translation Service */
Matthew Garrett 447e3a6
 #endif
Matthew Garrett 447e3a6
+	void *rom; /* Physical pointer to ROM if it's not from the BAR */
Matthew Garrett 447e3a6
+	size_t romlen; /* Length of ROM if it's not from the BAR */
Matthew Garrett 447e3a6
 };
Matthew Garrett 447e3a6
 
Matthew Garrett 447e3a6
 static inline struct pci_dev *pci_physfn(struct pci_dev *dev)
Matthew Garrett 447e3a6
@@ -1582,6 +1584,7 @@
Matthew Garrett 447e3a6
 void pcibios_set_master(struct pci_dev *dev);
Matthew Garrett 447e3a6
 int pcibios_set_pcie_reset_state(struct pci_dev *dev,
Matthew Garrett 447e3a6
 				 enum pcie_reset_state state);
Matthew Garrett 447e3a6
+int pcibios_add_device(struct pci_dev *dev);
Matthew Garrett 447e3a6
 
Matthew Garrett 447e3a6
 #ifdef CONFIG_PCI_MMCONFIG
Matthew Garrett 447e3a6
 extern void __init pci_mmcfg_early_init(void);