/[linux-patches]/genpatches-2.6/tags/2.6.13-4/1019_2_sunhme-enable-and-map-pci-rom-properly.patch
Gentoo

Contents of /genpatches-2.6/tags/2.6.13-4/1019_2_sunhme-enable-and-map-pci-rom-properly.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 168 - (show annotations) (download)
Sun Sep 18 11:19:29 2005 UTC (8 years, 10 months ago) by dsd
File size: 2767 byte(s)
2.6.13-4 release
1 From stable-bounces@linux.kernel.org Sun Sep 11 14:10:11 2005
2 Date: Sun, 11 Sep 2005 14:10:02 -0700 (PDT)
3 From: Linus Torvalds <torvalds@osdl.org>
4 To: stable@kernel.org
5 Cc:
6 Subject: Sun HME: enable and map PCI ROM properly
7
8 From: Willy Tarreau <willy@w.ods.org>
9
10 This ports the Sun GEM ROM mapping/enable fixes it sunhme (which used
11 the same PCI ROM mapping code).
12
13 Without this, I get NULL MAC addresses for all 4 ports (it's a SUN QFE).
14 With it, I get the correct addresses (the ones printed on the label on
15 the card).
16
17 Signed-off-by: Linus Torvalds <torvalds@osdl.org>
18 Signed-off-by: Chris Wright <chrisw@osdl.org>
19 ---
20 drivers/net/sunhme.c | 45 ++++++++++++++++++---------------------------
21 1 files changed, 18 insertions(+), 27 deletions(-)
22
23 Index: linux-2.6.13.y/drivers/net/sunhme.c
24 ===================================================================
25 --- linux-2.6.13.y.orig/drivers/net/sunhme.c
26 +++ linux-2.6.13.y/drivers/net/sunhme.c
27 @@ -2954,7 +2954,7 @@ static int is_quattro_p(struct pci_dev *
28 }
29
30 /* Fetch MAC address from vital product data of PCI ROM. */
31 -static void find_eth_addr_in_vpd(void __iomem *rom_base, int len, int index, unsigned char *dev_addr)
32 +static int find_eth_addr_in_vpd(void __iomem *rom_base, int len, int index, unsigned char *dev_addr)
33 {
34 int this_offset;
35
36 @@ -2977,42 +2977,33 @@ static void find_eth_addr_in_vpd(void __
37
38 for (i = 0; i < 6; i++)
39 dev_addr[i] = readb(p + i);
40 - break;
41 + return 1;
42 }
43 index--;
44 }
45 + return 0;
46 }
47
48 static void get_hme_mac_nonsparc(struct pci_dev *pdev, unsigned char *dev_addr)
49 {
50 - u32 rom_reg_orig;
51 - void __iomem *p;
52 - int index;
53 + size_t size;
54 + void __iomem *p = pci_map_rom(pdev, &size);
55
56 - index = 0;
57 - if (is_quattro_p(pdev))
58 - index = PCI_SLOT(pdev->devfn);
59 -
60 - if (pdev->resource[PCI_ROM_RESOURCE].parent == NULL) {
61 - if (pci_assign_resource(pdev, PCI_ROM_RESOURCE) < 0)
62 - goto use_random;
63 + if (p) {
64 + int index = 0;
65 + int found;
66 +
67 + if (is_quattro_p(pdev))
68 + index = PCI_SLOT(pdev->devfn);
69 +
70 + found = readb(p) == 0x55 &&
71 + readb(p + 1) == 0xaa &&
72 + find_eth_addr_in_vpd(p, (64 * 1024), index, dev_addr);
73 + pci_unmap_rom(pdev, p);
74 + if (found)
75 + return;
76 }
77
78 - pci_read_config_dword(pdev, pdev->rom_base_reg, &rom_reg_orig);
79 - pci_write_config_dword(pdev, pdev->rom_base_reg,
80 - rom_reg_orig | PCI_ROM_ADDRESS_ENABLE);
81 -
82 - p = ioremap(pci_resource_start(pdev, PCI_ROM_RESOURCE), (64 * 1024));
83 - if (p != NULL && readb(p) == 0x55 && readb(p + 1) == 0xaa)
84 - find_eth_addr_in_vpd(p, (64 * 1024), index, dev_addr);
85 -
86 - if (p != NULL)
87 - iounmap(p);
88 -
89 - pci_write_config_dword(pdev, pdev->rom_base_reg, rom_reg_orig);
90 - return;
91 -
92 -use_random:
93 /* Sun MAC prefix then 3 random bytes. */
94 dev_addr[0] = 0x08;
95 dev_addr[1] = 0x00;

  ViewVC Help
Powered by ViewVC 1.1.20