From: Michael S. Tsirkin Date: Wed, 7 Apr 2010 07:55:47 +0000 (+0300) Subject: eepro100: convert to new capability API X-Git-Tag: TizenStudio_2.0_p2.3~5093^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8eae09d8d8f2be99abd7030fec2143ef9e8d2522;p=sdk%2Femulator%2Fqemu.git eepro100: convert to new capability API Using new pci_add_capability_at_offset makes eepro100 code cleaner. Signed-off-by: Michael S. Tsirkin Acked-by: Stefan Weil --- diff --git a/hw/eepro100.c b/hw/eepro100.c index 785a7da..a74d834 100644 --- a/hw/eepro100.c +++ b/hw/eepro100.c @@ -539,21 +539,17 @@ static void e100_pci_reset(EEPRO100State * s, E100PCIDeviceInfo *e100_device) if (e100_device->power_management) { /* Power Management Capabilities */ - int cfg_offset; - pci_reserve_capability(&s->dev, PCI_CONFIG_HEADER_SIZE, - 0xdc - PCI_CONFIG_HEADER_SIZE); - cfg_offset = pci_add_capability(&s->dev, PCI_CAP_ID_PM, PCI_PM_SIZEOF); - assert(cfg_offset == 0xdc); - if (cfg_offset > 0) { - /* Power Management Capabilities */ - pci_set_word(pci_conf + cfg_offset + PCI_PM_PMC, 0x7e21); + int cfg_offset = 0xdc; + int r = pci_add_capability_at_offset(&s->dev, PCI_CAP_ID_PM, + cfg_offset, PCI_PM_SIZEOF); + assert(r >= 0); + pci_set_word(pci_conf + cfg_offset + PCI_PM_PMC, 0x7e21); #if 0 /* TODO: replace dummy code for power management emulation. */ - /* TODO: Power Management Control / Status. */ - pci_set_word(pci_conf + cfg_offset + PCI_PM_CTRL, 0x0000); - /* TODO: Ethernet Power Consumption Registers (i82559 and later). */ - pci_set_byte(pci_conf + cfg_offset + PCI_PM_PPB_EXTENSIONS, 0x0000); + /* TODO: Power Management Control / Status. */ + pci_set_word(pci_conf + cfg_offset + PCI_PM_CTRL, 0x0000); + /* TODO: Ethernet Power Consumption Registers (i82559 and later). */ + pci_set_byte(pci_conf + cfg_offset + PCI_PM_PPB_EXTENSIONS, 0x0000); #endif - } } #if EEPROM_SIZE > 0