mirror of
https://github.com/qemu/qemu.git
synced 2025-08-09 10:25:06 +00:00
pci: remove PCIDeviceInfo::header_type
replace PCIDeviceInfo::header_type with is_bridge as suggested by Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
parent
b80d4a9887
commit
e327e323f1
@ -434,7 +434,7 @@ static PCIDeviceInfo pbm_pci_host_info = {
|
|||||||
.qdev.name = "pbm",
|
.qdev.name = "pbm",
|
||||||
.qdev.size = sizeof(PCIDevice),
|
.qdev.size = sizeof(PCIDevice),
|
||||||
.init = pbm_pci_host_init,
|
.init = pbm_pci_host_init,
|
||||||
.header_type = PCI_HEADER_TYPE_BRIDGE,
|
.is_bridge = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
static SysBusDeviceInfo pbm_host_info = {
|
static SysBusDeviceInfo pbm_host_info = {
|
||||||
|
@ -90,7 +90,7 @@ static PCIDeviceInfo dec_21154_pci_host_info = {
|
|||||||
.qdev.name = "dec-21154",
|
.qdev.name = "dec-21154",
|
||||||
.qdev.size = sizeof(PCIDevice),
|
.qdev.size = sizeof(PCIDevice),
|
||||||
.init = dec_21154_pci_host_init,
|
.init = dec_21154_pci_host_init,
|
||||||
.header_type = PCI_HEADER_TYPE_BRIDGE,
|
.is_bridge = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void dec_register_devices(void)
|
static void dec_register_devices(void)
|
||||||
|
15
hw/pci.c
15
hw/pci.c
@ -605,7 +605,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
|
|||||||
const char *name, int devfn,
|
const char *name, int devfn,
|
||||||
PCIConfigReadFunc *config_read,
|
PCIConfigReadFunc *config_read,
|
||||||
PCIConfigWriteFunc *config_write,
|
PCIConfigWriteFunc *config_write,
|
||||||
uint8_t header_type)
|
bool is_bridge)
|
||||||
{
|
{
|
||||||
if (devfn < 0) {
|
if (devfn < 0) {
|
||||||
for(devfn = bus->devfn_min ; devfn < ARRAY_SIZE(bus->devices);
|
for(devfn = bus->devfn_min ; devfn < ARRAY_SIZE(bus->devices);
|
||||||
@ -627,13 +627,12 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
|
|||||||
pci_dev->irq_state = 0;
|
pci_dev->irq_state = 0;
|
||||||
pci_config_alloc(pci_dev);
|
pci_config_alloc(pci_dev);
|
||||||
|
|
||||||
header_type &= ~PCI_HEADER_TYPE_MULTI_FUNCTION;
|
if (!is_bridge) {
|
||||||
if (header_type == PCI_HEADER_TYPE_NORMAL) {
|
|
||||||
pci_set_default_subsystem_id(pci_dev);
|
pci_set_default_subsystem_id(pci_dev);
|
||||||
}
|
}
|
||||||
pci_init_cmask(pci_dev);
|
pci_init_cmask(pci_dev);
|
||||||
pci_init_wmask(pci_dev);
|
pci_init_wmask(pci_dev);
|
||||||
if (header_type == PCI_HEADER_TYPE_BRIDGE) {
|
if (is_bridge) {
|
||||||
pci_init_wmask_bridge(pci_dev);
|
pci_init_wmask_bridge(pci_dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1563,7 +1562,9 @@ static int pci_bridge_initfn(PCIDevice *dev)
|
|||||||
pci_set_word(dev->config + PCI_STATUS,
|
pci_set_word(dev->config + PCI_STATUS,
|
||||||
PCI_STATUS_66MHZ | PCI_STATUS_FAST_BACK);
|
PCI_STATUS_66MHZ | PCI_STATUS_FAST_BACK);
|
||||||
pci_config_set_class(dev->config, PCI_CLASS_BRIDGE_PCI);
|
pci_config_set_class(dev->config, PCI_CLASS_BRIDGE_PCI);
|
||||||
dev->config[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_BRIDGE;
|
dev->config[PCI_HEADER_TYPE] =
|
||||||
|
(dev->config[PCI_HEADER_TYPE] & PCI_HEADER_TYPE_MULTI_FUNCTION) |
|
||||||
|
PCI_HEADER_TYPE_BRIDGE;
|
||||||
pci_set_word(dev->config + PCI_SEC_STATUS,
|
pci_set_word(dev->config + PCI_SEC_STATUS,
|
||||||
PCI_STATUS_66MHZ | PCI_STATUS_FAST_BACK);
|
PCI_STATUS_66MHZ | PCI_STATUS_FAST_BACK);
|
||||||
return 0;
|
return 0;
|
||||||
@ -1614,7 +1615,7 @@ static int pci_qdev_init(DeviceState *qdev, DeviceInfo *base)
|
|||||||
devfn = pci_dev->devfn;
|
devfn = pci_dev->devfn;
|
||||||
pci_dev = do_pci_register_device(pci_dev, bus, base->name, devfn,
|
pci_dev = do_pci_register_device(pci_dev, bus, base->name, devfn,
|
||||||
info->config_read, info->config_write,
|
info->config_read, info->config_write,
|
||||||
info->header_type);
|
info->is_bridge);
|
||||||
if (pci_dev == NULL)
|
if (pci_dev == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
rc = info->init(pci_dev);
|
rc = info->init(pci_dev);
|
||||||
@ -1890,7 +1891,7 @@ static PCIDeviceInfo bridge_info = {
|
|||||||
.init = pci_bridge_initfn,
|
.init = pci_bridge_initfn,
|
||||||
.exit = pci_bridge_exitfn,
|
.exit = pci_bridge_exitfn,
|
||||||
.config_write = pci_bridge_write_config,
|
.config_write = pci_bridge_write_config,
|
||||||
.header_type = PCI_HEADER_TYPE_BRIDGE,
|
.is_bridge = 1,
|
||||||
.qdev.props = (Property[]) {
|
.qdev.props = (Property[]) {
|
||||||
DEFINE_PROP_HEX32("vendorid", PCIBridge, vid, 0),
|
DEFINE_PROP_HEX32("vendorid", PCIBridge, vid, 0),
|
||||||
DEFINE_PROP_HEX32("deviceid", PCIBridge, did, 0),
|
DEFINE_PROP_HEX32("deviceid", PCIBridge, did, 0),
|
||||||
|
8
hw/pci.h
8
hw/pci.h
@ -325,8 +325,12 @@ typedef struct {
|
|||||||
PCIConfigReadFunc *config_read;
|
PCIConfigReadFunc *config_read;
|
||||||
PCIConfigWriteFunc *config_write;
|
PCIConfigWriteFunc *config_write;
|
||||||
|
|
||||||
/* pci config header type */
|
/*
|
||||||
uint8_t header_type;
|
* pci-to-pci bridge or normal device.
|
||||||
|
* This doesn't mean pci host switch.
|
||||||
|
* When card bus bridge is supported, this would be enhanced.
|
||||||
|
*/
|
||||||
|
int is_bridge;
|
||||||
|
|
||||||
/* pcie stuff */
|
/* pcie stuff */
|
||||||
int is_express; /* is this device pci express? */
|
int is_express; /* is this device pci express? */
|
||||||
|
Loading…
Reference in New Issue
Block a user