Revision 558c8634 hw/eepro100.c
b/hw/eepro100.c | ||
---|---|---|
117 | 117 |
#define INT_MASK 0x0100 |
118 | 118 |
#define DRVR_INT 0x0200 /* Driver generated interrupt. */ |
119 | 119 |
|
120 |
typedef struct { |
|
121 |
PCIDeviceInfo pci; |
|
122 |
uint32_t device; |
|
123 |
uint16_t device_id; |
|
124 |
uint8_t revision; |
|
125 |
uint8_t stats_size; |
|
126 |
bool has_extended_tcb_support; |
|
127 |
bool power_management; |
|
128 |
} E100PCIDeviceInfo; |
|
129 |
|
|
120 | 130 |
/* Offsets to the various registers. |
121 | 131 |
All accesses need not be longword aligned. */ |
122 | 132 |
enum speedo_offsets { |
... | ... | |
443 | 453 |
} |
444 | 454 |
#endif |
445 | 455 |
|
446 |
static void pci_reset(EEPRO100State * s)
|
|
456 |
static void e100_pci_reset(EEPRO100State * s, E100PCIDeviceInfo *e100_device)
|
|
447 | 457 |
{ |
458 |
/* TODO: Use pci_add_capability(&s->dev, PCI_CAP_ID_PM, ...) for PM. */ |
|
448 | 459 |
uint32_t device = s->device; |
449 | 460 |
uint8_t *pci_conf = s->dev.config; |
450 |
bool power_management = 1; |
|
451 | 461 |
|
452 | 462 |
TRACE(OTHER, logout("%p\n", s)); |
453 | 463 |
|
454 | 464 |
/* PCI Vendor ID */ |
455 | 465 |
pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL); |
456 |
/* PCI Device ID depends on device and is set below. */ |
|
466 |
/* PCI Device ID */ |
|
467 |
pci_config_set_device_id(pci_conf, e100_device->device_id); |
|
457 | 468 |
/* PCI Status */ |
458 |
pci_set_word(pci_conf + PCI_STATUS, PCI_STATUS_DEVSEL_MEDIUM | PCI_STATUS_FAST_BACK); |
|
469 |
if (e100_device->power_management) { |
|
470 |
pci_set_word(pci_conf + PCI_STATUS, PCI_STATUS_DEVSEL_MEDIUM | |
|
471 |
PCI_STATUS_FAST_BACK | |
|
472 |
PCI_STATUS_CAP_LIST); |
|
473 |
} else { |
|
474 |
pci_set_word(pci_conf + PCI_STATUS, PCI_STATUS_DEVSEL_MEDIUM | |
|
475 |
PCI_STATUS_FAST_BACK); |
|
476 |
} |
|
459 | 477 |
/* PCI Revision ID */ |
460 |
pci_set_byte(pci_conf + PCI_REVISION_ID, 0x08);
|
|
478 |
pci_config_set_revision(pci_conf, e100_device->revision);
|
|
461 | 479 |
pci_config_set_class(pci_conf, PCI_CLASS_NETWORK_ETHERNET); |
462 | 480 |
/* PCI Latency Timer */ |
463 | 481 |
pci_set_byte(pci_conf + PCI_LATENCY_TIMER, 0x20); /* latency timer = 32 clocks */ |
464 | 482 |
/* Capability Pointer */ |
465 |
/* TODO: revisions with power_management 1 use this but |
|
466 |
* do not set new capability list bit in status register. */ |
|
467 |
pci_set_byte(pci_conf + PCI_CAPABILITY_LIST, 0xdc); |
|
483 |
if (e100_device->power_management) { |
|
484 |
pci_set_byte(pci_conf + PCI_CAPABILITY_LIST, 0xdc); |
|
485 |
} else { |
|
486 |
pci_set_byte(pci_conf + PCI_CAPABILITY_LIST, 0x00); |
|
487 |
} |
|
468 | 488 |
/* Minimum Grant */ |
469 | 489 |
pci_set_byte(pci_conf + PCI_MIN_GNT, 0x08); |
470 | 490 |
/* Maximum Latency */ |
471 | 491 |
pci_set_byte(pci_conf + PCI_MAX_LAT, 0x18); |
472 | 492 |
|
493 |
s->stats_size = e100_device->stats_size; |
|
494 |
s->has_extended_tcb_support = e100_device->has_extended_tcb_support; |
|
495 |
|
|
473 | 496 |
switch (device) { |
474 | 497 |
case i82550: |
475 |
/* TODO: check device id. */ |
|
476 |
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82551IT); |
|
477 |
/* Revision ID: 0x0c, 0x0d, 0x0e. */ |
|
478 |
pci_set_byte(pci_conf + PCI_REVISION_ID, 0x0e); |
|
479 |
/* TODO: check size of statistical counters. */ |
|
480 |
s->stats_size = 80; |
|
481 |
/* TODO: check extended tcb support. */ |
|
482 |
s->has_extended_tcb_support = 1; |
|
483 |
break; |
|
484 | 498 |
case i82551: |
485 |
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82551IT); |
|
486 |
/* Revision ID: 0x0f, 0x10. */ |
|
487 |
pci_set_byte(pci_conf + PCI_REVISION_ID, 0x0f); |
|
488 |
/* TODO: check size of statistical counters. */ |
|
489 |
s->stats_size = 80; |
|
490 |
s->has_extended_tcb_support = 1; |
|
491 |
break; |
|
492 | 499 |
case i82557A: |
493 |
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82557); |
|
494 |
pci_set_byte(pci_conf + PCI_REVISION_ID, 0x01); |
|
495 |
pci_set_byte(pci_conf + PCI_CAPABILITY_LIST, 0x00); |
|
496 |
power_management = 0; |
|
497 |
break; |
|
498 | 500 |
case i82557B: |
499 |
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82557); |
|
500 |
pci_set_byte(pci_conf + PCI_REVISION_ID, 0x02); |
|
501 |
pci_set_byte(pci_conf + PCI_CAPABILITY_LIST, 0x00); |
|
502 |
power_management = 0; |
|
503 |
break; |
|
504 | 501 |
case i82557C: |
505 |
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82557); |
|
506 |
pci_set_byte(pci_conf + PCI_REVISION_ID, 0x03); |
|
507 |
pci_set_byte(pci_conf + PCI_CAPABILITY_LIST, 0x00); |
|
508 |
power_management = 0; |
|
509 |
break; |
|
510 | 502 |
case i82558A: |
511 |
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82557); |
|
512 |
pci_set_word(pci_conf + PCI_STATUS, PCI_STATUS_DEVSEL_MEDIUM | |
|
513 |
PCI_STATUS_FAST_BACK | PCI_STATUS_CAP_LIST); |
|
514 |
pci_set_byte(pci_conf + PCI_REVISION_ID, 0x04); |
|
515 |
s->stats_size = 76; |
|
516 |
s->has_extended_tcb_support = 1; |
|
517 |
break; |
|
518 | 503 |
case i82558B: |
519 |
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82557); |
|
520 |
pci_set_word(pci_conf + PCI_STATUS, PCI_STATUS_DEVSEL_MEDIUM | |
|
521 |
PCI_STATUS_FAST_BACK | PCI_STATUS_CAP_LIST); |
|
522 |
pci_set_byte(pci_conf + PCI_REVISION_ID, 0x05); |
|
523 |
s->stats_size = 76; |
|
524 |
s->has_extended_tcb_support = 1; |
|
525 |
break; |
|
526 | 504 |
case i82559A: |
527 |
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82557); |
|
528 |
pci_set_word(pci_conf + PCI_STATUS, PCI_STATUS_DEVSEL_MEDIUM | |
|
529 |
PCI_STATUS_FAST_BACK | PCI_STATUS_CAP_LIST); |
|
530 |
pci_set_byte(pci_conf + PCI_REVISION_ID, 0x06); |
|
531 |
s->stats_size = 80; |
|
532 |
s->has_extended_tcb_support = 1; |
|
533 |
break; |
|
534 | 505 |
case i82559B: |
535 |
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82557); |
|
536 |
pci_set_word(pci_conf + PCI_STATUS, PCI_STATUS_DEVSEL_MEDIUM | |
|
537 |
PCI_STATUS_FAST_BACK | PCI_STATUS_CAP_LIST); |
|
538 |
pci_set_byte(pci_conf + PCI_REVISION_ID, 0x07); |
|
539 |
s->stats_size = 80; |
|
540 |
s->has_extended_tcb_support = 1; |
|
506 |
case i82559ER: |
|
507 |
case i82562: |
|
541 | 508 |
break; |
542 | 509 |
case i82559C: |
543 |
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82557); |
|
544 |
pci_set_word(pci_conf + PCI_STATUS, PCI_STATUS_DEVSEL_MEDIUM | |
|
545 |
PCI_STATUS_FAST_BACK | PCI_STATUS_CAP_LIST); |
|
546 |
pci_set_byte(pci_conf + PCI_REVISION_ID, 0x08); |
|
547 |
/* TODO: Windows wants revision id 0x0c. */ |
|
548 |
pci_set_byte(pci_conf + PCI_REVISION_ID, 0x0c); |
|
549 | 510 |
#if EEPROM_SIZE > 0 |
550 |
pci_set_word(pci_conf + PCI_SUBSYSTEM_VENDOR_ID, 0x8086);
|
|
511 |
pci_set_word(pci_conf + PCI_SUBSYSTEM_VENDOR_ID, PCI_VENDOR_ID_INTEL);
|
|
551 | 512 |
pci_set_word(pci_conf + PCI_SUBSYSTEM_ID, 0x0040); |
552 | 513 |
#endif |
553 |
s->stats_size = 80; |
|
554 |
s->has_extended_tcb_support = 1; |
|
555 |
break; |
|
556 |
case i82559ER: |
|
557 |
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82551IT); |
|
558 |
pci_set_word(pci_conf + PCI_STATUS, PCI_STATUS_DEVSEL_MEDIUM | |
|
559 |
PCI_STATUS_FAST_BACK | PCI_STATUS_CAP_LIST); |
|
560 |
pci_set_byte(pci_conf + PCI_REVISION_ID, 0x09); |
|
561 |
s->stats_size = 80; |
|
562 |
s->has_extended_tcb_support = 1; |
|
563 |
break; |
|
564 |
case i82562: |
|
565 |
/* TODO: check device id. */ |
|
566 |
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82551IT); |
|
567 |
/* TODO: wrong revision id. */ |
|
568 |
pci_set_byte(pci_conf + PCI_REVISION_ID, 0x0e); |
|
569 |
s->stats_size = 80; |
|
570 |
s->has_extended_tcb_support = 1; |
|
571 | 514 |
break; |
572 | 515 |
default: |
573 | 516 |
logout("Device %X is undefined!\n", device); |
574 | 517 |
} |
575 | 518 |
|
519 |
/* Standard statistical counters. */ |
|
576 | 520 |
s->configuration[6] |= BIT(5); |
577 | 521 |
|
578 | 522 |
if (s->stats_size == 80) { |
... | ... | |
597 | 541 |
} |
598 | 542 |
assert(s->stats_size > 0 && s->stats_size <= sizeof(s->statistics)); |
599 | 543 |
|
600 |
if (power_management) { |
|
544 |
if (e100_device->power_management) {
|
|
601 | 545 |
/* Power Management Capabilities */ |
602 |
pci_set_byte(pci_conf + 0xdc, 0x01);
|
|
546 |
pci_set_byte(pci_conf + 0xdc, PCI_CAP_ID_PM);
|
|
603 | 547 |
/* Next Item Pointer */ |
604 | 548 |
/* Capability ID */ |
605 | 549 |
pci_set_word(pci_conf + 0xde, 0x7e21); |
... | ... | |
1904 | 1848 |
.cleanup = nic_cleanup, |
1905 | 1849 |
}; |
1906 | 1850 |
|
1907 |
static int nic_init(PCIDevice *pci_dev, uint32_t device)
|
|
1851 |
static int e100_nic_init(PCIDevice *pci_dev)
|
|
1908 | 1852 |
{ |
1909 | 1853 |
EEPRO100State *s = DO_UPCAST(EEPRO100State, dev, pci_dev); |
1854 |
E100PCIDeviceInfo *e100_device = DO_UPCAST(E100PCIDeviceInfo, pci.qdev, |
|
1855 |
pci_dev->qdev.info); |
|
1910 | 1856 |
|
1911 | 1857 |
TRACE(OTHER, logout("\n")); |
1912 | 1858 |
|
1913 |
s->device = device; |
|
1859 |
s->device = e100_device->device;
|
|
1914 | 1860 |
|
1915 |
pci_reset(s);
|
|
1861 |
e100_pci_reset(s, e100_device);
|
|
1916 | 1862 |
|
1917 | 1863 |
/* Add 64 * 2 EEPROM. i82557 and i82558 support a 64 word EEPROM, |
1918 | 1864 |
* i82559 and later support 64 or 256 word EEPROM. */ |
... | ... | |
1952 | 1898 |
return 0; |
1953 | 1899 |
} |
1954 | 1900 |
|
1955 |
static int pci_i82550_init(PCIDevice *pci_dev) |
|
1956 |
{ |
|
1957 |
return nic_init(pci_dev, i82550); |
|
1958 |
} |
|
1959 |
|
|
1960 |
static int pci_i82551_init(PCIDevice *pci_dev) |
|
1961 |
{ |
|
1962 |
return nic_init(pci_dev, i82551); |
|
1963 |
} |
|
1964 |
|
|
1965 |
static int pci_i82557a_init(PCIDevice *pci_dev) |
|
1966 |
{ |
|
1967 |
return nic_init(pci_dev, i82557A); |
|
1968 |
} |
|
1969 |
|
|
1970 |
static int pci_i82557b_init(PCIDevice *pci_dev) |
|
1971 |
{ |
|
1972 |
return nic_init(pci_dev, i82557B); |
|
1973 |
} |
|
1974 |
|
|
1975 |
static int pci_i82557c_init(PCIDevice *pci_dev) |
|
1976 |
{ |
|
1977 |
return nic_init(pci_dev, i82557C); |
|
1978 |
} |
|
1979 |
|
|
1980 |
static int pci_i82558a_init(PCIDevice *pci_dev) |
|
1981 |
{ |
|
1982 |
return nic_init(pci_dev, i82558A); |
|
1983 |
} |
|
1984 |
|
|
1985 |
static int pci_i82558b_init(PCIDevice *pci_dev) |
|
1986 |
{ |
|
1987 |
return nic_init(pci_dev, i82558B); |
|
1988 |
} |
|
1989 |
|
|
1990 |
static int pci_i82559a_init(PCIDevice *pci_dev) |
|
1991 |
{ |
|
1992 |
return nic_init(pci_dev, i82559A); |
|
1993 |
} |
|
1994 |
|
|
1995 |
static int pci_i82559b_init(PCIDevice *pci_dev) |
|
1996 |
{ |
|
1997 |
return nic_init(pci_dev, i82559B); |
|
1998 |
} |
|
1999 |
|
|
2000 |
static int pci_i82559c_init(PCIDevice *pci_dev) |
|
2001 |
{ |
|
2002 |
return nic_init(pci_dev, i82559C); |
|
2003 |
} |
|
2004 |
|
|
2005 |
static int pci_i82559er_init(PCIDevice *pci_dev) |
|
2006 |
{ |
|
2007 |
return nic_init(pci_dev, i82559ER); |
|
2008 |
} |
|
2009 |
|
|
2010 |
static int pci_i82562_init(PCIDevice *pci_dev) |
|
2011 |
{ |
|
2012 |
return nic_init(pci_dev, i82562); |
|
2013 |
} |
|
2014 |
|
|
2015 |
static PCIDeviceInfo eepro100_info[] = { |
|
1901 |
static E100PCIDeviceInfo e100_devices[] = { |
|
2016 | 1902 |
{ |
2017 |
.qdev.name = "i82550", |
|
2018 |
.qdev.desc = "Intel i82550 Ethernet", |
|
2019 |
.qdev.size = sizeof(EEPRO100State), |
|
2020 |
.init = pci_i82550_init, |
|
2021 |
.exit = pci_nic_uninit, |
|
2022 |
.romfile = "gpxe-eepro100-80861209.rom", |
|
2023 |
.qdev.props = (Property[]) { |
|
2024 |
DEFINE_NIC_PROPERTIES(EEPRO100State, conf), |
|
2025 |
DEFINE_PROP_END_OF_LIST(), |
|
2026 |
}, |
|
2027 |
},{ |
|
2028 |
.qdev.name = "i82551", |
|
2029 |
.qdev.desc = "Intel i82551 Ethernet", |
|
2030 |
.qdev.size = sizeof(EEPRO100State), |
|
2031 |
.init = pci_i82551_init, |
|
2032 |
.exit = pci_nic_uninit, |
|
2033 |
.romfile = "gpxe-eepro100-80861209.rom", |
|
2034 |
.qdev.props = (Property[]) { |
|
2035 |
DEFINE_NIC_PROPERTIES(EEPRO100State, conf), |
|
2036 |
DEFINE_PROP_END_OF_LIST(), |
|
2037 |
}, |
|
1903 |
.pci.qdev.name = "i82550", |
|
1904 |
.pci.qdev.desc = "Intel i82550 Ethernet", |
|
1905 |
.device = i82550, |
|
1906 |
/* TODO: check device id. */ |
|
1907 |
.device_id = PCI_DEVICE_ID_INTEL_82551IT, |
|
1908 |
/* Revision ID: 0x0c, 0x0d, 0x0e. */ |
|
1909 |
.revision = 0x0e, |
|
1910 |
/* TODO: check size of statistical counters. */ |
|
1911 |
.stats_size = 80, |
|
1912 |
/* TODO: check extended tcb support. */ |
|
1913 |
.has_extended_tcb_support = true, |
|
1914 |
.power_management = true, |
|
2038 | 1915 |
},{ |
2039 |
.qdev.name = "i82557a",
|
|
2040 |
.qdev.desc = "Intel i82557A Ethernet",
|
|
2041 |
.qdev.size = sizeof(EEPRO100State),
|
|
2042 |
.init = pci_i82557a_init,
|
|
2043 |
.exit = pci_nic_uninit,
|
|
2044 |
.romfile = "gpxe-eepro100-80861229.rom",
|
|
2045 |
.qdev.props = (Property[]) {
|
|
2046 |
DEFINE_NIC_PROPERTIES(EEPRO100State, conf),
|
|
2047 |
DEFINE_PROP_END_OF_LIST(),
|
|
2048 |
},
|
|
1916 |
.pci.qdev.name = "i82551",
|
|
1917 |
.pci.qdev.desc = "Intel i82551 Ethernet",
|
|
1918 |
.device = i82551,
|
|
1919 |
.device_id = PCI_DEVICE_ID_INTEL_82551IT,
|
|
1920 |
/* Revision ID: 0x0f, 0x10. */
|
|
1921 |
.revision = 0x0f,
|
|
1922 |
/* TODO: check size of statistical counters. */
|
|
1923 |
.stats_size = 80,
|
|
1924 |
.has_extended_tcb_support = true,
|
|
1925 |
.power_management = true,
|
|
2049 | 1926 |
},{ |
2050 |
.qdev.name = "i82557b", |
|
2051 |
.qdev.desc = "Intel i82557B Ethernet", |
|
2052 |
.qdev.size = sizeof(EEPRO100State), |
|
2053 |
.init = pci_i82557b_init, |
|
2054 |
.exit = pci_nic_uninit, |
|
2055 |
.romfile = "gpxe-eepro100-80861229.rom", |
|
2056 |
.qdev.props = (Property[]) { |
|
2057 |
DEFINE_NIC_PROPERTIES(EEPRO100State, conf), |
|
2058 |
DEFINE_PROP_END_OF_LIST(), |
|
2059 |
}, |
|
1927 |
.pci.qdev.name = "i82557a", |
|
1928 |
.pci.qdev.desc = "Intel i82557A Ethernet", |
|
1929 |
.device = i82557A, |
|
1930 |
.device_id = PCI_DEVICE_ID_INTEL_82557, |
|
1931 |
.revision = 0x01, |
|
1932 |
.power_management = false, |
|
2060 | 1933 |
},{ |
2061 |
.qdev.name = "i82557c", |
|
2062 |
.qdev.desc = "Intel i82557C Ethernet", |
|
2063 |
.qdev.size = sizeof(EEPRO100State), |
|
2064 |
.init = pci_i82557c_init, |
|
2065 |
.exit = pci_nic_uninit, |
|
2066 |
.romfile = "gpxe-eepro100-80861229.rom", |
|
2067 |
.qdev.props = (Property[]) { |
|
2068 |
DEFINE_NIC_PROPERTIES(EEPRO100State, conf), |
|
2069 |
DEFINE_PROP_END_OF_LIST(), |
|
2070 |
}, |
|
1934 |
.pci.qdev.name = "i82557b", |
|
1935 |
.pci.qdev.desc = "Intel i82557B Ethernet", |
|
1936 |
.device = i82557B, |
|
1937 |
.device_id = PCI_DEVICE_ID_INTEL_82557, |
|
1938 |
.revision = 0x02, |
|
1939 |
.power_management = false, |
|
2071 | 1940 |
},{ |
2072 |
.qdev.name = "i82558a", |
|
2073 |
.qdev.desc = "Intel i82558A Ethernet", |
|
2074 |
.qdev.size = sizeof(EEPRO100State), |
|
2075 |
.init = pci_i82558a_init, |
|
2076 |
.exit = pci_nic_uninit, |
|
2077 |
.romfile = "gpxe-eepro100-80861229.rom", |
|
2078 |
.qdev.props = (Property[]) { |
|
2079 |
DEFINE_NIC_PROPERTIES(EEPRO100State, conf), |
|
2080 |
DEFINE_PROP_END_OF_LIST(), |
|
2081 |
}, |
|
1941 |
.pci.qdev.name = "i82557c", |
|
1942 |
.pci.qdev.desc = "Intel i82557C Ethernet", |
|
1943 |
.device = i82557C, |
|
1944 |
.device_id = PCI_DEVICE_ID_INTEL_82557, |
|
1945 |
.revision = 0x03, |
|
1946 |
.power_management = false, |
|
2082 | 1947 |
},{ |
2083 |
.qdev.name = "i82558b", |
|
2084 |
.qdev.desc = "Intel i82558B Ethernet", |
|
2085 |
.qdev.size = sizeof(EEPRO100State), |
|
2086 |
.init = pci_i82558b_init, |
|
2087 |
.exit = pci_nic_uninit, |
|
2088 |
.romfile = "gpxe-eepro100-80861229.rom", |
|
2089 |
.qdev.props = (Property[]) { |
|
2090 |
DEFINE_NIC_PROPERTIES(EEPRO100State, conf), |
|
2091 |
DEFINE_PROP_END_OF_LIST(), |
|
2092 |
}, |
|
1948 |
.pci.qdev.name = "i82558a", |
|
1949 |
.pci.qdev.desc = "Intel i82558A Ethernet", |
|
1950 |
.device = i82558A, |
|
1951 |
.device_id = PCI_DEVICE_ID_INTEL_82557, |
|
1952 |
.revision = 0x04, |
|
1953 |
.stats_size = 76, |
|
1954 |
.has_extended_tcb_support = true, |
|
1955 |
.power_management = true, |
|
2093 | 1956 |
},{ |
2094 |
.qdev.name = "i82559a", |
|
2095 |
.qdev.desc = "Intel i82559A Ethernet", |
|
2096 |
.qdev.size = sizeof(EEPRO100State), |
|
2097 |
.init = pci_i82559a_init, |
|
2098 |
.exit = pci_nic_uninit, |
|
2099 |
.romfile = "gpxe-eepro100-80861229.rom", |
|
2100 |
.qdev.props = (Property[]) { |
|
2101 |
DEFINE_NIC_PROPERTIES(EEPRO100State, conf), |
|
2102 |
DEFINE_PROP_END_OF_LIST(), |
|
2103 |
}, |
|
1957 |
.pci.qdev.name = "i82558b", |
|
1958 |
.pci.qdev.desc = "Intel i82558B Ethernet", |
|
1959 |
.device = i82558B, |
|
1960 |
.device_id = PCI_DEVICE_ID_INTEL_82557, |
|
1961 |
.revision = 0x05, |
|
1962 |
.stats_size = 76, |
|
1963 |
.has_extended_tcb_support = true, |
|
1964 |
.power_management = true, |
|
2104 | 1965 |
},{ |
2105 |
.qdev.name = "i82559b", |
|
2106 |
.qdev.desc = "Intel i82559B Ethernet", |
|
2107 |
.qdev.size = sizeof(EEPRO100State), |
|
2108 |
.init = pci_i82559b_init, |
|
2109 |
.exit = pci_nic_uninit, |
|
2110 |
.romfile = "gpxe-eepro100-80861229.rom", |
|
2111 |
.qdev.props = (Property[]) { |
|
2112 |
DEFINE_NIC_PROPERTIES(EEPRO100State, conf), |
|
2113 |
DEFINE_PROP_END_OF_LIST(), |
|
2114 |
}, |
|
1966 |
.pci.qdev.name = "i82559a", |
|
1967 |
.pci.qdev.desc = "Intel i82559A Ethernet", |
|
1968 |
.device = i82559A, |
|
1969 |
.device_id = PCI_DEVICE_ID_INTEL_82557, |
|
1970 |
.revision = 0x06, |
|
1971 |
.stats_size = 80, |
|
1972 |
.has_extended_tcb_support = true, |
|
1973 |
.power_management = true, |
|
2115 | 1974 |
},{ |
2116 |
.qdev.name = "i82559c", |
|
2117 |
.qdev.desc = "Intel i82559C Ethernet", |
|
2118 |
.qdev.size = sizeof(EEPRO100State), |
|
2119 |
.init = pci_i82559c_init, |
|
2120 |
.exit = pci_nic_uninit, |
|
2121 |
.romfile = "gpxe-eepro100-80861229.rom", |
|
2122 |
.qdev.props = (Property[]) { |
|
2123 |
DEFINE_NIC_PROPERTIES(EEPRO100State, conf), |
|
2124 |
DEFINE_PROP_END_OF_LIST(), |
|
2125 |
}, |
|
1975 |
.pci.qdev.name = "i82559b", |
|
1976 |
.pci.qdev.desc = "Intel i82559B Ethernet", |
|
1977 |
.device = i82559B, |
|
1978 |
.device_id = PCI_DEVICE_ID_INTEL_82557, |
|
1979 |
.revision = 0x07, |
|
1980 |
.stats_size = 80, |
|
1981 |
.has_extended_tcb_support = true, |
|
1982 |
.power_management = true, |
|
2126 | 1983 |
},{ |
2127 |
.qdev.name = "i82559er", |
|
2128 |
.qdev.desc = "Intel i82559ER Ethernet", |
|
2129 |
.qdev.size = sizeof(EEPRO100State), |
|
2130 |
.init = pci_i82559er_init, |
|
2131 |
.exit = pci_nic_uninit, |
|
2132 |
.romfile = "gpxe-eepro100-80861209.rom", |
|
2133 |
.qdev.props = (Property[]) { |
|
2134 |
DEFINE_NIC_PROPERTIES(EEPRO100State, conf), |
|
2135 |
DEFINE_PROP_END_OF_LIST(), |
|
2136 |
}, |
|
1984 |
.pci.qdev.name = "i82559c", |
|
1985 |
.pci.qdev.desc = "Intel i82559C Ethernet", |
|
1986 |
.device = i82559C, |
|
1987 |
.device_id = PCI_DEVICE_ID_INTEL_82557, |
|
1988 |
#if 0 |
|
1989 |
.revision = 0x08, |
|
1990 |
#endif |
|
1991 |
/* TODO: Windows wants revision id 0x0c. */ |
|
1992 |
.revision = 0x0c, |
|
1993 |
.stats_size = 80, |
|
1994 |
.has_extended_tcb_support = true, |
|
1995 |
.power_management = true, |
|
2137 | 1996 |
},{ |
2138 |
.qdev.name = "i82562", |
|
2139 |
.qdev.desc = "Intel i82562 Ethernet", |
|
2140 |
.qdev.size = sizeof(EEPRO100State), |
|
2141 |
.init = pci_i82562_init, |
|
2142 |
.exit = pci_nic_uninit, |
|
2143 |
.romfile = "gpxe-eepro100-80861209.rom", |
|
2144 |
.qdev.props = (Property[]) { |
|
2145 |
DEFINE_NIC_PROPERTIES(EEPRO100State, conf), |
|
2146 |
DEFINE_PROP_END_OF_LIST(), |
|
2147 |
}, |
|
1997 |
.pci.qdev.name = "i82559er", |
|
1998 |
.pci.qdev.desc = "Intel i82559ER Ethernet", |
|
1999 |
.device = i82559ER, |
|
2000 |
.device_id = PCI_DEVICE_ID_INTEL_82551IT, |
|
2001 |
.revision = 0x09, |
|
2002 |
.stats_size = 80, |
|
2003 |
.has_extended_tcb_support = true, |
|
2004 |
.power_management = true, |
|
2148 | 2005 |
},{ |
2149 |
/* end of list */ |
|
2006 |
.pci.qdev.name = "i82562", |
|
2007 |
.pci.qdev.desc = "Intel i82562 Ethernet", |
|
2008 |
.device = i82562, |
|
2009 |
/* TODO: check device id. */ |
|
2010 |
.device_id = PCI_DEVICE_ID_INTEL_82551IT, |
|
2011 |
/* TODO: wrong revision id. */ |
|
2012 |
.revision = 0x0e, |
|
2013 |
.stats_size = 80, |
|
2014 |
.has_extended_tcb_support = true, |
|
2015 |
.power_management = true, |
|
2150 | 2016 |
} |
2151 | 2017 |
}; |
2152 | 2018 |
|
2019 |
static Property e100_properties[] = { |
|
2020 |
DEFINE_NIC_PROPERTIES(EEPRO100State, conf), |
|
2021 |
DEFINE_PROP_END_OF_LIST(), |
|
2022 |
}; |
|
2023 |
|
|
2153 | 2024 |
static void eepro100_register_devices(void) |
2154 | 2025 |
{ |
2155 |
pci_qdev_register_many(eepro100_info); |
|
2026 |
size_t i; |
|
2027 |
for (i = 0; i < ARRAY_SIZE(e100_devices); i++) { |
|
2028 |
PCIDeviceInfo *pci_dev = &e100_devices[i].pci; |
|
2029 |
switch (e100_devices[i].device_id) { |
|
2030 |
case PCI_DEVICE_ID_INTEL_82551IT: |
|
2031 |
pci_dev->romfile = "gpxe-eepro100-80861209.rom"; |
|
2032 |
break; |
|
2033 |
case PCI_DEVICE_ID_INTEL_82557: |
|
2034 |
pci_dev->romfile = "gpxe-eepro100-80861229.rom"; |
|
2035 |
break; |
|
2036 |
} |
|
2037 |
pci_dev->init = e100_nic_init; |
|
2038 |
pci_dev->exit = pci_nic_uninit; |
|
2039 |
pci_dev->qdev.props = e100_properties; |
|
2040 |
pci_dev->qdev.size = sizeof(EEPRO100State); |
|
2041 |
pci_qdev_register(pci_dev); |
|
2042 |
} |
|
2156 | 2043 |
} |
2157 | 2044 |
|
2158 | 2045 |
device_init(eepro100_register_devices) |
Also available in: Unified diff