| Submitter | Isaku Yamahata |
|---|---|
| Date | July 26, 2010, 10:59 a.m. |
| Message ID | <7134b731888ec1c97670a9a4e850c33c1ba6e0fd.1280141797.git.yamahata@valinux.co.jp> |
| Download | mbox | patch |
| Permalink | /patch/59909/ |
| State | New |
| Headers | show |
Comments
PCI_DEVFN() clean up parts is OK for me. On Tue, Jul 27, 2010 at 10:18 AM, Isaku Yamahata <yamahata@valinux.co.jp> wrote: > Oh yes, I fixed it. I was lost during switching branches. > Chen, can you please take care of PCI_DEVFN() clean up part? > > > On Tue, Jul 27, 2010 at 09:10:02AM +0800, chen huacai wrote: >> Seems like the master branch has already use >> pci_create_simple_multifunction(), the code is like this: >> >> int vt82c686b_init(PCIBus *bus, int devfn) >> { >> PCIDevice *d; >> >> d = pci_create_simple_multifunction(bus, devfn, true, "VT82C686B"); >> >> return d->devfn; >> } >> >> >> >> On Mon, Jul 26, 2010 at 6:59 PM, Isaku Yamahata <yamahata@valinux.co.jp> wrote: >> > This patch fixes multifunction bits of bonito. >> > Otherwise it aborts with the following message. >> > >> >> qemu-system-mips64el: PCI: single function device can't be populated in function 5.1 >> > >> > Cc: Huacai Chen <zltjiangshi@gmail.com> >> > Cc: Aurelien Jarno <aurelien@aurel32.net> >> > Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> >> > --- >> > ??hw/mips_fulong2e.c | ?? 14 +++++++------- >> > ??hw/vt82c686.c ?? ?? ??| ?? ??5 +++-- >> > ??hw/vt82c686.h ?? ?? ??| ?? ??2 +- >> > ??3 files changed, 11 insertions(+), 10 deletions(-) >> > >> > diff --git a/hw/mips_fulong2e.c b/hw/mips_fulong2e.c >> > index a9bbff6..41d6b05 100644 >> > --- a/hw/mips_fulong2e.c >> > +++ b/hw/mips_fulong2e.c >> > @@ -219,8 +219,8 @@ uint8_t eeprom_spd[0x80] = { >> > ??#ifdef HAS_AUDIO >> > ??static void audio_init (PCIBus *pci_bus) >> > ??{ >> > - ?? ??vt82c686b_ac97_init(pci_bus, (FULONG2E_VIA_SLOT << 3) + 5); >> > - ?? ??vt82c686b_mc97_init(pci_bus, (FULONG2E_VIA_SLOT << 3) + 6); >> > + ?? ??vt82c686b_ac97_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 5)); >> > + ?? ??vt82c686b_mc97_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 6)); >> > ??} >> > ??#endif >> > >> > @@ -349,18 +349,18 @@ static void mips_fulong2e_init(ram_addr_t ram_size, const char *boot_device, >> > ?? ?? ?? ?? hd[i] = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS); >> > ?? ?? } >> > >> > - ?? ??via_devfn = vt82c686b_init(pci_bus, FULONG2E_VIA_SLOT << 3); >> > + ?? ??via_devfn = vt82c686b_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 0), true); >> > ?? ?? if (via_devfn < 0) { >> > ?? ?? ?? ?? fprintf(stderr, "vt82c686b_init error \n"); >> > ?? ?? ?? ?? exit(1); >> > ?? ?? } >> > >> > ?? ?? isa_bus_irqs(i8259); >> > - ?? ??vt82c686b_ide_init(pci_bus, hd, (FULONG2E_VIA_SLOT << 3) + 1); >> > - ?? ??usb_uhci_vt82c686b_init(pci_bus, (FULONG2E_VIA_SLOT << 3) + 2); >> > - ?? ??usb_uhci_vt82c686b_init(pci_bus, (FULONG2E_VIA_SLOT << 3) + 3); >> > + ?? ??vt82c686b_ide_init(pci_bus, hd, PCI_DEVFN(FULONG2E_VIA_SLOT, 1)); >> > + ?? ??usb_uhci_vt82c686b_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 2)); >> > + ?? ??usb_uhci_vt82c686b_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 3)); >> > >> > - ?? ??smbus = vt82c686b_pm_init(pci_bus, (FULONG2E_VIA_SLOT << 3) + 4, >> > + ?? ??smbus = vt82c686b_pm_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 4), >> > ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 0xeee1, NULL); >> > ?? ?? eeprom_buf = qemu_mallocz(8 * 256); /* XXX: make this persistent */ >> > ?? ?? memcpy(eeprom_buf, eeprom_spd, sizeof(eeprom_spd)); >> > diff --git a/hw/vt82c686.c b/hw/vt82c686.c >> > index a0c5747..822728f 100644 >> > --- a/hw/vt82c686.c >> > +++ b/hw/vt82c686.c >> > @@ -571,11 +571,12 @@ static int vt82c686b_initfn(PCIDevice *d) >> > ?? ?? return 0; >> > ??} >> > >> > -int vt82c686b_init(PCIBus *bus, int devfn) >> > +int vt82c686b_init(PCIBus *bus, int devfn, bool multifunction) >> > ??{ >> > ?? ?? PCIDevice *d; >> > >> > - ?? ??d = pci_create_simple(bus, devfn, "VT82C686B"); >> > + ?? ??d = pci_create_simple_multifunction(bus, devfn, multifunction, >> > + ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??"VT82C686B"); >> > >> > ?? ?? return d->devfn; >> > ??} >> > diff --git a/hw/vt82c686.h b/hw/vt82c686.h >> > index e3270ca..c73a0f8 100644 >> > --- a/hw/vt82c686.h >> > +++ b/hw/vt82c686.h >> > @@ -2,7 +2,7 @@ >> > ??#define HW_VT82C686_H >> > >> > ??/* vt82c686.c */ >> > -int vt82c686b_init(PCIBus * bus, int devfn); >> > +int vt82c686b_init(PCIBus *bus, int devfn, bool multifunction); >> > ??void vt82c686b_ac97_init(PCIBus *bus, int devfn); >> > ??void vt82c686b_mc97_init(PCIBus *bus, int devfn); >> > ??i2c_bus *vt82c686b_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base, >> > -- >> > 1.7.1.1 >> > >> > >> >> >> >> -- >> Huacai Chen >> > > -- > yamahata >
Patch
diff --git a/hw/mips_fulong2e.c b/hw/mips_fulong2e.c index a9bbff6..41d6b05 100644 --- a/hw/mips_fulong2e.c +++ b/hw/mips_fulong2e.c @@ -219,8 +219,8 @@ uint8_t eeprom_spd[0x80] = { #ifdef HAS_AUDIO static void audio_init (PCIBus *pci_bus) { - vt82c686b_ac97_init(pci_bus, (FULONG2E_VIA_SLOT << 3) + 5); - vt82c686b_mc97_init(pci_bus, (FULONG2E_VIA_SLOT << 3) + 6); + vt82c686b_ac97_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 5)); + vt82c686b_mc97_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 6)); } #endif @@ -349,18 +349,18 @@ static void mips_fulong2e_init(ram_addr_t ram_size, const char *boot_device, hd[i] = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS); } - via_devfn = vt82c686b_init(pci_bus, FULONG2E_VIA_SLOT << 3); + via_devfn = vt82c686b_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 0), true); if (via_devfn < 0) { fprintf(stderr, "vt82c686b_init error \n"); exit(1); } isa_bus_irqs(i8259); - vt82c686b_ide_init(pci_bus, hd, (FULONG2E_VIA_SLOT << 3) + 1); - usb_uhci_vt82c686b_init(pci_bus, (FULONG2E_VIA_SLOT << 3) + 2); - usb_uhci_vt82c686b_init(pci_bus, (FULONG2E_VIA_SLOT << 3) + 3); + vt82c686b_ide_init(pci_bus, hd, PCI_DEVFN(FULONG2E_VIA_SLOT, 1)); + usb_uhci_vt82c686b_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 2)); + usb_uhci_vt82c686b_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 3)); - smbus = vt82c686b_pm_init(pci_bus, (FULONG2E_VIA_SLOT << 3) + 4, + smbus = vt82c686b_pm_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 4), 0xeee1, NULL); eeprom_buf = qemu_mallocz(8 * 256); /* XXX: make this persistent */ memcpy(eeprom_buf, eeprom_spd, sizeof(eeprom_spd)); diff --git a/hw/vt82c686.c b/hw/vt82c686.c index a0c5747..822728f 100644 --- a/hw/vt82c686.c +++ b/hw/vt82c686.c @@ -571,11 +571,12 @@ static int vt82c686b_initfn(PCIDevice *d) return 0; } -int vt82c686b_init(PCIBus *bus, int devfn) +int vt82c686b_init(PCIBus *bus, int devfn, bool multifunction) { PCIDevice *d; - d = pci_create_simple(bus, devfn, "VT82C686B"); + d = pci_create_simple_multifunction(bus, devfn, multifunction, + "VT82C686B"); return d->devfn; } diff --git a/hw/vt82c686.h b/hw/vt82c686.h index e3270ca..c73a0f8 100644 --- a/hw/vt82c686.h +++ b/hw/vt82c686.h @@ -2,7 +2,7 @@ #define HW_VT82C686_H /* vt82c686.c */ -int vt82c686b_init(PCIBus * bus, int devfn); +int vt82c686b_init(PCIBus *bus, int devfn, bool multifunction); void vt82c686b_ac97_init(PCIBus *bus, int devfn); void vt82c686b_mc97_init(PCIBus *bus, int devfn); i2c_bus *vt82c686b_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,