diff options
author | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2019-09-27 18:08:20 +0300 |
---|---|---|
committer | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2019-09-28 21:16:40 +0000 |
commit | 8f5138d8a510d98e13e49d84afeaa8a075563571 (patch) | |
tree | 062c321ba5e123505186d08f805f5f792adc81b9 /src/drivers/net/ne2k.c | |
parent | a67eaec0d03213ccfbac2f1805b4de900fe9b123 (diff) | |
download | coreboot-8f5138d8a510d98e13e49d84afeaa8a075563571.tar.xz |
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>
Diffstat (limited to 'src/drivers/net/ne2k.c')
-rw-r--r-- | src/drivers/net/ne2k.c | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/src/drivers/net/ne2k.c b/src/drivers/net/ne2k.c index e3dd948a83..c7b53e4e7b 100644 --- a/src/drivers/net/ne2k.c +++ b/src/drivers/net/ne2k.c @@ -197,7 +197,8 @@ static void ns8390_tx_header(unsigned int eth_nic_base, int pktlen) 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 @@ void ne2k_transmit(unsigned int eth_nic_base) { set_count(eth_nic_base, 0); } -#if !ENV_RAMSTAGE - static void ns8390_reset(unsigned int eth_nic_base) { int i; @@ -267,24 +266,23 @@ static void ns8390_reset(unsigned int eth_nic_base) 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 @@ int ne2k_init(unsigned int eth_nic_base) { 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 @@ static const struct pci_driver ne2k_driver __pci_driver = { .vendor = 0x10ec, .device = 0x8029, }; - -#endif /* !ENV_RAMSTAGE */ |