Patchwork [46/61] pci/bridge: implement intel 82801ba bridge.

login
register
mail settings
Submitter Isaku Yamahata
Date Sept. 30, 2009, 10:18 a.m.
Message ID <1254305917-14784-47-git-send-email-yamahata@valinux.co.jp>
Download mbox | patch
Permalink /patch/34591/
State Superseded
Headers show

Comments

Isaku Yamahata - Sept. 30, 2009, 10:18 a.m.
implement intel 82801ba bridge.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 Makefile.target |    2 +-
 hw/pci_bridge.c |   63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 hw/pci_bridge.h |   38 +++++++++++++++++++++++++++++++++
 hw/pci_ids.h    |    3 ++
 4 files changed, 105 insertions(+), 1 deletions(-)
 create mode 100644 hw/pci_bridge.c
 create mode 100644 hw/pci_bridge.h

Patch

diff --git a/Makefile.target b/Makefile.target
index fba44b8..ab5c098 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -145,7 +145,7 @@  endif #CONFIG_BSD_USER
 ifdef CONFIG_SOFTMMU
 
 obj-y = vl.o monitor.o pci.o isa_mmio.o machine.o \
-        gdbstub.o gdbstub-xml.o
+        gdbstub.o gdbstub-xml.o pci_bridge.o
 # virtio has to be here due to weird dependency between PCI and virtio-net.
 # need to fix this properly
 obj-y += virtio-blk.o virtio-balloon.o virtio-net.o virtio-console.o virtio-pci.o
diff --git a/hw/pci_bridge.c b/hw/pci_bridge.c
new file mode 100644
index 0000000..161a23d
--- /dev/null
+++ b/hw/pci_bridge.c
@@ -0,0 +1,63 @@ 
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Copyright (c) 2009 Isaku Yamahata <yamahata at valinux co jp>
+ *                    VA Linux Systems Japan K.K.
+ *
+ */
+
+#include <stdlib.h>
+
+#include "qdev.h"
+#include "pci.h"
+#include "pci_bridge.h"
+
+static PCIDeviceInfo i82801ba11_info = {
+    .qdev.name = PCI_BRIDGE_INTEL_82801BA_11,
+    .qdev.size = sizeof(PCIDevice),
+
+    .config_write = pci_bridge_write_config,
+    .init = pci_bridge_initfn,
+
+    .header_type = PCI_HEADER_TYPE_BRIDGE,
+    .pcie = 1,
+};
+
+static void i82801ba11_register_device(void)
+{
+    pci_qdev_register(&i82801ba11_info);
+}
+
+device_init(i82801ba11_register_device);
+
+PCIBus *i82801ba11_init(PCIBus *bus, int devfn, int sec_bus, int sub_bus)
+{
+    return pci_bridge_create_simple(bus, devfn,
+                                    PCI_VENDOR_ID_INTEL,
+                                    PCI_DEVICE_ID_INTEL_82801BA_11,
+                                    sec_bus, sub_bus,
+                                    pci_swizzle_map_irq_fn,
+                                    PCI_BRIDGE_INTEL_82801BA_11,
+                                    PCI_BRIDGE_INTEL_82801BA_11);
+}
+
+/*
+ * Local variables:
+ *  c-indent-level: 4
+ *  c-basic-offset: 4
+ *  tab-width: 8
+ *  indent-tab-mode: nil
+ * End:
+ */
diff --git a/hw/pci_bridge.h b/hw/pci_bridge.h
new file mode 100644
index 0000000..90eeaeb
--- /dev/null
+++ b/hw/pci_bridge.h
@@ -0,0 +1,38 @@ 
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Copyright (c) 2009 Isaku Yamahata <yamahata at valinux co jp>
+ *                    VA Linux Systems Japan K.K.
+ *
+ */
+
+#ifndef QEMU_PCI_BRIDGE_H
+#define QEMU_PCI_BRIDGE_H
+
+#include "pci.h"
+
+#define PCI_BRIDGE_INTEL_82801BA_11     "i82801ba11"
+
+PCIBus *i82801ba11_init(PCIBus *bus, int devfn, int sec_bus, int sub_bus);
+
+#endif  /* QEMU_PCI_BRIDGE_H */
+/*
+ * Local variables:
+ *  c-indent-level: 4
+ *  c-basic-offset: 4
+ *  tab-width: 8
+ *  indent-tab-mode: nil
+ * End:
+ */
diff --git a/hw/pci_ids.h b/hw/pci_ids.h
index 3afe674..f7d0387 100644
--- a/hw/pci_ids.h
+++ b/hw/pci_ids.h
@@ -88,6 +88,7 @@ 
 #define PCI_VENDOR_ID_INTEL              0x8086
 #define PCI_DEVICE_ID_INTEL_82441        0x1237
 #define PCI_DEVICE_ID_INTEL_82801AA_5    0x2415
+#define PCI_DEVICE_ID_INTEL_82801BA_11   0x244e
 #define PCI_DEVICE_ID_INTEL_82371SB_0    0x7000
 #define PCI_DEVICE_ID_INTEL_82371SB_1    0x7010
 #define PCI_DEVICE_ID_INTEL_82371SB_2    0x7020
@@ -95,3 +96,5 @@ 
 #define PCI_DEVICE_ID_INTEL_82371AB      0x7111
 #define PCI_DEVICE_ID_INTEL_82371AB_2    0x7112
 #define PCI_DEVICE_ID_INTEL_82371AB_3    0x7113
+
+#define PCI_VENDOR_ID_INVALID            0xffff