hw/display/sm501: Replace i2c_send_recv() by i2c_recv() & i2c_send()
[qemu/ar7.git] / hw / audio / via-ac97.c
blob6d556f74fc9dca1437a7cf06cf0b211da501ce65
1 /*
2 * VIA south bridges sound support
4 * This work is licensed under the GNU GPL license version 2 or later.
5 */
7 /*
8 * TODO: This is entirely boiler plate just registering empty PCI devices
9 * with the right ID guests expect, functionality should be added here.
12 #include "qemu/osdep.h"
13 #include "hw/isa/vt82c686.h"
14 #include "hw/pci/pci.h"
16 static void via_ac97_realize(PCIDevice *pci_dev, Error **errp)
18 pci_set_word(pci_dev->config + PCI_COMMAND,
19 PCI_COMMAND_INVALIDATE | PCI_COMMAND_PARITY);
20 pci_set_word(pci_dev->config + PCI_STATUS,
21 PCI_STATUS_CAP_LIST | PCI_STATUS_DEVSEL_MEDIUM);
22 pci_set_long(pci_dev->config + PCI_INTERRUPT_PIN, 0x03);
25 static void via_ac97_class_init(ObjectClass *klass, void *data)
27 DeviceClass *dc = DEVICE_CLASS(klass);
28 PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
30 k->realize = via_ac97_realize;
31 k->vendor_id = PCI_VENDOR_ID_VIA;
32 k->device_id = PCI_DEVICE_ID_VIA_AC97;
33 k->revision = 0x50;
34 k->class_id = PCI_CLASS_MULTIMEDIA_AUDIO;
35 set_bit(DEVICE_CATEGORY_SOUND, dc->categories);
36 dc->desc = "VIA AC97";
37 /* Reason: Part of a south bridge chip */
38 dc->user_creatable = false;
41 static const TypeInfo via_ac97_info = {
42 .name = TYPE_VIA_AC97,
43 .parent = TYPE_PCI_DEVICE,
44 .instance_size = sizeof(PCIDevice),
45 .class_init = via_ac97_class_init,
46 .interfaces = (InterfaceInfo[]) {
47 { INTERFACE_CONVENTIONAL_PCI_DEVICE },
48 { },
52 static void via_mc97_realize(PCIDevice *pci_dev, Error **errp)
54 pci_set_word(pci_dev->config + PCI_COMMAND,
55 PCI_COMMAND_INVALIDATE | PCI_COMMAND_VGA_PALETTE);
56 pci_set_word(pci_dev->config + PCI_STATUS, PCI_STATUS_DEVSEL_MEDIUM);
57 pci_set_long(pci_dev->config + PCI_INTERRUPT_PIN, 0x03);
60 static void via_mc97_class_init(ObjectClass *klass, void *data)
62 DeviceClass *dc = DEVICE_CLASS(klass);
63 PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
65 k->realize = via_mc97_realize;
66 k->vendor_id = PCI_VENDOR_ID_VIA;
67 k->device_id = PCI_DEVICE_ID_VIA_MC97;
68 k->class_id = PCI_CLASS_COMMUNICATION_OTHER;
69 k->revision = 0x30;
70 set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
71 dc->desc = "VIA MC97";
72 /* Reason: Part of a south bridge chip */
73 dc->user_creatable = false;
76 static const TypeInfo via_mc97_info = {
77 .name = TYPE_VIA_MC97,
78 .parent = TYPE_PCI_DEVICE,
79 .instance_size = sizeof(PCIDevice),
80 .class_init = via_mc97_class_init,
81 .interfaces = (InterfaceInfo[]) {
82 { INTERFACE_CONVENTIONAL_PCI_DEVICE },
83 { },
87 static void via_ac97_register_types(void)
89 type_register_static(&via_ac97_info);
90 type_register_static(&via_mc97_info);
93 type_init(via_ac97_register_types)