Revision 97526229 hw/pcnet.c
b/hw/pcnet.c | ||
---|---|---|
1981 | 1981 |
|
1982 | 1982 |
pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_AMD); |
1983 | 1983 |
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_AMD_LANCE); |
1984 |
*(uint16_t *)&pci_conf[0x04] = cpu_to_le16(0x0007); |
|
1985 |
*(uint16_t *)&pci_conf[0x06] = cpu_to_le16(0x0280); |
|
1986 |
pci_conf[0x08] = 0x10; |
|
1987 |
pci_conf[0x09] = 0x00; |
|
1984 |
/* TODO: value should be 0 at RST# */ |
|
1985 |
pci_set_word(pci_conf + PCI_COMMAND, |
|
1986 |
PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER); |
|
1987 |
pci_set_word(pci_conf + PCI_STATUS, |
|
1988 |
PCI_STATUS_FAST_BACK | PCI_STATUS_DEVSEL_MEDIUM); |
|
1989 |
pci_conf[PCI_REVISION_ID] = 0x10; |
|
1990 |
/* TODO: 0 is the default anyway, no need to set it. */ |
|
1991 |
pci_conf[PCI_CLASS_PROG] = 0x00; |
|
1988 | 1992 |
pci_config_set_class(pci_conf, PCI_CLASS_NETWORK_ETHERNET); |
1989 | 1993 |
pci_conf[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL; // header_type |
1990 | 1994 |
|
1991 |
*(uint32_t *)&pci_conf[0x10] = cpu_to_le32(0x00000001); |
|
1992 |
*(uint32_t *)&pci_conf[0x14] = cpu_to_le32(0x00000000); |
|
1995 |
/* TODO: not necessary, is set when BAR is registered. */ |
|
1996 |
pci_set_long(pci_conf + PCI_BASE_ADDRESS_0, PCI_BASE_ADDRESS_SPACE_IO); |
|
1997 |
pci_set_long(pci_conf + PCI_BASE_ADDRESS_0 + 4, |
|
1998 |
PCI_BASE_ADDRESS_SPACE_MEMORY); |
|
1993 | 1999 |
|
1994 |
pci_conf[0x3d] = 1; // interrupt pin 0 |
|
1995 |
pci_conf[0x3e] = 0x06; |
|
1996 |
pci_conf[0x3f] = 0xff; |
|
2000 |
/* TODO: value must be 0 at RST# */ |
|
2001 |
pci_conf[PCI_INTERRUPT_PIN] = 1; // interrupt pin 0 |
|
2002 |
pci_conf[PCI_MIN_GNT] = 0x06; |
|
2003 |
pci_conf[PCI_MAX_LAT] = 0xff; |
|
1997 | 2004 |
|
1998 | 2005 |
/* Handler for memory-mapped I/O */ |
1999 | 2006 |
s->mmio_index = |
2000 | 2007 |
cpu_register_io_memory(pcnet_mmio_read, pcnet_mmio_write, &d->state); |
2001 | 2008 |
|
2009 |
/* TODO: use pci_dev, avoid cast below. */ |
|
2002 | 2010 |
pci_register_bar((PCIDevice *)d, 0, PCNET_IOPORT_SIZE, |
2003 | 2011 |
PCI_BASE_ADDRESS_SPACE_IO, pcnet_ioport_map); |
2004 | 2012 |
|
Also available in: Unified diff