/[linux-patches]/genpatches-2.6/tags/2.6.13-4/1001_1_fix-pci-rom-mapping.patch
Gentoo

Contents of /genpatches-2.6/tags/2.6.13-4/1001_1_fix-pci-rom-mapping.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 168 - (show annotations) (download)
Sun Sep 18 11:19:29 2005 UTC (9 years, 2 months ago) by dsd
File size: 2557 byte(s)
2.6.13-4 release
1 From stable-bounces@linux.kernel.org Sat Sep 3 15:29:40 2005
2 From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
3 To: stable@kernel.org
4 Date: Sun, 04 Sep 2005 08:28:05 +1000
5 Subject: [PATCH] Fix PCI ROM mapping
6
7 This fixes a problem with pci_map_rom() which doesn't properly
8 update the ROM BAR value with the address thas allocated for it by the
9 PCI code. This problem, among other, breaks boot on Mac laptops.
10
11 It'ss a new version based on Linus latest one with better error
12 checking.
13
14 Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
15 Signed-off-by: Linus Torvalds <torvalds@osdl.org>
16 Signed-off-by: Chris Wright <chrisw@osdl.org>
17 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
18 ---
19 drivers/pci/rom.c | 24 +++++++++++++++++-------
20 1 files changed, 17 insertions(+), 7 deletions(-)
21
22 Index: linux-2.6.13.y/drivers/pci/rom.c
23 ===================================================================
24 --- linux-2.6.13.y.orig/drivers/pci/rom.c
25 +++ linux-2.6.13.y/drivers/pci/rom.c
26 @@ -21,13 +21,21 @@
27 * between the ROM and other resources, so enabling it may disable access
28 * to MMIO registers or other card memory.
29 */
30 -static void pci_enable_rom(struct pci_dev *pdev)
31 +static int pci_enable_rom(struct pci_dev *pdev)
32 {
33 + struct resource *res = pdev->resource + PCI_ROM_RESOURCE;
34 + struct pci_bus_region region;
35 u32 rom_addr;
36
37 + if (!res->flags)
38 + return -1;
39 +
40 + pcibios_resource_to_bus(pdev, &region, res);
41 pci_read_config_dword(pdev, pdev->rom_base_reg, &rom_addr);
42 - rom_addr |= PCI_ROM_ADDRESS_ENABLE;
43 + rom_addr &= ~PCI_ROM_ADDRESS_MASK;
44 + rom_addr |= region.start | PCI_ROM_ADDRESS_ENABLE;
45 pci_write_config_dword(pdev, pdev->rom_base_reg, rom_addr);
46 + return 0;
47 }
48
49 /**
50 @@ -71,19 +79,21 @@ void __iomem *pci_map_rom(struct pci_dev
51 } else {
52 if (res->flags & IORESOURCE_ROM_COPY) {
53 *size = pci_resource_len(pdev, PCI_ROM_RESOURCE);
54 - return (void __iomem *)pci_resource_start(pdev, PCI_ROM_RESOURCE);
55 + return (void __iomem *)pci_resource_start(pdev,
56 + PCI_ROM_RESOURCE);
57 } else {
58 /* assign the ROM an address if it doesn't have one */
59 - if (res->parent == NULL)
60 - pci_assign_resource(pdev, PCI_ROM_RESOURCE);
61 -
62 + if (res->parent == NULL &&
63 + pci_assign_resource(pdev,PCI_ROM_RESOURCE))
64 + return NULL;
65 start = pci_resource_start(pdev, PCI_ROM_RESOURCE);
66 *size = pci_resource_len(pdev, PCI_ROM_RESOURCE);
67 if (*size == 0)
68 return NULL;
69
70 /* Enable ROM space decodes */
71 - pci_enable_rom(pdev);
72 + if (pci_enable_rom(pdev))
73 + return NULL;
74 }
75 }
76

  ViewVC Help
Powered by ViewVC 1.1.20