Skip to contentSkip to conversation

MIPS: Initial support of vt82686b south bridge used by fulong mini pc

PATCH Superseded Huacai Chen 2 participants 2 messages Jun 22, 2010 – Jun 28, 2010 Kbuild

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v5 2/6 MIPS: Initial support of vt82686b south bridge used by fulong mini pc

---
 Makefile.target |    2 +-
 hw/pci_ids.h    |    8 +
 hw/vt82c686.c   |  569 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 hw/vt82c686.h   |   11 +
 4 files changed, 589 insertions(+), 1 deletions(-)
 create mode 100644 hw/vt82c686.c
 create mode 100644 hw/vt82c686.h
Makefile.target +1 -1
index 36de833..4b23e6d 100644
@@ -221,7 +221,7 @@ obj-mips-y += vga.o i8259.o
 obj-mips-y += g364fb.o jazz_led.o
 obj-mips-y += gt64xxx.o mc146818rtc.o
 obj-mips-y += piix4.o cirrus_vga.o
-obj-mips-$(CONFIG_FULONG) += bonito.o
+obj-mips-$(CONFIG_FULONG) += bonito.o vt82c686.o
 
 obj-microblaze-y = petalogix_s3adsp1800_mmu.o
 
hw/pci_ids.h +8 -0
index fe7a121..39e9f1d 100644
@@ -78,6 +78,14 @@
 
 #define PCI_VENDOR_ID_XILINX             0x10ee
 
+#define PCI_VENDOR_ID_VIA                0x1106
+#define PCI_DEVICE_ID_VIA_ISA_BRIDGE     0x0686
+#define PCI_DEVICE_ID_VIA_IDE            0x0571
+#define PCI_DEVICE_ID_VIA_UHCI           0x3038
+#define PCI_DEVICE_ID_VIA_ACPI           0x3057
+#define PCI_DEVICE_ID_VIA_AC97           0x3058
+#define PCI_DEVICE_ID_VIA_MC97           0x3068
+
 #define PCI_VENDOR_ID_MARVELL            0x11ab
 
 #define PCI_VENDOR_ID_ENSONIQ            0x1274
hw/vt82c686.c new file +569 -0

569 lines not on this page · raw message

hw/vt82c686.h new file +11 -0
new file mode 100644
index 0000000..e3270ca
@@ -0,0 +1,11 @@
+#ifndef HW_VT82C686_H
+#define HW_VT82C686_H
+
+/* vt82c686.c */
+int vt82c686b_init(PCIBus * bus, int devfn);
+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,
+            qemu_irq sci_irq);
+
+#endif
Signature · 1 line
1.7.0.4
#1 lore raw

hw/vt82c686.c line 50

Quoted 6 lines · Huacai Chen
hw/vt82c686.c new file +4 -0
+static void superio_ioport_writeb(void *opaque, uint32_t addr, uint32_t data)
+{
+    int can_write;
+    SuperIOConfig *superio_conf = (SuperIOConfig *)opaque;

Useless cast from void *.

hw/vt82c686.c line 96

Quoted 4 lines
hw/vt82c686.c new file +3 -0
+static uint32_t superio_ioport_readb(void *opaque, uint32_t addr)
+{
+    SuperIOConfig *superio_conf = (SuperIOConfig *)opaque;

the same.

hw/vt82c686.c line 167

Quoted 13 lines
hw/vt82c686.c new file +13 -0
+static void vt82c686b_save(QEMUFile * f, void *opaque)
+{
+    PCIDevice *d = opaque;
+    pci_device_save(d, f);
+}
+
+static int vt82c686b_load(QEMUFile * f, void *opaque, int version_id)
+{
+    PCIDevice *d = opaque;
+    if (version_id != 1)
+        return -EINVAL;
+    return pci_device_load(d, f);
+}

You use vmstate in the rest of devices, why use old style here?

hw/vt82c686.c line 185

Quoted 3 lines
hw/vt82c686.c new file +3 -0
+typedef struct VT686AC97State {
+    PCIDevice dev;
+    int unused;

not needed really.

hw/vt82c686.c line 190

Quoted 5 lines
hw/vt82c686.c new file +5 -0
+} VT686AC97State;
+
+typedef struct VT686MC97State {
+    PCIDevice dev;
+    int unused;

also not needed.

hw/vt82c686.c line 197

Quoted 7 lines
hw/vt82c686.c new file +7 -0
+} VT686MC97State;
+
+#define RTC_EN    (1 << 10)
+#define PWRBTN_EN (1 << 8)
+#define GBL_EN    (1 << 5)
+#define TMROF_EN  (1 << 0)
+#define SCI_EN    (1 << 0)

not used in the rest of the code. Suspicions to be the same bit that previous one.

hw/vt82c686.c line 403

Quoted 4 lines
hw/vt82c686.c new file +4 -0
+
+    s = (VT686AC97State *)pci_register_device(bus,
+                                         "vt82c686b_AC97", sizeof(VT686AC97State),
+                                         devfn, NULL, NULL);

use DO_UPCAST like rest of driver instead of cast.

hw/vt82c686.c line 424

Quoted 8 lines
hw/vt82c686.c new file +8 -0
+void vt82c686b_mc97_init(PCIBus *bus, int devfn)
+{
+    VT686MC97State *s;
+    uint8_t *pci_conf;
+
+    s = (VT686MC97State *)pci_register_device(bus,
+                                         "vt82c686b_MC97", sizeof(VT686MC97State),
+                                         devfn, NULL, NULL);

Same than previous comment.

hw/vt82c686.c line 551

Quoted 2 lines
hw/vt82c686.c new file +2 -0
+    /* set super io config */
+    vt686->superio_conf = qemu_mallocz(sizeof(SuperIOConfig));

Why do you use a pointer instead of changing it to a embeded estruct inside struct VT82C686BState?

Later, Juan.