From: Chris Wright <chrisw@osdl.org>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: Justin Forbes <jmforbes@linuxtx.org>,
Zwane Mwaikambo <zwane@arm.linux.org.uk>,
"Theodore Ts'o" <tytso@mit.edu>,
Randy Dunlap <rdunlap@xenotime.net>,
Chuck Wolber <chuckw@quantumlinux.com>,
torvalds@osdl.org, akpm@osdl.org, alan@lxorguk.ukuu.org.uk,
Linus Torvalds <torvalds@osdl.org>,
Chris Wright <chrisw@osdl.org>
Subject: [PATCH 05/11] Sun GEM ethernet: enable and map PCI ROM properly
Date: Wed, 14 Sep 2005 18:03:48 -0700 [thread overview]
Message-ID: <20050915010405.460144000@localhost.localdomain> (raw)
In-Reply-To: 20050915010343.577985000@localhost.localdomain
[-- Attachment #1: sungem-enable-and-map-pci-rom-properly.patch --]
[-- Type: text/plain, Size: 2432 bytes --]
-stable review patch. If anyone has any objections, please let us know.
------------------
This same patch was reported to fix the MAC address detection on sunhme
(next patch). Most people seem to be running this on Sparcs or PPC
machines, where we get the MAC address from their respective firmware
rather than from the (previously broken) ROM mapping routines.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Chris Wright <chrisw@osdl.org>
---
drivers/net/sungem.c | 36 ++++++++++++++----------------------
1 files changed, 14 insertions(+), 22 deletions(-)
Index: linux-2.6.13.y/drivers/net/sungem.c
===================================================================
--- linux-2.6.13.y.orig/drivers/net/sungem.c
+++ linux-2.6.13.y/drivers/net/sungem.c
@@ -2816,7 +2816,7 @@ static int gem_ioctl(struct net_device *
#if (!defined(__sparc__) && !defined(CONFIG_PPC_PMAC))
/* Fetch MAC address from vital product data of PCI ROM. */
-static void find_eth_addr_in_vpd(void __iomem *rom_base, int len, unsigned char *dev_addr)
+static int find_eth_addr_in_vpd(void __iomem *rom_base, int len, unsigned char *dev_addr)
{
int this_offset;
@@ -2837,35 +2837,27 @@ static void find_eth_addr_in_vpd(void __
for (i = 0; i < 6; i++)
dev_addr[i] = readb(p + i);
- break;
+ return 1;
}
+ return 0;
}
static void get_gem_mac_nonobp(struct pci_dev *pdev, unsigned char *dev_addr)
{
- u32 rom_reg_orig;
- void __iomem *p;
-
- if (pdev->resource[PCI_ROM_RESOURCE].parent == NULL) {
- if (pci_assign_resource(pdev, PCI_ROM_RESOURCE) < 0)
- goto use_random;
- }
-
- pci_read_config_dword(pdev, pdev->rom_base_reg, &rom_reg_orig);
- pci_write_config_dword(pdev, pdev->rom_base_reg,
- rom_reg_orig | PCI_ROM_ADDRESS_ENABLE);
+ size_t size;
+ void __iomem *p = pci_map_rom(pdev, &size);
- p = ioremap(pci_resource_start(pdev, PCI_ROM_RESOURCE), (64 * 1024));
- if (p != NULL && readb(p) == 0x55 && readb(p + 1) == 0xaa)
- find_eth_addr_in_vpd(p, (64 * 1024), dev_addr);
+ if (p) {
+ int found;
- if (p != NULL)
- iounmap(p);
-
- pci_write_config_dword(pdev, pdev->rom_base_reg, rom_reg_orig);
- return;
+ found = readb(p) == 0x55 &&
+ readb(p + 1) == 0xaa &&
+ find_eth_addr_in_vpd(p, (64 * 1024), dev_addr);
+ pci_unmap_rom(pdev, p);
+ if (found)
+ return;
+ }
-use_random:
/* Sun MAC prefix then 3 random bytes. */
dev_addr[0] = 0x08;
dev_addr[1] = 0x00;
--
next prev parent reply other threads:[~2005-09-15 1:04 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-15 1:03 [PATCH 00/11] -stable review Chris Wright
2005-09-15 1:03 ` [PATCH 01/11] [PATCH] lost fput in 32bit ioctl on x86-64 Chris Wright
2005-09-15 1:03 ` [PATCH 02/11] [PATCH] Lost sockfd_put() in routing_ioctl() Chris Wright
2005-09-15 1:03 ` [PATCH 03/11] [PATCH] forcedeth: Initialize link settings in every nv_open() Chris Wright
2005-09-15 1:03 ` [PATCH 04/11] hpt366: write the full 4 bytes of ROM address, not just low 1 byte Chris Wright
2005-09-15 2:18 ` David Lang
2005-09-15 2:26 ` Andrew Morton
2005-09-15 2:29 ` [PATCH 04/11] hpt366: write the full 4 bytes of ROM address,not " David Lang
2005-09-15 6:11 ` [PATCH 04/11] hpt366: write the full 4 bytes of ROM address, not " Chris Wright
2005-09-15 10:39 ` David Lang
2005-09-15 10:28 ` Martin Mares
2005-09-15 1:03 ` Chris Wright [this message]
2005-09-15 1:03 ` [PATCH 06/11] [stable] [ROM 3/3] Sun HME: enable and map PCI ROM properly Chris Wright
2005-09-15 1:03 ` [PATCH 07/11] [NETFILTER]: Fix DHCP + MASQUERADE problem Chris Wright
2005-09-15 1:03 ` [PATCH 08/11] jfs: jfs_delete_inode must call clear_inode Chris Wright
2005-09-15 1:03 ` [PATCH 09/11] [PATCH] Fix MPOL_F_VERIFY Chris Wright
2005-09-15 1:03 ` [PATCH 10/11] Fix up more strange byte writes to the PCI_ROM_ADDRESS config word Chris Wright
2005-09-15 1:03 ` [PATCH 11/11] USB: ftdi_sio: custom baud rate fix Chris Wright
2005-09-15 7:36 ` [PATCH 00/11] -stable review Alexander Nyberg
2005-09-15 20:04 ` Chris Wright
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050915010405.460144000@localhost.localdomain \
--to=chrisw@osdl.org \
--cc=akpm@osdl.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=chuckw@quantumlinux.com \
--cc=jmforbes@linuxtx.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rdunlap@xenotime.net \
--cc=stable@kernel.org \
--cc=torvalds@osdl.org \
--cc=tytso@mit.edu \
--cc=zwane@arm.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox