From: "Michael S. Tsirkin" <mst@redhat.com>
To: Isaku Yamahata <yamahata@valinux.co.jp>
Cc: blauwirbel@gmail.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH v2 5/5] pci_bridge: introduce pci bridge library.
Date: Mon, 12 Jul 2010 15:10:00 +0300 [thread overview]
Message-ID: <20100712121000.GA31649@redhat.com> (raw)
In-Reply-To: <f8c20ad486a6d30f910674727a73880bcd6e10ae.1278930415.git.yamahata@valinux.co.jp>
On Mon, Jul 12, 2010 at 07:36:44PM +0900, Isaku Yamahata wrote:
> diff --git a/hw/pci_bridge.h b/hw/pci_bridge.h
> index ddb2c82..4697c7a 100644
> --- a/hw/pci_bridge.h
> +++ b/hw/pci_bridge.h
> @@ -29,13 +29,27 @@
> #include "pci.h"
>
> PCIDevice *pci_bridge_get_device(PCIBus *bus);
> +PCIBus *pci_bridge_get_sec_bus(PCIBridge *br);
>
> -pcibus_t pci_bridge_get_base(PCIDevice *bridge, uint8_t type);
> -pcibus_t pci_bridge_get_limit(PCIDevice *bridge, uint8_t type);
> +pcibus_t pci_bridge_get_base(const PCIDevice *bridge, uint8_t type);
> +pcibus_t pci_bridge_get_limit(const PCIDevice *bridge, uint8_t type);
>
> -PCIBus *pci_bridge_init(PCIBus *bus, int devfn, bool multifunction,
> - uint16_t vid, uint16_t did,
> - pci_map_irq_fn map_irq, const char *name);
> +void pci_bridge_write_config(PCIDevice *d,
> + uint32_t address, uint32_t val, int len);
> +void pci_bridge_reset_reg(PCIDevice *dev);
> +void pci_bridge_reset(DeviceState *qdev);
> +
> +int pci_bridge_initfn(PCIDevice *pci_dev);
> +int pci_bridge_exitfn(PCIDevice *pci_dev);
> +
> +void pci_bridge_qdev_register(PCIDeviceInfo *info);
> +
> +PCIBridge *pci_bridge_create(PCIBus *bus, int devfn, bool multifunction,
> + pci_map_irq_fn map_irq,
> + const char *name, const char *bus_name);
> +PCIBridge *pci_bridge_create_simple(PCIBus *bus, int devfn, bool multifunction,
> + pci_map_irq_fn map_irq,
> + const char *name, const char *bus_name);
The APIs leave much to be desired. _simple and regular are same? What does _register do?
We really should just use qdev: Can't we use pci_qdev_register_many and
pci_create to create the bridge? Long term, all pci_create variants
should go and get replaced with qdev_create.
>
> #endif /* QEMU_PCI_BRIDGE_H */
> /*
> diff --git a/hw/pci_internals.h b/hw/pci_internals.h
> index fa844ab..6502f83 100644
> --- a/hw/pci_internals.h
> +++ b/hw/pci_internals.h
> @@ -30,11 +30,13 @@ struct PCIBus {
> int *irq_count;
> };
>
> -typedef struct {
> +struct PCIBridge {
> PCIDevice dev;
> +
> + /* private member */
> PCIBus sec_bus;
> - uint32_t vid;
> - uint32_t did;
> -} PCIBridge;
> + pci_map_irq_fn map_irq;
> + const char *bus_name;
> +};
>
> #endif /* QEMU_PCI_INTERNALS_H */
> diff --git a/qemu-common.h b/qemu-common.h
> index 3fb2f0b..d735235 100644
> --- a/qemu-common.h
> +++ b/qemu-common.h
> @@ -219,6 +219,7 @@ typedef struct PCIHostState PCIHostState;
> typedef struct PCIExpressHost PCIExpressHost;
> typedef struct PCIBus PCIBus;
> typedef struct PCIDevice PCIDevice;
> +typedef struct PCIBridge PCIBridge;
> typedef struct SerialState SerialState;
> typedef struct IRQState *qemu_irq;
> typedef struct PCMCIACardState PCMCIACardState;
> --
> 1.7.1.1
next prev parent reply other threads:[~2010-07-12 12:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-12 10:36 [Qemu-devel] [PATCH v2 0/5] pci: split out bridge code into pci_bridge and make it library Isaku Yamahata
2010-07-12 10:36 ` [Qemu-devel] [PATCH v2 1/5] pci: move out pci internal structures, PCIBus, PCIBridge, and pci_bus_info Isaku Yamahata
2010-07-12 10:36 ` [Qemu-devel] [PATCH v2 2/5] pci/bridge: split out pci bridge code into pci_bridge.c from pci.c Isaku Yamahata
2010-07-12 12:16 ` [Qemu-devel] " Michael S. Tsirkin
2010-07-12 13:22 ` Isaku Yamahata
2010-07-12 10:36 ` [Qemu-devel] [PATCH v2 3/5] pci_bridge: rename PCIBridge::bus -> PCIBridge::sec_bus Isaku Yamahata
2010-07-12 10:36 ` [Qemu-devel] [PATCH v2 4/5] pci_bridge: clean up: remove pci_{register, unregister}_secondary_bus() Isaku Yamahata
2010-07-12 10:36 ` [Qemu-devel] [PATCH v2 5/5] pci_bridge: introduce pci bridge library Isaku Yamahata
2010-07-12 12:10 ` Michael S. Tsirkin [this message]
2010-07-12 13:28 ` [Qemu-devel] " Isaku Yamahata
2010-07-12 14:47 ` Michael S. Tsirkin
2010-07-12 12:11 ` [Qemu-devel] Re: [PATCH v2 0/5] pci: split out bridge code into pci_bridge and make it library Michael S. Tsirkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100712121000.GA31649@redhat.com \
--to=mst@redhat.com \
--cc=blauwirbel@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=yamahata@valinux.co.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.