Kyösti Mälkki has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/35650 )
Change subject: drivers/net/ne2k: Remove some __SIMPLE_DEVICE__ use ......................................................................
drivers/net/ne2k: Remove some __SIMPLE_DEVICE__ use
Note that the code assumes mainboard code to configure any PCI bridges prior to calling console_init().
Change-Id: I0312d359f153c02e4afcf1c09d79f9eb3019a8b2 Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- M src/drivers/net/ne2k.c 1 file changed, 12 insertions(+), 19 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/50/35650/1
diff --git a/src/drivers/net/ne2k.c b/src/drivers/net/ne2k.c index e3dd948..c7b53e4 100644 --- a/src/drivers/net/ne2k.c +++ b/src/drivers/net/ne2k.c @@ -197,7 +197,8 @@ eth_pio_write(hdr, (TX_START << 8), sizeof(hdr), eth_nic_base); }
-void ne2k_transmit(unsigned int eth_nic_base) { +void ne2k_transmit(unsigned int eth_nic_base) +{ unsigned int pktsize; unsigned int len = get_count(eth_nic_base);
@@ -226,8 +227,6 @@ set_count(eth_nic_base, 0); }
-#if !ENV_RAMSTAGE - static void ns8390_reset(unsigned int eth_nic_base) { int i; @@ -267,24 +266,23 @@ set_count(eth_nic_base, 0); }
-int ne2k_init(unsigned int eth_nic_base) { - -#ifdef __SIMPLE_DEVICE__ +int ne2k_init(unsigned int eth_nic_base) +{ pci_devfn_t dev; -#else - struct device *dev; -#endif unsigned char c;
- /* Power management controller */ - dev = pci_locate_device(PCI_ID(0x10ec, - 0x8029), 0); + /* FIXME: This console is not enabled for bootblock. */ + if (!ENV_ROMSTAGE) + return 0;
+ /* For this to work, mainboard code must have configured + PCI bridges prior to calling console_init(). */ + dev = pci_locate_device(PCI_ID(0x10ec, 0x8029), 0); if (dev == PCI_DEV_INVALID) return 0;
- pci_write_config32(dev, 0x10, eth_nic_base | 1); - pci_write_config8(dev, 0x4, 0x1); + pci_s_write_config32(dev, 0x10, eth_nic_base | 1); + pci_s_write_config8(dev, 0x4, 0x1);
c = inb(eth_nic_base + NE_ASIC_OFFSET + NE_RESET); outb(c, eth_nic_base + NE_ASIC_OFFSET + NE_RESET); @@ -302,9 +300,6 @@ return 1; }
-#else -int ne2k_init(unsigned int eth_nic_base) { return 0; } // dummy symbol for ramstage - static void read_resources(struct device *dev) { struct resource *res; @@ -333,5 +328,3 @@ .vendor = 0x10ec, .device = 0x8029, }; - -#endif /* !ENV_RAMSTAGE */
Aaron Durbin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35650 )
Change subject: drivers/net/ne2k: Remove some __SIMPLE_DEVICE__ use ......................................................................
Patch Set 2: Code-Review+2
Kyösti Mälkki has submitted this change. ( https://review.coreboot.org/c/coreboot/+/35650 )
Change subject: drivers/net/ne2k: Remove some __SIMPLE_DEVICE__ use ......................................................................
drivers/net/ne2k: Remove some __SIMPLE_DEVICE__ use
Note that the code assumes mainboard code to configure any PCI bridges prior to calling console_init().
Change-Id: I0312d359f153c02e4afcf1c09d79f9eb3019a8b2 Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/35650 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Aaron Durbin adurbin@chromium.org --- M src/drivers/net/ne2k.c 1 file changed, 12 insertions(+), 19 deletions(-)
Approvals: build bot (Jenkins): Verified Aaron Durbin: Looks good to me, approved
diff --git a/src/drivers/net/ne2k.c b/src/drivers/net/ne2k.c index e3dd948..c7b53e4 100644 --- a/src/drivers/net/ne2k.c +++ b/src/drivers/net/ne2k.c @@ -197,7 +197,8 @@ eth_pio_write(hdr, (TX_START << 8), sizeof(hdr), eth_nic_base); }
-void ne2k_transmit(unsigned int eth_nic_base) { +void ne2k_transmit(unsigned int eth_nic_base) +{ unsigned int pktsize; unsigned int len = get_count(eth_nic_base);
@@ -226,8 +227,6 @@ set_count(eth_nic_base, 0); }
-#if !ENV_RAMSTAGE - static void ns8390_reset(unsigned int eth_nic_base) { int i; @@ -267,24 +266,23 @@ set_count(eth_nic_base, 0); }
-int ne2k_init(unsigned int eth_nic_base) { - -#ifdef __SIMPLE_DEVICE__ +int ne2k_init(unsigned int eth_nic_base) +{ pci_devfn_t dev; -#else - struct device *dev; -#endif unsigned char c;
- /* Power management controller */ - dev = pci_locate_device(PCI_ID(0x10ec, - 0x8029), 0); + /* FIXME: This console is not enabled for bootblock. */ + if (!ENV_ROMSTAGE) + return 0;
+ /* For this to work, mainboard code must have configured + PCI bridges prior to calling console_init(). */ + dev = pci_locate_device(PCI_ID(0x10ec, 0x8029), 0); if (dev == PCI_DEV_INVALID) return 0;
- pci_write_config32(dev, 0x10, eth_nic_base | 1); - pci_write_config8(dev, 0x4, 0x1); + pci_s_write_config32(dev, 0x10, eth_nic_base | 1); + pci_s_write_config8(dev, 0x4, 0x1);
c = inb(eth_nic_base + NE_ASIC_OFFSET + NE_RESET); outb(c, eth_nic_base + NE_ASIC_OFFSET + NE_RESET); @@ -302,9 +300,6 @@ return 1; }
-#else -int ne2k_init(unsigned int eth_nic_base) { return 0; } // dummy symbol for ramstage - static void read_resources(struct device *dev) { struct resource *res; @@ -333,5 +328,3 @@ .vendor = 0x10ec, .device = 0x8029, }; - -#endif /* !ENV_RAMSTAGE */