On Fri, 24 Sep 2010, Isaku Yamahata wrote:
> On Fri, Sep 17, 2010 at 12:15:00PM +0100, anthony.perard@xxxxxxxxxx wrote:
> > From: Anthony PERARD <anthony.perard@xxxxxxxxxx>
> >
> > This patch introduces Xen specific call in piix_pci.
> >
> > The specific part for Xen is in write_config, set_irq and get_pirq.
> >
> > Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
> > Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
> > ---
> > hw/piix_pci.c | 10 +++++++++-
> > hw/xen.h | 6 ++++++
> > xen-all.c | 29 +++++++++++++++++++++++++++++
> > xen-stub.c | 13 +++++++++++++
> > 4 files changed, 57 insertions(+), 1 deletions(-)
> >
> > diff --git a/hw/piix_pci.c b/hw/piix_pci.c
> > index f152a0f..41a342f 100644
> > --- a/hw/piix_pci.c
> > +++ b/hw/piix_pci.c
> > @@ -142,6 +143,9 @@ static void i440fx_write_config(PCIDevice *dev,
> > {
> > PCII440FXState *d = DO_UPCAST(PCII440FXState, dev, dev);
> >
> > + if (xen_enabled())
> > + xen_piix_pci_write_config_client(address, val, len);
> > +
> > /* XXX: implement SMRAM.D_LOCK */
> > pci_default_write_config(dev, address, val, len);
> > if (ranges_overlap(address, len, I440FX_PAM, I440FX_PAM_SIZE) ||
>
> Maybe I wasn't clear enough. This dynamic check can also be eliminated.
> Something like the following pseudo code.
>
> i440fx_init()
> ...
> if (xen_enabled) {
> d = pci_create_simple(b, 0, "i440FX-xen");
> } else }
> d = pci_create_simple(b, 0, "i440FX");
> }
>
>
> static PCIDeviceInfo i440fx_info[] = {
> {
> .qdev.name = "i440FX",
> ...
> .config_write = i440fx_write_config,
> },{
> .qdev.name = "i440FX-xen",
> ...
> .config_write = i440fx_write_config_xen,
> },{
>
>
> i440fx_write_config_xen()
> {
> xen_piix_pci_write_config_client();
> i440fx_write_config()
> }
Ok, I will do that. Thanks for this sample of code.
--
Anthony PERARD
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|