Skip to content

Commit

Permalink
hw/pci-host/i440fx: Have common names for some local variables
Browse files Browse the repository at this point in the history
`PCIHostState` is often referred to as `phb`, own device state usually as `s`.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230630073720.21297-11-shentey@gmail.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
  • Loading branch information
shentok authored and mstsirkin committed Jul 10, 2023
1 parent cda39f1 commit a707466
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions hw/pci-host/i440fx.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,28 +205,28 @@ static void i440fx_pcihost_get_pci_hole64_end(Object *obj, Visitor *v,

static void i440fx_pcihost_initfn(Object *obj)
{
PCIHostState *s = PCI_HOST_BRIDGE(obj);
PCIHostState *phb = PCI_HOST_BRIDGE(obj);

memory_region_init_io(&s->conf_mem, obj, &pci_host_conf_le_ops, s,
memory_region_init_io(&phb->conf_mem, obj, &pci_host_conf_le_ops, phb,
"pci-conf-idx", 4);
memory_region_init_io(&s->data_mem, obj, &pci_host_data_le_ops, s,
memory_region_init_io(&phb->data_mem, obj, &pci_host_data_le_ops, phb,
"pci-conf-data", 4);
}

static void i440fx_pcihost_realize(DeviceState *dev, Error **errp)
{
PCIHostState *s = PCI_HOST_BRIDGE(dev);
PCIHostState *phb = PCI_HOST_BRIDGE(dev);
SysBusDevice *sbd = SYS_BUS_DEVICE(dev);

memory_region_add_subregion(s->bus->address_space_io, 0xcf8, &s->conf_mem);
memory_region_add_subregion(phb->bus->address_space_io, 0xcf8, &phb->conf_mem);
sysbus_init_ioports(sbd, 0xcf8, 4);

memory_region_add_subregion(s->bus->address_space_io, 0xcfc, &s->data_mem);
memory_region_add_subregion(phb->bus->address_space_io, 0xcfc, &phb->data_mem);
sysbus_init_ioports(sbd, 0xcfc, 4);

/* register i440fx 0xcf8 port as coalesced pio */
memory_region_set_flush_coalesced(&s->data_mem);
memory_region_add_coalescing(&s->conf_mem, 0, 4);
memory_region_set_flush_coalesced(&phb->data_mem);
memory_region_add_coalescing(&phb->conf_mem, 0, 4);
}

static void i440fx_realize(PCIDevice *dev, Error **errp)
Expand All @@ -248,17 +248,16 @@ PCIBus *i440fx_init(const char *pci_type,
MemoryRegion *pci_address_space,
MemoryRegion *ram_memory)
{
I440FXState *s = I440FX_PCI_HOST_BRIDGE(dev);
PCIHostState *phb = PCI_HOST_BRIDGE(dev);
PCIBus *b;
PCIDevice *d;
PCIHostState *s;
PCII440FXState *f;
unsigned i;
I440FXState *i440fx;

s = PCI_HOST_BRIDGE(dev);
b = pci_root_bus_new(dev, NULL, pci_address_space,
address_space_io, 0, TYPE_PCI_BUS);
s->bus = b;
phb->bus = b;
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);

d = pci_create_simple(b, 0, pci_type);
Expand All @@ -267,8 +266,7 @@ PCIBus *i440fx_init(const char *pci_type,
f->pci_address_space = pci_address_space;
f->ram_memory = ram_memory;

i440fx = I440FX_PCI_HOST_BRIDGE(dev);
range_set_bounds(&i440fx->pci_hole, below_4g_mem_size,
range_set_bounds(&s->pci_hole, below_4g_mem_size,
IO_APIC_DEFAULT_ADDRESS - 1);

/* setup pci memory mapping */
Expand Down

0 comments on commit a707466

Please sign in to comment.