Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
openSUSE:Evergreen:11.4
kvm.573
kvm-qemu-lpc.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File kvm-qemu-lpc.patch of Package kvm.573
#qemu-only -> submit upstream qemu Index: qemu-kvm-0.13.0/Makefile.target =================================================================== --- qemu-kvm-0.13.0.orig/Makefile.target +++ qemu-kvm-0.13.0/Makefile.target @@ -219,6 +219,7 @@ obj-i386-y += debugcon.o multiboot.o obj-i386-y += pc_piix.o obj-i386-y += testdev.o obj-i386-y += acpi.o acpi_piix4.o +obj-i386-y += lpc.o obj-i386-y += pcspk.o i8254.o obj-i386-$(CONFIG_KVM_PIT) += i8254-kvm.o Index: qemu-kvm-0.13.0/hw/lpc.c =================================================================== --- /dev/null +++ qemu-kvm-0.13.0/hw/lpc.c @@ -0,0 +1,162 @@ +/* + * Low Pin Count emulation + * + * Copyright (c) 2007 Alexander Graf + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * ***************************************************************** + * + * This driver emulates an ICH-7 LPC partially. The LPC is basically the + * same as the ISA-bridge in the existing PIIX implementation, but + * more recent and includes support for HPET and Power Management. + * + */ +#include "hw.h" +#include "pci.h" +#include "console.h" + +#define RCBA_BASE 0xFED1C000 + +void hpet_init(qemu_irq irq); + +static uint32_t rcba_ram_readl(void *opaque, target_phys_addr_t addr) +{ + printf("qemu: rcba_read l at %#lx\n", addr); + if(addr == RCBA_BASE + 0x3404) { /* This is the HPET config pointer */ + printf("qemu: rcba_read HPET_CONFIG_POINTER\n"); + return 0xf0; // enabled at 0xfed00000 + } else if(addr == RCBA_BASE + 0x3410) { /* This is the HPET config pointer */ + printf("qemu: rcba_read GCS\n"); + return 0; + } else { + return 0x0; + } +} + +static void rcba_ram_writel(void *opaque, target_phys_addr_t addr, + uint32_t value) +{ + printf("qemu: rcba_write l %#lx = %#x\n", addr, value); +} + +static CPUReadMemoryFunc *rcba_ram_read[] = { + NULL, + NULL, + rcba_ram_readl, +}; + +static CPUWriteMemoryFunc *rcba_ram_write[] = { + NULL, + NULL, + rcba_ram_writel, +}; + +void lpc_init(PCIBus *bus, int devfn, qemu_irq *pic) { + int iomemtype; + uint8_t *pci_conf; + PCIDevice *d; + + /* register a function 1 of PIIX3 */ + d = (PCIDevice *)pci_register_device(bus, "LPC", + sizeof(PCIDevice), + 31 << 3, + NULL, NULL); + pci_conf = d->config; + pci_conf[0x00] = 0x86; + pci_conf[0x01] = 0x80; + pci_conf[0x02] = 0xb9; + pci_conf[0x03] = 0x27; + pci_conf[0x08] = 0x02; // Revision 2 + + pci_conf[0x0a] = 0x01; // PCI-to-ISA Bridge + pci_conf[0x0b] = 0x06; // Bridge + + pci_conf[0x0e] = 0xf0; + + // Subsystem + pci_conf[0x2c] = 0x86; + pci_conf[0x2d] = 0x80; + pci_conf[0x2e] = 0x70; + pci_conf[0x2f] = 0x72; + + pci_conf[0x3d] = 0x03; + + // PMBASE + pci_conf[0x40] = 0x01; + pci_conf[0x41] = 0x0b; + + pci_conf[0xf0] = RCBA_BASE | 1; // enabled + pci_conf[0xf1] = RCBA_BASE << 8; + pci_conf[0xf2] = RCBA_BASE << 16; + pci_conf[0xf3] = RCBA_BASE << 24; + + + /* RCBA Area */ + + iomemtype = cpu_register_io_memory(rcba_ram_read, rcba_ram_write, d); + + cpu_register_physical_memory(RCBA_BASE, 0x4000, iomemtype); +#if 0 + cpu_register_physical_memory(0x00CDA000, 0x4000, iomemtype); +#endif + + + + pci_conf[0x04] = 0x07; // master, memory and I/O + pci_conf[0x05] = 0x00; + pci_conf[0x06] = 0x00; + pci_conf[0x07] = 0x02; // PCI_status_devsel_medium + pci_conf[0x4c] = 0x4d; + pci_conf[0x4e] = 0x03; + pci_conf[0x4f] = 0x00; + pci_conf[0x60] = 0x0a; // PCI A -> IRQ 10 + pci_conf[0x61] = 0x0a; // PCI B -> IRQ 10 + pci_conf[0x62] = 0x0b; // PCI C -> IRQ 11 + pci_conf[0x63] = 0x0b; // PCI D -> IRQ 11 + pci_conf[0x69] = 0x02; + pci_conf[0x70] = 0x80; + pci_conf[0x76] = 0x0c; + pci_conf[0x77] = 0x0c; + pci_conf[0x78] = 0x02; + pci_conf[0x79] = 0x00; + pci_conf[0x80] = 0x00; + pci_conf[0x82] = 0x00; + pci_conf[0xa0] = 0x08; + pci_conf[0xa2] = 0x00; + pci_conf[0xa3] = 0x00; + pci_conf[0xa4] = 0x00; + pci_conf[0xa5] = 0x00; + pci_conf[0xa6] = 0x00; + pci_conf[0xa7] = 0x00; + pci_conf[0xa8] = 0x0f; + pci_conf[0xaa] = 0x00; + pci_conf[0xab] = 0x00; + pci_conf[0xac] = 0x00; + pci_conf[0xae] = 0x00; + +// XXX hpet goes via apic + hpet_init(pic); + +#if 0 + register_ioport_read(0x1000, 128, 1, pmbase_readb, d); + register_ioport_write(0x1000, 128, 1, pmbase_writeb, d); + register_ioport_read(0x1000, 64, 2, pmbase_readw, d); + register_ioport_write(0x1000, 64, 2, pmbase_writew, d); + register_ioport_read(0x1000, 32, 4, pmbase_readl, d); + register_ioport_write(0x1000, 32, 5, pmbase_writel, d); +#endif +} + Index: qemu-kvm-0.13.0/hw/pc.h =================================================================== --- qemu-kvm-0.13.0.orig/hw/pc.h +++ qemu-kvm-0.13.0/hw/pc.h @@ -179,6 +179,9 @@ void isa_cirrus_vga_init(void); void isa_ne2000_init(int base, int irq, NICInfo *nd); +/* lpc.c */ +void lpc_init(PCIBus *bus, int devfn, qemu_irq *pic); + /* extboot.c */ void extboot_init(BlockDriverState *bs);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor