Commit afcc3cdfc4f6291ae6cb803339c794029bf6c99a
1 parent
b6dc7ebb
Use the correct PCI IDs for Malta.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2945 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
6 changed files
with
83 additions
and
5 deletions
hw/ide.c
... | ... | @@ -376,6 +376,7 @@ typedef struct IDEState { |
376 | 376 | |
377 | 377 | #define IDE_TYPE_PIIX3 0 |
378 | 378 | #define IDE_TYPE_CMD646 1 |
379 | +#define IDE_TYPE_PIIX4 2 | |
379 | 380 | |
380 | 381 | /* CMD646 specific */ |
381 | 382 | #define MRDMODE 0x71 |
... | ... | @@ -2875,6 +2876,44 @@ void pci_piix3_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn, |
2875 | 2876 | register_savevm("ide", 0, 1, pci_ide_save, pci_ide_load, d); |
2876 | 2877 | } |
2877 | 2878 | |
2879 | +/* hd_table must contain 4 block drivers */ | |
2880 | +/* NOTE: for the PIIX4, the IRQs and IOports are hardcoded */ | |
2881 | +void pci_piix4_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn, | |
2882 | + qemu_irq *pic) | |
2883 | +{ | |
2884 | + PCIIDEState *d; | |
2885 | + uint8_t *pci_conf; | |
2886 | + | |
2887 | + /* register a function 1 of PIIX4 */ | |
2888 | + d = (PCIIDEState *)pci_register_device(bus, "PIIX4 IDE", | |
2889 | + sizeof(PCIIDEState), | |
2890 | + devfn, | |
2891 | + NULL, NULL); | |
2892 | + d->type = IDE_TYPE_PIIX4; | |
2893 | + | |
2894 | + pci_conf = d->dev.config; | |
2895 | + pci_conf[0x00] = 0x86; // Intel | |
2896 | + pci_conf[0x01] = 0x80; | |
2897 | + pci_conf[0x02] = 0x11; | |
2898 | + pci_conf[0x03] = 0x71; | |
2899 | + pci_conf[0x09] = 0x80; // legacy ATA mode | |
2900 | + pci_conf[0x0a] = 0x01; // class_sub = PCI_IDE | |
2901 | + pci_conf[0x0b] = 0x01; // class_base = PCI_mass_storage | |
2902 | + pci_conf[0x0e] = 0x00; // header_type | |
2903 | + | |
2904 | + piix3_reset(d); | |
2905 | + | |
2906 | + pci_register_io_region((PCIDevice *)d, 4, 0x10, | |
2907 | + PCI_ADDRESS_SPACE_IO, bmdma_map); | |
2908 | + | |
2909 | + ide_init2(&d->ide_if[0], hd_table[0], hd_table[1], pic[14]); | |
2910 | + ide_init2(&d->ide_if[2], hd_table[2], hd_table[3], pic[15]); | |
2911 | + ide_init_ioport(&d->ide_if[0], 0x1f0, 0x3f6); | |
2912 | + ide_init_ioport(&d->ide_if[2], 0x170, 0x376); | |
2913 | + | |
2914 | + register_savevm("ide", 0, 1, pci_ide_save, pci_ide_load, d); | |
2915 | +} | |
2916 | + | |
2878 | 2917 | /***********************************************************/ |
2879 | 2918 | /* MacIO based PowerPC IDE */ |
2880 | 2919 | ... | ... |
hw/mips_malta.c
... | ... | @@ -830,8 +830,8 @@ void mips_malta_init (int ram_size, int vga_ram_size, int boot_device, |
830 | 830 | |
831 | 831 | /* Southbridge */ |
832 | 832 | piix4_devfn = piix4_init(pci_bus, 80); |
833 | - pci_piix3_ide_init(pci_bus, bs_table, piix4_devfn + 1, i8259); | |
834 | - usb_uhci_init(pci_bus, piix4_devfn + 2); | |
833 | + pci_piix4_ide_init(pci_bus, bs_table, piix4_devfn + 1, i8259); | |
834 | + usb_uhci_piix4_init(pci_bus, piix4_devfn + 2); | |
835 | 835 | smbus = piix4_pm_init(pci_bus, piix4_devfn + 3, 0x1100); |
836 | 836 | eeprom_buf = qemu_mallocz(8 * 256); /* XXX: make this persistent */ |
837 | 837 | for (i = 0; i < 8; i++) { | ... | ... |
hw/pc.c
... | ... | @@ -897,7 +897,7 @@ static void pc_init1(int ram_size, int vga_ram_size, int boot_device, |
897 | 897 | cmos_init(ram_size, boot_device, bs_table); |
898 | 898 | |
899 | 899 | if (pci_enabled && usb_enabled) { |
900 | - usb_uhci_init(pci_bus, piix3_devfn + 2); | |
900 | + usb_uhci_piix3_init(pci_bus, piix3_devfn + 2); | |
901 | 901 | } |
902 | 902 | |
903 | 903 | if (pci_enabled && acpi_enabled) { | ... | ... |
hw/usb-uhci.c
... | ... | @@ -783,7 +783,7 @@ static void uhci_map(PCIDevice *pci_dev, int region_num, |
783 | 783 | register_ioport_read(addr, 32, 1, uhci_ioport_readb, s); |
784 | 784 | } |
785 | 785 | |
786 | -void usb_uhci_init(PCIBus *bus, int devfn) | |
786 | +void usb_uhci_piix3_init(PCIBus *bus, int devfn) | |
787 | 787 | { |
788 | 788 | UHCIState *s; |
789 | 789 | uint8_t *pci_conf; |
... | ... | @@ -817,3 +817,39 @@ void usb_uhci_init(PCIBus *bus, int devfn) |
817 | 817 | pci_register_io_region(&s->dev, 4, 0x20, |
818 | 818 | PCI_ADDRESS_SPACE_IO, uhci_map); |
819 | 819 | } |
820 | + | |
821 | +void usb_uhci_piix4_init(PCIBus *bus, int devfn) | |
822 | +{ | |
823 | + UHCIState *s; | |
824 | + uint8_t *pci_conf; | |
825 | + int i; | |
826 | + | |
827 | + s = (UHCIState *)pci_register_device(bus, | |
828 | + "USB-UHCI", sizeof(UHCIState), | |
829 | + devfn, NULL, NULL); | |
830 | + pci_conf = s->dev.config; | |
831 | + pci_conf[0x00] = 0x86; | |
832 | + pci_conf[0x01] = 0x80; | |
833 | + pci_conf[0x02] = 0x12; | |
834 | + pci_conf[0x03] = 0x71; | |
835 | + pci_conf[0x08] = 0x01; // revision number | |
836 | + pci_conf[0x09] = 0x00; | |
837 | + pci_conf[0x0a] = 0x03; | |
838 | + pci_conf[0x0b] = 0x0c; | |
839 | + pci_conf[0x0e] = 0x00; // header_type | |
840 | + pci_conf[0x3d] = 4; // interrupt pin 3 | |
841 | + pci_conf[0x60] = 0x10; // release number | |
842 | + | |
843 | + for(i = 0; i < NB_PORTS; i++) { | |
844 | + qemu_register_usb_port(&s->ports[i].port, s, i, uhci_attach); | |
845 | + } | |
846 | + s->frame_timer = qemu_new_timer(vm_clock, uhci_frame_timer, s); | |
847 | + | |
848 | + uhci_reset(s); | |
849 | + | |
850 | + /* Use region 4 for consistency with real hardware. BSD guests seem | |
851 | + to rely on this. */ | |
852 | + pci_register_io_region(&s->dev, 4, 0x20, | |
853 | + PCI_ADDRESS_SPACE_IO, uhci_map); | |
854 | +} | |
855 | + | ... | ... |
hw/usb.h
... | ... | @@ -203,7 +203,8 @@ void usb_packet_complete(USBPacket *p); |
203 | 203 | USBDevice *usb_hub_init(int nb_ports); |
204 | 204 | |
205 | 205 | /* usb-uhci.c */ |
206 | -void usb_uhci_init(PCIBus *bus, int devfn); | |
206 | +void usb_uhci_piix3_init(PCIBus *bus, int devfn); | |
207 | +void usb_uhci_piix4_init(PCIBus *bus, int devfn); | |
207 | 208 | |
208 | 209 | /* usb-ohci.c */ |
209 | 210 | void usb_ohci_init_pci(struct PCIBus *bus, int num_ports, int devfn); | ... | ... |
vl.h
... | ... | @@ -983,6 +983,8 @@ void pci_cmd646_ide_init(PCIBus *bus, BlockDriverState **hd_table, |
983 | 983 | int secondary_ide_enabled); |
984 | 984 | void pci_piix3_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn, |
985 | 985 | qemu_irq *pic); |
986 | +void pci_piix4_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn, | |
987 | + qemu_irq *pic); | |
986 | 988 | int pmac_ide_init (BlockDriverState **hd_table, qemu_irq irq); |
987 | 989 | |
988 | 990 | /* cdrom.c */ | ... | ... |