]> git.proxmox.com Git - mirror_qemu.git/blame - hw/pci-bridge/i82801b11.c
Merge tag 'pull-jan-omnibus-020223-1' of https://gitlab.com/stsquad/qemu into staging
[mirror_qemu.git] / hw / pci-bridge / i82801b11.c
CommitLineData
a1c93046
JB
1/*
2 * Copyright (c) 2006 Fabrice Bellard
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 * THE SOFTWARE.
21 */
22/*
23 * QEMU i82801b11 dmi-to-pci Bridge Emulation
24 *
25 * Copyright (c) 2009, 2010, 2011
26 * Isaku Yamahata <yamahata at valinux co jp>
27 * VA Linux Systems Japan K.K.
28 * Copyright (C) 2012 Jason Baron <jbaron@redhat.com>
29 *
30 * This library is free software; you can redistribute it and/or
31 * modify it under the terms of the GNU Lesser General Public
32 * License as published by the Free Software Foundation; either
61f3c91a 33 * version 2.1 of the License, or (at your option) any later version.
a1c93046
JB
34 *
35 * This library is distributed in the hope that it will be useful,
36 * but WITHOUT ANY WARRANTY; without even the implied warranty of
37 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
38 * Lesser General Public License for more details.
39 *
40 * You should have received a copy of the GNU Lesser General Public
41 * License along with this library; if not, see <http://www.gnu.org/licenses/>
42 */
43
97d5408f 44#include "qemu/osdep.h"
674b0a57 45#include "hw/pci/pci_bridge.h"
d6454270 46#include "migration/vmstate.h"
0b8fa32f 47#include "qemu/module.h"
0d09e41a 48#include "hw/i386/ich9.h"
a1c93046
JB
49
50/*****************************************************************************/
51/* ICH9 DMI-to-PCI bridge */
52#define I82801ba_SSVID_OFFSET 0x50
53#define I82801ba_SSVID_SVID 0
54#define I82801ba_SSVID_SSID 0
55
56typedef struct I82801b11Bridge {
5315dc78
AF
57 /*< private >*/
58 PCIBridge parent_obj;
59 /*< public >*/
a1c93046
JB
60} I82801b11Bridge;
61
f8cd1b02 62static void i82801b11_bridge_realize(PCIDevice *d, Error **errp)
a1c93046
JB
63{
64 int rc;
65
9cfaa007 66 pci_bridge_initfn(d, TYPE_PCI_BUS);
a1c93046
JB
67
68 rc = pci_bridge_ssvid_init(d, I82801ba_SSVID_OFFSET,
f8cd1b02
MZ
69 I82801ba_SSVID_SVID, I82801ba_SSVID_SSID,
70 errp);
a1c93046
JB
71 if (rc < 0) {
72 goto err_bridge;
73 }
4268b096 74 pci_config_set_prog_interface(d->config, PCI_CLASS_BRIDGE_PCI_INF_SUB);
f8cd1b02 75 return;
a1c93046
JB
76
77err_bridge:
78 pci_bridge_exitfn(d);
a1c93046
JB
79}
80
3d100d0f
DDAG
81static const VMStateDescription i82801b11_bridge_dev_vmstate = {
82 .name = "i82801b11_bridge",
9d6b9db1 83 .priority = MIG_PRI_PCI_BUS,
3d100d0f
DDAG
84 .fields = (VMStateField[]) {
85 VMSTATE_PCI_DEVICE(parent_obj, PCIBridge),
86 VMSTATE_END_OF_LIST()
87 }
88};
89
a1c93046
JB
90static void i82801b11_bridge_class_init(ObjectClass *klass, void *data)
91{
92 PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
125ee0ed 93 DeviceClass *dc = DEVICE_CLASS(klass);
a1c93046 94
a1c93046
JB
95 k->vendor_id = PCI_VENDOR_ID_INTEL;
96 k->device_id = PCI_DEVICE_ID_INTEL_82801BA_11;
97 k->revision = ICH9_D2P_A2_REVISION;
f8cd1b02 98 k->realize = i82801b11_bridge_realize;
4965b7f0 99 k->config_write = pci_bridge_write_config;
3d100d0f 100 dc->vmsd = &i82801b11_bridge_dev_vmstate;
ed247f40 101 dc->reset = pci_bridge_reset;
125ee0ed 102 set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
a1c93046
JB
103}
104
105static const TypeInfo i82801b11_bridge_info = {
106 .name = "i82801b11-bridge",
f055e96b 107 .parent = TYPE_PCI_BRIDGE,
a1c93046
JB
108 .instance_size = sizeof(I82801b11Bridge),
109 .class_init = i82801b11_bridge_class_init,
fd3b02c8
EH
110 .interfaces = (InterfaceInfo[]) {
111 { INTERFACE_CONVENTIONAL_PCI_DEVICE },
112 { },
113 },
a1c93046
JB
114};
115
a1c93046
JB
116static void d2pbr_register(void)
117{
118 type_register_static(&i82801b11_bridge_info);
119}
120
121type_init(d2pbr_register);