ia64/xen-unstable

changeset 11183:130eee9e9728

[qemu patches] Update patches for changeset 11161:5c1021595e3c.

Signed-off-by: Christian Limpach <Christian.Limpach@xensource.com>
author chris@kneesaa.uk.xensource.com
date Thu Aug 17 12:01:44 2006 +0100 (2006-08-17)
parents 5c1021595e3c
children b9af81884b99
files tools/ioemu/patches/series tools/ioemu/patches/xen-platform-device
line diff
     1.1 --- a/tools/ioemu/patches/series	Thu Aug 17 12:01:23 2006 +0100
     1.2 +++ b/tools/ioemu/patches/series	Thu Aug 17 12:01:44 2006 +0100
     1.3 @@ -42,3 +42,4 @@ qemu-fix-memset-args
     1.4  qemu-fix-write-to-disk-synchronous
     1.5  xen-support-buffered-ioreqs
     1.6  qemu-daemonize
     1.7 +xen-platform-device
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/tools/ioemu/patches/xen-platform-device	Thu Aug 17 12:01:44 2006 +0100
     2.3 @@ -0,0 +1,186 @@
     2.4 +Add the xen platform device to the qemu PCI bus.  Useful functionality
     2.5 +will come later.
     2.6 +
     2.7 +Index: ioemu/Makefile.target
     2.8 +===================================================================
     2.9 +--- ioemu.orig/Makefile.target	2006-08-17 11:37:49.910902700 +0100
    2.10 ++++ ioemu/Makefile.target	2006-08-17 11:42:15.196191649 +0100
    2.11 +@@ -359,6 +359,7 @@
    2.12 + VL_OBJS+= usb-uhci.o
    2.13 + VL_OBJS+= piix4acpi.o
    2.14 + VL_OBJS+= xenstore.o
    2.15 ++VL_OBJS+= xen_platform.o
    2.16 + DEFINES += -DHAS_AUDIO
    2.17 + endif
    2.18 + ifeq ($(TARGET_BASE_ARCH), ppc)
    2.19 +Index: ioemu/hw/pc.c
    2.20 +===================================================================
    2.21 +--- ioemu.orig/hw/pc.c	2006-08-17 11:37:49.794915697 +0100
    2.22 ++++ ioemu/hw/pc.c	2006-08-17 11:43:11.818853900 +0100
    2.23 +@@ -823,6 +823,9 @@
    2.24 +     }
    2.25 + #endif /* !CONFIG_DM */
    2.26 + 
    2.27 ++    if (pci_enabled)
    2.28 ++        pci_xen_platform_init(pci_bus);
    2.29 ++
    2.30 +     for(i = 0; i < MAX_SERIAL_PORTS; i++) {
    2.31 +         if (serial_hds[i]) {
    2.32 +             serial_init(&pic_set_irq_new, isa_pic,
    2.33 +Index: ioemu/hw/xen_platform.c
    2.34 +===================================================================
    2.35 +--- /dev/null	1970-01-01 00:00:00.000000000 +0000
    2.36 ++++ ioemu/hw/xen_platform.c	2006-08-17 11:56:16.043076969 +0100
    2.37 +@@ -0,0 +1,138 @@
    2.38 ++/*
    2.39 ++ * XEN platform fake pci device, formerly known as the event channel device
    2.40 ++ * 
    2.41 ++ * Copyright (c) 2003-2004 Intel Corp.
    2.42 ++ * Copyright (c) 2006 XenSource
    2.43 ++ * 
    2.44 ++ * Permission is hereby granted, free of charge, to any person obtaining a copy
    2.45 ++ * of this software and associated documentation files (the "Software"), to deal
    2.46 ++ * in the Software without restriction, including without limitation the rights
    2.47 ++ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    2.48 ++ * copies of the Software, and to permit persons to whom the Software is
    2.49 ++ * furnished to do so, subject to the following conditions:
    2.50 ++ *
    2.51 ++ * The above copyright notice and this permission notice shall be included in
    2.52 ++ * all copies or substantial portions of the Software.
    2.53 ++ *
    2.54 ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    2.55 ++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    2.56 ++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
    2.57 ++ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    2.58 ++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    2.59 ++ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    2.60 ++ * THE SOFTWARE.
    2.61 ++ */
    2.62 ++#include "vl.h"
    2.63 ++
    2.64 ++#include <xenguest.h>
    2.65 ++#include <xc_private.h>
    2.66 ++
    2.67 ++extern FILE *logfile;
    2.68 ++
    2.69 ++static void platform_ioport_write(void *opaque, uint32_t addr, uint32_t val)
    2.70 ++{
    2.71 ++    return;
    2.72 ++}
    2.73 ++
    2.74 ++static uint32_t platform_ioport_read(void *opaque, uint32_t addr)
    2.75 ++{
    2.76 ++    return 0;
    2.77 ++}
    2.78 ++
    2.79 ++static void platform_ioport_map(PCIDevice *pci_dev, int region_num,
    2.80 ++                                uint32_t addr, uint32_t size, int type)
    2.81 ++{
    2.82 ++    register_ioport_write(addr, 16, 4, platform_ioport_write, NULL);
    2.83 ++    register_ioport_read(addr, 16, 1, platform_ioport_read, NULL);
    2.84 ++}
    2.85 ++
    2.86 ++static uint32_t platform_mmio_read(void *opaque, target_phys_addr_t addr)
    2.87 ++{
    2.88 ++    fprintf(logfile, "Warning: try read from xen platform mmio space\n");
    2.89 ++    return 0;
    2.90 ++}
    2.91 ++
    2.92 ++static void platform_mmio_write(void *opaque, target_phys_addr_t addr,
    2.93 ++			       uint32_t val)
    2.94 ++{
    2.95 ++    fprintf(logfile, "Warning: try write to xen platform mmio space\n");
    2.96 ++    return;
    2.97 ++}
    2.98 ++
    2.99 ++static CPUReadMemoryFunc *platform_mmio_read_funcs[3] = {
   2.100 ++    platform_mmio_read,
   2.101 ++    platform_mmio_read,
   2.102 ++    platform_mmio_read,
   2.103 ++};
   2.104 ++
   2.105 ++static CPUWriteMemoryFunc *platform_mmio_write_funcs[3] = {
   2.106 ++    platform_mmio_write,
   2.107 ++    platform_mmio_write,
   2.108 ++    platform_mmio_write,
   2.109 ++};
   2.110 ++
   2.111 ++static void platform_mmio_map(PCIDevice *d, int region_num,
   2.112 ++                              uint32_t addr, uint32_t size, int type)
   2.113 ++{
   2.114 ++    int mmio_io_addr;
   2.115 ++
   2.116 ++    mmio_io_addr = cpu_register_io_memory(0, platform_mmio_read_funcs,
   2.117 ++                                          platform_mmio_write_funcs, NULL);
   2.118 ++
   2.119 ++    cpu_register_physical_memory(addr, 0x1000000, mmio_io_addr);
   2.120 ++}
   2.121 ++
   2.122 ++struct pci_config_header {
   2.123 ++    uint16_t vendor_id;
   2.124 ++    uint16_t device_id;
   2.125 ++    uint16_t command;
   2.126 ++    uint16_t status;
   2.127 ++    uint8_t  revision;
   2.128 ++    uint8_t  api;
   2.129 ++    uint8_t  subclass;
   2.130 ++    uint8_t  class;
   2.131 ++    uint8_t  cache_line_size; /* Units of 32 bit words */
   2.132 ++    uint8_t  latency_timer; /* In units of bus cycles */
   2.133 ++    uint8_t  header_type; /* Should be 0 */
   2.134 ++    uint8_t  bist; /* Built in self test */
   2.135 ++    uint32_t base_address_regs[6];
   2.136 ++    uint32_t reserved1;
   2.137 ++    uint32_t reserved2;
   2.138 ++    uint32_t rom_addr;
   2.139 ++    uint32_t reserved3;
   2.140 ++    uint32_t reserved4;
   2.141 ++    uint8_t  interrupt_line;
   2.142 ++    uint8_t  interrupt_pin;
   2.143 ++    uint8_t  min_gnt;
   2.144 ++    uint8_t  max_lat;
   2.145 ++};
   2.146 ++
   2.147 ++void pci_xen_platform_init(PCIBus *bus)
   2.148 ++{
   2.149 ++    PCIDevice *d;
   2.150 ++    struct pci_config_header *pch;
   2.151 ++
   2.152 ++    printf("Register xen platform.\n");
   2.153 ++    d = pci_register_device(bus, "xen-platform", sizeof(PCIDevice), -1, NULL,
   2.154 ++			    NULL);
   2.155 ++    pch = (struct pci_config_header *)d->config;
   2.156 ++    pch->vendor_id = 0xfffd;
   2.157 ++    pch->device_id = 0x0101;
   2.158 ++    pch->command = 3; /* IO and memory access */
   2.159 ++    pch->revision = 0;
   2.160 ++    pch->api = 0;
   2.161 ++    pch->subclass = 0x80; /* Other */
   2.162 ++    pch->class = 0xff; /* Unclassified device class */
   2.163 ++    pch->header_type = 0;
   2.164 ++    pch->interrupt_pin = 1;
   2.165 ++
   2.166 ++    pci_register_io_region(d, 0, 0x100, PCI_ADDRESS_SPACE_IO,
   2.167 ++                           platform_ioport_map);
   2.168 ++
   2.169 ++    /* reserve 16MB mmio address for share memory*/
   2.170 ++    pci_register_io_region(d, 1, 0x1000000, PCI_ADDRESS_SPACE_MEM_PREFETCH,
   2.171 ++			   platform_mmio_map);
   2.172 ++
   2.173 ++    register_savevm("platform", 0, 1, generic_pci_save, generic_pci_load, d);
   2.174 ++    printf("Done register platform.\n");
   2.175 ++}
   2.176 +Index: ioemu/vl.h
   2.177 +===================================================================
   2.178 +--- ioemu.orig/vl.h	2006-08-17 11:37:49.932900235 +0100
   2.179 ++++ ioemu/vl.h	2006-08-17 11:44:59.487739984 +0100
   2.180 +@@ -1208,6 +1208,9 @@
   2.181 + void xenstore_check_new_media_present(int timeout);
   2.182 + void xenstore_write_vncport(int vnc_display);
   2.183 + 
   2.184 ++/* xen_platform.c */
   2.185 ++void pci_xen_platform_init(PCIBus *bus);
   2.186 ++
   2.187 + 
   2.188 + void kqemu_record_dump(void);
   2.189 +