summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.target2
-rw-r--r--hw/acpi.c5
-rw-r--r--hw/mips_malta.c17
-rw-r--r--hw/pc.c2
-rw-r--r--vl.h2
5 files changed, 17 insertions, 11 deletions
diff --git a/Makefile.target b/Makefile.target
index 45928f3c49..b8abf3e354 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -438,7 +438,7 @@ ifeq ($(TARGET_BASE_ARCH), mips)
VL_OBJS+= mips_r4k.o mips_malta.o mips_pica61.o
VL_OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o
VL_OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
-VL_OBJS+= piix_pci.o parallel.o mixeng.o cirrus_vga.o $(SOUND_HW) $(AUDIODRV)
+VL_OBJS+= piix_pci.o smbus_eeprom.o parallel.o mixeng.o cirrus_vga.o $(SOUND_HW) $(AUDIODRV)
CPPFLAGS += -DHAS_AUDIO
endif
ifeq ($(TARGET_BASE_ARCH), sparc)
diff --git a/hw/acpi.c b/hw/acpi.c
index de4002e92f..ce3f7f2df6 100644
--- a/hw/acpi.c
+++ b/hw/acpi.c
@@ -24,7 +24,6 @@
#define PM_FREQ 3579545
#define ACPI_DBG_IO_ADDR 0xb044
-#define SMB_IO_BASE 0xb100
typedef struct PIIX4PMState {
PCIDevice dev;
@@ -451,11 +450,10 @@ static int pm_load(QEMUFile* f,void* opaque,int version_id)
return 0;
}
-i2c_bus *piix4_pm_init(PCIBus *bus, int devfn)
+i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base)
{
PIIX4PMState *s;
uint8_t *pci_conf;
- uint32_t smb_io_base;
s = (PIIX4PMState *)pci_register_device(bus,
"PM", sizeof(PIIX4PMState),
@@ -486,7 +484,6 @@ i2c_bus *piix4_pm_init(PCIBus *bus, int devfn)
pci_conf[0x67] = (serial_hds[0] != NULL ? 0x08 : 0) |
(serial_hds[1] != NULL ? 0x90 : 0);
- smb_io_base = SMB_IO_BASE;
pci_conf[0x90] = smb_io_base | 1;
pci_conf[0x91] = smb_io_base >> 8;
pci_conf[0xd2] = 0x09;
diff --git a/hw/mips_malta.c b/hw/mips_malta.c
index 82ba809522..6339cc9419 100644
--- a/hw/mips_malta.c
+++ b/hw/mips_malta.c
@@ -775,6 +775,10 @@ void mips_malta_init (int ram_size, int vga_ram_size, int boot_device,
int ret;
mips_def_t *def;
qemu_irq *i8259;
+ int piix4_devfn;
+ uint8_t *eeprom_buf;
+ i2c_bus *smbus;
+ int i;
/* init CPUs */
if (cpu_model == NULL) {
@@ -843,10 +847,15 @@ void mips_malta_init (int ram_size, int vga_ram_size, int boot_device,
pci_bus = pci_gt64120_init(i8259);
/* Southbridge */
- piix4_init(pci_bus, 80);
- pci_piix3_ide_init(pci_bus, bs_table, 81, i8259);
- usb_uhci_init(pci_bus, 82);
- piix4_pm_init(pci_bus, 83);
+ piix4_devfn = piix4_init(pci_bus, 80);
+ pci_piix3_ide_init(pci_bus, bs_table, piix4_devfn + 1, i8259);
+ usb_uhci_init(pci_bus, piix4_devfn + 2);
+ smbus = piix4_pm_init(pci_bus, piix4_devfn + 3, 0x1100);
+ eeprom_buf = qemu_mallocz(8 * 256); /* XXX: make this persistent */
+ for (i = 0; i < 8; i++) {
+ /* TODO: Populate SPD eeprom data. */
+ smbus_eeprom_device_init(smbus, 0x50 + i, eeprom_buf + (i * 256));
+ }
pit = pit_init(0x40, i8259[0]);
DMA_init(0);
diff --git a/hw/pc.c b/hw/pc.c
index b91b64faef..1cd5d4cff8 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -905,7 +905,7 @@ static void pc_init1(int ram_size, int vga_ram_size, int boot_device,
i2c_bus *smbus;
/* TODO: Populate SPD eeprom data. */
- smbus = piix4_pm_init(pci_bus, piix3_devfn + 3);
+ smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100);
for (i = 0; i < 8; i++) {
smbus_eeprom_device_init(smbus, 0x50 + i, eeprom_buf + (i * 256));
}
diff --git a/vl.h b/vl.h
index 8fed8374d9..21525fdc92 100644
--- a/vl.h
+++ b/vl.h
@@ -1132,7 +1132,7 @@ int pcspk_audio_init(AudioState *, qemu_irq *pic);
/* acpi.c */
extern int acpi_enabled;
-i2c_bus *piix4_pm_init(PCIBus *bus, int devfn);
+i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base);
void piix4_smbus_register_device(SMBusDevice *dev, uint8_t addr);
void acpi_bios_init(void);