mirror of https://github.com/xemu-project/xemu.git
xbox: initial mcpx aci device code
This commit is contained in:
parent
3caf9e9957
commit
e6eb2853cb
|
@ -13,6 +13,6 @@ obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt.o xen_pt_config_init.o xen_pt_msi.o
|
|||
obj-y += kvm/
|
||||
obj-$(CONFIG_SPICE) += qxl.o qxl-logger.o qxl-render.o
|
||||
|
||||
obj-$(CONFIG_XBOX) += xbox.o xbox_pci.o acpi_xbox.o amd_smbus.o nv2a.o nv2a_vsh.o mcpx_apu.o smbus_xbox_smc.o smbus_cx25871.o smbus_adm1032.o
|
||||
obj-$(CONFIG_XBOX) += xbox.o xbox_pci.o acpi_xbox.o amd_smbus.o nv2a.o nv2a_vsh.o mcpx_apu.o mcpx_aci.o smbus_xbox_smc.o smbus_cx25871.o smbus_adm1032.o
|
||||
|
||||
obj-y := $(addprefix ../,$(obj-y))
|
||||
|
|
|
@ -0,0 +1,110 @@
|
|||
/*
|
||||
* QEMU MCPX Audio Codec Interface implementation
|
||||
*
|
||||
* Copyright (c) 2012 espes
|
||||
*
|
||||
* 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 or
|
||||
* (at your option) version 3 of the License.
|
||||
*
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "hw.h"
|
||||
#include "pc.h"
|
||||
#include "pci.h"
|
||||
#include "ac97_int.h"
|
||||
|
||||
#include "mcpx_apu.h"
|
||||
|
||||
typedef struct MCPXACIState {
|
||||
PCIDevice dev;
|
||||
qemu_irq irq;
|
||||
|
||||
AC97LinkState ac97;
|
||||
|
||||
|
||||
MemoryRegion io_nam, io_nabm;
|
||||
|
||||
MemoryRegion mmio;
|
||||
MemoryRegion nam_mmio, nabm_mmio;
|
||||
} MCPXACIState;
|
||||
|
||||
|
||||
#define MCPX_ACI_DEVICE(obj) \
|
||||
OBJECT_CHECK(MCPXACIState, (obj), "mcpx-aci")
|
||||
|
||||
|
||||
static int mcpx_aci_initfn(PCIDevice *dev)
|
||||
{
|
||||
MCPXACIState *d = MCPX_ACI_DEVICE(dev);
|
||||
|
||||
//mmio
|
||||
memory_region_init(&d->mmio, "mcpx-aci-mmio", 0x1000);
|
||||
|
||||
memory_region_init_io(&d->io_nam, &ac97_io_nam_ops, &d->ac97,
|
||||
"mcpx-aci-nam", 0x100);
|
||||
memory_region_init_io(&d->io_nabm, &ac97_io_nabm_ops, &d->ac97,
|
||||
"mcpx-aci-nabm", 0x80);
|
||||
|
||||
/*pci_register_bar(&d->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &d->io_nam);
|
||||
pci_register_bar(&d->dev, 1, PCI_BASE_ADDRESS_SPACE_IO, &d->io_nabm);
|
||||
|
||||
memory_region_init_alias(&d->nam_mmio, NULL, &d->io_nam, 0, 0x100);
|
||||
memory_region_add_subregion(&d->mmio, 0x0, &d->nam_mmio);
|
||||
|
||||
memory_region_init_alias(&d->nabm_mmio, NULL, &d->io_nabm, 0, 0x80);
|
||||
memory_region_add_subregion(&d->mmio, 0x100, &d->nabm_mmio);*/
|
||||
|
||||
memory_region_add_subregion(&d->mmio, 0x0, &d->io_nam);
|
||||
memory_region_add_subregion(&d->mmio, 0x100, &d->io_nabm);
|
||||
|
||||
pci_register_bar(&d->dev, 2, PCI_BASE_ADDRESS_SPACE_MEMORY, &d->mmio);
|
||||
|
||||
ac97_common_init(&d->ac97, d->irq, pci_dma_context(&d->dev));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void mcpx_aci_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
|
||||
|
||||
k->vendor_id = PCI_VENDOR_ID_NVIDIA;
|
||||
k->device_id = PCI_DEVICE_ID_NVIDIA_MCPX_ACI;
|
||||
k->revision = 210;
|
||||
k->class_id = PCI_CLASS_MULTIMEDIA_AUDIO;
|
||||
k->init = mcpx_aci_initfn;
|
||||
|
||||
dc->desc = "MCPX Audio Codec Interface";
|
||||
}
|
||||
|
||||
static const TypeInfo mcpx_aci_info = {
|
||||
.name = "mcpx-aci",
|
||||
.parent = TYPE_PCI_DEVICE,
|
||||
.instance_size = sizeof(MCPXACIState),
|
||||
.class_init = mcpx_aci_class_init,
|
||||
};
|
||||
|
||||
static void mcpx_aci_register(void)
|
||||
{
|
||||
type_register_static(&mcpx_aci_info);
|
||||
}
|
||||
type_init(mcpx_aci_register);
|
||||
|
||||
|
||||
void mcpx_aci_init(PCIBus *bus, int devfn, qemu_irq irq)
|
||||
{
|
||||
PCIDevice *dev;
|
||||
MCPXACIState *d;
|
||||
dev = pci_create_simple(bus, devfn, "mcpx-aci");
|
||||
d = MCPX_ACI_DEVICE(dev);
|
||||
d->irq = irq;
|
||||
}
|
|
@ -21,5 +21,6 @@
|
|||
#define HW_MCPX_APU_H
|
||||
|
||||
void mcpx_apu_init(PCIBus *bus, int devfn, qemu_irq irq);
|
||||
void mcpx_aci_init(PCIBus *bus, int devfn, qemu_irq irq);
|
||||
|
||||
#endif
|
|
@ -149,6 +149,7 @@
|
|||
|
||||
#define PCI_VENDOR_ID_NVIDIA 0x10de
|
||||
#define PCI_DEVICE_ID_NVIDIA_MCPX_APU 0x01b0
|
||||
#define PCI_DEVICE_ID_NVIDIA_MCPX_ACI 0x01b1
|
||||
#define PCI_DEVICE_ID_NVIDIA_NFORCE_LPC 0x01b2
|
||||
#define PCI_DEVICE_ID_NVIDIA_NFORCE_SMBUS 0x01b4
|
||||
#define PCI_DEVICE_ID_NVIDIA_NFORCE_AGP 0x01b7
|
||||
|
|
Loading…
Reference in New Issue