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>
This commit is contained in:
parent
a67eaec0d0
commit
8f5138d8a5
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue