Patchwork [19/34] e1000: convert to pci_bar_map

login
register
mail settings
Submitter Blue Swirl
Date July 22, 2010, 9:59 p.m.
Message ID <AANLkTil0bDRLdqbspWBHljDPiELdTw7blDkl_7cONq6B@mail.gmail.com>
Download mbox | patch
Permalink /patch/59704/
State New
Headers show

Comments

Blue Swirl - July 22, 2010, 9:59 p.m.
Use pci_bar_map() and post_map_func instead of a mapping function.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
 hw/e1000.c |   15 +++------------
 1 files changed, 3 insertions(+), 12 deletions(-)

Patch

diff --git a/hw/e1000.c b/hw/e1000.c
index 6d1c3d4..d64fb79 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -149,14 +149,6 @@  static const char phy_regcap[0x20] = {
 };

 static void
-ioport_map(PCIDevice *pci_dev, int region_num, pcibus_t addr,
-           pcibus_t size, int type)
-{
-    DBGOUT(IO, "e1000_ioport_map addr=0x%04"FMT_PCIBUS
-           " size=0x%08"FMT_PCIBUS"\n", addr, size);
-}
-
-static void
 set_interrupt_cause(E1000State *s, int index, uint32_t val)
 {
     if (val)
@@ -1020,7 +1012,6 @@  static void
 e1000_mmio_map(PCIDevice *pci_dev, int region_num,
                 pcibus_t addr, pcibus_t size, int type)
 {
-    E1000State *d = DO_UPCAST(E1000State, dev, pci_dev);
     int i;
     const uint32_t excluded_regs[] = {
         E1000_MDIC, E1000_ICR, E1000_ICS, E1000_IMS,
@@ -1031,7 +1022,6 @@  e1000_mmio_map(PCIDevice *pci_dev, int region_num,
     DBGOUT(MMIO, "e1000_mmio_map addr=0x%08"FMT_PCIBUS" 0x%08"FMT_PCIBUS"\n",
            addr, size);

-    cpu_register_physical_memory(addr, PNPMMIO_SIZE, d->mmio_index);
     qemu_register_coalesced_mmio(addr, excluded_regs[0]);

     for (i = 0; excluded_regs[i] != PNPMMIO_SIZE; i++)
@@ -1105,10 +1095,11 @@  static int pci_e1000_init(PCIDevice *pci_dev)
             e1000_mmio_write, d);

     pci_register_bar((PCIDevice *)d, 0, PNPMMIO_SIZE,
-                     PCI_BASE_ADDRESS_SPACE_MEMORY, e1000_mmio_map, NULL);
+                     PCI_BASE_ADDRESS_SPACE_MEMORY, NULL, e1000_mmio_map);
+    pci_bar_map((PCIDevice *)d, 0, 0, 0, PNPMMIO_SIZE, d->mmio_index);

     pci_register_bar((PCIDevice *)d, 1, IOPORT_SIZE,
-                     PCI_BASE_ADDRESS_SPACE_IO, ioport_map, NULL);
+                     PCI_BASE_ADDRESS_SPACE_IO, NULL, NULL);

     memmove(d->eeprom_data, e1000_eeprom_template,
         sizeof e1000_eeprom_template);