Commit 7b717336e2873fd6d9f178a12549eaa2367d14d0
1 parent
6e473128
SMBus support for MIPS Malta.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2893 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
5 changed files
with
17 additions
and
11 deletions
Makefile.target
... | ... | @@ -438,7 +438,7 @@ ifeq ($(TARGET_BASE_ARCH), mips) |
438 | 438 | VL_OBJS+= mips_r4k.o mips_malta.o mips_pica61.o |
439 | 439 | VL_OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o |
440 | 440 | VL_OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o |
441 | -VL_OBJS+= piix_pci.o parallel.o mixeng.o cirrus_vga.o $(SOUND_HW) $(AUDIODRV) | |
441 | +VL_OBJS+= piix_pci.o smbus_eeprom.o parallel.o mixeng.o cirrus_vga.o $(SOUND_HW) $(AUDIODRV) | |
442 | 442 | CPPFLAGS += -DHAS_AUDIO |
443 | 443 | endif |
444 | 444 | ifeq ($(TARGET_BASE_ARCH), sparc) | ... | ... |
hw/acpi.c
... | ... | @@ -24,7 +24,6 @@ |
24 | 24 | #define PM_FREQ 3579545 |
25 | 25 | |
26 | 26 | #define ACPI_DBG_IO_ADDR 0xb044 |
27 | -#define SMB_IO_BASE 0xb100 | |
28 | 27 | |
29 | 28 | typedef struct PIIX4PMState { |
30 | 29 | PCIDevice dev; |
... | ... | @@ -451,11 +450,10 @@ static int pm_load(QEMUFile* f,void* opaque,int version_id) |
451 | 450 | return 0; |
452 | 451 | } |
453 | 452 | |
454 | -i2c_bus *piix4_pm_init(PCIBus *bus, int devfn) | |
453 | +i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base) | |
455 | 454 | { |
456 | 455 | PIIX4PMState *s; |
457 | 456 | uint8_t *pci_conf; |
458 | - uint32_t smb_io_base; | |
459 | 457 | |
460 | 458 | s = (PIIX4PMState *)pci_register_device(bus, |
461 | 459 | "PM", sizeof(PIIX4PMState), |
... | ... | @@ -486,7 +484,6 @@ i2c_bus *piix4_pm_init(PCIBus *bus, int devfn) |
486 | 484 | pci_conf[0x67] = (serial_hds[0] != NULL ? 0x08 : 0) | |
487 | 485 | (serial_hds[1] != NULL ? 0x90 : 0); |
488 | 486 | |
489 | - smb_io_base = SMB_IO_BASE; | |
490 | 487 | pci_conf[0x90] = smb_io_base | 1; |
491 | 488 | pci_conf[0x91] = smb_io_base >> 8; |
492 | 489 | pci_conf[0xd2] = 0x09; | ... | ... |
hw/mips_malta.c
... | ... | @@ -775,6 +775,10 @@ void mips_malta_init (int ram_size, int vga_ram_size, int boot_device, |
775 | 775 | int ret; |
776 | 776 | mips_def_t *def; |
777 | 777 | qemu_irq *i8259; |
778 | + int piix4_devfn; | |
779 | + uint8_t *eeprom_buf; | |
780 | + i2c_bus *smbus; | |
781 | + int i; | |
778 | 782 | |
779 | 783 | /* init CPUs */ |
780 | 784 | if (cpu_model == NULL) { |
... | ... | @@ -843,10 +847,15 @@ void mips_malta_init (int ram_size, int vga_ram_size, int boot_device, |
843 | 847 | pci_bus = pci_gt64120_init(i8259); |
844 | 848 | |
845 | 849 | /* Southbridge */ |
846 | - piix4_init(pci_bus, 80); | |
847 | - pci_piix3_ide_init(pci_bus, bs_table, 81, i8259); | |
848 | - usb_uhci_init(pci_bus, 82); | |
849 | - piix4_pm_init(pci_bus, 83); | |
850 | + piix4_devfn = piix4_init(pci_bus, 80); | |
851 | + pci_piix3_ide_init(pci_bus, bs_table, piix4_devfn + 1, i8259); | |
852 | + usb_uhci_init(pci_bus, piix4_devfn + 2); | |
853 | + smbus = piix4_pm_init(pci_bus, piix4_devfn + 3, 0x1100); | |
854 | + eeprom_buf = qemu_mallocz(8 * 256); /* XXX: make this persistent */ | |
855 | + for (i = 0; i < 8; i++) { | |
856 | + /* TODO: Populate SPD eeprom data. */ | |
857 | + smbus_eeprom_device_init(smbus, 0x50 + i, eeprom_buf + (i * 256)); | |
858 | + } | |
850 | 859 | pit = pit_init(0x40, i8259[0]); |
851 | 860 | DMA_init(0); |
852 | 861 | ... | ... |
hw/pc.c
... | ... | @@ -905,7 +905,7 @@ static void pc_init1(int ram_size, int vga_ram_size, int boot_device, |
905 | 905 | i2c_bus *smbus; |
906 | 906 | |
907 | 907 | /* TODO: Populate SPD eeprom data. */ |
908 | - smbus = piix4_pm_init(pci_bus, piix3_devfn + 3); | |
908 | + smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100); | |
909 | 909 | for (i = 0; i < 8; i++) { |
910 | 910 | smbus_eeprom_device_init(smbus, 0x50 + i, eeprom_buf + (i * 256)); |
911 | 911 | } | ... | ... |
vl.h
... | ... | @@ -1132,7 +1132,7 @@ int pcspk_audio_init(AudioState *, qemu_irq *pic); |
1132 | 1132 | |
1133 | 1133 | /* acpi.c */ |
1134 | 1134 | extern int acpi_enabled; |
1135 | -i2c_bus *piix4_pm_init(PCIBus *bus, int devfn); | |
1135 | +i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base); | |
1136 | 1136 | void piix4_smbus_register_device(SMBusDevice *dev, uint8_t addr); |
1137 | 1137 | void acpi_bios_init(void); |
1138 | 1138 | ... | ... |