* [PATCH] e1000: Fix for 32 bits platforms with 64 bits resources
@ 2007-11-16 7:37 Benjamin Herrenschmidt
2007-11-24 2:52 ` Jeff Garzik
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Benjamin Herrenschmidt @ 2007-11-16 7:37 UTC (permalink / raw)
To: auke-jan.h.kok; +Cc: netdev, jgarzik, linuxppc-dev
The e1000 driver stores the content of the PCI resources into
unsigned long's before ioremapping. This breaks on 32 bits
platforms that support 64 bits MMIO resources such as ppc 44x.
This fixes it by removing those temporary variables and passing
directly the result of pci_resource_start/len to ioremap.
The side effect is that I removed the assignments to the netdev
fields mem_start, mem_end and base_addr, which are totally useless
for PCI devices.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
--
drivers/net/e1000/e1000_main.c | 18 +++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)
Index: linux-work/drivers/net/e1000/e1000_main.c
===================================================================
--- linux-work.orig/drivers/net/e1000/e1000_main.c 2007-11-16 17:14:32.000000000 +1100
+++ linux-work/drivers/net/e1000/e1000_main.c 2007-11-16 18:32:07.000000000 +1100
@@ -861,8 +861,6 @@ e1000_probe(struct pci_dev *pdev,
{
struct net_device *netdev;
struct e1000_adapter *adapter;
- unsigned long mmio_start, mmio_len;
- unsigned long flash_start, flash_len;
static int cards_found = 0;
static int global_quad_port_a = 0; /* global ksp3 port a indication */
@@ -905,11 +903,9 @@ e1000_probe(struct pci_dev *pdev,
adapter->hw.back = adapter;
adapter->msg_enable = (1 << debug) - 1;
- mmio_start = pci_resource_start(pdev, BAR_0);
- mmio_len = pci_resource_len(pdev, BAR_0);
-
err = -EIO;
- adapter->hw.hw_addr = ioremap(mmio_start, mmio_len);
+ adapter->hw.hw_addr = ioremap(pci_resource_start(pdev, BAR_0),
+ pci_resource_len(pdev, BAR_0));
if (!adapter->hw.hw_addr)
goto err_ioremap;
@@ -944,10 +940,6 @@ e1000_probe(struct pci_dev *pdev,
#endif
strncpy(netdev->name, pci_name(pdev), sizeof(netdev->name) - 1);
- netdev->mem_start = mmio_start;
- netdev->mem_end = mmio_start + mmio_len;
- netdev->base_addr = adapter->hw.io_base;
-
adapter->bd_number = cards_found;
/* setup the private structure */
@@ -960,9 +952,9 @@ e1000_probe(struct pci_dev *pdev,
* because it depends on mac_type */
if ((adapter->hw.mac_type == e1000_ich8lan) &&
(pci_resource_flags(pdev, 1) & IORESOURCE_MEM)) {
- flash_start = pci_resource_start(pdev, 1);
- flash_len = pci_resource_len(pdev, 1);
- adapter->hw.flash_address = ioremap(flash_start, flash_len);
+ adapter->hw.flash_address =
+ ioremap(pci_resource_start(pdev, 1),
+ pci_resource_len(pdev, 1));
if (!adapter->hw.flash_address)
goto err_flashmap;
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] e1000: Fix for 32 bits platforms with 64 bits resources
2007-11-16 7:37 [PATCH] e1000: Fix for 32 bits platforms with 64 bits resources Benjamin Herrenschmidt
@ 2007-11-24 2:52 ` Jeff Garzik
2007-11-26 23:15 ` Kok, Auke
2007-11-28 18:47 ` Brandeburg, Jesse
2008-02-06 12:13 ` Jeff Garzik
2 siblings, 1 reply; 6+ messages in thread
From: Jeff Garzik @ 2007-11-24 2:52 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: netdev, auke-jan.h.kok, linuxppc-dev
Benjamin Herrenschmidt wrote:
> The e1000 driver stores the content of the PCI resources into
> unsigned long's before ioremapping. This breaks on 32 bits
> platforms that support 64 bits MMIO resources such as ppc 44x.
>
> This fixes it by removing those temporary variables and passing
> directly the result of pci_resource_start/len to ioremap.
>
> The side effect is that I removed the assignments to the netdev
> fields mem_start, mem_end and base_addr, which are totally useless
> for PCI devices.
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> --
>
> drivers/net/e1000/e1000_main.c | 18 +++++-------------
> 1 file changed, 5 insertions(+), 13 deletions(-)
Looks good to me. auke?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] e1000: Fix for 32 bits platforms with 64 bits resources
2007-11-24 2:52 ` Jeff Garzik
@ 2007-11-26 23:15 ` Kok, Auke
0 siblings, 0 replies; 6+ messages in thread
From: Kok, Auke @ 2007-11-26 23:15 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linuxppc-dev, auke-jan.h.kok, netdev
Jeff Garzik wrote:
> Benjamin Herrenschmidt wrote:
>> The e1000 driver stores the content of the PCI resources into
>> unsigned long's before ioremapping. This breaks on 32 bits
>> platforms that support 64 bits MMIO resources such as ppc 44x.
>>
>> This fixes it by removing those temporary variables and passing
>> directly the result of pci_resource_start/len to ioremap.
>>
>> The side effect is that I removed the assignments to the netdev
>> fields mem_start, mem_end and base_addr, which are totally useless
>> for PCI devices.
>>
>> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>> --
>>
>> drivers/net/e1000/e1000_main.c | 18 +++++-------------
>> 1 file changed, 5 insertions(+), 13 deletions(-)
>
> Looks good to me. auke?
yes, please apply.
Acked-by: Auke Kok <auke-jan.h.kok@intel.com>
Auke
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH] e1000: Fix for 32 bits platforms with 64 bits resources
2007-11-16 7:37 [PATCH] e1000: Fix for 32 bits platforms with 64 bits resources Benjamin Herrenschmidt
2007-11-24 2:52 ` Jeff Garzik
@ 2007-11-28 18:47 ` Brandeburg, Jesse
2007-11-28 19:52 ` Benjamin Herrenschmidt
2008-02-06 12:13 ` Jeff Garzik
2 siblings, 1 reply; 6+ messages in thread
From: Brandeburg, Jesse @ 2007-11-28 18:47 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Kok, Auke-jan H; +Cc: netdev, Jeff Garzik, linuxppc-dev
Benjamin Herrenschmidt wrote:
> The e1000 driver stores the content of the PCI resources into
> unsigned long's before ioremapping. This breaks on 32 bits
> platforms that support 64 bits MMIO resources such as ppc 44x.
>=20
> This fixes it by removing those temporary variables and passing
> directly the result of pci_resource_start/len to ioremap.
the patch is mostly fine, but looking through the tree, doesn't every
driver that has 64 bit capable resources have this problem?
in fact, skeleton module has this problem, if I'm not mistaken. e1000
isn't the only one. :-)
=20
> The side effect is that I removed the assignments to the netdev
> fields mem_start, mem_end and base_addr, which are totally useless
> for PCI devices.
also, concerning this, ifconfig shows the output of these variables, I
don't think we want to blatantly remove them, as it is actually removing
information that is, if not used, at least displayed to user space.
eth6 Link encap:Ethernet HWaddr 00:0E:01:0C:02:03
inet addr:134.134.3.121 Bcast:134.134.3.255
Mask:255.255.255.0
inet6 addr: fe80::20e:1ff:fe0c:203/64 Scope:Link
UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1
RX packets:9022519 errors:0 dropped:0 overruns:0 frame:0
TX packets:1303701 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4044613454 (3857.2 Mb) TX bytes:118365109 (112.8 Mb)
Base address:0xf000 Memory:feac0000-feae0000
^^^^^^^^^^^^^^^^^
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH] e1000: Fix for 32 bits platforms with 64 bits resources
2007-11-28 18:47 ` Brandeburg, Jesse
@ 2007-11-28 19:52 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 6+ messages in thread
From: Benjamin Herrenschmidt @ 2007-11-28 19:52 UTC (permalink / raw)
To: Brandeburg, Jesse; +Cc: netdev, Kok, Auke-jan H, Jeff Garzik, linuxppc-dev
On Wed, 2007-11-28 at 10:47 -0800, Brandeburg, Jesse wrote:
>
> > The side effect is that I removed the assignments to the netdev
> > fields mem_start, mem_end and base_addr, which are totally useless
> > for PCI devices.
>
> also, concerning this, ifconfig shows the output of these variables, I
> don't think we want to blatantly remove them, as it is actually removing
> information that is, if not used, at least displayed to user space.
It's not the right place to have that information and there is no
room in the user space field to fit more than 32 bits on 32 bits
platforms so I'd rather remove it. It's really only for ISA drivers that
have user configurable addresses.
Ben.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] e1000: Fix for 32 bits platforms with 64 bits resources
2007-11-16 7:37 [PATCH] e1000: Fix for 32 bits platforms with 64 bits resources Benjamin Herrenschmidt
2007-11-24 2:52 ` Jeff Garzik
2007-11-28 18:47 ` Brandeburg, Jesse
@ 2008-02-06 12:13 ` Jeff Garzik
2 siblings, 0 replies; 6+ messages in thread
From: Jeff Garzik @ 2008-02-06 12:13 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: netdev, auke-jan.h.kok, jgarzik, linuxppc-dev
Benjamin Herrenschmidt wrote:
> The e1000 driver stores the content of the PCI resources into
> unsigned long's before ioremapping. This breaks on 32 bits
> platforms that support 64 bits MMIO resources such as ppc 44x.
>
> This fixes it by removing those temporary variables and passing
> directly the result of pci_resource_start/len to ioremap.
>
> The side effect is that I removed the assignments to the netdev
> fields mem_start, mem_end and base_addr, which are totally useless
> for PCI devices.
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> --
>
> drivers/net/e1000/e1000_main.c | 18 +++++-------------
> 1 file changed, 5 insertions(+), 13 deletions(-)
applied
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-02-06 12:14 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-16 7:37 [PATCH] e1000: Fix for 32 bits platforms with 64 bits resources Benjamin Herrenschmidt
2007-11-24 2:52 ` Jeff Garzik
2007-11-26 23:15 ` Kok, Auke
2007-11-28 18:47 ` Brandeburg, Jesse
2007-11-28 19:52 ` Benjamin Herrenschmidt
2008-02-06 12:13 ` Jeff Garzik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).