# HG changeset patch
# User awilliam@xxxxxxxxxxx
# Node ID 4f4d358aa5e4debc5d985ad629cdb0bc71f885c2
# Parent 7e7846ea4ab321e6d6b7ad34bbcd808cd2bbcfff
# Parent 7826e5482d421cf3bfd2a3e54800f7a21ca2a9f9
merge with xen-unstable.hg
---
patches/linux-2.6.16.29/blktap-aio-16_03_06.patch
| 271 -
patches/linux-2.6.16.29/device_bind.patch
| 14
patches/linux-2.6.16.29/fix-hz-suspend.patch
| 25
patches/linux-2.6.16.29/fix-ide-cd-pio-mode.patch
| 13
patches/linux-2.6.16.29/i386-mach-io-check-nmi.patch
| 35
patches/linux-2.6.16.29/ipv6-no-autoconf.patch
| 18
patches/linux-2.6.16.29/net-csum.patch
| 57
patches/linux-2.6.16.29/net-gso-0-base.patch
| 2441 ----------
patches/linux-2.6.16.29/net-gso-1-check-dodgy.patch
| 22
patches/linux-2.6.16.29/net-gso-2-checksum-fix.patch
| 400 -
patches/linux-2.6.16.29/net-gso-3-fix-errorcheck.patch
| 13
patches/linux-2.6.16.29/net-gso-4-kill-warnon.patch
| 16
patches/linux-2.6.16.29/net-gso-5-rcv-mss.patch
| 11
patches/linux-2.6.16.29/pci-mmconfig-fix-from-2.6.17.patch
| 252 -
patches/linux-2.6.16.29/pmd-shared.patch
| 100
patches/linux-2.6.16.29/rcu_needs_cpu.patch
| 33
patches/linux-2.6.16.29/rename-TSS_sysenter_esp0-SYSENTER_stack_esp0.patch
| 26
patches/linux-2.6.16.29/series
| 25
patches/linux-2.6.16.29/smp-alts.patch
| 540 --
patches/linux-2.6.16.29/tpm_plugin_2.6.17.patch
| 1380 -----
patches/linux-2.6.16.29/x86-elfnote-as-preprocessor-macro.patch
| 27
patches/linux-2.6.16.29/x86-increase-interrupt-vector-range.patch
| 73
patches/linux-2.6.16.29/x86-put-note-sections-into-a-pt_note-segment-in-vmlinux.patch
| 138
patches/linux-2.6.16.29/x86_64-put-note-sections-into-a-pt_note-segment-in-vmlinux.patch
| 72
patches/linux-2.6.16.29/xen-hotplug.patch
| 10
patches/linux-2.6.16.29/xenoprof-generic.patch
| 615 --
tools/firmware/hvmloader/acpi/gen.c
| 53
tools/firmware/hvmloader/acpi_madt.c
| 162
xen/arch/x86/hvm/i8259.c
| 568 --
.hgignore
| 1
buildconfigs/mk.linux-2.6-xen
| 2
extras/mini-os/Makefile
| 7
extras/mini-os/arch/x86/mm.c
| 428 +
extras/mini-os/arch/x86/sched.c
| 150
extras/mini-os/events.c
| 15
extras/mini-os/include/mm.h
| 175
extras/mini-os/include/sched.h
| 26
extras/mini-os/include/x86/arch_mm.h
| 209
extras/mini-os/include/x86/arch_sched.h
| 58
extras/mini-os/include/x86/x86_32/hypercall-x86_32.h
| 2
extras/mini-os/include/x86/x86_64/hypercall-x86_64.h
| 2
extras/mini-os/kernel.c
| 6
extras/mini-os/mm.c
| 376 -
extras/mini-os/sched.c
| 137
linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c
| 12
linux-2.6-xen-sparse/arch/i386/oprofile/Makefile
| 5
linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c
| 567 --
linux-2.6-xen-sparse/arch/x86_64/kernel/acpi/Makefile
| 1
linux-2.6-xen-sparse/arch/x86_64/oprofile/Makefile
| 5
linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c
| 2
linux-2.6-xen-sparse/drivers/xen/blkback/common.h
| 2
linux-2.6-xen-sparse/drivers/xen/blkback/vbd.c
| 2
linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c
| 2
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
| 9
linux-2.6-xen-sparse/drivers/xen/char/mem.c
| 57
linux-2.6-xen-sparse/drivers/xen/netback/netback.c
| 2
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c
| 7
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
| 25
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.h
| 3
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe_backend.c
| 4
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c
| 7
linux-2.6-xen-sparse/drivers/xen/xenoprof/xenoprofile.c
| 500 ++
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h
| 1
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/io.h
| 3
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/maddr.h
| 42
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/xenoprof.h
| 48
linux-2.6-xen-sparse/include/asm-ia64/maddr.h
| 5
linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/io.h
| 3
linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/maddr.h
| 31
linux-2.6-xen-sparse/include/linux/skbuff.h
| 24
linux-2.6-xen-sparse/include/xen/xenoprof.h
| 42
linux-2.6-xen-sparse/mm/memory.c
| 1
linux-2.6-xen-sparse/mm/mmap.c
| 17
linux-2.6-xen-sparse/net/core/skbuff.c
| 125
patches/linux-2.6.16.32/blktap-aio-16_03_06.patch
| 161
patches/linux-2.6.16.32/device_bind.patch
| 9
patches/linux-2.6.16.32/fix-hz-suspend.patch
| 9
patches/linux-2.6.16.32/fix-ide-cd-pio-mode.patch
| 13
patches/linux-2.6.16.32/i386-mach-io-check-nmi.patch
| 30
patches/linux-2.6.16.32/ipv6-no-autoconf.patch
| 16
patches/linux-2.6.16.32/kasprintf.patch
| 32
patches/linux-2.6.16.32/net-csum.patch
| 40
patches/linux-2.6.16.32/net-gso-0-base.patch
| 1970 ++++++++
patches/linux-2.6.16.32/net-gso-1-check-dodgy.patch
| 16
patches/linux-2.6.16.32/net-gso-2-checksum-fix.patch
| 311 +
patches/linux-2.6.16.32/net-gso-3-fix-errorcheck.patch
| 13
patches/linux-2.6.16.32/net-gso-4-kill-warnon.patch
| 26
patches/linux-2.6.16.32/net-gso-5-rcv-mss.patch
| 11
patches/linux-2.6.16.32/pci-mmconfig-fix-from-2.6.17.patch
| 143
patches/linux-2.6.16.32/pmd-shared.patch
| 57
patches/linux-2.6.16.32/rcu_needs_cpu.patch
| 18
patches/linux-2.6.16.32/rename-TSS_sysenter_esp0-SYSENTER_stack_esp0.patch
| 26
patches/linux-2.6.16.32/series
| 27
patches/linux-2.6.16.32/smp-alts.patch
| 330 +
patches/linux-2.6.16.32/tpm_plugin_2.6.17.patch
| 703 ++
patches/linux-2.6.16.32/vsnprintf.patch
| 177
patches/linux-2.6.16.32/x86-elfnote-as-preprocessor-macro.patch
| 25
patches/linux-2.6.16.32/x86-increase-interrupt-vector-range.patch
| 73
patches/linux-2.6.16.32/x86-put-note-sections-into-a-pt_note-segment-in-vmlinux.patch
| 39
patches/linux-2.6.16.32/x86_64-put-note-sections-into-a-pt_note-segment-in-vmlinux.patch
| 63
patches/linux-2.6.16.32/xen-hotplug.patch
| 10
patches/linux-2.6.16.32/xenoprof-generic.patch
| 294 +
tools/blktap/drivers/blktapctrl.c
| 2
tools/blktap/drivers/blktapctrl.h
| 6
tools/blktap/drivers/tapdisk.h
| 6
tools/blktap/lib/blktaplib.h
| 12
tools/blktap/lib/xenbus.c
| 2
tools/check/check_python_devel
| 16
tools/examples/vif-common.sh
| 2
tools/examples/xend-config.sxp
| 36
tools/examples/xmexample.hvm
| 20
tools/examples/xmexample.vti
| 4
tools/firmware/hvmloader/Makefile
| 12
tools/firmware/hvmloader/acpi/Makefile
| 22
tools/firmware/hvmloader/acpi/acpi2_0.h
| 18
tools/firmware/hvmloader/acpi/build.c
| 387 -
tools/firmware/hvmloader/acpi/dsdt.asl
| 591 +-
tools/firmware/hvmloader/acpi/dsdt.c
| 659 +-
tools/firmware/hvmloader/acpi/static_tables.c
| 41
tools/firmware/hvmloader/acpi_utils.c
| 74
tools/firmware/hvmloader/apic_regs.h
| 108
tools/firmware/hvmloader/config.h
| 13
tools/firmware/hvmloader/hvmloader.c
| 464 +
tools/firmware/hvmloader/mp_tables.c
| 493 --
tools/firmware/hvmloader/pci_regs.h
| 108
tools/firmware/hvmloader/smbios.c
| 839 +--
tools/firmware/hvmloader/util.c
| 645 +-
tools/firmware/hvmloader/util.h
| 48
tools/firmware/rombios/rombios.c
| 96
tools/firmware/vmxassist/util.c
| 13
tools/firmware/vmxassist/vm86.h
| 10
tools/ioemu/Makefile.target
| 6
tools/ioemu/hw/fdc.c
| 2
tools/ioemu/hw/pci.c
| 24
tools/ioemu/target-i386-dm/i8259-dm.c
| 2
tools/ioemu/target-i386-dm/piix_pci-dm.c
| 152
tools/ioemu/vl.c
| 25
tools/libfsimage/ext2fs/fsys_ext2fs.c
| 9
tools/libfsimage/reiserfs/fsys_reiserfs.c
| 9
tools/libxc/xc_domain.c
| 16
tools/libxc/xc_hvm_build.c
| 181
tools/libxc/xc_linux_build.c
| 6
tools/libxc/xc_linux_restore.c
| 16
tools/libxc/xc_misc.c
| 76
tools/libxc/xc_private.c
| 32
tools/libxc/xenctrl.h
| 18
tools/libxc/xenguest.h
| 19
tools/libxc/xg_private.c
| 7
tools/python/README.XendConfig
| 1
tools/python/README.sxpcfg
| 1
tools/python/xen/lowlevel/xc/xc.c
| 51
tools/python/xen/util/xmlrpclib2.py
| 27
tools/python/xen/web/connection.py
| 16
tools/python/xen/web/tcp.py
| 14
tools/python/xen/xend/XendAPI.py
| 25
tools/python/xen/xend/XendAuthSessions.py
| 14
tools/python/xen/xend/XendCheckpoint.py
| 26
tools/python/xen/xend/XendClient.py
| 1
tools/python/xen/xend/XendConfig.py
| 10
tools/python/xen/xend/XendConstants.py
| 6
tools/python/xen/xend/XendDevices.py
| 10
tools/python/xen/xend/XendDomain.py
| 136
tools/python/xen/xend/XendDomainInfo.py
| 5
tools/python/xen/xend/XendNode.py
| 2
tools/python/xen/xend/XendRoot.py
| 9
tools/python/xen/xend/image.py
| 15
tools/python/xen/xend/server/SrvDomain.py
| 12
tools/python/xen/xend/server/SrvServer.py
| 57
tools/python/xen/xend/server/XMLRPCServer.py
| 46
tools/python/xen/xend/server/tpmif.py
| 8
tools/python/xen/xm/cfgbootpolicy.py
| 4
tools/python/xen/xm/create.py
| 12
tools/python/xen/xm/main.py
| 118
unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h
| 5
unmodified_drivers/linux-2.6/platform-pci/evtchn.c
| 32
unmodified_drivers/linux-2.6/platform-pci/platform-compat.c
| 23
unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
| 22
xen/arch/x86/Rules.mk
| 1
xen/arch/x86/domain.c
| 2
xen/arch/x86/hvm/Makefile
| 7
xen/arch/x86/hvm/hvm.c
| 218
xen/arch/x86/hvm/instrlen.c
| 163
xen/arch/x86/hvm/irq.c
| 227
xen/arch/x86/hvm/platform.c
| 158
xen/arch/x86/hvm/rtc.c
| 279 -
xen/arch/x86/hvm/svm/emulate.c
| 26
xen/arch/x86/hvm/svm/intr.c
| 64
xen/arch/x86/hvm/svm/svm.c
| 208
xen/arch/x86/hvm/svm/vmcb.c
| 1
xen/arch/x86/hvm/vioapic.c
| 313 -
xen/arch/x86/hvm/vlapic.c
| 29
xen/arch/x86/hvm/vmx/io.c
| 44
xen/arch/x86/hvm/vmx/vmx.c
| 374 +
xen/arch/x86/hvm/vpic.c
| 463 +
xen/arch/x86/mm.c
| 44
xen/arch/x86/mm/shadow/common.c
| 897 +--
xen/arch/x86/mm/shadow/multi.c
| 620 +-
xen/arch/x86/mm/shadow/private.h
| 256 -
xen/arch/x86/mm/shadow/types.h
| 24
xen/arch/x86/oprofile/nmi_int.c
| 5
xen/arch/x86/oprofile/xenoprof.c
| 695 --
xen/arch/x86/traps.c
| 24
xen/arch/x86/x86_emulate.c
| 232
xen/common/Makefile
| 1
xen/common/grant_table.c
| 12
xen/common/xenoprof.c
| 743 +++
xen/include/asm-x86/domain.h
| 7
xen/include/asm-x86/hvm/domain.h
| 11
xen/include/asm-x86/hvm/hvm.h
| 38
xen/include/asm-x86/hvm/io.h
| 1
xen/include/asm-x86/hvm/irq.h
| 107
xen/include/asm-x86/hvm/svm/emulate.h
| 4
xen/include/asm-x86/hvm/vioapic.h
| 20
xen/include/asm-x86/hvm/vlapic.h
| 1
xen/include/asm-x86/hvm/vpic.h
| 84
xen/include/asm-x86/hvm/vpt.h
| 29
xen/include/asm-x86/mm.h
| 44
xen/include/asm-x86/shadow.h
| 80
xen/include/asm-x86/xenoprof.h
| 68
xen/include/public/hvm/hvm_info_table.h
| 1
xen/include/public/hvm/hvm_op.h
| 50
xen/include/public/xenoprof.h
| 4
xen/include/xen/xenoprof.h
| 7
223 files changed, 14070 insertions(+), 13871 deletions(-)
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 .hgignore
--- a/.hgignore Mon Nov 27 10:10:57 2006 -0700
+++ b/.hgignore Tue Nov 28 10:37:36 2006 -0700
@@ -98,7 +98,6 @@
^tools/firmware/.*\.bin$
^tools/firmware/.*\.sym$
^tools/firmware/.*bios/.*bios.*\.txt$
-^tools/firmware/hvmloader/acpi/acpigen$
^tools/firmware/hvmloader/hvmloader$
^tools/firmware/hvmloader/roms\.h$
^tools/firmware/rombios/BIOS-bochs-[^/]*$
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 buildconfigs/mk.linux-2.6-xen
--- a/buildconfigs/mk.linux-2.6-xen Mon Nov 27 10:10:57 2006 -0700
+++ b/buildconfigs/mk.linux-2.6-xen Tue Nov 28 10:37:36 2006 -0700
@@ -1,5 +1,5 @@ LINUX_SERIES = 2.6
LINUX_SERIES = 2.6
-LINUX_VER = 2.6.16.29
+LINUX_VER = 2.6.16.32
EXTRAVERSION ?= xen
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 extras/mini-os/Makefile
--- a/extras/mini-os/Makefile Mon Nov 27 10:10:57 2006 -0700
+++ b/extras/mini-os/Makefile Tue Nov 28 10:37:36 2006 -0700
@@ -55,9 +55,10 @@ endif
endif
ifeq ($(TARGET_ARCH),ia64)
-CFLAGS += -mfixed-range=f12-f15,f32-f127
-ASFLAGS += -x assembler-with-cpp -ansi -Wall
-ASFLAGS += -mfixed-range=f12-f15,f32-f127
+CFLAGS += -mfixed-range=f2-f5,f12-f15,f32-f127 -mconstant-gp
+ASFLAGS += -x assembler-with-cpp -Wall
+ASFLAGS += -mfixed-range=f2-f5,f12-f15,f32-f127 -fomit-frame-pointer
+ASFLAGS += -fno-builtin -fno-common -fno-strict-aliasing -mconstant-gp
ARCH_LINKS = IA64_LINKS # Special link on ia64 needed
define arch_links
[ -e include/ia64/asm-xsi-offsets.h ] || ln -sf
../../../../xen/include/asm-ia64/asm-xsi-offsets.h
include/ia64/asm-xsi-offsets.h
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 extras/mini-os/events.c
--- a/extras/mini-os/events.c Mon Nov 27 10:10:57 2006 -0700
+++ b/extras/mini-os/events.c Tue Nov 28 10:37:36 2006 -0700
@@ -35,6 +35,21 @@ static ev_action_t ev_actions[NR_EVS];
static ev_action_t ev_actions[NR_EVS];
void default_handler(evtchn_port_t port, struct pt_regs *regs, void *data);
+void unbind_all_ports(void)
+{
+ int i;
+
+ for(i=0;i<NR_EVS;i++)
+ {
+ if(ev_actions[i].handler != default_handler)
+ {
+ struct evtchn_close close;
+ mask_evtchn(i);
+ close.port = i;
+ HYPERVISOR_event_channel_op(EVTCHNOP_close, &close);
+ }
+ }
+}
/*
* Demux events to different handlers.
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 extras/mini-os/include/mm.h
--- a/extras/mini-os/include/mm.h Mon Nov 27 10:10:57 2006 -0700
+++ b/extras/mini-os/include/mm.h Tue Nov 28 10:37:36 2006 -0700
@@ -29,182 +29,15 @@
#include <xen/arch-x86_32.h>
#elif defined(__x86_64__)
#include <xen/arch-x86_64.h>
+#elif defined(__ia64__)
+#include <xen/arch-ia64.h>
#else
#error "Unsupported architecture"
#endif
#include <lib.h>
+#include <arch_mm.h>
-#define L1_FRAME 1
-#define L2_FRAME 2
-#define L3_FRAME 3
-
-#define L1_PAGETABLE_SHIFT 12
-
-#if defined(__i386__)
-
-#if !defined(CONFIG_X86_PAE)
-
-#define L2_PAGETABLE_SHIFT 22
-
-#define L1_PAGETABLE_ENTRIES 1024
-#define L2_PAGETABLE_ENTRIES 1024
-
-#define PADDR_BITS 32
-#define PADDR_MASK (~0UL)
-
-#define NOT_L1_FRAMES 1
-#define PRIpte "08lx"
-typedef unsigned long pgentry_t;
-
-#else /* defined(CONFIG_X86_PAE) */
-
-#define L2_PAGETABLE_SHIFT 21
-#define L3_PAGETABLE_SHIFT 30
-
-#define L1_PAGETABLE_ENTRIES 512
-#define L2_PAGETABLE_ENTRIES 512
-#define L3_PAGETABLE_ENTRIES 4
-
-#define PADDR_BITS 44
-#define PADDR_MASK ((1ULL << PADDR_BITS)-1)
-
-#define L2_MASK ((1UL << L3_PAGETABLE_SHIFT) - 1)
-
-/*
- * If starting from virtual address greater than 0xc0000000,
- * this value will be 2 to account for final mid-level page
- * directory which is always mapped in at this location.
- */
-#define NOT_L1_FRAMES 3
-#define PRIpte "016llx"
-typedef uint64_t pgentry_t;
-
-#endif /* !defined(CONFIG_X86_PAE) */
-
-#elif defined(__x86_64__)
-
-#define L2_PAGETABLE_SHIFT 21
-#define L3_PAGETABLE_SHIFT 30
-#define L4_PAGETABLE_SHIFT 39
-
-#define L1_PAGETABLE_ENTRIES 512
-#define L2_PAGETABLE_ENTRIES 512
-#define L3_PAGETABLE_ENTRIES 512
-#define L4_PAGETABLE_ENTRIES 512
-
-/* These are page-table limitations. Current CPUs support only 40-bit phys. */
-#define PADDR_BITS 52
-#define VADDR_BITS 48
-#define PADDR_MASK ((1UL << PADDR_BITS)-1)
-#define VADDR_MASK ((1UL << VADDR_BITS)-1)
-
-#define L2_MASK ((1UL << L3_PAGETABLE_SHIFT) - 1)
-#define L3_MASK ((1UL << L4_PAGETABLE_SHIFT) - 1)
-
-#define NOT_L1_FRAMES 3
-#define PRIpte "016lx"
-typedef unsigned long pgentry_t;
-
-#endif
-
-#define L1_MASK ((1UL << L2_PAGETABLE_SHIFT) - 1)
-
-/* Given a virtual address, get an entry offset into a page table. */
-#define l1_table_offset(_a) \
- (((_a) >> L1_PAGETABLE_SHIFT) & (L1_PAGETABLE_ENTRIES - 1))
-#define l2_table_offset(_a) \
- (((_a) >> L2_PAGETABLE_SHIFT) & (L2_PAGETABLE_ENTRIES - 1))
-#if defined(__x86_64__) || defined(CONFIG_X86_PAE)
-#define l3_table_offset(_a) \
- (((_a) >> L3_PAGETABLE_SHIFT) & (L3_PAGETABLE_ENTRIES - 1))
-#endif
-#if defined(__x86_64__)
-#define l4_table_offset(_a) \
- (((_a) >> L4_PAGETABLE_SHIFT) & (L4_PAGETABLE_ENTRIES - 1))
-#endif
-
-#define _PAGE_PRESENT 0x001UL
-#define _PAGE_RW 0x002UL
-#define _PAGE_USER 0x004UL
-#define _PAGE_PWT 0x008UL
-#define _PAGE_PCD 0x010UL
-#define _PAGE_ACCESSED 0x020UL
-#define _PAGE_DIRTY 0x040UL
-#define _PAGE_PAT 0x080UL
-#define _PAGE_PSE 0x080UL
-#define _PAGE_GLOBAL 0x100UL
-
-#if defined(__i386__)
-#define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED)
-#define L2_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY |_PAGE_USER)
-#if defined(CONFIG_X86_PAE)
-#define L3_PROT (_PAGE_PRESENT)
-#endif /* CONFIG_X86_PAE */
-#elif defined(__x86_64__)
-#define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_USER)
-#define L2_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER)
-#define L3_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER)
-#define L4_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER)
-#endif /* __i386__ || __x86_64__ */
-
-#ifndef CONFIG_X86_PAE
-#define PAGE_SIZE (1UL << L1_PAGETABLE_SHIFT)
-#else
-#define PAGE_SIZE (1ULL << L1_PAGETABLE_SHIFT)
-#endif
-#define PAGE_SHIFT L1_PAGETABLE_SHIFT
-#define PAGE_MASK (~(PAGE_SIZE-1))
-
-#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> L1_PAGETABLE_SHIFT)
-#define PFN_DOWN(x) ((x) >> L1_PAGETABLE_SHIFT)
-#define PFN_PHYS(x) ((x) << L1_PAGETABLE_SHIFT)
-
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
-
-/* Definitions for machine and pseudophysical addresses. */
-#ifdef CONFIG_X86_PAE
-typedef unsigned long long paddr_t;
-typedef unsigned long long maddr_t;
-#else
-typedef unsigned long paddr_t;
-typedef unsigned long maddr_t;
-#endif
-
-extern unsigned long *phys_to_machine_mapping;
-extern char _text, _etext, _edata, _end;
-#define pfn_to_mfn(_pfn) (phys_to_machine_mapping[(_pfn)])
-static __inline__ maddr_t phys_to_machine(paddr_t phys)
-{
- maddr_t machine = pfn_to_mfn(phys >> PAGE_SHIFT);
- machine = (machine << PAGE_SHIFT) | (phys & ~PAGE_MASK);
- return machine;
-}
-
-#define mfn_to_pfn(_mfn) (machine_to_phys_mapping[(_mfn)])
-static __inline__ paddr_t machine_to_phys(maddr_t machine)
-{
- paddr_t phys = mfn_to_pfn(machine >> PAGE_SHIFT);
- phys = (phys << PAGE_SHIFT) | (machine & ~PAGE_MASK);
- return phys;
-}
-
-#define VIRT_START ((unsigned long)&_text)
-
-#define to_phys(x) ((unsigned long)(x)-VIRT_START)
-#define to_virt(x) ((void *)((unsigned long)(x)+VIRT_START))
-
-#define virt_to_pfn(_virt) (PFN_DOWN(to_phys(_virt)))
-#define virt_to_mfn(_virt) (pfn_to_mfn(virt_to_pfn(_virt)))
-#define mach_to_virt(_mach) (to_virt(machine_to_phys(_mach)))
-#define virt_to_mach(_virt) (phys_to_machine(to_phys(_virt)))
-#define mfn_to_virt(_mfn) (to_virt(mfn_to_pfn(_mfn) << PAGE_SHIFT))
-#define pfn_to_virt(_pfn) (to_virt((_pfn) << PAGE_SHIFT))
-
-/* Pagetable walking. */
-#define pte_to_mfn(_pte) (((_pte) & (PADDR_MASK&PAGE_MASK)) >>
L1_PAGETABLE_SHIFT)
-#define pte_to_virt(_pte) to_virt(mfn_to_pfn(pte_to_mfn(_pte)) <<
PAGE_SHIFT)
void init_mm(void);
unsigned long alloc_pages(int order);
@@ -220,6 +53,8 @@ static __inline__ int get_order(unsigned
return order;
}
+void arch_init_demand_mapping_area(unsigned long max_pfn);
+void arch_init_mm(unsigned long* start_pfn_p, unsigned long* max_pfn_p);
void *map_frames(unsigned long *f, unsigned long n);
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 extras/mini-os/include/sched.h
--- a/extras/mini-os/include/sched.h Mon Nov 27 10:10:57 2006 -0700
+++ b/extras/mini-os/include/sched.h Tue Nov 28 10:37:36 2006 -0700
@@ -3,36 +3,40 @@
#include <list.h>
#include <time.h>
+#include <arch_sched.h>
struct thread
{
char *name;
char *stack;
+#if !defined(__ia64__)
unsigned long sp; /* Stack pointer */
unsigned long ip; /* Instruction pointer */
+#else /* !defined(__ia64__) */
+ thread_regs_t regs;
+#endif /* !defined(__ia64__) */
struct list_head thread_list;
u32 flags;
s_time_t wakeup_time;
};
+extern struct thread *idle_thread;
+void idle_thread_fn(void *unused);
+#define RUNNABLE_FLAG 0x00000001
+
+#define is_runnable(_thread) (_thread->flags & RUNNABLE_FLAG)
+#define set_runnable(_thread) (_thread->flags |= RUNNABLE_FLAG)
+#define clear_runnable(_thread) (_thread->flags &= ~RUNNABLE_FLAG)
+
+#define switch_threads(prev, next) arch_switch_threads(prev, next)
+
void init_sched(void);
void run_idle_thread(void);
struct thread* create_thread(char *name, void (*function)(void *), void *data);
void schedule(void);
-static inline struct thread* get_current(void)
-{
- struct thread **current;
-#ifdef __i386__
- __asm__("andl %%esp,%0; ":"=r" (current) : "r" (~8191UL));
-#else
- __asm__("andq %%rsp,%0; ":"=r" (current) : "r" (~8191UL));
-#endif
- return *current;
-}
-
#define current get_current()
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4
extras/mini-os/include/x86/x86_32/hypercall-x86_32.h
--- a/extras/mini-os/include/x86/x86_32/hypercall-x86_32.h Mon Nov 27
10:10:57 2006 -0700
+++ b/extras/mini-os/include/x86/x86_32/hypercall-x86_32.h Tue Nov 28
10:37:36 2006 -0700
@@ -167,7 +167,7 @@ HYPERVISOR_fpu_taskswitch(
static inline int
HYPERVISOR_sched_op(
- int cmd, unsigned long arg)
+ int cmd, void *arg)
{
return _hypercall2(int, sched_op, cmd, arg);
}
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4
extras/mini-os/include/x86/x86_64/hypercall-x86_64.h
--- a/extras/mini-os/include/x86/x86_64/hypercall-x86_64.h Mon Nov 27
10:10:57 2006 -0700
+++ b/extras/mini-os/include/x86/x86_64/hypercall-x86_64.h Tue Nov 28
10:37:36 2006 -0700
@@ -171,7 +171,7 @@ HYPERVISOR_fpu_taskswitch(
static inline int
HYPERVISOR_sched_op(
- int cmd, unsigned long arg)
+ int cmd, void *arg)
{
return _hypercall2(int, sched_op, cmd, arg);
}
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 extras/mini-os/kernel.c
--- a/extras/mini-os/kernel.c Mon Nov 27 10:10:57 2006 -0700
+++ b/extras/mini-os/kernel.c Tue Nov 28 10:37:36 2006 -0700
@@ -159,5 +159,9 @@ void do_exit(void)
void do_exit(void)
{
printk("Do_exit called!\n");
- for ( ;; ) HYPERVISOR_sched_op(SCHEDOP_shutdown, SHUTDOWN_crash);
+ for( ;; )
+ {
+ struct sched_shutdown sched_shutdown = { .reason = SHUTDOWN_crash };
+ HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
+ }
}
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 extras/mini-os/mm.c
--- a/extras/mini-os/mm.c Mon Nov 27 10:10:57 2006 -0700
+++ b/extras/mini-os/mm.c Tue Nov 28 10:37:36 2006 -0700
@@ -48,10 +48,6 @@
#define DEBUG(_f, _a...) ((void)0)
#endif
-unsigned long *phys_to_machine_mapping;
-extern char *stack;
-extern void page_walk(unsigned long virt_addr);
-
/*********************
* ALLOCATION BITMAP
* One bit per page of memory. Bit set => page is allocated.
@@ -226,11 +222,11 @@ static void init_page_allocator(unsigned
/* All allocated by default. */
memset(alloc_bitmap, ~0, bitmap_size);
/* Free up the memory we've been given to play with. */
- map_free(min>>PAGE_SHIFT, range>>PAGE_SHIFT);
+ map_free(PHYS_PFN(min), range>>PAGE_SHIFT);
/* The buddy lists are addressed in high memory. */
- min += VIRT_START;
- max += VIRT_START;
+ min = (unsigned long) to_virt(min);
+ max = (unsigned long) to_virt(max);
while ( range != 0 )
{
@@ -297,7 +293,7 @@ unsigned long alloc_pages(int order)
free_head[i] = spare_ch;
}
- map_alloc(to_phys(alloc_ch)>>PAGE_SHIFT, 1<<order);
+ map_alloc(PHYS_PFN(to_phys(alloc_ch)), 1<<order);
return((unsigned long)alloc_ch);
@@ -365,350 +361,6 @@ void free_pages(void *pointer, int order
}
-void new_pt_frame(unsigned long *pt_pfn, unsigned long prev_l_mfn,
- unsigned long offset, unsigned long level)
-{
- pgentry_t *tab = (pgentry_t *)start_info.pt_base;
- unsigned long pt_page = (unsigned long)pfn_to_virt(*pt_pfn);
- unsigned long prot_e, prot_t, pincmd;
- mmu_update_t mmu_updates[1];
- struct mmuext_op pin_request;
-
- DEBUG("Allocating new L%d pt frame for pt_pfn=%lx, "
- "prev_l_mfn=%lx, offset=%lx",
- level, *pt_pfn, prev_l_mfn, offset);
-
- /* We need to clear the page, otherwise we might fail to map it
- as a page table page */
- memset((unsigned long*)pfn_to_virt(*pt_pfn), 0, PAGE_SIZE);
-
- switch ( level )
- {
- case L1_FRAME:
- prot_e = L1_PROT;
- prot_t = L2_PROT;
- pincmd = MMUEXT_PIN_L1_TABLE;
- break;
-#if defined(__x86_64__) || defined(CONFIG_X86_PAE)
- case L2_FRAME:
- prot_e = L2_PROT;
- prot_t = L3_PROT;
- pincmd = MMUEXT_PIN_L2_TABLE;
- break;
-#endif
-#if defined(__x86_64__)
- case L3_FRAME:
- prot_e = L3_PROT;
- prot_t = L4_PROT;
- pincmd = MMUEXT_PIN_L3_TABLE;
- break;
-#endif
- default:
- printk("new_pt_frame() called with invalid level number %d\n", level);
- do_exit();
- break;
- }
- /* Update the entry */
-#if defined(__x86_64__)
- tab = pte_to_virt(tab[l4_table_offset(pt_page)]);
- tab = pte_to_virt(tab[l3_table_offset(pt_page)]);
-#endif
-#if defined(CONFIG_X86_PAE)
- tab = pte_to_virt(tab[l3_table_offset(pt_page)]);
-#endif
-
- mmu_updates[0].ptr = ((pgentry_t)tab[l2_table_offset(pt_page)] &
PAGE_MASK) +
- sizeof(pgentry_t) * l1_table_offset(pt_page);
- mmu_updates[0].val = (pgentry_t)pfn_to_mfn(*pt_pfn) << PAGE_SHIFT |
- (prot_e & ~_PAGE_RW);
- if(HYPERVISOR_mmu_update(mmu_updates, 1, NULL, DOMID_SELF) < 0)
- {
- printk("PTE for new page table page could not be updated\n");
- do_exit();
- }
-
- /* Pin the page to provide correct protection */
- pin_request.cmd = pincmd;
- pin_request.arg1.mfn = pfn_to_mfn(*pt_pfn);
- if(HYPERVISOR_mmuext_op(&pin_request, 1, NULL, DOMID_SELF) < 0)
- {
- printk("ERROR: pinning failed\n");
- do_exit();
- }
-
- /* Now fill the new page table page with entries.
- Update the page directory as well. */
- mmu_updates[0].ptr = ((pgentry_t)prev_l_mfn << PAGE_SHIFT) +
sizeof(pgentry_t) * offset;
- mmu_updates[0].val = (pgentry_t)pfn_to_mfn(*pt_pfn) << PAGE_SHIFT | prot_t;
- if(HYPERVISOR_mmu_update(mmu_updates, 1, NULL, DOMID_SELF) < 0)
- {
- printk("ERROR: mmu_update failed\n");
- do_exit();
- }
- *pt_pfn += 1;
-}
-
-/* Checks if a pagetable frame is needed (if weren't allocated by Xen) */
-static int need_pt_frame(unsigned long virt_address, int level)
-{
- unsigned long hyp_virt_start = HYPERVISOR_VIRT_START;
-#if defined(__x86_64__)
- unsigned long hyp_virt_end = HYPERVISOR_VIRT_END;
-#else
- unsigned long hyp_virt_end = 0xffffffff;
-#endif
-
- /* In general frames will _not_ be needed if they were already
- allocated to map the hypervisor into our VA space */
-#if defined(__x86_64__)
- if(level == L3_FRAME)
- {
- if(l4_table_offset(virt_address) >=
- l4_table_offset(hyp_virt_start) &&
- l4_table_offset(virt_address) <=
- l4_table_offset(hyp_virt_end))
- return 0;
- return 1;
- } else
-#endif
-
-#if defined(__x86_64__) || defined(CONFIG_X86_PAE)
- if(level == L2_FRAME)
- {
-#if defined(__x86_64__)
- if(l4_table_offset(virt_address) >=
- l4_table_offset(hyp_virt_start) &&
- l4_table_offset(virt_address) <=
- l4_table_offset(hyp_virt_end))
-#endif
- if(l3_table_offset(virt_address) >=
- l3_table_offset(hyp_virt_start) &&
- l3_table_offset(virt_address) <=
- l3_table_offset(hyp_virt_end))
- return 0;
-
- return 1;
- } else
-#endif /* defined(__x86_64__) || defined(CONFIG_X86_PAE) */
-
- /* Always need l1 frames */
- if(level == L1_FRAME)
- return 1;
-
- printk("ERROR: Unknown frame level %d, hypervisor %llx,%llx\n",
- level, hyp_virt_start, hyp_virt_end);
- return -1;
-}
-
-void build_pagetable(unsigned long *start_pfn, unsigned long *max_pfn)
-{
- unsigned long start_address, end_address;
- unsigned long pfn_to_map, pt_pfn = *start_pfn;
- static mmu_update_t mmu_updates[L1_PAGETABLE_ENTRIES + 1];
- pgentry_t *tab = (pgentry_t *)start_info.pt_base, page;
- unsigned long mfn = pfn_to_mfn(virt_to_pfn(start_info.pt_base));
- unsigned long offset;
- int count = 0;
-
- pfn_to_map = (start_info.nr_pt_frames - NOT_L1_FRAMES) *
L1_PAGETABLE_ENTRIES;
-
- if (*max_pfn >= virt_to_pfn(HYPERVISOR_VIRT_START))
- {
- printk("WARNING: Mini-OS trying to use Xen virtual space. "
- "Truncating memory from %dMB to ",
- ((unsigned long)pfn_to_virt(*max_pfn) - (unsigned
long)&_text)>>20);
- *max_pfn = virt_to_pfn(HYPERVISOR_VIRT_START - PAGE_SIZE);
- printk("%dMB\n",
- ((unsigned long)pfn_to_virt(*max_pfn) - (unsigned
long)&_text)>>20);
- }
-
- start_address = (unsigned long)pfn_to_virt(pfn_to_map);
- end_address = (unsigned long)pfn_to_virt(*max_pfn);
-
- /* We worked out the virtual memory range to map, now mapping loop */
- printk("Mapping memory range 0x%lx - 0x%lx\n", start_address, end_address);
-
- while(start_address < end_address)
- {
- tab = (pgentry_t *)start_info.pt_base;
- mfn = pfn_to_mfn(virt_to_pfn(start_info.pt_base));
-
-#if defined(__x86_64__)
- offset = l4_table_offset(start_address);
- /* Need new L3 pt frame */
- if(!(start_address & L3_MASK))
- if(need_pt_frame(start_address, L3_FRAME))
- new_pt_frame(&pt_pfn, mfn, offset, L3_FRAME);
-
- page = tab[offset];
- mfn = pte_to_mfn(page);
- tab = to_virt(mfn_to_pfn(mfn) << PAGE_SHIFT);
-#endif
-#if defined(__x86_64__) || defined(CONFIG_X86_PAE)
- offset = l3_table_offset(start_address);
- /* Need new L2 pt frame */
- if(!(start_address & L2_MASK))
- if(need_pt_frame(start_address, L2_FRAME))
- new_pt_frame(&pt_pfn, mfn, offset, L2_FRAME);
-
- page = tab[offset];
- mfn = pte_to_mfn(page);
- tab = to_virt(mfn_to_pfn(mfn) << PAGE_SHIFT);
-#endif
- offset = l2_table_offset(start_address);
- /* Need new L1 pt frame */
- if(!(start_address & L1_MASK))
- if(need_pt_frame(start_address, L1_FRAME))
- new_pt_frame(&pt_pfn, mfn, offset, L1_FRAME);
-
- page = tab[offset];
- mfn = pte_to_mfn(page);
- offset = l1_table_offset(start_address);
-
- mmu_updates[count].ptr = ((pgentry_t)mfn << PAGE_SHIFT) +
sizeof(pgentry_t) * offset;
- mmu_updates[count].val = (pgentry_t)pfn_to_mfn(pfn_to_map++) <<
PAGE_SHIFT | L1_PROT;
- count++;
- if (count == L1_PAGETABLE_ENTRIES || pfn_to_map == *max_pfn)
- {
- if(HYPERVISOR_mmu_update(mmu_updates, count, NULL, DOMID_SELF) < 0)
- {
- printk("PTE could not be updated\n");
- do_exit();
- }
- count = 0;
- }
- start_address += PAGE_SIZE;
- }
- *start_pfn = pt_pfn;
-}
-
-
-void mem_test(unsigned long *start_add, unsigned long *end_add)
-{
- unsigned long mask = 0x10000;
- unsigned long *pointer;
-
- for(pointer = start_add; pointer < end_add; pointer++)
- {
- if(!(((unsigned long)pointer) & 0xfffff))
- {
- printk("Writing to %lx\n", pointer);
- page_walk((unsigned long)pointer);
- }
- *pointer = (unsigned long)pointer & ~mask;
- }
-
- for(pointer = start_add; pointer < end_add; pointer++)
- {
- if(((unsigned long)pointer & ~mask) != *pointer)
- printk("Read error at 0x%lx. Read: 0x%lx, should read 0x%lx\n",
- (unsigned long)pointer,
- *pointer,
- ((unsigned long)pointer & ~mask));
- }
-
-}
-
-static pgentry_t *demand_map_pgt;
-static void *demand_map_area_start;
-
-static void init_demand_mapping_area(unsigned long max_pfn)
-{
- unsigned long mfn;
- pgentry_t *tab;
- unsigned long start_addr;
- unsigned long pt_pfn;
- unsigned offset;
-
- /* Round up to four megs. + 1024 rather than + 1023 since we want
- to be sure we don't end up in the same place we started. */
- max_pfn = (max_pfn + L1_PAGETABLE_ENTRIES) & ~(L1_PAGETABLE_ENTRIES - 1);
- if (max_pfn == 0 ||
- (unsigned long)pfn_to_virt(max_pfn + L1_PAGETABLE_ENTRIES) >=
- HYPERVISOR_VIRT_START) {
- printk("Too much memory; no room for demand map hole.\n");
- do_exit();
- }
-
- demand_map_area_start = pfn_to_virt(max_pfn);
- printk("Demand map pfns start at %lx (%p).\n", max_pfn,
- demand_map_area_start);
- start_addr = (unsigned long)demand_map_area_start;
-
- tab = (pgentry_t *)start_info.pt_base;
- mfn = virt_to_mfn(start_info.pt_base);
- pt_pfn = virt_to_pfn(alloc_page());
-
-#if defined(__x86_64__)
- offset = l4_table_offset(start_addr);
- if (!(tab[offset] & _PAGE_PRESENT)) {
- new_pt_frame(&pt_pfn, mfn, offset, L3_FRAME);
- pt_pfn = virt_to_pfn(alloc_page());
- }
- ASSERT(tab[offset] & _PAGE_PRESENT);
- mfn = pte_to_mfn(tab[offset]);
- tab = to_virt(mfn_to_pfn(mfn) << PAGE_SHIFT);
-#endif
-#if defined(__x86_64__) || defined(CONFIG_X86_PAE)
- offset = l3_table_offset(start_addr);
- if (!(tab[offset] & _PAGE_PRESENT)) {
- new_pt_frame(&pt_pfn, mfn, offset, L2_FRAME);
- pt_pfn = virt_to_pfn(alloc_page());
- }
- ASSERT(tab[offset] & _PAGE_PRESENT);
- mfn = pte_to_mfn(tab[offset]);
- tab = to_virt(mfn_to_pfn(mfn) << PAGE_SHIFT);
-#endif
- offset = l2_table_offset(start_addr);
- if (tab[offset] & _PAGE_PRESENT) {
- printk("Demand map area already has a page table covering it?\n");
- BUG();
- }
- demand_map_pgt = pfn_to_virt(pt_pfn);
- new_pt_frame(&pt_pfn, mfn, offset, L1_FRAME);
- ASSERT(tab[offset] & _PAGE_PRESENT);
-}
-
-void *map_frames(unsigned long *f, unsigned long n)
-{
- unsigned long x;
- unsigned long y = 0;
- mmu_update_t mmu_updates[16];
- int rc;
-
- if (n > 16) {
- printk("Tried to map too many (%ld) frames at once.\n", n);
- return NULL;
- }
-
- /* Find a run of n contiguous frames */
- for (x = 0; x <= 1024 - n; x += y + 1) {
- for (y = 0; y < n; y++)
- if (demand_map_pgt[x+y] & _PAGE_PRESENT)
- break;
- if (y == n)
- break;
- }
- if (y != n) {
- printk("Failed to map %ld frames!\n", n);
- return NULL;
- }
-
- /* Found it at x. Map it in. */
- for (y = 0; y < n; y++) {
- mmu_updates[y].ptr = virt_to_mach(&demand_map_pgt[x + y]);
- mmu_updates[y].val = (f[y] << PAGE_SHIFT) | L1_PROT;
- }
-
- rc = HYPERVISOR_mmu_update(mmu_updates, n, NULL, DOMID_SELF);
- if (rc < 0) {
- printk("Map %ld failed: %d.\n", n, rc);
- return NULL;
- } else {
- return (void *)(unsigned long)((unsigned long)demand_map_area_start +
- x * PAGE_SIZE);
- }
-}
void init_mm(void)
{
@@ -717,22 +369,7 @@ void init_mm(void)
printk("MM: Init\n");
- printk(" _text: %p\n", &_text);
- printk(" _etext: %p\n", &_etext);
- printk(" _edata: %p\n", &_edata);
- printk(" stack start: %p\n", &stack);
- printk(" _end: %p\n", &_end);
-
- /* First page follows page table pages and 3 more pages (store page etc) */
- start_pfn = PFN_UP(to_phys(start_info.pt_base)) +
- start_info.nr_pt_frames + 3;
- max_pfn = start_info.nr_pages;
-
- printk(" start_pfn: %lx\n", start_pfn);
- printk(" max_pfn: %lx\n", max_pfn);
-
- build_pagetable(&start_pfn, &max_pfn);
-
+ arch_init_mm(&start_pfn, &max_pfn);
/*
* now we can initialise the page allocator
*/
@@ -742,8 +379,7 @@ void init_mm(void)
init_page_allocator(PFN_PHYS(start_pfn), PFN_PHYS(max_pfn));
printk("MM: done\n");
- init_demand_mapping_area(max_pfn);
- printk("Initialised demand area.\n");
+ arch_init_demand_mapping_area(max_pfn);
}
void sanity_check(void)
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 extras/mini-os/sched.c
--- a/extras/mini-os/sched.c Mon Nov 27 10:10:57 2006 -0700
+++ b/extras/mini-os/sched.c Tue Nov 28 10:37:36 2006 -0700
@@ -54,81 +54,8 @@
#define DEBUG(_f, _a...) ((void)0)
#endif
-
-#define RUNNABLE_FLAG 0x00000001
-
-#define is_runnable(_thread) (_thread->flags & RUNNABLE_FLAG)
-#define set_runnable(_thread) (_thread->flags |= RUNNABLE_FLAG)
-#define clear_runnable(_thread) (_thread->flags &= ~RUNNABLE_FLAG)
-
-
struct thread *idle_thread = NULL;
LIST_HEAD(exited_threads);
-
-void idle_thread_fn(void *unused);
-
-void dump_stack(struct thread *thread)
-{
- unsigned long *bottom = (unsigned long *)(thread->stack + 2*4*1024);
- unsigned long *pointer = (unsigned long *)thread->sp;
- int count;
- if(thread == current)
- {
-#ifdef __i386__
- asm("movl %%esp,%0"
- : "=r"(pointer));
-#else
- asm("movq %%rsp,%0"
- : "=r"(pointer));
-#endif
- }
- printk("The stack for \"%s\"\n", thread->name);
- for(count = 0; count < 25 && pointer < bottom; count ++)
- {
- printk("[0x%lx] 0x%lx\n", pointer, *pointer);
- pointer++;
- }
-
- if(pointer < bottom) printk(" ... continues.\n");
-}
-
-#ifdef __i386__
-#define switch_threads(prev, next) do { \
- unsigned long esi,edi; \
- __asm__ __volatile__("pushfl\n\t" \
- "pushl %%ebp\n\t" \
- "movl %%esp,%0\n\t" /* save ESP */ \
- "movl %4,%%esp\n\t" /* restore ESP */ \
- "movl $1f,%1\n\t" /* save EIP */ \
- "pushl %5\n\t" /* restore EIP */ \
- "ret\n\t" \
- "1:\t" \
- "popl %%ebp\n\t" \
- "popfl" \
- :"=m" (prev->sp),"=m" (prev->ip), \
- "=S" (esi),"=D" (edi) \
- :"m" (next->sp),"m" (next->ip), \
- "2" (prev), "d" (next)); \
-} while (0)
-#elif __x86_64__
-#define switch_threads(prev, next) do { \
- unsigned long rsi,rdi; \
- __asm__ __volatile__("pushfq\n\t" \
- "pushq %%rbp\n\t" \
- "movq %%rsp,%0\n\t" /* save RSP */ \
- "movq %4,%%rsp\n\t" /* restore RSP */ \
- "movq $1f,%1\n\t" /* save RIP */ \
- "pushq %5\n\t" /* restore RIP */ \
- "ret\n\t" \
- "1:\t" \
- "popq %%rbp\n\t" \
- "popfq" \
- :"=m" (prev->sp),"=m" (prev->ip), \
- "=S" (rsi),"=D" (rdi) \
- :"m" (next->sp),"m" (next->ip), \
- "2" (prev), "d" (next)); \
-} while (0)
-#endif
void inline print_runqueue(void)
{
@@ -250,50 +177,6 @@ void exit_thread(void)
schedule();
}
-/* Pushes the specified value onto the stack of the specified thread */
-static void stack_push(struct thread *thread, unsigned long value)
-{
- thread->sp -= sizeof(unsigned long);
- *((unsigned long *)thread->sp) = value;
-}
-
-struct thread* create_thread(char *name, void (*function)(void *), void *data)
-{
- struct thread *thread;
- unsigned long flags;
-
- thread = xmalloc(struct thread);
- /* Allocate 2 pages for stack, stack will be 2pages aligned */
- thread->stack = (char *)alloc_pages(1);
- thread->name = name;
- printk("Thread \"%s\": pointer: 0x%lx, stack: 0x%lx\n", name, thread,
- thread->stack);
-
- thread->sp = (unsigned long)thread->stack + 4096 * 2;
- /* Save pointer to the thread on the stack, used by current macro */
- *((unsigned long *)thread->stack) = (unsigned long)thread;
-
- stack_push(thread, (unsigned long) function);
- stack_push(thread, (unsigned long) data);
- thread->ip = (unsigned long) thread_starter;
-
- /* Not runable, not exited, not sleeping */
- thread->flags = 0;
- thread->wakeup_time = 0LL;
- set_runnable(thread);
- local_irq_save(flags);
- if(idle_thread != NULL) {
- list_add_tail(&thread->thread_list, &idle_thread->thread_list);
- } else if(function != idle_thread_fn)
- {
- printk("BUG: Not allowed to create thread before initialising
scheduler.\n");
- BUG();
- }
- local_irq_restore(flags);
- return thread;
-}
-
-
void block(struct thread *thread)
{
thread->wakeup_time = 0LL;
@@ -327,26 +210,6 @@ void idle_thread_fn(void *unused)
}
}
-void run_idle_thread(void)
-{
- /* Switch stacks and run the thread */
-#if defined(__i386__)
- __asm__ __volatile__("mov %0,%%esp\n\t"
- "push %1\n\t"
- "ret"
- :"=m" (idle_thread->sp)
- :"m" (idle_thread->ip));
-#elif defined(__x86_64__)
- __asm__ __volatile__("mov %0,%%rsp\n\t"
- "push %1\n\t"
- "ret"
- :"=m" (idle_thread->sp)
- :"m" (idle_thread->ip));
-#endif
-}
-
-
-
DECLARE_MUTEX(mutex);
void th_f1(void *data)
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4
linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c
--- a/linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c Mon Nov 27 10:10:57
2006 -0700
+++ b/linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c Tue Nov 28 10:37:36
2006 -0700
@@ -98,18 +98,6 @@ void xen_l4_entry_update(pgd_t *ptr, pgd
BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL, DOMID_SELF) < 0);
}
#endif /* CONFIG_X86_64 */
-
-void xen_machphys_update(unsigned long mfn, unsigned long pfn)
-{
- mmu_update_t u;
- if (xen_feature(XENFEAT_auto_translated_physmap)) {
- BUG_ON(pfn != mfn);
- return;
- }
- u.ptr = ((unsigned long long)mfn << PAGE_SHIFT) | MMU_MACHPHYS_UPDATE;
- u.val = pfn;
- BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL, DOMID_SELF) < 0);
-}
void xen_pt_switch(unsigned long ptr)
{
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4
linux-2.6-xen-sparse/arch/i386/oprofile/Makefile
--- a/linux-2.6-xen-sparse/arch/i386/oprofile/Makefile Mon Nov 27 10:10:57
2006 -0700
+++ b/linux-2.6-xen-sparse/arch/i386/oprofile/Makefile Tue Nov 28 10:37:36
2006 -0700
@@ -7,7 +7,10 @@ DRIVER_OBJS = $(addprefix ../../../drive
timer_int.o )
ifdef CONFIG_XEN
-oprofile-y := $(DRIVER_OBJS) xenoprof.o
+XENOPROF_COMMON_OBJS = $(addprefix ../../../drivers/xen/xenoprof/, \
+ xenoprofile.o)
+oprofile-y := $(DRIVER_OBJS) \
+ $(XENOPROF_COMMON_OBJS) xenoprof.o
else
oprofile-y := $(DRIVER_OBJS) init.o backtrace.o
oprofile-$(CONFIG_X86_LOCAL_APIC) += nmi_int.o op_model_athlon.o \
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4
linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c
--- a/linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c Mon Nov 27
10:10:57 2006 -0700
+++ b/linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c Tue Nov 28
10:37:36 2006 -0700
@@ -9,249 +9,83 @@
* Modified by Aravind Menon and Jose Renato Santos for Xen
* These modifications are:
* Copyright (C) 2005 Hewlett-Packard Co.
+ *
+ * x86-specific part
+ * Copyright (c) 2006 Isaku Yamahata <yamahata at valinux co jp>
+ * VA Linux Systems Japan K.K.
*/
#include <linux/init.h>
-#include <linux/notifier.h>
-#include <linux/smp.h>
#include <linux/oprofile.h>
-#include <linux/sysdev.h>
-#include <linux/slab.h>
-#include <linux/interrupt.h>
-#include <linux/vmalloc.h>
-#include <asm/nmi.h>
-#include <asm/msr.h>
-#include <asm/apic.h>
+#include <linux/sched.h>
#include <asm/pgtable.h>
-#include <xen/evtchn.h>
-#include "op_counter.h"
#include <xen/driver_util.h>
#include <xen/interface/xen.h>
#include <xen/interface/xenoprof.h>
-#include <../../../drivers/oprofile/cpu_buffer.h>
-#include <../../../drivers/oprofile/event_buffer.h>
+#include <xen/xenoprof.h>
+#include "op_counter.h"
-#define MAX_XENOPROF_SAMPLES 16
+static unsigned int num_events = 0;
-static int xenoprof_start(void);
-static void xenoprof_stop(void);
-
-static int xenoprof_enabled = 0;
-static unsigned int num_events = 0;
-static int is_primary = 0;
-static int active_defined;
-
-/* sample buffers shared with Xen */
-xenoprof_buf_t * xenoprof_buf[MAX_VIRT_CPUS];
-/* Shared buffer area */
-char * shared_buffer = NULL;
-/* Number of buffers in shared area (one per VCPU) */
-int nbuf;
-/* Mappings of VIRQ_XENOPROF to irq number (per cpu) */
-int ovf_irq[NR_CPUS];
-/* cpu model type string - copied from Xen memory space on XENOPROF_init
command */
-char cpu_type[XENOPROF_CPU_TYPE_SIZE];
-
-/* Passive sample buffers shared with Xen */
-xenoprof_buf_t *p_xenoprof_buf[MAX_OPROF_DOMAINS][MAX_VIRT_CPUS];
-/* Passive shared buffer area */
-char *p_shared_buffer[MAX_OPROF_DOMAINS];
-
-#ifdef CONFIG_PM
-
-static int xenoprof_suspend(struct sys_device * dev, pm_message_t state)
+void __init xenoprof_arch_init_counter(struct xenoprof_init *init)
{
- if (xenoprof_enabled == 1)
- xenoprof_stop();
- return 0;
-}
-
-
-static int xenoprof_resume(struct sys_device * dev)
-{
- if (xenoprof_enabled == 1)
- xenoprof_start();
- return 0;
-}
-
-
-static struct sysdev_class oprofile_sysclass = {
- set_kset_name("oprofile"),
- .resume = xenoprof_resume,
- .suspend = xenoprof_suspend
-};
-
-
-static struct sys_device device_oprofile = {
- .id = 0,
- .cls = &oprofile_sysclass,
-};
-
-
-static int __init init_driverfs(void)
-{
- int error;
- if (!(error = sysdev_class_register(&oprofile_sysclass)))
- error = sysdev_register(&device_oprofile);
- return error;
-}
-
-
-static void __exit exit_driverfs(void)
-{
- sysdev_unregister(&device_oprofile);
- sysdev_class_unregister(&oprofile_sysclass);
-}
-
-#else
-#define init_driverfs() do { } while (0)
-#define exit_driverfs() do { } while (0)
-#endif /* CONFIG_PM */
-
-unsigned long long oprofile_samples = 0;
-unsigned long long p_oprofile_samples = 0;
-
-unsigned int pdomains;
-struct xenoprof_passive passive_domains[MAX_OPROF_DOMAINS];
-
-static void xenoprof_add_pc(xenoprof_buf_t *buf, int is_passive)
-{
- int head, tail, size;
-
- head = buf->event_head;
- tail = buf->event_tail;
- size = buf->event_size;
-
- if (tail > head) {
- while (tail < size) {
- oprofile_add_pc(buf->event_log[tail].eip,
- buf->event_log[tail].mode,
- buf->event_log[tail].event);
- if (!is_passive)
- oprofile_samples++;
- else
- p_oprofile_samples++;
- tail++;
- }
- tail = 0;
- }
- while (tail < head) {
- oprofile_add_pc(buf->event_log[tail].eip,
- buf->event_log[tail].mode,
- buf->event_log[tail].event);
- if (!is_passive)
- oprofile_samples++;
- else
- p_oprofile_samples++;
- tail++;
- }
-
- buf->event_tail = tail;
-}
-
-static void xenoprof_handle_passive(void)
-{
- int i, j;
- int flag_domain, flag_switch = 0;
-
- for (i = 0; i < pdomains; i++) {
- flag_domain = 0;
- for (j = 0; j < passive_domains[i].nbuf; j++) {
- xenoprof_buf_t *buf = p_xenoprof_buf[i][j];
- if (buf->event_head == buf->event_tail)
- continue;
- if (!flag_domain) {
- if
(!oprofile_add_domain_switch(passive_domains[i].
- domain_id))
- goto done;
- flag_domain = 1;
- }
- xenoprof_add_pc(buf, 1);
- flag_switch = 1;
- }
- }
-done:
- if (flag_switch)
- oprofile_add_domain_switch(COORDINATOR_DOMAIN);
-}
-
-static irqreturn_t
-xenoprof_ovf_interrupt(int irq, void * dev_id, struct pt_regs * regs)
-{
- struct xenoprof_buf * buf;
- int cpu;
- static unsigned long flag;
-
- cpu = smp_processor_id();
- buf = xenoprof_buf[cpu];
-
- xenoprof_add_pc(buf, 0);
-
- if (is_primary && !test_and_set_bit(0, &flag)) {
- xenoprof_handle_passive();
- smp_mb__before_clear_bit();
- clear_bit(0, &flag);
- }
-
- return IRQ_HANDLED;
-}
-
-
-static void unbind_virq(void)
-{
- int i;
-
- for_each_cpu(i) {
- if (ovf_irq[i] >= 0) {
- unbind_from_irqhandler(ovf_irq[i], NULL);
- ovf_irq[i] = -1;
- }
+ num_events = init->num_events;
+ /* just in case - make sure we do not overflow event list
+ (i.e. counter_config list) */
+ if (num_events > OP_MAX_COUNTER) {
+ num_events = OP_MAX_COUNTER;
+ init->num_events = num_events;
}
}
+void xenoprof_arch_counter(void)
+{
+ int i;
+ struct xenoprof_counter counter;
-static int bind_virq(void)
-{
- int i, result;
-
- for_each_cpu(i) {
- result = bind_virq_to_irqhandler(VIRQ_XENOPROF,
- i,
- xenoprof_ovf_interrupt,
- SA_INTERRUPT,
- "xenoprof",
- NULL);
-
- if (result < 0) {
- unbind_virq();
- return result;
- }
-
- ovf_irq[i] = result;
+ for (i=0; i<num_events; i++) {
+ counter.ind = i;
+ counter.count = (uint64_t)counter_config[i].count;
+ counter.enabled = (uint32_t)counter_config[i].enabled;
+ counter.event = (uint32_t)counter_config[i].event;
+ counter.kernel = (uint32_t)counter_config[i].kernel;
+ counter.user = (uint32_t)counter_config[i].user;
+ counter.unit_mask = (uint64_t)counter_config[i].unit_mask;
+ HYPERVISOR_xenoprof_op(XENOPROF_counter,
+ &counter);
}
-
- return 0;
}
+void xenoprof_arch_start(void)
+{
+ /* nothing */
+}
-static int map_xenoprof_buffer(int max_samples)
+void xenoprof_arch_stop(void)
{
- struct xenoprof_get_buffer get_buffer;
- struct xenoprof_buf *buf;
- int npages, ret, i;
+ /* nothing */
+}
+
+void xenoprof_arch_unmap_shared_buffer(struct xenoprof_shared_buffer * sbuf)
+{
+ if (sbuf->buffer) {
+ vunmap(sbuf->buffer);
+ sbuf->buffer = NULL;
+ }
+}
+
+int xenoprof_arch_map_shared_buffer(struct xenoprof_get_buffer * get_buffer,
+ struct xenoprof_shared_buffer * sbuf)
+{
+ int npages, ret;
struct vm_struct *area;
- if ( shared_buffer )
- return 0;
-
- get_buffer.max_samples = max_samples;
-
- if ( (ret = HYPERVISOR_xenoprof_op(XENOPROF_get_buffer, &get_buffer)) )
+ sbuf->buffer = NULL;
+ if ( (ret = HYPERVISOR_xenoprof_op(XENOPROF_get_buffer, get_buffer)) )
return ret;
- nbuf = get_buffer.nbuf;
- npages = (get_buffer.bufsize * nbuf - 1) / PAGE_SIZE + 1;
+ npages = (get_buffer->bufsize * get_buffer->nbuf - 1) / PAGE_SIZE + 1;
area = alloc_vm_area(npages * PAGE_SIZE);
if (area == NULL)
@@ -259,231 +93,55 @@ static int map_xenoprof_buffer(int max_s
if ( (ret = direct_kernel_remap_pfn_range(
(unsigned long)area->addr,
- get_buffer.buf_maddr >> PAGE_SHIFT,
- npages * PAGE_SIZE, __pgprot(_KERNPG_TABLE), DOMID_SELF))
) {
+ get_buffer->buf_gmaddr >> PAGE_SHIFT,
+ npages * PAGE_SIZE, __pgprot(_KERNPG_TABLE),
+ DOMID_SELF)) ) {
vunmap(area->addr);
return ret;
}
- shared_buffer = area->addr;
- for (i=0; i< nbuf; i++) {
- buf = (struct xenoprof_buf*)
- &shared_buffer[i * get_buffer.bufsize];
- BUG_ON(buf->vcpu_id >= MAX_VIRT_CPUS);
- xenoprof_buf[buf->vcpu_id] = buf;
- }
-
- return 0;
-}
-
-
-static int xenoprof_setup(void)
-{
- int ret;
- int i;
-
- if ( (ret = map_xenoprof_buffer(MAX_XENOPROF_SAMPLES)) )
- return ret;
-
- if ( (ret = bind_virq()) )
- return ret;
-
- if (is_primary) {
- struct xenoprof_counter counter;
-
- /* Define dom0 as an active domain if not done yet */
- if (!active_defined) {
- domid_t domid;
- ret =
HYPERVISOR_xenoprof_op(XENOPROF_reset_active_list, NULL);
- if (ret)
- goto err;
- domid = 0;
- ret = HYPERVISOR_xenoprof_op(XENOPROF_set_active,
&domid);
- if (ret)
- goto err;
- active_defined = 1;
- }
-
- ret = HYPERVISOR_xenoprof_op(XENOPROF_reserve_counters, NULL);
- if (ret)
- goto err;
- for (i=0; i<num_events; i++) {
- counter.ind = i;
- counter.count = (uint64_t)counter_config[i].count;
- counter.enabled = (uint32_t)counter_config[i].enabled;
- counter.event = (uint32_t)counter_config[i].event;
- counter.kernel = (uint32_t)counter_config[i].kernel;
- counter.user = (uint32_t)counter_config[i].user;
- counter.unit_mask =
(uint64_t)counter_config[i].unit_mask;
- HYPERVISOR_xenoprof_op(XENOPROF_counter,
- &counter);
- }
- ret = HYPERVISOR_xenoprof_op(XENOPROF_setup_events, NULL);
-
- if (ret)
- goto err;
- }
-
- ret = HYPERVISOR_xenoprof_op(XENOPROF_enable_virq, NULL);
- if (ret)
- goto err;
-
- xenoprof_enabled = 1;
- return 0;
- err:
- unbind_virq();
+ sbuf->buffer = area->addr;
return ret;
}
-
-static void xenoprof_shutdown(void)
-{
- xenoprof_enabled = 0;
-
- HYPERVISOR_xenoprof_op(XENOPROF_disable_virq, NULL);
-
- if (is_primary) {
- HYPERVISOR_xenoprof_op(XENOPROF_release_counters, NULL);
- active_defined = 0;
- }
-
- unbind_virq();
-
-}
-
-
-static int xenoprof_start(void)
-{
- int ret = 0;
-
- if (is_primary)
- ret = HYPERVISOR_xenoprof_op(XENOPROF_start, NULL);
-
- return ret;
-}
-
-
-static void xenoprof_stop(void)
-{
- if (is_primary)
- HYPERVISOR_xenoprof_op(XENOPROF_stop, NULL);
-}
-
-
-static int xenoprof_set_active(int * active_domains,
- unsigned int adomains)
-{
- int ret = 0;
- int i;
- int set_dom0 = 0;
- domid_t domid;
-
- if (!is_primary)
- return 0;
-
- if (adomains > MAX_OPROF_DOMAINS)
- return -E2BIG;
-
- ret = HYPERVISOR_xenoprof_op(XENOPROF_reset_active_list, NULL);
- if (ret)
- return ret;
-
- for (i=0; i<adomains; i++) {
- domid = active_domains[i];
- if (domid != active_domains[i]) {
- ret = -EINVAL;
- goto out;
- }
- ret = HYPERVISOR_xenoprof_op(XENOPROF_set_active, &domid);
- if (ret)
- goto out;
- if (active_domains[i] == 0)
- set_dom0 = 1;
- }
- /* dom0 must always be active but may not be in the list */
- if (!set_dom0) {
- domid = 0;
- ret = HYPERVISOR_xenoprof_op(XENOPROF_set_active, &domid);
- }
-
-out:
- if (ret)
- HYPERVISOR_xenoprof_op(XENOPROF_reset_active_list, NULL);
- active_defined = !ret;
- return ret;
-}
-
-static int xenoprof_set_passive(int * p_domains,
- unsigned int pdoms)
+int xenoprof_arch_set_passive(struct xenoprof_passive * pdomain,
+ struct xenoprof_shared_buffer * sbuf)
{
int ret;
- int i, j;
int npages;
- struct xenoprof_buf *buf;
struct vm_struct *area;
pgprot_t prot = __pgprot(_KERNPG_TABLE);
- if (!is_primary)
- return 0;
+ sbuf->buffer = NULL;
+ ret = HYPERVISOR_xenoprof_op(XENOPROF_set_passive, pdomain);
+ if (ret)
+ goto out;
- if (pdoms > MAX_OPROF_DOMAINS)
- return -E2BIG;
+ npages = (pdomain->bufsize * pdomain->nbuf - 1) / PAGE_SIZE + 1;
- ret = HYPERVISOR_xenoprof_op(XENOPROF_reset_passive_list, NULL);
- if (ret)
- return ret;
-
- for (i = 0; i < pdoms; i++) {
- passive_domains[i].domain_id = p_domains[i];
- passive_domains[i].max_samples = 2048;
- ret = HYPERVISOR_xenoprof_op(XENOPROF_set_passive,
- &passive_domains[i]);
- if (ret)
- goto out;
-
- npages = (passive_domains[i].bufsize * passive_domains[i].nbuf
- 1) / PAGE_SIZE + 1;
-
- area = alloc_vm_area(npages * PAGE_SIZE);
- if (area == NULL) {
- ret = -ENOMEM;
- goto out;
- }
-
- ret = direct_kernel_remap_pfn_range(
- (unsigned long)area->addr,
- passive_domains[i].buf_maddr >> PAGE_SHIFT,
- npages * PAGE_SIZE, prot, DOMID_SELF);
- if (ret) {
- vunmap(area->addr);
- goto out;
- }
-
- p_shared_buffer[i] = area->addr;
-
- for (j = 0; j < passive_domains[i].nbuf; j++) {
- buf = (struct xenoprof_buf *)
- &p_shared_buffer[i][j *
passive_domains[i].bufsize];
- BUG_ON(buf->vcpu_id >= MAX_VIRT_CPUS);
- p_xenoprof_buf[i][buf->vcpu_id] = buf;
- }
-
+ area = alloc_vm_area(npages * PAGE_SIZE);
+ if (area == NULL) {
+ ret = -ENOMEM;
+ goto out;
}
- pdomains = pdoms;
- return 0;
+ ret = direct_kernel_remap_pfn_range(
+ (unsigned long)area->addr,
+ pdomain->buf_gmaddr >> PAGE_SHIFT,
+ npages * PAGE_SIZE, prot, DOMID_SELF);
+ if (ret) {
+ vunmap(area->addr);
+ goto out;
+ }
+ sbuf->buffer = area->addr;
out:
- for (j = 0; j < i; j++) {
- vunmap(p_shared_buffer[j]);
- p_shared_buffer[j] = NULL;
- }
-
- return ret;
+ return ret;
}
struct op_counter_config counter_config[OP_MAX_COUNTER];
-static int xenoprof_create_files(struct super_block * sb, struct dentry * root)
+int xenoprof_create_files(struct super_block * sb, struct dentry * root)
{
unsigned int i;
@@ -510,75 +168,12 @@ static int xenoprof_create_files(struct
return 0;
}
-
-struct oprofile_operations xenoprof_ops = {
- .create_files = xenoprof_create_files,
- .set_active = xenoprof_set_active,
- .set_passive = xenoprof_set_passive,
- .setup = xenoprof_setup,
- .shutdown = xenoprof_shutdown,
- .start = xenoprof_start,
- .stop = xenoprof_stop
-};
-
-
-/* in order to get driverfs right */
-static int using_xenoprof;
-
int __init oprofile_arch_init(struct oprofile_operations * ops)
{
- struct xenoprof_init init;
- int ret, i;
-
- ret = HYPERVISOR_xenoprof_op(XENOPROF_init, &init);
-
- if (!ret) {
- num_events = init.num_events;
- is_primary = init.is_primary;
-
- /* just in case - make sure we do not overflow event list
- (i.e. counter_config list) */
- if (num_events > OP_MAX_COUNTER)
- num_events = OP_MAX_COUNTER;
-
- /* cpu_type is detected by Xen */
- cpu_type[XENOPROF_CPU_TYPE_SIZE-1] = 0;
- strncpy(cpu_type, init.cpu_type, XENOPROF_CPU_TYPE_SIZE - 1);
- xenoprof_ops.cpu_type = cpu_type;
-
- init_driverfs();
- using_xenoprof = 1;
- *ops = xenoprof_ops;
-
- for (i=0; i<NR_CPUS; i++)
- ovf_irq[i] = -1;
-
- active_defined = 0;
- }
- printk(KERN_INFO "oprofile_arch_init: ret %d, events %d, "
- "is_primary %d\n", ret, num_events, is_primary);
- return ret;
+ return xenoprofile_init(ops);
}
-
-void __exit oprofile_arch_exit(void)
+void oprofile_arch_exit(void)
{
- int i;
-
- if (using_xenoprof)
- exit_driverfs();
-
- if (shared_buffer) {
- vunmap(shared_buffer);
- shared_buffer = NULL;
- }
- if (is_primary) {
- for (i = 0; i < pdomains; i++)
- if (p_shared_buffer[i]) {
- vunmap(p_shared_buffer[i]);
- p_shared_buffer[i] = NULL;
- }
- HYPERVISOR_xenoprof_op(XENOPROF_shutdown, NULL);
- }
-
+ xenoprofile_exit();
}
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4
linux-2.6-xen-sparse/arch/x86_64/kernel/acpi/Makefile
--- a/linux-2.6-xen-sparse/arch/x86_64/kernel/acpi/Makefile Mon Nov 27
10:10:57 2006 -0700
+++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/acpi/Makefile Tue Nov 28
10:37:36 2006 -0700
@@ -4,6 +4,7 @@ obj-$(CONFIG_ACPI_SLEEP) += sleep.o wake
ifneq ($(CONFIG_ACPI_PROCESSOR),)
obj-y += processor.o
+processor-y := ../../../i386/kernel/acpi/processor.o
../../../i386/kernel/acpi/cstate.o
endif
boot-$(CONFIG_XEN) := ../../../i386/kernel/acpi/boot-xen.o
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4
linux-2.6-xen-sparse/arch/x86_64/oprofile/Makefile
--- a/linux-2.6-xen-sparse/arch/x86_64/oprofile/Makefile Mon Nov 27
10:10:57 2006 -0700
+++ b/linux-2.6-xen-sparse/arch/x86_64/oprofile/Makefile Tue Nov 28
10:37:36 2006 -0700
@@ -12,6 +12,8 @@ DRIVER_OBJS = $(addprefix ../../../drive
timer_int.o )
ifdef CONFIG_XEN
+XENOPROF_COMMON_OBJS = $(addprefix ../../../drivers/xen/xenoprof/, \
+ xenoprofile.o)
OPROFILE-y := xenoprof.o
else
OPROFILE-y := init.o backtrace.o
@@ -19,4 +21,5 @@ OPROFILE-$(CONFIG_X86_LOCAL_APIC) += nmi
op_model_ppro.o
OPROFILE-$(CONFIG_X86_IO_APIC) += nmi_timer_int.o
endif
-oprofile-y = $(DRIVER_OBJS) $(addprefix ../../i386/oprofile/, $(OPROFILE-y))
+oprofile-y = $(DRIVER_OBJS) $(XENOPROF_COMMON_OBJS) \
+ $(addprefix ../../i386/oprofile/, $(OPROFILE-y))
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4
linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c
--- a/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c Mon Nov 27
10:10:57 2006 -0700
+++ b/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c Tue Nov 28
10:37:36 2006 -0700
@@ -215,9 +215,7 @@ static int increase_reservation(unsigned
BUG_ON(!xen_feature(XENFEAT_auto_translated_physmap) &&
phys_to_machine_mapping_valid(pfn));
- /* Update P->M and M->P tables. */
set_phys_to_machine(pfn, frame_list[i]);
- xen_machphys_update(frame_list[i], pfn);
/* Link back into the page tables if not highmem. */
if (pfn < max_low_pfn) {
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4
linux-2.6-xen-sparse/drivers/xen/blkback/common.h
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/common.h Mon Nov 27 10:10:57
2006 -0700
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/common.h Tue Nov 28 10:37:36
2006 -0700
@@ -113,7 +113,7 @@ int vbd_create(blkif_t *blkif, blkif_vde
unsigned minor, int readonly);
void vbd_free(struct vbd *vbd);
-unsigned long vbd_size(struct vbd *vbd);
+unsigned long long vbd_size(struct vbd *vbd);
unsigned int vbd_info(struct vbd *vbd);
unsigned long vbd_secsize(struct vbd *vbd);
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4
linux-2.6-xen-sparse/drivers/xen/blkback/vbd.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/vbd.c Mon Nov 27 10:10:57
2006 -0700
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/vbd.c Tue Nov 28 10:37:36
2006 -0700
@@ -35,7 +35,7 @@
#define vbd_sz(_v) ((_v)->bdev->bd_part ? \
(_v)->bdev->bd_part->nr_sects : (_v)->bdev->bd_disk->capacity)
-unsigned long vbd_size(struct vbd *vbd)
+unsigned long long vbd_size(struct vbd *vbd)
{
return vbd_sz(vbd);
}
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4
linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Mon Nov 27 10:10:57
2006 -0700
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Tue Nov 28 10:37:36
2006 -0700
@@ -389,7 +389,7 @@ again:
if (err)
goto abort;
- err = xenbus_printf(xbt, dev->nodename, "sectors", "%lu",
+ err = xenbus_printf(xbt, dev->nodename, "sectors", "%llu",
vbd_size(&be->blkif->vbd));
if (err) {
xenbus_dev_fatal(dev, err, "writing %s/sectors",
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c Mon Nov 27
10:10:57 2006 -0700
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c Tue Nov 28
10:37:36 2006 -0700
@@ -138,10 +138,10 @@ static int blkfront_resume(struct xenbus
DPRINTK("blkfront_resume: %s\n", dev->nodename);
- blkif_free(info, 1);
+ blkif_free(info, info->connected == BLKIF_STATE_CONNECTED);
err = talk_to_backend(dev, info);
- if (!err)
+ if (info->connected == BLKIF_STATE_SUSPENDED && !err)
blkif_recover(info);
return err;
@@ -298,7 +298,8 @@ static void backend_changed(struct xenbu
*/
static void connect(struct blkfront_info *info)
{
- unsigned long sectors, sector_size;
+ unsigned long long sectors;
+ unsigned long sector_size;
unsigned int binfo;
int err;
@@ -309,7 +310,7 @@ static void connect(struct blkfront_info
DPRINTK("blkfront.c:connect:%s.\n", info->xbdev->otherend);
err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
- "sectors", "%lu", §ors,
+ "sectors", "%llu", §ors,
"info", "%u", &binfo,
"sector-size", "%lu", §or_size,
NULL);
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 linux-2.6-xen-sparse/drivers/xen/char/mem.c
--- a/linux-2.6-xen-sparse/drivers/xen/char/mem.c Mon Nov 27 10:10:57
2006 -0700
+++ b/linux-2.6-xen-sparse/drivers/xen/char/mem.c Tue Nov 28 10:37:36
2006 -0700
@@ -28,13 +28,12 @@
#include <asm/io.h>
#include <asm/hypervisor.h>
-static inline int uncached_access(struct file *file)
-{
- if (file->f_flags & O_SYNC)
- return 1;
- /* Xen sets correct MTRR type on non-RAM for us. */
- return 0;
-}
+#ifndef ARCH_HAS_VALID_PHYS_ADDR_RANGE
+static inline int valid_phys_addr_range(unsigned long addr, size_t *count)
+{
+ return 1;
+}
+#endif
/*
* This funcion reads the *physical* memory. The f_pos points directly to the
@@ -46,6 +45,9 @@ static ssize_t read_mem(struct file * fi
unsigned long p = *ppos, ignored;
ssize_t read = 0, sz;
void __iomem *v;
+
+ if (!valid_phys_addr_range(p, &count))
+ return -EFAULT;
while (count > 0) {
/*
@@ -58,13 +60,15 @@ static ssize_t read_mem(struct file * fi
sz = min_t(unsigned long, sz, count);
- if ((v = ioremap(p, sz)) == NULL) {
+ v = xlate_dev_mem_ptr(p, sz);
+ if (IS_ERR(v) || v == NULL) {
/*
- * Some programs (e.g., dmidecode) groove off into
weird RAM
- * areas where no tables can possibly exist (because
Xen will
- * have stomped on them!). These programs get rather
upset if
- * we let them know that Xen failed their access, so we
fake
- * out a read of all zeroes. :-)
+ * Some programs (e.g., dmidecode) groove off into
+ * weird RAM areas where no tables can possibly exist
+ * (because Xen will have stomped on them!). These
+ * programs get rather upset if we let them know that
+ * Xen failed their access, so we fake out a read of
+ * all zeroes.
*/
if (clear_user(buf, count))
return -EFAULT;
@@ -73,7 +77,7 @@ static ssize_t read_mem(struct file * fi
}
ignored = copy_to_user(buf, v, sz);
- iounmap(v);
+ xlate_dev_mem_ptr_unmap(v);
if (ignored)
return -EFAULT;
buf += sz;
@@ -92,6 +96,9 @@ static ssize_t write_mem(struct file * f
unsigned long p = *ppos, ignored;
ssize_t written = 0, sz;
void __iomem *v;
+
+ if (!valid_phys_addr_range(p, &count))
+ return -EFAULT;
while (count > 0) {
/*
@@ -104,11 +111,17 @@ static ssize_t write_mem(struct file * f
sz = min_t(unsigned long, sz, count);
- if ((v = ioremap(p, sz)) == NULL)
- break;
+ v = xlate_dev_mem_ptr(p, sz);
+ if (v == NULL)
+ break;
+ if (IS_ERR(v)) {
+ if (written == 0)
+ return PTR_ERR(v);
+ break;
+ }
ignored = copy_from_user(v, buf, sz);
- iounmap(v);
+ xlate_dev_mem_ptr_unmap(v);
if (ignored) {
written += sz - ignored;
if (written)
@@ -125,6 +138,15 @@ static ssize_t write_mem(struct file * f
return written;
}
+#ifndef ARCH_HAS_DEV_MEM_MMAP_MEM
+static inline int uncached_access(struct file *file)
+{
+ if (file->f_flags & O_SYNC)
+ return 1;
+ /* Xen sets correct MTRR type on non-RAM for us. */
+ return 0;
+}
+
static int mmap_mem(struct file * file, struct vm_area_struct * vma)
{
size_t size = vma->vm_end - vma->vm_start;
@@ -136,6 +158,7 @@ static int mmap_mem(struct file * file,
return direct_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
size, vma->vm_page_prot, DOMID_IO);
}
+#endif
/*
* The memory devices use the full 32/64 bits of the offset, and so we cannot
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4
linux-2.6-xen-sparse/drivers/xen/netback/netback.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c Mon Nov 27
10:10:57 2006 -0700
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c Tue Nov 28
10:37:36 2006 -0700
@@ -494,7 +494,7 @@ static int netbk_check_gop(int nr_frags,
copy_op = npo->copy + npo->copy_cons++;
if (copy_op->status != GNTST_okay) {
DPRINTK("Bad status %d from copy to DOM%d.\n",
- gop->status, domid);
+ copy_op->status, domid);
status = NETIF_RSP_ERROR;
}
} else {
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c Mon Nov 27
10:10:57 2006 -0700
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c Tue Nov 28
10:37:36 2006 -0700
@@ -38,9 +38,6 @@
#ifdef HAVE_XEN_PLATFORM_COMPAT_H
#include <xen/platform-compat.h>
#endif
-
-/* xenbus_probe.c */
-extern char *kasprintf(const char *fmt, ...);
#define DPRINTK(fmt, args...) \
pr_debug("xenbus_client (%s:%d) " fmt ".\n", __FUNCTION__, __LINE__,
##args)
@@ -88,7 +85,7 @@ int xenbus_watch_path2(struct xenbus_dev
const char **, unsigned int))
{
int err;
- char *state = kasprintf("%s/%s", path, path2);
+ char *state = kasprintf(GFP_KERNEL, "%s/%s", path, path2);
if (!state) {
xenbus_dev_fatal(dev, -ENOMEM, "allocating path for watch");
return -ENOMEM;
@@ -156,7 +153,7 @@ EXPORT_SYMBOL_GPL(xenbus_frontend_closed
*/
static char *error_path(struct xenbus_device *dev)
{
- return kasprintf("error/%s", dev->nodename);
+ return kasprintf(GFP_KERNEL, "error/%s", dev->nodename);
}
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c Mon Nov 27
10:10:57 2006 -0700
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c Tue Nov 28
10:37:36 2006 -0700
@@ -444,27 +444,6 @@ static void xenbus_dev_release(struct de
kfree(to_xenbus_device(dev));
}
-/* Simplified asprintf. */
-char *kasprintf(const char *fmt, ...)
-{
- va_list ap;
- unsigned int len;
- char *p, dummy[1];
-
- va_start(ap, fmt);
- /* FIXME: vsnprintf has a bug, NULL should work */
- len = vsnprintf(dummy, 0, fmt, ap);
- va_end(ap);
-
- p = kmalloc(len + 1, GFP_KERNEL);
- if (!p)
- return NULL;
- va_start(ap, fmt);
- vsprintf(p, fmt, ap);
- va_end(ap);
- return p;
-}
-
static ssize_t xendev_show_nodename(struct device *dev,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
struct device_attribute *attr,
@@ -547,7 +526,7 @@ static int xenbus_probe_frontend(const c
char *nodename;
int err;
- nodename = kasprintf("%s/%s/%s", xenbus_frontend.root, type, name);
+ nodename = kasprintf(GFP_KERNEL, "%s/%s/%s", xenbus_frontend.root,
type, name);
if (!nodename)
return -ENOMEM;
@@ -644,7 +623,7 @@ void dev_changed(const char *node, struc
rootlen = strsep_len(node, '/', bus->levels);
if (rootlen < 0)
return;
- root = kasprintf("%.*s", rootlen, node);
+ root = kasprintf(GFP_KERNEL, "%.*s", rootlen, node);
if (!root)
return;
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.h
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.h Mon Nov 27
10:10:57 2006 -0700
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.h Tue Nov 28
10:37:36 2006 -0700
@@ -70,8 +70,5 @@ extern int xenbus_probe_devices(struct x
extern void dev_changed(const char *node, struct xen_bus_type *bus);
-/* Simplified asprintf. Probably belongs in lib */
-extern char *kasprintf(const char *fmt, ...);
-
#endif
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe_backend.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe_backend.c Mon Nov
27 10:10:57 2006 -0700
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe_backend.c Tue Nov
28 10:37:36 2006 -0700
@@ -188,7 +188,7 @@ static int xenbus_probe_backend_unit(con
char *nodename;
int err;
- nodename = kasprintf("%s/%s", dir, name);
+ nodename = kasprintf(GFP_KERNEL, "%s/%s", dir, name);
if (!nodename)
return -ENOMEM;
@@ -209,7 +209,7 @@ static int xenbus_probe_backend(const ch
DPRINTK("");
- nodename = kasprintf("%s/%s/%s", xenbus_backend.root, type, domid);
+ nodename = kasprintf(GFP_KERNEL, "%s/%s/%s", xenbus_backend.root, type,
domid);
if (!nodename)
return -ENOMEM;
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c Mon Nov 27
10:10:57 2006 -0700
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c Tue Nov 28
10:37:36 2006 -0700
@@ -51,9 +51,6 @@
#include <xen/platform-compat.h>
#endif
-/* xenbus_probe.c */
-extern char *kasprintf(const char *fmt, ...);
-
struct xs_stored_msg {
struct list_head list;
@@ -295,9 +292,9 @@ static char *join(const char *dir, const
char *buffer;
if (strlen(name) == 0)
- buffer = kasprintf("%s", dir);
+ buffer = kasprintf(GFP_KERNEL, "%s", dir);
else
- buffer = kasprintf("%s/%s", dir, name);
+ buffer = kasprintf(GFP_KERNEL, "%s/%s", dir, name);
return (!buffer) ? ERR_PTR(-ENOMEM) : buffer;
}
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h
--- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h Mon Nov
27 10:10:57 2006 -0700
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h Tue Nov
28 10:37:36 2006 -0700
@@ -98,7 +98,6 @@ void xen_pgd_unpin(unsigned long ptr);
void xen_pgd_unpin(unsigned long ptr);
void xen_set_ldt(unsigned long ptr, unsigned long bytes);
-void xen_machphys_update(unsigned long mfn, unsigned long pfn);
#ifdef CONFIG_SMP
#include <linux/cpumask.h>
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/io.h
--- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/io.h Mon Nov 27
10:10:57 2006 -0700
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/io.h Tue Nov 28
10:37:36 2006 -0700
@@ -54,7 +54,8 @@
* Convert a physical pointer to a virtual kernel pointer for /dev/mem
* access
*/
-#define xlate_dev_mem_ptr(p) __va(p)
+#define xlate_dev_mem_ptr(p, sz) ioremap(p, sz)
+#define xlate_dev_mem_ptr_unmap(p) iounmap(p)
/*
* Convert a virtual cached pointer to an uncached pointer
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/maddr.h
--- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/maddr.h Mon Nov
27 10:10:57 2006 -0700
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/maddr.h Tue Nov
28 10:37:36 2006 -0700
@@ -8,6 +8,15 @@
#define INVALID_P2M_ENTRY (~0UL)
#define FOREIGN_FRAME_BIT (1UL<<31)
#define FOREIGN_FRAME(m) ((m) | FOREIGN_FRAME_BIT)
+
+/* Definitions for machine and pseudophysical addresses. */
+#ifdef CONFIG_X86_PAE
+typedef unsigned long long paddr_t;
+typedef unsigned long long maddr_t;
+#else
+typedef unsigned long paddr_t;
+typedef unsigned long maddr_t;
+#endif
#ifdef CONFIG_XEN
@@ -101,26 +110,6 @@ static inline void set_phys_to_machine(u
phys_to_machine_mapping[pfn] = mfn;
}
-
-#else /* !CONFIG_XEN */
-
-#define pfn_to_mfn(pfn) (pfn)
-#define mfn_to_pfn(mfn) (mfn)
-#define mfn_to_local_pfn(mfn) (mfn)
-#define set_phys_to_machine(pfn, mfn) BUG_ON((pfn) != (mfn))
-#define phys_to_machine_mapping_valid(pfn) (1)
-
-#endif /* !CONFIG_XEN */
-
-/* Definitions for machine and pseudophysical addresses. */
-#ifdef CONFIG_X86_PAE
-typedef unsigned long long paddr_t;
-typedef unsigned long long maddr_t;
-#else
-typedef unsigned long paddr_t;
-typedef unsigned long maddr_t;
-#endif
-
static inline maddr_t phys_to_machine(paddr_t phys)
{
maddr_t machine = pfn_to_mfn(phys >> PAGE_SHIFT);
@@ -148,6 +137,19 @@ static inline paddr_t pte_machine_to_phy
return phys;
}
+#else /* !CONFIG_XEN */
+
+#define pfn_to_mfn(pfn) (pfn)
+#define mfn_to_pfn(mfn) (mfn)
+#define mfn_to_local_pfn(mfn) (mfn)
+#define set_phys_to_machine(pfn, mfn) BUG_ON((pfn) != (mfn))
+#define phys_to_machine_mapping_valid(pfn) (1)
+#define phys_to_machine(phys) ((maddr_t)(phys))
+#define machine_to_phys(mach) ((paddr_t)(mach))
+#define pte_machine_to_phys(mach) ((paddr_t)(mach))
+
+#endif /* !CONFIG_XEN */
+
/* VIRT <-> MACHINE conversion */
#define virt_to_machine(v) (phys_to_machine(__pa(v)))
#define virt_to_mfn(v) (pfn_to_mfn(__pa(v) >> PAGE_SHIFT))
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4
linux-2.6-xen-sparse/include/asm-ia64/maddr.h
--- a/linux-2.6-xen-sparse/include/asm-ia64/maddr.h Mon Nov 27 10:10:57
2006 -0700
+++ b/linux-2.6-xen-sparse/include/asm-ia64/maddr.h Tue Nov 28 10:37:36
2006 -0700
@@ -96,11 +96,6 @@ mfn_to_local_pfn(unsigned long mfn)
#define virt_to_machine(virt) __pa(virt) // for tpmfront.c
#define set_phys_to_machine(pfn, mfn) do { } while (0)
-#ifdef CONFIG_VMX_GUEST
-extern void xen_machphys_update(unsigned long mfn, unsigned long pfn);
-#else /* CONFIG_VMX_GUEST */
-#define xen_machphys_update(mfn, pfn) do { } while (0)
-#endif /* CONFIG_VMX_GUEST */
typedef unsigned long maddr_t; // to compile netback, netfront
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4
linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/io.h
--- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/io.h Mon Nov 27
10:10:57 2006 -0700
+++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/io.h Tue Nov 28
10:37:36 2006 -0700
@@ -346,7 +346,8 @@ extern int iommu_bio_merge;
* Convert a physical pointer to a virtual kernel pointer for /dev/mem
* access
*/
-#define xlate_dev_mem_ptr(p) __va(p)
+#define xlate_dev_mem_ptr(p, sz) ioremap(p, sz)
+#define xlate_dev_mem_ptr_unmap(p) iounmap(p)
/*
* Convert a virtual cached pointer to an uncached pointer
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4
linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/maddr.h
--- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/maddr.h Mon Nov
27 10:10:57 2006 -0700
+++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/maddr.h Tue Nov
28 10:37:36 2006 -0700
@@ -8,6 +8,10 @@
#define INVALID_P2M_ENTRY (~0UL)
#define FOREIGN_FRAME_BIT (1UL<<63)
#define FOREIGN_FRAME(m) ((m) | FOREIGN_FRAME_BIT)
+
+/* Definitions for machine and pseudophysical addresses. */
+typedef unsigned long paddr_t;
+typedef unsigned long maddr_t;
#ifdef CONFIG_XEN
@@ -99,20 +103,6 @@ static inline void set_phys_to_machine(u
phys_to_machine_mapping[pfn] = mfn;
}
-#else /* !CONFIG_XEN */
-
-#define pfn_to_mfn(pfn) (pfn)
-#define mfn_to_pfn(mfn) (mfn)
-#define mfn_to_local_pfn(mfn) (mfn)
-#define set_phys_to_machine(pfn, mfn) BUG_ON((pfn) != (mfn))
-#define phys_to_machine_mapping_valid(pfn) (1)
-
-#endif /* !CONFIG_XEN */
-
-/* Definitions for machine and pseudophysical addresses. */
-typedef unsigned long paddr_t;
-typedef unsigned long maddr_t;
-
static inline maddr_t phys_to_machine(paddr_t phys)
{
maddr_t machine = pfn_to_mfn(phys >> PAGE_SHIFT);
@@ -135,6 +125,19 @@ static inline paddr_t pte_machine_to_phy
return phys;
}
+#else /* !CONFIG_XEN */
+
+#define pfn_to_mfn(pfn) (pfn)
+#define mfn_to_pfn(mfn) (mfn)
+#define mfn_to_local_pfn(mfn) (mfn)
+#define set_phys_to_machine(pfn, mfn) BUG_ON((pfn) != (mfn))
+#define phys_to_machine_mapping_valid(pfn) (1)
+#define phys_to_machine(phys) ((maddr_t)(phys))
+#define machine_to_phys(mach) ((paddr_t)(mach))
+#define pte_machine_to_phys(mach) ((paddr_t)(mach))
+
+#endif /* !CONFIG_XEN */
+
/* VIRT <-> MACHINE conversion */
#define virt_to_machine(v) (phys_to_machine(__pa(v)))
#define virt_to_mfn(v) (pfn_to_mfn(__pa(v) >> PAGE_SHIFT))
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 linux-2.6-xen-sparse/include/linux/skbuff.h
--- a/linux-2.6-xen-sparse/include/linux/skbuff.h Mon Nov 27 10:10:57
2006 -0700
+++ b/linux-2.6-xen-sparse/include/linux/skbuff.h Tue Nov 28 10:37:36
2006 -0700
@@ -974,15 +974,16 @@ static inline void skb_reserve(struct sk
#define NET_IP_ALIGN 2
#endif
-extern int ___pskb_trim(struct sk_buff *skb, unsigned int len, int realloc);
+extern int ___pskb_trim(struct sk_buff *skb, unsigned int len);
static inline void __skb_trim(struct sk_buff *skb, unsigned int len)
{
- if (!skb->data_len) {
- skb->len = len;
- skb->tail = skb->data + len;
- } else
- ___pskb_trim(skb, len, 0);
+ if (unlikely(skb->data_len)) {
+ WARN_ON(1);
+ return;
+ }
+ skb->len = len;
+ skb->tail = skb->data + len;
}
/**
@@ -992,6 +993,7 @@ static inline void __skb_trim(struct sk_
*
* Cut the length of a buffer down by removing data from the tail. If
* the buffer is already under the length specified it is not modified.
+ * The skb must be linear.
*/
static inline void skb_trim(struct sk_buff *skb, unsigned int len)
{
@@ -1002,12 +1004,10 @@ static inline void skb_trim(struct sk_bu
static inline int __pskb_trim(struct sk_buff *skb, unsigned int len)
{
- if (!skb->data_len) {
- skb->len = len;
- skb->tail = skb->data+len;
- return 0;
- }
- return ___pskb_trim(skb, len, 1);
+ if (skb->data_len)
+ return ___pskb_trim(skb, len);
+ __skb_trim(skb, len);
+ return 0;
}
static inline int pskb_trim(struct sk_buff *skb, unsigned int len)
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 linux-2.6-xen-sparse/mm/memory.c
--- a/linux-2.6-xen-sparse/mm/memory.c Mon Nov 27 10:10:57 2006 -0700
+++ b/linux-2.6-xen-sparse/mm/memory.c Tue Nov 28 10:37:36 2006 -0700
@@ -1535,6 +1535,7 @@ static inline void cow_user_page(struct
if (__copy_from_user_inatomic(kaddr, uaddr, PAGE_SIZE))
memset(kaddr, 0, PAGE_SIZE);
kunmap_atomic(kaddr, KM_USER0);
+ flush_dcache_page(dst);
return;
}
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 linux-2.6-xen-sparse/mm/mmap.c
--- a/linux-2.6-xen-sparse/mm/mmap.c Mon Nov 27 10:10:57 2006 -0700
+++ b/linux-2.6-xen-sparse/mm/mmap.c Tue Nov 28 10:37:36 2006 -0700
@@ -29,6 +29,10 @@
#include <asm/uaccess.h>
#include <asm/cacheflush.h>
#include <asm/tlb.h>
+
+#ifndef arch_mmap_check
+#define arch_mmap_check(addr, len, flags) (0)
+#endif
static void unmap_region(struct mm_struct *mm,
struct vm_area_struct *vma, struct vm_area_struct *prev,
@@ -906,6 +910,10 @@ unsigned long do_mmap_pgoff(struct file
if (!len)
return -EINVAL;
+ error = arch_mmap_check(addr, len, flags);
+ if (error)
+ return error;
+
/* Careful about overflows.. */
len = PAGE_ALIGN(len);
if (!len || len > TASK_SIZE)
@@ -1846,6 +1854,7 @@ unsigned long do_brk(unsigned long addr,
unsigned long flags;
struct rb_node ** rb_link, * rb_parent;
pgoff_t pgoff = addr >> PAGE_SHIFT;
+ int error;
len = PAGE_ALIGN(len);
if (!len)
@@ -1853,6 +1862,12 @@ unsigned long do_brk(unsigned long addr,
if ((addr + len) > TASK_SIZE || (addr + len) < addr)
return -EINVAL;
+
+ flags = VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags;
+
+ error = arch_mmap_check(addr, len, flags);
+ if (error)
+ return error;
/*
* mlock MCL_FUTURE?
@@ -1893,8 +1908,6 @@ unsigned long do_brk(unsigned long addr,
if (security_vm_enough_memory(len >> PAGE_SHIFT))
return -ENOMEM;
-
- flags = VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags;
/* Can we just expand an old private anonymous mapping? */
if (vma_merge(mm, prev, addr, addr + len, flags,
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 linux-2.6-xen-sparse/net/core/skbuff.c
--- a/linux-2.6-xen-sparse/net/core/skbuff.c Mon Nov 27 10:10:57 2006 -0700
+++ b/linux-2.6-xen-sparse/net/core/skbuff.c Tue Nov 28 10:37:36 2006 -0700
@@ -261,17 +261,22 @@ nodata:
}
-static void skb_drop_fraglist(struct sk_buff *skb)
-{
- struct sk_buff *list = skb_shinfo(skb)->frag_list;
-
- skb_shinfo(skb)->frag_list = NULL;
+static void skb_drop_list(struct sk_buff **listp)
+{
+ struct sk_buff *list = *listp;
+
+ *listp = NULL;
do {
struct sk_buff *this = list;
list = list->next;
kfree_skb(this);
} while (list);
+}
+
+static inline void skb_drop_fraglist(struct sk_buff *skb)
+{
+ skb_drop_list(&skb_shinfo(skb)->frag_list);
}
static void skb_clone_fraglist(struct sk_buff *skb)
@@ -604,6 +609,7 @@ struct sk_buff *pskb_copy(struct sk_buff
n->csum = skb->csum;
n->ip_summed = skb->ip_summed;
+ n->truesize += skb->data_len;
n->data_len = skb->data_len;
n->len = skb->len;
@@ -798,49 +804,86 @@ struct sk_buff *skb_pad(struct sk_buff *
return nskb;
}
-/* Trims skb to length len. It can change skb pointers, if "realloc" is 1.
- * If realloc==0 and trimming is impossible without change of data,
- * it is BUG().
- */
-
-int ___pskb_trim(struct sk_buff *skb, unsigned int len, int realloc)
-{
+/* Trims skb to length len. It can change skb pointers.
+ */
+
+int ___pskb_trim(struct sk_buff *skb, unsigned int len)
+{
+ struct sk_buff **fragp;
+ struct sk_buff *frag;
int offset = skb_headlen(skb);
int nfrags = skb_shinfo(skb)->nr_frags;
int i;
-
- for (i = 0; i < nfrags; i++) {
+ int err;
+
+ if (skb_cloned(skb) &&
+ unlikely((err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC))))
+ return err;
+
+ i = 0;
+ if (offset >= len)
+ goto drop_pages;
+
+ for (; i < nfrags; i++) {
int end = offset + skb_shinfo(skb)->frags[i].size;
- if (end > len) {
- if (skb_cloned(skb)) {
- BUG_ON(!realloc);
- if (pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
- return -ENOMEM;
- }
- if (len <= offset) {
- put_page(skb_shinfo(skb)->frags[i].page);
- skb_shinfo(skb)->nr_frags--;
- } else {
- skb_shinfo(skb)->frags[i].size = len - offset;
- }
- }
- offset = end;
- }
-
- if (offset < len) {
+
+ if (end < len) {
+ offset = end;
+ continue;
+ }
+
+ skb_shinfo(skb)->frags[i++].size = len - offset;
+
+drop_pages:
+ skb_shinfo(skb)->nr_frags = i;
+
+ for (; i < nfrags; i++)
+ put_page(skb_shinfo(skb)->frags[i].page);
+
+ if (skb_shinfo(skb)->frag_list)
+ skb_drop_fraglist(skb);
+ goto done;
+ }
+
+ for (fragp = &skb_shinfo(skb)->frag_list; (frag = *fragp);
+ fragp = &frag->next) {
+ int end = offset + frag->len;
+
+ if (skb_shared(frag)) {
+ struct sk_buff *nfrag;
+
+ nfrag = skb_clone(frag, GFP_ATOMIC);
+ if (unlikely(!nfrag))
+ return -ENOMEM;
+
+ nfrag->next = frag->next;
+ kfree_skb(frag);
+ frag = nfrag;
+ *fragp = frag;
+ }
+
+ if (end < len) {
+ offset = end;
+ continue;
+ }
+
+ if (end > len &&
+ unlikely((err = pskb_trim(frag, len - offset))))
+ return err;
+
+ if (frag->next)
+ skb_drop_list(&frag->next);
+ break;
+ }
+
+done:
+ if (len > skb_headlen(skb)) {
skb->data_len -= skb->len - len;
skb->len = len;
} else {
- if (len <= skb_headlen(skb)) {
- skb->len = len;
- skb->data_len = 0;
- skb->tail = skb->data + len;
- if (skb_shinfo(skb)->frag_list && !skb_cloned(skb))
- skb_drop_fraglist(skb);
- } else {
- skb->data_len -= skb->len - len;
- skb->len = len;
- }
+ skb->len = len;
+ skb->data_len = 0;
+ skb->tail = skb->data + len;
}
return 0;
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/blktap/drivers/blktapctrl.c
--- a/tools/blktap/drivers/blktapctrl.c Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/blktap/drivers/blktapctrl.c Tue Nov 28 10:37:36 2006 -0700
@@ -420,7 +420,7 @@ static int read_msg(int fd, int msgtype,
image->secsize = img->secsize;
image->info = img->info;
- DPRINTF("Received CTLMSG_IMG: %lu, %lu, %lu\n",
+ DPRINTF("Received CTLMSG_IMG: %llu, %lu, %u\n",
image->size, image->secsize, image->info);
if(msgtype != CTLMSG_IMG) ret = 0;
break;
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/blktap/drivers/blktapctrl.h
--- a/tools/blktap/drivers/blktapctrl.h Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/blktap/drivers/blktapctrl.h Tue Nov 28 10:37:36 2006 -0700
@@ -30,19 +30,19 @@
*/
-static inline long int tapdisk_get_size(blkif_t *blkif)
+static inline unsigned long long tapdisk_get_size(blkif_t *blkif)
{
image_t *img = (image_t *)blkif->prv;
return img->size;
}
-static inline long int tapdisk_get_secsize(blkif_t *blkif)
+static inline unsigned long tapdisk_get_secsize(blkif_t *blkif)
{
image_t *img = (image_t *)blkif->prv;
return img->secsize;
}
-static inline unsigned tapdisk_get_info(blkif_t *blkif)
+static inline unsigned int tapdisk_get_info(blkif_t *blkif)
{
image_t *img = (image_t *)blkif->prv;
return img->info;
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/blktap/drivers/tapdisk.h
--- a/tools/blktap/drivers/tapdisk.h Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/blktap/drivers/tapdisk.h Tue Nov 28 10:37:36 2006 -0700
@@ -74,9 +74,9 @@ struct td_state {
void *ring_info;
void *fd_entry;
char backing_file[1024]; /*Used by differencing disks, e.g. qcow*/
- long int sector_size;
- uint64_t size;
- long int info;
+ unsigned long sector_size;
+ unsigned long long size;
+ unsigned int info;
};
/* Prototype of the callback to activate as requests complete. */
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/blktap/lib/blktaplib.h
--- a/tools/blktap/lib/blktaplib.h Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/blktap/lib/blktaplib.h Tue Nov 28 10:37:36 2006 -0700
@@ -97,9 +97,9 @@ typedef struct {
} pending_req_t;
struct blkif_ops {
- long int (*get_size)(struct blkif *blkif);
- long int (*get_secsize)(struct blkif *blkif);
- unsigned (*get_info)(struct blkif *blkif);
+ unsigned long long (*get_size)(struct blkif *blkif);
+ unsigned long (*get_secsize)(struct blkif *blkif);
+ unsigned int (*get_info)(struct blkif *blkif);
};
typedef struct blkif {
@@ -156,9 +156,9 @@ typedef struct domid_translate {
} domid_translate_t ;
typedef struct image {
- long int size;
- long int secsize;
- long int info;
+ unsigned long long size;
+ unsigned long secsize;
+ unsigned int info;
} image_t;
typedef struct msg_hdr {
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/blktap/lib/xenbus.c
--- a/tools/blktap/lib/xenbus.c Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/blktap/lib/xenbus.c Tue Nov 28 10:37:36 2006 -0700
@@ -219,7 +219,7 @@ static void ueblktap_setup(struct xs_han
}
/* Supply the information about the device to xenstore */
- er = xs_printf(h, be->backpath, "sectors", "%lu",
+ er = xs_printf(h, be->backpath, "sectors", "%llu",
be->blkif->ops->get_size(be->blkif));
if (er == 0) {
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/examples/vif-common.sh
--- a/tools/examples/vif-common.sh Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/examples/vif-common.sh Tue Nov 28 10:37:36 2006 -0700
@@ -103,7 +103,7 @@ function handle_iptable()
if [ "$ip" != "" ]
then
local addr
- for addr in "$ip"
+ for addr in $ip
do
frob_iptable -s "$addr"
done
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/examples/xend-config.sxp
--- a/tools/examples/xend-config.sxp Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/examples/xend-config.sxp Tue Nov 28 10:37:36 2006 -0700
@@ -13,6 +13,42 @@
#(logfile /var/log/xen/xend.log)
#(loglevel DEBUG)
+
+
+# The Xen-API server configuration. (Please note that this server is
+# available as an UNSUPPORTED PREVIEW in Xen 3.0.4, and should not be relied
+# upon).
+#
+# This value configures the ports, interfaces, and access controls for the
+# Xen-API server. Each entry in the list starts with either unix, a port
+# number, or an address:port pair. If this is "unix", then a UDP socket is
+# opened, and this entry applies to that. If it is a port, then Xend will
+# listen on all interfaces on that TCP port, and if it is an address:port
+# pair, then Xend will listen on the specified port, using the interface with
+# the specified address.
+#
+# The subsequent string configures the user-based access control for the
+# listener in question. This can be one of "none" or "pam", indicating either
+# that users should be allowed access unconditionally, or that the local
+# Pluggable Authentication Modules configuration should be used. If this
+# string is missing or empty, then "pam" is used.
+#
+# The final string gives the host-based access control for that listener. If
+# this is missing or empty, then all connections are accepted. Otherwise,
+# this should be a space-separated sequence of regular expressions; any host
+# with a fully-qualified domain name or an IP address that matches one of
+# these regular expressions will be accepted.
+#
+# Example: listen on TCP port 9363 on all interfaces, accepting connections
+# only from machines in example.com or localhost, and allow access through
+# the unix domain socket unconditionally:
+#
+# (xen-api-server ((9363 pam '^localhost$ example\\.com$')
+# (unix none)))
+#
+# Default:
+# (xen-api-server ((unix)))
+
#(xend-http-server no)
#(xend-unix-server no)
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/examples/xmexample.hvm
--- a/tools/examples/xmexample.hvm Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/examples/xmexample.hvm Tue Nov 28 10:37:36 2006 -0700
@@ -39,14 +39,18 @@ name = "ExampleHVMDomain"
#uuid = "06ed00fe-1162-4fc4-b5d8-11993ee4a8b9"
#-----------------------------------------------------------------------------
-# the number of cpus guest platform has, default=1
+# The number of cpus guest platform has, default=1
#vcpus=1
-# enable/disable HVM guest PAE, default=0 (disabled)
-#pae=0
-
-# enable/disable HVM guest ACPI, default=0 (disabled)
-#acpi=0
+# Enable/disable HVM guest PAE, default=1 (enabled)
+#pae=1
+
+# Enable/disable HVM guest ACPI, default=1 (enabled)
+#acpi=1
+
+# Enable/disable HVM APIC mode, default=1 (enabled)
+# Note that this option is ignored if vcpus > 1
+#apic=1
# List of which CPUS this domain is allowed to use, default Xen picks
#cpus = "" # leave to Xen to pick
@@ -190,3 +194,7 @@ serial='pty'
# absolute mouse)
#usbdevice='mouse'
#usbdevice='tablet'
+
+#-----------------------------------------------------------------------------
+# Set keyboard layout, default is en-us keyboard.
+#keymap='ja'
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/examples/xmexample.vti
--- a/tools/examples/xmexample.vti Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/examples/xmexample.vti Tue Nov 28 10:37:36 2006 -0700
@@ -134,3 +134,7 @@ serial='pty'
# absolute mouse)
#usbdevice='mouse'
#usbdevice='tablet'
+
+#-----------------------------------------------------------------------------
+# Set keyboard layout, default is en-us keyboard.
+#keymap='ja'
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/firmware/hvmloader/Makefile
--- a/tools/firmware/hvmloader/Makefile Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/firmware/hvmloader/Makefile Tue Nov 28 10:37:36 2006 -0700
@@ -40,25 +40,27 @@ CFLAGS += $(DEFINES) -I. $(XENINC) -fno
CFLAGS += $(DEFINES) -I. $(XENINC) -fno-builtin -O2 -msoft-float
LDFLAGS = -nostdlib -Wl,-N -Wl,-Ttext -Wl,$(LOADADDR)
-SRCS = hvmloader.c acpi_madt.c mp_tables.c util.c smbios.c acpi_utils.c
+SRCS = hvmloader.c mp_tables.c util.c smbios.c acpi_utils.c
OBJS = $(patsubst %.c,%.o,$(SRCS))
.PHONY: all
all: hvmloader
-hvmloader: roms.h $(SRCS)
+hvmloader: roms.h acpi/acpi.a $(SRCS)
$(CC) $(CFLAGS) -c $(SRCS)
- $(CC) $(CFLAGS) $(LDFLAGS) -o hvmloader.tmp $(OBJS)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o hvmloader.tmp $(OBJS) acpi/acpi.a
$(OBJCOPY) hvmloader.tmp hvmloader
rm -f hvmloader.tmp
+.PHONY: acpi/acpi.a
+acpi/acpi.a:
+ $(MAKE) -C acpi
+
roms.h: ../rombios/BIOS-bochs-latest ../vgabios/VGABIOS-lgpl-latest.bin
../vgabios/VGABIOS-lgpl-latest.cirrus.bin ../vmxassist/vmxassist.bin
- $(MAKE) -C acpi
sh ./mkhex rombios ../rombios/BIOS-bochs-latest > roms.h
sh ./mkhex vgabios_stdvga ../vgabios/VGABIOS-lgpl-latest.bin >> roms.h
sh ./mkhex vgabios_cirrusvga ../vgabios/VGABIOS-lgpl-latest.cirrus.bin
>> roms.h
sh ./mkhex vmxassist ../vmxassist/vmxassist.bin >> roms.h
- sh ./mkhex acpi acpi/acpi.bin >> roms.h
.PHONY: clean
clean:
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/firmware/hvmloader/acpi/Makefile
--- a/tools/firmware/hvmloader/acpi/Makefile Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/firmware/hvmloader/acpi/Makefile Tue Nov 28 10:37:36 2006 -0700
@@ -15,21 +15,20 @@
# Place - Suite 330, Boston, MA 02111-1307 USA.
#
+override XEN_TARGET_ARCH = x86_32
XEN_ROOT = ../../../..
+CFLAGS := -I. -I.. -I$(XEN_ROOT)/tools/libxc
include $(XEN_ROOT)/tools/Rules.mk
-HOSTCFLAGS += -I. -I.. -I$(XEN_ROOT)/tools/libxc
-
-C_SRC = build.c dsdt.c gen.c static_tables.c
+C_SRC = build.c dsdt.c static_tables.c
H_SRC = $(wildcard *.h)
-ACPI_GEN = acpigen
-ACPI_BIN = acpi.bin
+OBJS = $(patsubst %.c,%.o,$(C_SRC))
IASL_VER = acpica-unix-20050513
IASL_URL =
http://developer.intel.com/technology/iapc/acpi/downloads/$(IASL_VER).tar.gz
vpath iasl $(PATH)
-all:$(ACPI_BIN)
+all: acpi.a
dsdt.c: dsdt.asl
$(MAKE) iasl
@@ -50,14 +49,13 @@ iasl:
make -C $(IASL_VER)/compiler
$(INSTALL_PROG) $(IASL_VER)/compiler/iasl /usr/bin/iasl
-$(ACPI_GEN): $(C_SRC) $(H_SRC)
- $(HOSTCC) -o $(ACPI_GEN) $(HOSTCFLAGS) $(C_SRC)
+acpi.a: $(OBJS)
+ $(AR) rc $@ $(OBJS)
-$(ACPI_BIN): $(ACPI_GEN)
- ./$(ACPI_GEN) $(ACPI_BIN)
+%.o: %.c $(H_SRC)
+ $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
clean:
- rm -rf *.o $(ACPI_GEN) $(ACPI_BIN) $(IASL_VER)
- rm -rf $(IASL_VER).tar.gz
+ rm -rf *.a *.o $(IASL_VER) $(IASL_VER).tar.gz
install: all
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/firmware/hvmloader/acpi/acpi2_0.h
--- a/tools/firmware/hvmloader/acpi/acpi2_0.h Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/firmware/hvmloader/acpi/acpi2_0.h Tue Nov 28 10:37:36 2006 -0700
@@ -249,7 +249,7 @@ struct acpi_20_facs {
/*
* Multiple APIC Description Table header definition (MADT).
*/
-struct acpi_20_madt_header {
+struct acpi_20_madt {
struct acpi_header header;
uint32_t lapic_addr;
uint32_t flags;
@@ -307,10 +307,13 @@ struct acpi_20_madt_ioapic {
uint32_t gsi_base;
};
-struct acpi_20_madt {
- struct acpi_20_madt_header header;
- struct acpi_20_madt_ioapic io_apic[1];
- struct acpi_20_madt_lapic lapic[32];
+struct acpi_20_madt_intsrcovr {
+ uint8_t type;
+ uint8_t length;
+ uint8_t bus;
+ uint8_t source;
+ uint32_t gsi;
+ uint16_t flags;
};
/*
@@ -327,9 +330,8 @@ struct acpi_20_madt {
#pragma pack ()
#define ACPI_PHYSICAL_ADDRESS 0xEA000
-#define ACPI_TABLE_SIZE (4*1024)
-
-void AcpiBuildTable(uint8_t *buf);
+
+int acpi_build_tables(uint8_t *);
#endif /* _ACPI_2_0_H_ */
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/firmware/hvmloader/acpi/build.c
--- a/tools/firmware/hvmloader/acpi/build.c Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/firmware/hvmloader/acpi/build.c Tue Nov 28 10:37:36 2006 -0700
@@ -1,233 +1,198 @@
/*
* Copyright (c) 2004, Intel Corporation.
+ * Copyright (c) 2006, Keir Fraser, XenSource Inc.
*
* This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
+ * under the terms and conditions of the GNU General Public License, version
+ * 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope 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, write to the Free Software Foundation, Inc., 59 Temple
* Place - Suite 330, Boston, MA 02111-1307 USA.
- *
*/
#include "acpi2_0.h"
+#include "../config.h"
+#include "../util.h"
extern struct acpi_20_rsdp Rsdp;
extern struct acpi_20_rsdt Rsdt;
extern struct acpi_20_xsdt Xsdt;
extern struct acpi_20_fadt Fadt;
-extern struct acpi_20_madt Madt;
extern struct acpi_20_facs Facs;
-extern unsigned char *AmlCode;
+extern unsigned char AmlCode[];
extern int DsdtLen;
-
-typedef struct _ACPI_TABLE_ALL{
- struct acpi_20_rsdp *Rsdp;
- struct acpi_20_rsdt *Rsdt;
- struct acpi_20_xsdt *Xsdt;
- struct acpi_20_fadt *Fadt;
- struct acpi_20_madt *Madt;
- struct acpi_20_facs *Facs;
- unsigned char *Dsdt;
- uint32_t RsdpOffset;
- uint32_t RsdtOffset;
- uint32_t XsdtOffset;
- uint32_t FadtOffset;
- uint32_t MadtOffset;
- uint32_t FacsOffset;
- uint32_t DsdtOffset;
-}ACPI_TABLE_ALL;
-
-static
-void
-MemCopy(void* src, void* dst, int len){
-
- uint8_t* src0=src;
- uint8_t* dst0=dst;
-
- while(len--){
- *(dst0++)=*(src0++);
- }
-}
-
-static
-void
-SetCheckSum(
- void* Table,
- uint32_t ChecksumOffset,
- uint32_t Length
- )
-/*
- * Routine Description:
- * Calculate Checksum and store the result in the checksum
- * filed of the table
- *
- * INPUT:
- * Table: Start pointer of table
- * ChecksumOffset: Offset of checksum field in the table
- * Length: Length of Table
- */
-{
- uint8_t Sum = 0;
- uint8_t *Ptr;
-
- Ptr=Table;
- Ptr[ChecksumOffset]=0;
- while (Length--) {
- Sum = (uint8_t)(Sum + (*Ptr++));
- }
-
- Ptr = Table;
- Ptr[ChecksumOffset] = (uint8_t) (0xff - Sum + 1);
-}
-
-//
-// FIELD_OFFSET - returns the byte offset to a field within a structure
-//
-#define FIELD_OFFSET(TYPE,Field) ((uint32_t)(&(((TYPE *) 0)->Field)))
-
-static
-void
-UpdateTable(
- ACPI_TABLE_ALL *table
- )
-/*
- * Update the ACPI table:
- * fill in the actuall physical address of RSDT, XSDT, FADT, MADT,
FACS
- * Caculate the checksum
- */
-{
- // RSDP Update
- table->Rsdp->rsdt_address = (uint32_t)(ACPI_PHYSICAL_ADDRESS+
- table->RsdtOffset);
- table->Rsdp->xsdt_address = (uint64_t)(ACPI_PHYSICAL_ADDRESS+
- table->XsdtOffset);
- SetCheckSum(table->Rsdp,
- FIELD_OFFSET(struct acpi_10_rsdp, checksum),
- sizeof(struct acpi_10_rsdp)
- );
- SetCheckSum(table->Rsdp,
- FIELD_OFFSET(struct acpi_20_rsdp,
- extended_checksum),
- sizeof(struct acpi_20_rsdp)
- );
-
-
- //RSDT Update
- table->Rsdt->entry[0] = (uint32_t)(ACPI_PHYSICAL_ADDRESS +
- table->FadtOffset);
- table->Rsdt->entry[1] = (uint32_t)(ACPI_PHYSICAL_ADDRESS +
- table->MadtOffset);
- table->Rsdt->header.length = sizeof (struct acpi_header) +
- 2*sizeof(uint32_t);
- SetCheckSum(table->Rsdt,
- FIELD_OFFSET(struct acpi_header, checksum),
- table->Rsdt->header.length
- );
-
- //XSDT Update
- table->Xsdt->entry[0] = (uint64_t)(ACPI_PHYSICAL_ADDRESS +
- table->FadtOffset);
- table->Xsdt->entry[1] = (uint64_t)(ACPI_PHYSICAL_ADDRESS +
- table->MadtOffset);
- table->Xsdt->header.length = sizeof (struct acpi_header) +
- 2*sizeof(uint64_t);
- SetCheckSum(table->Xsdt,
- FIELD_OFFSET(struct acpi_header, checksum),
- table->Xsdt->header.length
- );
-
- // FADT Update
- table->Fadt->dsdt = (uint32_t)(ACPI_PHYSICAL_ADDRESS +
- table->DsdtOffset);
- table->Fadt->x_dsdt = (uint64_t)(ACPI_PHYSICAL_ADDRESS +
- table->DsdtOffset);
- table->Fadt->firmware_ctrl = (uint32_t)(ACPI_PHYSICAL_ADDRESS +
- table->FacsOffset);
- table->Fadt->x_firmware_ctrl = (uint64_t)(ACPI_PHYSICAL_ADDRESS +
- table->FacsOffset);
- SetCheckSum(table->Fadt,
- FIELD_OFFSET(struct acpi_header, checksum),
- sizeof(struct acpi_20_fadt)
- );
-
- // MADT update
- SetCheckSum(table->Madt,
- FIELD_OFFSET(struct acpi_header, checksum),
- sizeof(struct acpi_20_madt)
- );
-}
-
-void
-AcpiBuildTable(uint8_t* buf)
-/*
- * Copy all the ACPI table to buffer
- * Buffer Layout:
- * FACS
- * RSDP
- * RSDT
- * XSDT
- * FADT
- * MADT
- * DSDT
- *
- */
-{
- ACPI_TABLE_ALL table;
- int offset=0;
-
- // FACS: should be 64-bit alignment
- // so it is put at the start of buffer
- // as the buffer is 64 bit alignment
- table.FacsOffset = offset;
- table.Facs = (struct acpi_20_facs *)(&buf[offset]);
- MemCopy(&Facs, table.Facs, sizeof(struct acpi_20_facs));
- offset += sizeof(struct acpi_20_facs);
-
- // RSDP
- table.RsdpOffset = offset;
- table.Rsdp = (struct acpi_20_rsdp *)(&buf[offset]);
- MemCopy(&Rsdp, table.Rsdp, sizeof(struct acpi_20_rsdp));
- offset += sizeof(struct acpi_20_rsdp);
-
- // RSDT
- table.RsdtOffset = offset;
- table.Rsdt = (struct acpi_20_rsdt *)(&buf[offset]);
- MemCopy(&Rsdt, table.Rsdt, sizeof(struct acpi_20_rsdt));
- offset += sizeof(struct acpi_20_rsdt);
-
- // XSDT
- table.XsdtOffset = offset;
- table.Xsdt = (struct acpi_20_xsdt *)(&buf[offset]);
- MemCopy(&Xsdt, table.Xsdt, sizeof(struct acpi_20_xsdt));
- offset += sizeof(struct acpi_20_xsdt);
-
- // FADT
- table.FadtOffset = offset;
- table.Fadt = (struct acpi_20_fadt *)(&buf[offset]);
- MemCopy(&Fadt, table.Fadt, sizeof(struct acpi_20_fadt));
- offset += sizeof(struct acpi_20_fadt);
-
- // MADT
- table.MadtOffset = offset;
- table.Madt = (struct acpi_20_madt*)(&buf[offset]);
- MemCopy(&Madt, table.Madt, sizeof(struct acpi_20_madt));
- offset += sizeof(struct acpi_20_madt);
-
- // DSDT
- table.DsdtOffset = offset;
- table.Dsdt = (unsigned char *)(&buf[offset]);
- MemCopy(&AmlCode, table.Dsdt, DsdtLen);
- offset += DsdtLen;
-
- UpdateTable(&table);
+static void set_checksum(
+ void *table, uint32_t checksum_offset, uint32_t length)
+{
+ uint8_t *p, sum = 0;
+
+ p = table;
+ p[checksum_offset] = 0;
+
+ while ( length-- )
+ sum = sum + *p++;
+
+ p = table;
+ p[checksum_offset] = -sum;
+}
+
+int construct_madt(struct acpi_20_madt *madt)
+{
+ struct acpi_20_madt_intsrcovr *intsrcovr;
+ struct acpi_20_madt_ioapic *io_apic;
+ struct acpi_20_madt_lapic *lapic;
+ int i, offset = 0;
+
+ memset(madt, 0, sizeof(*madt));
+ madt->header.signature = ACPI_2_0_MADT_SIGNATURE;
+ madt->header.revision = ACPI_2_0_MADT_REVISION;
+ strncpy(madt->header.oem_id, "INTEL ", 6);
+ madt->header.oem_table_id = ACPI_OEM_TABLE_ID;
+ madt->header.oem_revision = ACPI_OEM_REVISION;
+ madt->header.creator_id = ACPI_CREATOR_ID;
+ madt->header.creator_revision = ACPI_CREATOR_REVISION;
+ madt->lapic_addr = LAPIC_BASE_ADDRESS;
+ madt->flags = ACPI_PCAT_COMPAT;
+ offset += sizeof(*madt);
+
+ intsrcovr = (struct acpi_20_madt_intsrcovr *)(madt + 1);
+ for ( i = 0; i < 16; i++ )
+ {
+ if ( !(PCI_ISA_IRQ_MASK & (1U << i)) )
+ continue;
+
+ /* PCI: active-low level-triggered */
+ memset(intsrcovr, 0, sizeof(*intsrcovr));
+ intsrcovr->type = ACPI_INTERRUPT_SOURCE_OVERRIDE;
+ intsrcovr->length = sizeof(*intsrcovr);
+ intsrcovr->source = i;
+ intsrcovr->gsi = i;
+ intsrcovr->flags = 0xf;
+
+ offset += sizeof(*intsrcovr);
+ intsrcovr++;
+ }
+
+ io_apic = (struct acpi_20_madt_ioapic *)intsrcovr;
+ memset(io_apic, 0, sizeof(*io_apic));
+ io_apic->type = ACPI_IO_APIC;
+ io_apic->length = sizeof(*io_apic);
+ io_apic->ioapic_id = IOAPIC_ID;
+ io_apic->ioapic_addr = IOAPIC_BASE_ADDRESS;
+ offset += sizeof(*io_apic);
+
+ lapic = (struct acpi_20_madt_lapic *)(io_apic + 1);
+ for ( i = 0; i < get_vcpu_nr(); i++ )
+ {
+ memset(lapic, 0, sizeof(*lapic));
+ lapic->type = ACPI_PROCESSOR_LOCAL_APIC;
+ lapic->length = sizeof(*lapic);
+ lapic->acpi_processor_id = lapic->apic_id = i + 1;
+ lapic->flags = ACPI_LOCAL_APIC_ENABLED;
+ offset += sizeof(*lapic);
+ lapic++;
+ }
+
+ madt->header.length = offset;
+ set_checksum(madt, offsetof(struct acpi_header, checksum), offset);
+
+ return offset;
+}
+
+/*
+ * Copy all the ACPI table to buffer.
+ * Buffer layout: FACS, DSDT, FADT, MADT, XSDT, RSDT, RSDP.
+ */
+int acpi_build_tables(uint8_t *buf)
+{
+ struct acpi_20_rsdp *rsdp;
+ struct acpi_20_rsdt *rsdt;
+ struct acpi_20_xsdt *xsdt;
+ struct acpi_20_fadt *fadt;
+ struct acpi_20_madt *madt = 0;
+ struct acpi_20_facs *facs;
+ unsigned char *dsdt;
+ int offset = 0, requires_madt;
+
+ requires_madt = ((get_vcpu_nr() > 1) || get_apic_mode());
+
+#define inc_offset(sz) (offset = (offset + (sz) + 15) & ~15)
+
+ facs = (struct acpi_20_facs *)&buf[offset];
+ memcpy(facs, &Facs, sizeof(struct acpi_20_facs));
+ inc_offset(sizeof(struct acpi_20_facs));
+
+ dsdt = (unsigned char *)&buf[offset];
+ memcpy(dsdt, &AmlCode, DsdtLen);
+ inc_offset(DsdtLen);
+
+ fadt = (struct acpi_20_fadt *)&buf[offset];
+ memcpy(fadt, &Fadt, sizeof(struct acpi_20_fadt));
+ inc_offset(sizeof(struct acpi_20_fadt));
+ fadt->dsdt = (unsigned long)dsdt;
+ fadt->x_dsdt = (unsigned long)dsdt;
+ fadt->firmware_ctrl = (unsigned long)facs;
+ fadt->x_firmware_ctrl = (unsigned long)facs;
+ set_checksum(fadt,
+ offsetof(struct acpi_header, checksum),
+ sizeof(struct acpi_20_fadt));
+
+ if ( requires_madt )
+ {
+ madt = (struct acpi_20_madt *)&buf[offset];
+ inc_offset(construct_madt(madt));
+ }
+
+ xsdt = (struct acpi_20_xsdt *)&buf[offset];
+ memcpy(xsdt, &Xsdt, sizeof(struct acpi_20_xsdt));
+ inc_offset(sizeof(struct acpi_20_xsdt));
+ xsdt->entry[0] = (unsigned long)fadt;
+ xsdt->header.length = sizeof(struct acpi_header) + sizeof(uint64_t);
+ if ( requires_madt )
+ {
+ xsdt->entry[1] = (unsigned long)madt;
+ xsdt->header.length += sizeof(uint64_t);
+ }
+ set_checksum(xsdt,
+ offsetof(struct acpi_header, checksum),
+ xsdt->header.length);
+
+ rsdt = (struct acpi_20_rsdt *)&buf[offset];
+ memcpy(rsdt, &Rsdt, sizeof(struct acpi_20_rsdt));
+ inc_offset(sizeof(struct acpi_20_rsdt));
+ rsdt->entry[0] = (unsigned long)fadt;
+ rsdt->header.length = sizeof(struct acpi_header) + sizeof(uint32_t);
+ if ( requires_madt )
+ {
+ rsdt->entry[1] = (unsigned long)madt;
+ rsdt->header.length += sizeof(uint32_t);
+ }
+ set_checksum(rsdt,
+ offsetof(struct acpi_header, checksum),
+ rsdt->header.length);
+
+ rsdp = (struct acpi_20_rsdp *)&buf[offset];
+ memcpy(rsdp, &Rsdp, sizeof(struct acpi_20_rsdp));
+ inc_offset(sizeof(struct acpi_20_rsdp));
+ rsdp->rsdt_address = (unsigned long)rsdt;
+ rsdp->xsdt_address = (unsigned long)xsdt;
+ set_checksum(rsdp,
+ offsetof(struct acpi_10_rsdp, checksum),
+ sizeof(struct acpi_10_rsdp));
+ set_checksum(rsdp,
+ offsetof(struct acpi_20_rsdp, extended_checksum),
+ sizeof(struct acpi_20_rsdp));
+
+#undef inc_offset
+
+ return offset;
}
/*
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/firmware/hvmloader/acpi/dsdt.asl
--- a/tools/firmware/hvmloader/acpi/dsdt.asl Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/firmware/hvmloader/acpi/dsdt.asl Tue Nov 28 10:37:36 2006 -0700
@@ -1,24 +1,21 @@
-//**********************************************************************//
-//*
-//* Copyright (c) 2004, Intel Corporation.
-//*
-//* This program is free software; you can redistribute it and/or modify it
-//* under the terms and conditions of the GNU General Public License,
-//* version 2, as published by the Free Software Foundation.
-//*
-//* This program is distributed in the hope 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, write to the Free Software Foundation, Inc., 59
Temple
-//* Place - Suite 330, Boston, MA 02111-1307 USA.
-
-//**
-//** DSDT for Xen with Qemu device model
-//**
-//**
+/******************************************************************************
+ * DSDT for Xen with Qemu device model
+ *
+ * Copyright (c) 2004, Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place - Suite 330, Boston, MA 02111-1307 USA.
+ */
DefinitionBlock ("DSDT.aml", "DSDT", 1, "INTEL","int-xen", 2006)
{
@@ -36,11 +33,9 @@ DefinitionBlock ("DSDT.aml", "DSDT", 1,
Processor (CPU1, 0x01, 0x00000000, 0x00) {}
Processor (CPU2, 0x02, 0x00000000, 0x00) {}
Processor (CPU3, 0x03, 0x00000000, 0x00) {}
-
}
-/* Poweroff support - ties in with qemu emulation */
-
+ /* Poweroff support - ties in with qemu emulation */
Name (\_S5, Package (0x04)
{
0x07,
@@ -49,318 +44,453 @@ DefinitionBlock ("DSDT.aml", "DSDT", 1,
0x00
})
-
Name(PICD, 0)
-
- Method(_PIC, 1) {
-
- Store(Arg0, PICD)
+ Method(_PIC, 1)
+ {
+ Store(Arg0, PICD)
}
+
Scope (\_SB)
{
- /* Fix HCT test for 0x400 pci memory - need to report low 640 MB mem as
motherboard resource */
-
- Device(MEM0) {
+ /* Fix HCT test for 0x400 pci memory:
+ * - need to report low 640 MB mem as motherboard resource
+ */
+
+ Device(MEM0)
+ {
Name(_HID, EISAID("PNP0C02"))
Name(_CRS, ResourceTemplate() {
- QWordMemory (ResourceConsumer, PosDecode, MinFixed, MaxFixed,
Cacheable, ReadWrite,
+ QWordMemory(
+ ResourceConsumer, PosDecode, MinFixed,
+ MaxFixed, Cacheable, ReadWrite,
0x00000000,
0x00000000,
0x0009ffff,
0x00000000,
0x000a0000)
- }
- )
+ })
}
Device (PCI0)
- {
+ {
Name (_HID, EisaId ("PNP0A03"))
Name (_UID, 0x00)
Name (_ADR, 0x00)
Name (_BBN, 0x00)
- OperationRegion (PIRP, PCI_Config, 0x3c, 0x10)
- Field(PIRP, ByteAcc, NoLock, Preserve){
- IRQ3,3,
- IRQ5,5,
- IRQ7,7,
- IRQ9,9,
- IRQA,10,
- IRQB,11
- }
- Method (_CRS, 0, NotSerialized)
- {
-
+ Method (_CRS, 0, NotSerialized)
+ {
Name (PRT0, ResourceTemplate ()
- {
- /* bus number is from 0 - 255*/
- WordBusNumber (ResourceConsumer, MinFixed, MaxFixed,
SubDecode,
+ {
+ /* bus number is from 0 - 255*/
+ WordBusNumber(
+ ResourceConsumer, MinFixed, MaxFixed, SubDecode,
0x0000,
0x0000,
0x00FF,
0x0000,
0x0100)
IO (Decode16, 0x0CF8, 0x0CF8, 0x01, 0x08)
- WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode,
EntireRange,
+ WordIO(
+ ResourceProducer, MinFixed, MaxFixed, PosDecode,
+ EntireRange,
0x0000,
0x0000,
0x0CF7,
0x0000,
0x0CF8)
- WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode,
EntireRange,
+ WordIO(
+ ResourceProducer, MinFixed, MaxFixed, PosDecode,
+ EntireRange,
0x0000,
0x0D00,
0xFFFF,
0x0000,
0xF300)
- /* reserve memory for pci devices */
-
- DWordMemory (ResourceProducer, PosDecode, MinFixed,
MaxFixed, Cacheable, ReadWrite,
+ /* reserve memory for pci devices */
+ DWordMemory(
+ ResourceProducer, PosDecode, MinFixed, MaxFixed,
+ Cacheable, ReadWrite,
0x00000000,
0x000A0000,
0x000BFFFF,
0x00000000,
0x00020000)
- DWordMemory (ResourceConsumer, PosDecode, MinFixed,
MaxFixed, Cacheable, ReadWrite,
+ DWordMemory(
+ ResourceConsumer, PosDecode, MinFixed, MaxFixed,
+ Cacheable, ReadWrite,
0x00000000,
0xF0000000,
0xF4FFFFFF,
0x00000000,
0x05000000)
-
})
Return (PRT0)
}
- Name(BUFA, ResourceTemplate() {
- IRQ(Level, ActiveLow, Shared) {
- 3,4,5,6,7,10,11,12,14,15}
- })
-
- Name(BUFB, Buffer(){
- 0x23, 0x00, 0x00, 0x18,
- 0x79, 0})
-
- CreateWordField(BUFB, 0x01, IRQV)
-
- Name(BUFC, Buffer(){
- 5, 7, 10, 11
- })
-
- CreateByteField(BUFC, 0x01, PIQA)
- CreateByteField(BUFC, 0x01, PIQB)
- CreateByteField(BUFC, 0x01, PIQC)
- CreateByteField(BUFC, 0x01, PIQD)
-
- Device(LNKA) {
- Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
+
+ Name(BUFA, ResourceTemplate() {
+ IRQ(Level, ActiveLow, Shared) { 5, 6, 10, 11 }
+ })
+
+ Name(BUFB, Buffer() {
+ 0x23, 0x00, 0x00, 0x18, 0x79, 0
+ })
+
+ CreateWordField(BUFB, 0x01, IRQV)
+
+ Device(LNKA) {
+ Name(_HID, EISAID("PNP0C0F")) /* PCI interrupt link */
Name(_UID, 1)
+
Method(_STA, 0) {
- And(PIRA, 0x80, Local0)
- If(LEqual(Local0, 0x80)) {
- Return(0x09)
- }
- Else {
- Return(0x0B)
- }
- }
+ And(PIRA, 0x80, Local0)
+ If(LEqual(Local0, 0x80)) {
+ Return(0x09)
+ } Else {
+ Return(0x0B)
+ }
+ }
Method(_PRS) {
-
- Return(BUFA)
- } // Method(_PRS)
+ Return(BUFA)
+ }
Method(_DIS) {
- Or(PIRA, 0x80, PIRA)
+ Or(PIRA, 0x80, PIRA)
}
Method(_CRS) {
- And(PIRB, 0x0f, Local0)
- ShiftLeft(0x1, Local0, IRQV)
- Return(BUFB)
- }
+ And(PIRA, 0x0f, Local0)
+ ShiftLeft(0x1, Local0, IRQV)
+ Return(BUFB)
+ }
Method(_SRS, 1) {
- CreateWordField(ARG0, 0x01, IRQ1)
- FindSetRightBit(IRQ1, Local0)
- Decrement(Local0)
- Store(Local0, PIRA)
- } // Method(_SRS)
- }
-
- Device(LNKB){
- Name(_HID, EISAID("PNP0C0F"))
+ CreateWordField(ARG0, 0x01, IRQ1)
+ FindSetRightBit(IRQ1, Local0)
+ Decrement(Local0)
+ Store(Local0, PIRA)
+ }
+ }
+
+ Device(LNKB) {
+ Name(_HID, EISAID("PNP0C0F")) /* PCI interrupt link */
Name(_UID, 2)
+
Method(_STA, 0) {
- And(PIRB, 0x80, Local0)
- If(LEqual(Local0, 0x80)) {
- Return(0x09)
- }
- Else {
- Return(0x0B)
- }
- }
+ And(PIRB, 0x80, Local0)
+ If(LEqual(Local0, 0x80)) {
+ Return(0x09)
+ } Else {
+ Return(0x0B)
+ }
+ }
Method(_PRS) {
- Return(BUFA)
- } // Method(_PRS)
+ Return(BUFA)
+ }
Method(_DIS) {
-
- Or(PIRB, 0x80, PIRB)
+ Or(PIRB, 0x80, PIRB)
}
Method(_CRS) {
- And(PIRB, 0x0f, Local0)
- ShiftLeft(0x1, Local0, IRQV)
- Return(BUFB)
- } // Method(_CRS)
+ And(PIRB, 0x0f, Local0)
+ ShiftLeft(0x1, Local0, IRQV)
+ Return(BUFB)
+ }
Method(_SRS, 1) {
- CreateWordField(ARG0, 0x01, IRQ1)
- FindSetRightBit(IRQ1, Local0)
- Decrement(Local0)
- Store(Local0, PIRB)
- } // Method(_SRS)
- }
-
- Device(LNKC){
- Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
+ CreateWordField(ARG0, 0x01, IRQ1)
+ FindSetRightBit(IRQ1, Local0)
+ Decrement(Local0)
+ Store(Local0, PIRB)
+ }
+ }
+
+ Device(LNKC) {
+ Name(_HID, EISAID("PNP0C0F")) /* PCI interrupt link */
Name(_UID, 3)
+
Method(_STA, 0) {
- And(PIRC, 0x80, Local0)
- If(LEqual(Local0, 0x80)) {
- Return(0x09)
- }
- Else {
- Return(0x0B)
- }
+ And(PIRC, 0x80, Local0)
+ If(LEqual(Local0, 0x80)) {
+ Return(0x09)
+ } Else {
+ Return(0x0B)
+ }
}
Method(_PRS) {
- Return(BUFA)
- } // Method(_PRS)
+ Return(BUFA)
+ }
Method(_DIS) {
-
- Or(PIRC, 0x80, PIRC)
+ Or(PIRC, 0x80, PIRC)
}
Method(_CRS) {
- And(PIRC, 0x0f, Local0)
- ShiftLeft(0x1, Local0, IRQV)
- Return(BUFB)
- } // Method(_CRS)
+ And(PIRC, 0x0f, Local0)
+ ShiftLeft(0x1, Local0, IRQV)
+ Return(BUFB)
+ }
Method(_SRS, 1) {
- CreateWordField(ARG0, 0x01, IRQ1)
- FindSetRightBit(IRQ1, Local0)
- Decrement(Local0)
- Store(Local0, PIRC)
- } // Method(_SRS)
- }
-
- Device(LNKD) {
- Name(_HID, EISAID("PNP0C0F"))
+ CreateWordField(ARG0, 0x01, IRQ1)
+ FindSetRightBit(IRQ1, Local0)
+ Decrement(Local0)
+ Store(Local0, PIRC)
+ }
+ }
+
+ Device(LNKD) {
+ Name(_HID, EISAID("PNP0C0F")) /* PCI interrupt link */
Name(_UID, 4)
+
Method(_STA, 0) {
- And(PIRD, 0x80, Local0)
- If(LEqual(Local0, 0x80)) {
- Return(0x09)
- }
- Else {
- Return(0x0B)
- }
+ And(PIRD, 0x80, Local0)
+ If(LEqual(Local0, 0x80)) {
+ Return(0x09)
+ } Else {
+ Return(0x0B)
+ }
}
Method(_PRS) {
- Return(BUFA)
- } // Method(_PRS)
+ Return(BUFA)
+ }
Method(_DIS) {
- Or(PIRD, 0x80, PIRD)
+ Or(PIRD, 0x80, PIRD)
}
Method(_CRS) {
- And(PIRD, 0x0f, Local0)
- ShiftLeft(0x1, Local0, IRQV)
- Return(BUFB)
- } // Method(_CRS)
+ And(PIRD, 0x0f, Local0)
+ ShiftLeft(0x1, Local0, IRQV)
+ Return(BUFB)
+ }
Method(_SRS, 1) {
- CreateWordField(ARG0, 0x01, IRQ1)
- FindSetRightBit(IRQ1, Local0)
- Decrement(Local0)
- Store(Local0, PIRD)
- } // Method(_SRS)
- }
- Method(_PRT,0) {
- If(PICD) {Return(PRTA)}
- Return (PRTP)
- } // end _PRT
-
- Name(PRTP, Package() {
- // Slot 1, INTA - INTD
- Package(){0x0000ffff, 0, \_SB.PCI0.LNKA, 0},
- Package(){0x0000ffff, 1, \_SB.PCI0.LNKB, 0},
- Package(){0x0000ffff, 2, \_SB.PCI0.LNKC, 0},
- Package(){0x0000ffff, 3, \_SB.PCI0.LNKD, 0},
-
- // Slot 2, INTA - INTD
- Package(){0x0001ffff, 0, \_SB.PCI0.LNKB, 0},
- Package(){0x0001ffff, 1, \_SB.PCI0.LNKC, 0},
- Package(){0x0001ffff, 2, \_SB.PCI0.LNKD, 0},
- Package(){0x0001ffff, 3, \_SB.PCI0.LNKA, 0},
-
- // Slot 3, INTA - INTD
- Package(){0x0002ffff, 0, \_SB.PCI0.LNKC, 0},
- Package(){0x0002ffff, 1, \_SB.PCI0.LNKD, 0},
- Package(){0x0002ffff, 2, \_SB.PCI0.LNKA, 0},
- Package(){0x0002ffff, 3, \_SB.PCI0.LNKB, 0},
-
- // Slot 4, INTA - INTD
- Package(){0x0003ffff, 0, \_SB.PCI0.LNKD, 0},
- Package(){0x0003ffff, 1, \_SB.PCI0.LNKA, 0},
- Package(){0x0003ffff, 2, \_SB.PCI0.LNKB, 0},
- Package(){0x0003ffff, 3, \_SB.PCI0.LNKC, 0},
-
- // Slot 5, INTA - INTD
- Package(){0x0004ffff, 0, \_SB.PCI0.LNKA, 0},
- Package(){0x0004ffff, 1, \_SB.PCI0.LNKB, 0},
- Package(){0x0004ffff, 2, \_SB.PCI0.LNKC, 0},
- Package(){0x0004ffff, 3, \_SB.PCI0.LNKD, 0},
- }
- )
- Name(PRTA, Package(){
- Package(){0x0001ffff, 0, 0, 5}, // Device 1, INTA
- Package(){0x0002ffff, 0, 0, 7}, // Device 2, INTA
- Package(){0x0003ffff, 0, 0, 10}, // Device 3, INTA
- Package(){0x0004ffff, 0, 0, 11}, // Device 4, INTA
- }
- )
+ CreateWordField(ARG0, 0x01, IRQ1)
+ FindSetRightBit(IRQ1, Local0)
+ Decrement(Local0)
+ Store(Local0, PIRD)
+ }
+ }
+
+ Method(_PRT,0) {
+ If(PICD) {
+ Return(PRTA)
+ }
+ Return (PRTP)
+ }
+
+ Name(PRTP, Package() {
+ /* Device 1, INTA - INTD */
+ Package(){0x0001ffff, 0, \_SB.PCI0.LNKB, 0},
+ Package(){0x0001ffff, 1, \_SB.PCI0.LNKC, 0},
+ Package(){0x0001ffff, 2, \_SB.PCI0.LNKD, 0},
+ Package(){0x0001ffff, 3, \_SB.PCI0.LNKA, 0},
+
+ /* Device 2, INTA - INTD */
+ Package(){0x0002ffff, 0, \_SB.PCI0.LNKC, 0},
+ Package(){0x0002ffff, 1, \_SB.PCI0.LNKD, 0},
+ Package(){0x0002ffff, 2, \_SB.PCI0.LNKA, 0},
+ Package(){0x0002ffff, 3, \_SB.PCI0.LNKB, 0},
+
+ /* Device 3, INTA - INTD */
+ Package(){0x0003ffff, 0, \_SB.PCI0.LNKD, 0},
+ Package(){0x0003ffff, 1, \_SB.PCI0.LNKA, 0},
+ Package(){0x0003ffff, 2, \_SB.PCI0.LNKB, 0},
+ Package(){0x0003ffff, 3, \_SB.PCI0.LNKC, 0},
+
+ /* Device 4, INTA - INTD */
+ Package(){0x0004ffff, 0, \_SB.PCI0.LNKA, 0},
+ Package(){0x0004ffff, 1, \_SB.PCI0.LNKB, 0},
+ Package(){0x0004ffff, 2, \_SB.PCI0.LNKC, 0},
+ Package(){0x0004ffff, 3, \_SB.PCI0.LNKD, 0},
+
+ /* Device 5, INTA - INTD */
+ Package(){0x0005ffff, 0, \_SB.PCI0.LNKB, 0},
+ Package(){0x0005ffff, 1, \_SB.PCI0.LNKC, 0},
+ Package(){0x0005ffff, 2, \_SB.PCI0.LNKD, 0},
+ Package(){0x0005ffff, 3, \_SB.PCI0.LNKA, 0},
+
+ /* Device 6, INTA - INTD */
+ Package(){0x0006ffff, 0, \_SB.PCI0.LNKC, 0},
+ Package(){0x0006ffff, 1, \_SB.PCI0.LNKD, 0},
+ Package(){0x0006ffff, 2, \_SB.PCI0.LNKA, 0},
+ Package(){0x0006ffff, 3, \_SB.PCI0.LNKB, 0},
+
+ /* Device 7, INTA - INTD */
+ Package(){0x0007ffff, 0, \_SB.PCI0.LNKD, 0},
+ Package(){0x0007ffff, 1, \_SB.PCI0.LNKA, 0},
+ Package(){0x0007ffff, 2, \_SB.PCI0.LNKB, 0},
+ Package(){0x0007ffff, 3, \_SB.PCI0.LNKC, 0},
+
+ /* Device 8, INTA - INTD */
+ Package(){0x0008ffff, 0, \_SB.PCI0.LNKA, 0},
+ Package(){0x0008ffff, 1, \_SB.PCI0.LNKB, 0},
+ Package(){0x0008ffff, 2, \_SB.PCI0.LNKC, 0},
+ Package(){0x0008ffff, 3, \_SB.PCI0.LNKD, 0},
+
+ /* Device 9, INTA - INTD */
+ Package(){0x0009ffff, 0, \_SB.PCI0.LNKB, 0},
+ Package(){0x0009ffff, 1, \_SB.PCI0.LNKC, 0},
+ Package(){0x0009ffff, 2, \_SB.PCI0.LNKD, 0},
+ Package(){0x0009ffff, 3, \_SB.PCI0.LNKA, 0},
+
+ /* Device 10, INTA - INTD */
+ Package(){0x000affff, 0, \_SB.PCI0.LNKC, 0},
+ Package(){0x000affff, 1, \_SB.PCI0.LNKD, 0},
+ Package(){0x000affff, 2, \_SB.PCI0.LNKA, 0},
+ Package(){0x000affff, 3, \_SB.PCI0.LNKB, 0},
+
+ /* Device 11, INTA - INTD */
+ Package(){0x000bffff, 0, \_SB.PCI0.LNKD, 0},
+ Package(){0x000bffff, 1, \_SB.PCI0.LNKA, 0},
+ Package(){0x000bffff, 2, \_SB.PCI0.LNKB, 0},
+ Package(){0x000bffff, 3, \_SB.PCI0.LNKC, 0},
+
+ /* Device 12, INTA - INTD */
+ Package(){0x000cffff, 0, \_SB.PCI0.LNKA, 0},
+ Package(){0x000cffff, 1, \_SB.PCI0.LNKB, 0},
+ Package(){0x000cffff, 2, \_SB.PCI0.LNKC, 0},
+ Package(){0x000cffff, 3, \_SB.PCI0.LNKD, 0},
+
+ /* Device 13, INTA - INTD */
+ Package(){0x000dffff, 0, \_SB.PCI0.LNKB, 0},
+ Package(){0x000dffff, 1, \_SB.PCI0.LNKC, 0},
+ Package(){0x000dffff, 2, \_SB.PCI0.LNKD, 0},
+ Package(){0x000dffff, 3, \_SB.PCI0.LNKA, 0},
+
+ /* Device 14, INTA - INTD */
+ Package(){0x000effff, 0, \_SB.PCI0.LNKC, 0},
+ Package(){0x000effff, 1, \_SB.PCI0.LNKD, 0},
+ Package(){0x000effff, 2, \_SB.PCI0.LNKA, 0},
+ Package(){0x000effff, 3, \_SB.PCI0.LNKB, 0},
+
+ /* Device 15, INTA - INTD */
+ Package(){0x000fffff, 0, \_SB.PCI0.LNKD, 0},
+ Package(){0x000fffff, 1, \_SB.PCI0.LNKA, 0},
+ Package(){0x000fffff, 2, \_SB.PCI0.LNKB, 0},
+ Package(){0x000fffff, 3, \_SB.PCI0.LNKC, 0},
+ })
+
+ Name(PRTA, Package() {
+ /* Device 1, INTA - INTD */
+ Package(){0x0001ffff, 0, 0, 20},
+ Package(){0x0001ffff, 1, 0, 21},
+ Package(){0x0001ffff, 2, 0, 22},
+ Package(){0x0001ffff, 3, 0, 23},
+
+ /* Device 2, INTA - INTD */
+ Package(){0x0002ffff, 0, 0, 24},
+ Package(){0x0002ffff, 1, 0, 25},
+ Package(){0x0002ffff, 2, 0, 26},
+ Package(){0x0002ffff, 3, 0, 27},
+
+ /* Device 3, INTA - INTD */
+ Package(){0x0003ffff, 0, 0, 28},
+ Package(){0x0003ffff, 1, 0, 29},
+ Package(){0x0003ffff, 2, 0, 30},
+ Package(){0x0003ffff, 3, 0, 31},
+
+ /* Device 4, INTA - INTD */
+ Package(){0x0004ffff, 0, 0, 32},
+ Package(){0x0004ffff, 1, 0, 33},
+ Package(){0x0004ffff, 2, 0, 34},
+ Package(){0x0004ffff, 3, 0, 35},
+
+ /* Device 5, INTA - INTD */
+ Package(){0x0005ffff, 0, 0, 36},
+ Package(){0x0005ffff, 1, 0, 37},
+ Package(){0x0005ffff, 2, 0, 38},
+ Package(){0x0005ffff, 3, 0, 39},
+
+ /* Device 6, INTA - INTD */
+ Package(){0x0006ffff, 0, 0, 40},
+ Package(){0x0006ffff, 1, 0, 41},
+ Package(){0x0006ffff, 2, 0, 42},
+ Package(){0x0006ffff, 3, 0, 43},
+
+ /* Device 7, INTA - INTD */
+ Package(){0x0007ffff, 0, 0, 44},
+ Package(){0x0007ffff, 1, 0, 45},
+ Package(){0x0007ffff, 2, 0, 46},
+ Package(){0x0007ffff, 3, 0, 47},
+
+ /* Device 8, INTA - INTD */
+ Package(){0x0008ffff, 0, 0, 17},
+ Package(){0x0008ffff, 1, 0, 18},
+ Package(){0x0008ffff, 2, 0, 19},
+ Package(){0x0008ffff, 3, 0, 20},
+
+ /* Device 9, INTA - INTD */
+ Package(){0x0009ffff, 0, 0, 21},
+ Package(){0x0009ffff, 1, 0, 22},
+ Package(){0x0009ffff, 2, 0, 23},
+ Package(){0x0009ffff, 3, 0, 24},
+
+ /* Device 10, INTA - INTD */
+ Package(){0x000affff, 0, 0, 25},
+ Package(){0x000affff, 1, 0, 26},
+ Package(){0x000affff, 2, 0, 27},
+ Package(){0x000affff, 3, 0, 28},
+
+ /* Device 11, INTA - INTD */
+ Package(){0x000bffff, 0, 0, 29},
+ Package(){0x000bffff, 1, 0, 30},
+ Package(){0x000bffff, 2, 0, 31},
+ Package(){0x000bffff, 3, 0, 32},
+
+ /* Device 12, INTA - INTD */
+ Package(){0x000cffff, 0, 0, 33},
+ Package(){0x000cffff, 1, 0, 34},
+ Package(){0x000cffff, 2, 0, 35},
+ Package(){0x000cffff, 3, 0, 36},
+
+ /* Device 13, INTA - INTD */
+ Package(){0x000dffff, 0, 0, 37},
+ Package(){0x000dffff, 1, 0, 38},
+ Package(){0x000dffff, 2, 0, 39},
+ Package(){0x000dffff, 3, 0, 40},
+
+ /* Device 14, INTA - INTD */
+ Package(){0x000effff, 0, 0, 41},
+ Package(){0x000effff, 1, 0, 42},
+ Package(){0x000effff, 2, 0, 43},
+ Package(){0x000effff, 3, 0, 44},
+
+ /* Device 15, INTA - INTD */
+ Package(){0x000fffff, 0, 0, 45},
+ Package(){0x000fffff, 1, 0, 46},
+ Package(){0x000fffff, 2, 0, 47},
+ Package(){0x000fffff, 3, 0, 16},
+ })
Device (ISA)
{
- Name (_ADR, 0x00000000) /* device id, PCI bus num, ... */
-
- OperationRegion(PIRQ, PCI_Config, 0x60, 0x4)
- Scope(\) {
- Field (\_SB.PCI0.ISA.PIRQ, ByteAcc, NoLock,
Preserve) {
- PIRA, 8,
- PIRB, 8,
- PIRC, 8,
- PIRD, 8
- }
- }
+ Name (_ADR, 0x00010000) /* device 1, fn 0 */
+
+ OperationRegion(PIRQ, PCI_Config, 0x60, 0x4)
+ Scope(\) {
+ Field (\_SB.PCI0.ISA.PIRQ, ByteAcc, NoLock, Preserve) {
+ PIRA, 8,
+ PIRB, 8,
+ PIRC, 8,
+ PIRD, 8
+ }
+ }
Device (SYSR)
{
Name (_HID, EisaId ("PNP0C02"))
Name (_UID, 0x01)
Name (CRS, ResourceTemplate ()
{
- /* TODO: list hidden resources */
+ /* TODO: list hidden resources */
IO (Decode16, 0x0010, 0x0010, 0x00, 0x10)
IO (Decode16, 0x0022, 0x0022, 0x00, 0x0C)
IO (Decode16, 0x0030, 0x0030, 0x00, 0x10)
@@ -525,4 +655,3 @@ DefinitionBlock ("DSDT.aml", "DSDT", 1,
}
}
}
-
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/firmware/hvmloader/acpi/dsdt.c
--- a/tools/firmware/hvmloader/acpi/dsdt.c Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/firmware/hvmloader/acpi/dsdt.c Tue Nov 28 10:37:36 2006 -0700
@@ -5,15 +5,15 @@
* Copyright (C) 2000 - 2005 Intel Corporation
* Supports ACPI Specification Revision 3.0
*
- * Compilation of "dsdt.asl" - Fri Nov 17 10:00:20 2006
+ * Compilation of "dsdt.asl" - Wed Nov 22 18:26:19 2006
*
* C source code output
*
*/
unsigned char AmlCode[] =
{
- 0x44,0x53,0x44,0x54,0xF4,0x08,0x00,0x00, /* 00000000 "DSDT...." */
- 0x01,0x22,0x49,0x4E,0x54,0x45,0x4C,0x00, /* 00000008 "."INTEL." */
+ 0x44,0x53,0x44,0x54,0x9D,0x0D,0x00,0x00, /* 00000000 "DSDT...." */
+ 0x01,0x83,0x49,0x4E,0x54,0x45,0x4C,0x00, /* 00000008 "..INTEL." */
0x69,0x6E,0x74,0x2D,0x78,0x65,0x6E,0x00, /* 00000010 "int-xen." */
0xD6,0x07,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x13,0x05,0x05,0x20,0x08,0x50,0x4D,0x42, /* 00000020 "... .PMB" */
@@ -34,7 +34,7 @@ unsigned char AmlCode[] =
0x12,0x08,0x04,0x0A,0x07,0x0A,0x07,0x00, /* 00000098 "........" */
0x00,0x08,0x50,0x49,0x43,0x44,0x00,0x14, /* 000000A0 "..PICD.." */
0x0C,0x5F,0x50,0x49,0x43,0x01,0x70,0x68, /* 000000A8 "._PIC.ph" */
- 0x50,0x49,0x43,0x44,0x10,0x4F,0x83,0x5F, /* 000000B0 "PICD.O._" */
+ 0x50,0x49,0x43,0x44,0x10,0x48,0xCE,0x5F, /* 000000B0 "PICD.H._" */
0x53,0x42,0x5F,0x5B,0x82,0x49,0x04,0x4D, /* 000000B8 "SB_[.I.M" */
0x45,0x4D,0x30,0x08,0x5F,0x48,0x49,0x44, /* 000000C0 "EM0._HID" */
0x0C,0x41,0xD0,0x0C,0x02,0x08,0x5F,0x43, /* 000000C8 ".A...._C" */
@@ -45,259 +45,408 @@ unsigned char AmlCode[] =
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F0 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x0A,0x00, /* 000000F8 "........" */
0x00,0x00,0x00,0x00,0x79,0x00,0x5B,0x82, /* 00000100 "....y.[." */
- 0x4C,0x7E,0x50,0x43,0x49,0x30,0x08,0x5F, /* 00000108 "L~PCI0._" */
+ 0x45,0xC9,0x50,0x43,0x49,0x30,0x08,0x5F, /* 00000108 "E.PCI0._" */
0x48,0x49,0x44,0x0C,0x41,0xD0,0x0A,0x03, /* 00000110 "HID.A..." */
0x08,0x5F,0x55,0x49,0x44,0x00,0x08,0x5F, /* 00000118 "._UID.._" */
0x41,0x44,0x52,0x00,0x08,0x5F,0x42,0x42, /* 00000120 "ADR.._BB" */
- 0x4E,0x00,0x5B,0x80,0x50,0x49,0x52,0x50, /* 00000128 "N.[.PIRP" */
- 0x02,0x0A,0x3C,0x0A,0x10,0x5B,0x81,0x24, /* 00000130 "..<..[.$" */
- 0x50,0x49,0x52,0x50,0x01,0x49,0x52,0x51, /* 00000138 "PIRP.IRQ" */
- 0x33,0x03,0x49,0x52,0x51,0x35,0x05,0x49, /* 00000140 "3.IRQ5.I" */
- 0x52,0x51,0x37,0x07,0x49,0x52,0x51,0x39, /* 00000148 "RQ7.IRQ9" */
- 0x09,0x49,0x52,0x51,0x41,0x0A,0x49,0x52, /* 00000150 ".IRQA.IR" */
- 0x51,0x42,0x0B,0x14,0x44,0x08,0x5F,0x43, /* 00000158 "QB..D._C" */
- 0x52,0x53,0x00,0x08,0x50,0x52,0x54,0x30, /* 00000160 "RS..PRT0" */
- 0x11,0x42,0x07,0x0A,0x6E,0x88,0x0D,0x00, /* 00000168 ".B..n..." */
- 0x02,0x0F,0x00,0x00,0x00,0x00,0x00,0xFF, /* 00000170 "........" */
- 0x00,0x00,0x00,0x00,0x01,0x47,0x01,0xF8, /* 00000178 ".....G.." */
- 0x0C,0xF8,0x0C,0x01,0x08,0x88,0x0D,0x00, /* 00000180 "........" */
- 0x01,0x0C,0x03,0x00,0x00,0x00,0x00,0xF7, /* 00000188 "........" */
- 0x0C,0x00,0x00,0xF8,0x0C,0x88,0x0D,0x00, /* 00000190 "........" */
- 0x01,0x0C,0x03,0x00,0x00,0x00,0x0D,0xFF, /* 00000198 "........" */
- 0xFF,0x00,0x00,0x00,0xF3,0x87,0x17,0x00, /* 000001A0 "........" */
- 0x00,0x0C,0x03,0x00,0x00,0x00,0x00,0x00, /* 000001A8 "........" */
- 0x00,0x0A,0x00,0xFF,0xFF,0x0B,0x00,0x00, /* 000001B0 "........" */
- 0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x87, /* 000001B8 "........" */
- 0x17,0x00,0x00,0x0D,0x03,0x00,0x00,0x00, /* 000001C0 "........" */
- 0x00,0x00,0x00,0x00,0xF0,0xFF,0xFF,0xFF, /* 000001C8 "........" */
- 0xF4,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000001D0 "........" */
- 0x05,0x79,0x00,0xA4,0x50,0x52,0x54,0x30, /* 000001D8 ".y..PRT0" */
- 0x08,0x42,0x55,0x46,0x41,0x11,0x09,0x0A, /* 000001E0 ".BUFA..." */
- 0x06,0x23,0xF8,0xDC,0x18,0x79,0x00,0x08, /* 000001E8 ".#...y.." */
- 0x42,0x55,0x46,0x42,0x11,0x09,0x0A,0x06, /* 000001F0 "BUFB...." */
- 0x23,0x00,0x00,0x18,0x79,0x00,0x8B,0x42, /* 000001F8 "#...y..B" */
- 0x55,0x46,0x42,0x01,0x49,0x52,0x51,0x56, /* 00000200 "UFB.IRQV" */
- 0x08,0x42,0x55,0x46,0x43,0x11,0x07,0x0A, /* 00000208 ".BUFC..." */
- 0x04,0x05,0x07,0x0A,0x0B,0x8C,0x42,0x55, /* 00000210 "......BU" */
- 0x46,0x43,0x01,0x50,0x49,0x51,0x41,0x8C, /* 00000218 "FC.PIQA." */
- 0x42,0x55,0x46,0x43,0x01,0x50,0x49,0x51, /* 00000220 "BUFC.PIQ" */
- 0x42,0x8C,0x42,0x55,0x46,0x43,0x01,0x50, /* 00000228 "B.BUFC.P" */
- 0x49,0x51,0x43,0x8C,0x42,0x55,0x46,0x43, /* 00000230 "IQC.BUFC" */
- 0x01,0x50,0x49,0x51,0x44,0x5B,0x82,0x48, /* 00000238 ".PIQD[.H" */
- 0x08,0x4C,0x4E,0x4B,0x41,0x08,0x5F,0x48, /* 00000240 ".LNKA._H" */
- 0x49,0x44,0x0C,0x41,0xD0,0x0C,0x0F,0x08, /* 00000248 "ID.A...." */
- 0x5F,0x55,0x49,0x44,0x01,0x14,0x1C,0x5F, /* 00000250 "_UID..._" */
- 0x53,0x54,0x41,0x00,0x7B,0x50,0x49,0x52, /* 00000258 "STA.{PIR" */
- 0x41,0x0A,0x80,0x60,0xA0,0x08,0x93,0x60, /* 00000260 "A..`...`" */
- 0x0A,0x80,0xA4,0x0A,0x09,0xA1,0x04,0xA4, /* 00000268 "........" */
- 0x0A,0x0B,0x14,0x0B,0x5F,0x50,0x52,0x53, /* 00000270 "...._PRS" */
- 0x00,0xA4,0x42,0x55,0x46,0x41,0x14,0x11, /* 00000278 "..BUFA.." */
- 0x5F,0x44,0x49,0x53,0x00,0x7D,0x50,0x49, /* 00000280 "_DIS.}PI" */
- 0x52,0x41,0x0A,0x80,0x50,0x49,0x52,0x41, /* 00000288 "RA..PIRA" */
- 0x14,0x1A,0x5F,0x43,0x52,0x53,0x00,0x7B, /* 00000290 ".._CRS.{" */
- 0x50,0x49,0x52,0x42,0x0A,0x0F,0x60,0x79, /* 00000298 "PIRB..`y" */
- 0x01,0x60,0x49,0x52,0x51,0x56,0xA4,0x42, /* 000002A0 ".`IRQV.B" */
- 0x55,0x46,0x42,0x14,0x1B,0x5F,0x53,0x52, /* 000002A8 "UFB.._SR" */
- 0x53,0x01,0x8B,0x68,0x01,0x49,0x52,0x51, /* 000002B0 "S..h.IRQ" */
- 0x31,0x82,0x49,0x52,0x51,0x31,0x60,0x76, /* 000002B8 "1.IRQ1`v" */
- 0x60,0x70,0x60,0x50,0x49,0x52,0x41,0x5B, /* 000002C0 "`p`PIRA[" */
- 0x82,0x49,0x08,0x4C,0x4E,0x4B,0x42,0x08, /* 000002C8 ".I.LNKB." */
- 0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x0C, /* 000002D0 "_HID.A.." */
- 0x0F,0x08,0x5F,0x55,0x49,0x44,0x0A,0x02, /* 000002D8 ".._UID.." */
- 0x14,0x1C,0x5F,0x53,0x54,0x41,0x00,0x7B, /* 000002E0 ".._STA.{" */
- 0x50,0x49,0x52,0x42,0x0A,0x80,0x60,0xA0, /* 000002E8 "PIRB..`." */
- 0x08,0x93,0x60,0x0A,0x80,0xA4,0x0A,0x09, /* 000002F0 "..`....." */
- 0xA1,0x04,0xA4,0x0A,0x0B,0x14,0x0B,0x5F, /* 000002F8 "......._" */
- 0x50,0x52,0x53,0x00,0xA4,0x42,0x55,0x46, /* 00000300 "PRS..BUF" */
- 0x41,0x14,0x11,0x5F,0x44,0x49,0x53,0x00, /* 00000308 "A.._DIS." */
- 0x7D,0x50,0x49,0x52,0x42,0x0A,0x80,0x50, /* 00000310 "}PIRB..P" */
- 0x49,0x52,0x42,0x14,0x1A,0x5F,0x43,0x52, /* 00000318 "IRB.._CR" */
- 0x53,0x00,0x7B,0x50,0x49,0x52,0x42,0x0A, /* 00000320 "S.{PIRB." */
- 0x0F,0x60,0x79,0x01,0x60,0x49,0x52,0x51, /* 00000328 ".`y.`IRQ" */
- 0x56,0xA4,0x42,0x55,0x46,0x42,0x14,0x1B, /* 00000330 "V.BUFB.." */
- 0x5F,0x53,0x52,0x53,0x01,0x8B,0x68,0x01, /* 00000338 "_SRS..h." */
- 0x49,0x52,0x51,0x31,0x82,0x49,0x52,0x51, /* 00000340 "IRQ1.IRQ" */
- 0x31,0x60,0x76,0x60,0x70,0x60,0x50,0x49, /* 00000348 "1`v`p`PI" */
- 0x52,0x42,0x5B,0x82,0x49,0x08,0x4C,0x4E, /* 00000350 "RB[.I.LN" */
- 0x4B,0x43,0x08,0x5F,0x48,0x49,0x44,0x0C, /* 00000358 "KC._HID." */
- 0x41,0xD0,0x0C,0x0F,0x08,0x5F,0x55,0x49, /* 00000360 "A...._UI" */
- 0x44,0x0A,0x03,0x14,0x1C,0x5F,0x53,0x54, /* 00000368 "D...._ST" */
- 0x41,0x00,0x7B,0x50,0x49,0x52,0x43,0x0A, /* 00000370 "A.{PIRC." */
- 0x80,0x60,0xA0,0x08,0x93,0x60,0x0A,0x80, /* 00000378 ".`...`.." */
- 0xA4,0x0A,0x09,0xA1,0x04,0xA4,0x0A,0x0B, /* 00000380 "........" */
- 0x14,0x0B,0x5F,0x50,0x52,0x53,0x00,0xA4, /* 00000388 ".._PRS.." */
- 0x42,0x55,0x46,0x41,0x14,0x11,0x5F,0x44, /* 00000390 "BUFA.._D" */
- 0x49,0x53,0x00,0x7D,0x50,0x49,0x52,0x43, /* 00000398 "IS.}PIRC" */
- 0x0A,0x80,0x50,0x49,0x52,0x43,0x14,0x1A, /* 000003A0 "..PIRC.." */
- 0x5F,0x43,0x52,0x53,0x00,0x7B,0x50,0x49, /* 000003A8 "_CRS.{PI" */
- 0x52,0x43,0x0A,0x0F,0x60,0x79,0x01,0x60, /* 000003B0 "RC..`y.`" */
- 0x49,0x52,0x51,0x56,0xA4,0x42,0x55,0x46, /* 000003B8 "IRQV.BUF" */
- 0x42,0x14,0x1B,0x5F,0x53,0x52,0x53,0x01, /* 000003C0 "B.._SRS." */
- 0x8B,0x68,0x01,0x49,0x52,0x51,0x31,0x82, /* 000003C8 ".h.IRQ1." */
- 0x49,0x52,0x51,0x31,0x60,0x76,0x60,0x70, /* 000003D0 "IRQ1`v`p" */
- 0x60,0x50,0x49,0x52,0x43,0x5B,0x82,0x49, /* 000003D8 "`PIRC[.I" */
- 0x08,0x4C,0x4E,0x4B,0x44,0x08,0x5F,0x48, /* 000003E0 ".LNKD._H" */
- 0x49,0x44,0x0C,0x41,0xD0,0x0C,0x0F,0x08, /* 000003E8 "ID.A...." */
- 0x5F,0x55,0x49,0x44,0x0A,0x04,0x14,0x1C, /* 000003F0 "_UID...." */
- 0x5F,0x53,0x54,0x41,0x00,0x7B,0x50,0x49, /* 000003F8 "_STA.{PI" */
- 0x52,0x44,0x0A,0x80,0x60,0xA0,0x08,0x93, /* 00000400 "RD..`..." */
- 0x60,0x0A,0x80,0xA4,0x0A,0x09,0xA1,0x04, /* 00000408 "`......." */
- 0xA4,0x0A,0x0B,0x14,0x0B,0x5F,0x50,0x52, /* 00000410 "....._PR" */
- 0x53,0x00,0xA4,0x42,0x55,0x46,0x41,0x14, /* 00000418 "S..BUFA." */
- 0x11,0x5F,0x44,0x49,0x53,0x00,0x7D,0x50, /* 00000420 "._DIS.}P" */
- 0x49,0x52,0x44,0x0A,0x80,0x50,0x49,0x52, /* 00000428 "IRD..PIR" */
- 0x44,0x14,0x1A,0x5F,0x43,0x52,0x53,0x00, /* 00000430 "D.._CRS." */
- 0x7B,0x50,0x49,0x52,0x44,0x0A,0x0F,0x60, /* 00000438 "{PIRD..`" */
- 0x79,0x01,0x60,0x49,0x52,0x51,0x56,0xA4, /* 00000440 "y.`IRQV." */
- 0x42,0x55,0x46,0x42,0x14,0x1B,0x5F,0x53, /* 00000448 "BUFB.._S" */
- 0x52,0x53,0x01,0x8B,0x68,0x01,0x49,0x52, /* 00000450 "RS..h.IR" */
- 0x51,0x31,0x82,0x49,0x52,0x51,0x31,0x60, /* 00000458 "Q1.IRQ1`" */
- 0x76,0x60,0x70,0x60,0x50,0x49,0x52,0x44, /* 00000460 "v`p`PIRD" */
- 0x14,0x16,0x5F,0x50,0x52,0x54,0x00,0xA0, /* 00000468 ".._PRT.." */
- 0x0A,0x50,0x49,0x43,0x44,0xA4,0x50,0x52, /* 00000470 ".PICD.PR" */
- 0x54,0x41,0xA4,0x50,0x52,0x54,0x50,0x08, /* 00000478 "TA.PRTP." */
- 0x50,0x52,0x54,0x50,0x12,0x4D,0x11,0x14, /* 00000480 "PRTP.M.." */
- 0x12,0x0B,0x04,0x0B,0xFF,0xFF,0x00,0x4C, /* 00000488 ".......L" */
- 0x4E,0x4B,0x41,0x00,0x12,0x0B,0x04,0x0B, /* 00000490 "NKA....." */
- 0xFF,0xFF,0x01,0x4C,0x4E,0x4B,0x42,0x00, /* 00000498 "...LNKB." */
- 0x12,0x0C,0x04,0x0B,0xFF,0xFF,0x0A,0x02, /* 000004A0 "........" */
- 0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0C,0x04, /* 000004A8 "LNKC...." */
- 0x0B,0xFF,0xFF,0x0A,0x03,0x4C,0x4E,0x4B, /* 000004B0 ".....LNK" */
- 0x44,0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF, /* 000004B8 "D......." */
- 0x01,0x00,0x00,0x4C,0x4E,0x4B,0x42,0x00, /* 000004C0 "...LNKB." */
- 0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x01,0x00, /* 000004C8 "........" */
- 0x01,0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0E, /* 000004D0 ".LNKC..." */
- 0x04,0x0C,0xFF,0xFF,0x01,0x00,0x0A,0x02, /* 000004D8 "........" */
- 0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0E,0x04, /* 000004E0 "LNKD...." */
- 0x0C,0xFF,0xFF,0x01,0x00,0x0A,0x03,0x4C, /* 000004E8 ".......L" */
- 0x4E,0x4B,0x41,0x00,0x12,0x0D,0x04,0x0C, /* 000004F0 "NKA....." */
- 0xFF,0xFF,0x02,0x00,0x00,0x4C,0x4E,0x4B, /* 000004F8 ".....LNK" */
- 0x43,0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF, /* 00000500 "C......." */
- 0x02,0x00,0x01,0x4C,0x4E,0x4B,0x44,0x00, /* 00000508 "...LNKD." */
- 0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x02,0x00, /* 00000510 "........" */
- 0x0A,0x02,0x4C,0x4E,0x4B,0x41,0x00,0x12, /* 00000518 "..LNKA.." */
- 0x0E,0x04,0x0C,0xFF,0xFF,0x02,0x00,0x0A, /* 00000520 "........" */
- 0x03,0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0D, /* 00000528 ".LNKB..." */
- 0x04,0x0C,0xFF,0xFF,0x03,0x00,0x00,0x4C, /* 00000530 ".......L" */
- 0x4E,0x4B,0x44,0x00,0x12,0x0D,0x04,0x0C, /* 00000538 "NKD....." */
- 0xFF,0xFF,0x03,0x00,0x01,0x4C,0x4E,0x4B, /* 00000540 ".....LNK" */
- 0x41,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF, /* 00000548 "A......." */
- 0x03,0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x42, /* 00000550 "....LNKB" */
- 0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x03, /* 00000558 "........" */
- 0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x43,0x00, /* 00000560 "...LNKC." */
- 0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x04,0x00, /* 00000568 "........" */
- 0x00,0x4C,0x4E,0x4B,0x41,0x00,0x12,0x0D, /* 00000570 ".LNKA..." */
- 0x04,0x0C,0xFF,0xFF,0x04,0x00,0x01,0x4C, /* 00000578 ".......L" */
- 0x4E,0x4B,0x42,0x00,0x12,0x0E,0x04,0x0C, /* 00000580 "NKB....." */
- 0xFF,0xFF,0x04,0x00,0x0A,0x02,0x4C,0x4E, /* 00000588 "......LN" */
- 0x4B,0x43,0x00,0x12,0x0E,0x04,0x0C,0xFF, /* 00000590 "KC......" */
- 0xFF,0x04,0x00,0x0A,0x03,0x4C,0x4E,0x4B, /* 00000598 ".....LNK" */
- 0x44,0x00,0x08,0x50,0x52,0x54,0x41,0x12, /* 000005A0 "D..PRTA." */
- 0x32,0x04,0x12,0x0B,0x04,0x0C,0xFF,0xFF, /* 000005A8 "2......." */
- 0x01,0x00,0x00,0x00,0x0A,0x05,0x12,0x0B, /* 000005B0 "........" */
- 0x04,0x0C,0xFF,0xFF,0x02,0x00,0x00,0x00, /* 000005B8 "........" */
- 0x0A,0x07,0x12,0x0B,0x04,0x0C,0xFF,0xFF, /* 000005C0 "........" */
- 0x03,0x00,0x00,0x00,0x0A,0x0A,0x12,0x0B, /* 000005C8 "........" */
- 0x04,0x0C,0xFF,0xFF,0x04,0x00,0x00,0x00, /* 000005D0 "........" */
- 0x0A,0x0B,0x5B,0x82,0x48,0x31,0x49,0x53, /* 000005D8 "..[.H1IS" */
- 0x41,0x5F,0x08,0x5F,0x41,0x44,0x52,0x00, /* 000005E0 "A_._ADR." */
- 0x5B,0x80,0x50,0x49,0x52,0x51,0x02,0x0A, /* 000005E8 "[.PIRQ.." */
- 0x60,0x0A,0x04,0x10,0x2E,0x5C,0x00,0x5B, /* 000005F0 "`....\.[" */
- 0x81,0x29,0x5C,0x2F,0x04,0x5F,0x53,0x42, /* 000005F8 ".)\/._SB" */
- 0x5F,0x50,0x43,0x49,0x30,0x49,0x53,0x41, /* 00000600 "_PCI0ISA" */
- 0x5F,0x50,0x49,0x52,0x51,0x01,0x50,0x49, /* 00000608 "_PIRQ.PI" */
- 0x52,0x41,0x08,0x50,0x49,0x52,0x42,0x08, /* 00000610 "RA.PIRB." */
- 0x50,0x49,0x52,0x43,0x08,0x50,0x49,0x52, /* 00000618 "PIRC.PIR" */
- 0x44,0x08,0x5B,0x82,0x46,0x0B,0x53,0x59, /* 00000620 "D.[.F.SY" */
- 0x53,0x52,0x08,0x5F,0x48,0x49,0x44,0x0C, /* 00000628 "SR._HID." */
- 0x41,0xD0,0x0C,0x02,0x08,0x5F,0x55,0x49, /* 00000630 "A...._UI" */
- 0x44,0x01,0x08,0x43,0x52,0x53,0x5F,0x11, /* 00000638 "D..CRS_." */
- 0x4E,0x08,0x0A,0x8A,0x47,0x01,0x10,0x00, /* 00000640 "N...G..." */
- 0x10,0x00,0x00,0x10,0x47,0x01,0x22,0x00, /* 00000648 "....G."." */
- 0x22,0x00,0x00,0x0C,0x47,0x01,0x30,0x00, /* 00000650 ""...G.0." */
- 0x30,0x00,0x00,0x10,0x47,0x01,0x44,0x00, /* 00000658 "0...G.D." */
- 0x44,0x00,0x00,0x1C,0x47,0x01,0x62,0x00, /* 00000660 "D...G.b." */
- 0x62,0x00,0x00,0x02,0x47,0x01,0x65,0x00, /* 00000668 "b...G.e." */
- 0x65,0x00,0x00,0x0B,0x47,0x01,0x72,0x00, /* 00000670 "e...G.r." */
- 0x72,0x00,0x00,0x0E,0x47,0x01,0x80,0x00, /* 00000678 "r...G..." */
- 0x80,0x00,0x00,0x01,0x47,0x01,0x84,0x00, /* 00000680 "....G..." */
- 0x84,0x00,0x00,0x03,0x47,0x01,0x88,0x00, /* 00000688 "....G..." */
- 0x88,0x00,0x00,0x01,0x47,0x01,0x8C,0x00, /* 00000690 "....G..." */
- 0x8C,0x00,0x00,0x03,0x47,0x01,0x90,0x00, /* 00000698 "....G..." */
- 0x90,0x00,0x00,0x10,0x47,0x01,0xA2,0x00, /* 000006A0 "....G..." */
- 0xA2,0x00,0x00,0x1C,0x47,0x01,0xE0,0x00, /* 000006A8 "....G..." */
- 0xE0,0x00,0x00,0x10,0x47,0x01,0xA0,0x08, /* 000006B0 "....G..." */
- 0xA0,0x08,0x00,0x04,0x47,0x01,0xC0,0x0C, /* 000006B8 "....G..." */
- 0xC0,0x0C,0x00,0x10,0x47,0x01,0xD0,0x04, /* 000006C0 "....G..." */
- 0xD0,0x04,0x00,0x02,0x79,0x00,0x14,0x0B, /* 000006C8 "....y..." */
- 0x5F,0x43,0x52,0x53,0x00,0xA4,0x43,0x52, /* 000006D0 "_CRS..CR" */
- 0x53,0x5F,0x5B,0x82,0x2B,0x50,0x49,0x43, /* 000006D8 "S_[.+PIC" */
- 0x5F,0x08,0x5F,0x48,0x49,0x44,0x0B,0x41, /* 000006E0 "_._HID.A" */
- 0xD0,0x08,0x5F,0x43,0x52,0x53,0x11,0x18, /* 000006E8 ".._CRS.." */
- 0x0A,0x15,0x47,0x01,0x20,0x00,0x20,0x00, /* 000006F0 "..G. . ." */
- 0x01,0x02,0x47,0x01,0xA0,0x00,0xA0,0x00, /* 000006F8 "..G....." */
- 0x01,0x02,0x22,0x04,0x00,0x79,0x00,0x5B, /* 00000700 ".."..y.[" */
- 0x82,0x47,0x05,0x44,0x4D,0x41,0x30,0x08, /* 00000708 ".G.DMA0." */
- 0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x02, /* 00000710 "_HID.A.." */
- 0x00,0x08,0x5F,0x43,0x52,0x53,0x11,0x41, /* 00000718 ".._CRS.A" */
- 0x04,0x0A,0x3D,0x2A,0x10,0x04,0x47,0x01, /* 00000720 "..=*..G." */
- 0x00,0x00,0x00,0x00,0x00,0x10,0x47,0x01, /* 00000728 "......G." */
- 0x81,0x00,0x81,0x00,0x00,0x03,0x47,0x01, /* 00000730 "......G." */
- 0x87,0x00,0x87,0x00,0x00,0x01,0x47,0x01, /* 00000738 "......G." */
- 0x89,0x00,0x89,0x00,0x00,0x03,0x47,0x01, /* 00000740 "......G." */
- 0x8F,0x00,0x8F,0x00,0x00,0x01,0x47,0x01, /* 00000748 "......G." */
- 0xC0,0x00,0xC0,0x00,0x00,0x20,0x47,0x01, /* 00000750 "..... G." */
- 0x80,0x04,0x80,0x04,0x00,0x10,0x79,0x00, /* 00000758 "......y." */
- 0x5B,0x82,0x25,0x54,0x4D,0x52,0x5F,0x08, /* 00000760 "[.%TMR_." */
- 0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x01, /* 00000768 "_HID.A.." */
- 0x00,0x08,0x5F,0x43,0x52,0x53,0x11,0x10, /* 00000770 ".._CRS.." */
- 0x0A,0x0D,0x47,0x01,0x40,0x00,0x40,0x00, /* 00000778 "..G.@.@." */
- 0x00,0x04,0x22,0x01,0x00,0x79,0x00,0x5B, /* 00000780 ".."..y.[" */
- 0x82,0x25,0x52,0x54,0x43,0x5F,0x08,0x5F, /* 00000788 ".%RTC_._" */
- 0x48,0x49,0x44,0x0C,0x41,0xD0,0x0B,0x00, /* 00000790 "HID.A..." */
- 0x08,0x5F,0x43,0x52,0x53,0x11,0x10,0x0A, /* 00000798 "._CRS..." */
- 0x0D,0x47,0x01,0x70,0x00,0x70,0x00,0x00, /* 000007A0 ".G.p.p.." */
- 0x02,0x22,0x00,0x01,0x79,0x00,0x5B,0x82, /* 000007A8 "."..y.[." */
- 0x22,0x53,0x50,0x4B,0x52,0x08,0x5F,0x48, /* 000007B0 ""SPKR._H" */
- 0x49,0x44,0x0C,0x41,0xD0,0x08,0x00,0x08, /* 000007B8 "ID.A...." */
- 0x5F,0x43,0x52,0x53,0x11,0x0D,0x0A,0x0A, /* 000007C0 "_CRS...." */
- 0x47,0x01,0x61,0x00,0x61,0x00,0x00,0x01, /* 000007C8 "G.a.a..." */
- 0x79,0x00,0x5B,0x82,0x31,0x50,0x53,0x32, /* 000007D0 "y.[.1PS2" */
- 0x4D,0x08,0x5F,0x48,0x49,0x44,0x0C,0x41, /* 000007D8 "M._HID.A" */
- 0xD0,0x0F,0x13,0x08,0x5F,0x43,0x49,0x44, /* 000007E0 "...._CID" */
- 0x0C,0x41,0xD0,0x0F,0x13,0x14,0x09,0x5F, /* 000007E8 ".A....._" */
- 0x53,0x54,0x41,0x00,0xA4,0x0A,0x0F,0x08, /* 000007F0 "STA....." */
- 0x5F,0x43,0x52,0x53,0x11,0x08,0x0A,0x05, /* 000007F8 "_CRS...." */
- 0x22,0x00,0x10,0x79,0x00,0x5B,0x82,0x42, /* 00000800 ""..y.[.B" */
- 0x04,0x50,0x53,0x32,0x4B,0x08,0x5F,0x48, /* 00000808 ".PS2K._H" */
- 0x49,0x44,0x0C,0x41,0xD0,0x03,0x03,0x08, /* 00000810 "ID.A...." */
- 0x5F,0x43,0x49,0x44,0x0C,0x41,0xD0,0x03, /* 00000818 "_CID.A.." */
- 0x0B,0x14,0x09,0x5F,0x53,0x54,0x41,0x00, /* 00000820 "..._STA." */
- 0xA4,0x0A,0x0F,0x08,0x5F,0x43,0x52,0x53, /* 00000828 "...._CRS" */
- 0x11,0x18,0x0A,0x15,0x47,0x01,0x60,0x00, /* 00000830 "....G.`." */
- 0x60,0x00,0x00,0x01,0x47,0x01,0x64,0x00, /* 00000838 "`...G.d." */
- 0x64,0x00,0x00,0x01,0x22,0x02,0x00,0x79, /* 00000840 "d..."..y" */
- 0x00,0x5B,0x82,0x3A,0x46,0x44,0x43,0x30, /* 00000848 ".[.:FDC0" */
- 0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0, /* 00000850 "._HID.A." */
- 0x07,0x00,0x14,0x09,0x5F,0x53,0x54,0x41, /* 00000858 "...._STA" */
- 0x00,0xA4,0x0A,0x0F,0x08,0x5F,0x43,0x52, /* 00000860 "....._CR" */
- 0x53,0x11,0x1B,0x0A,0x18,0x47,0x01,0xF0, /* 00000868 "S....G.." */
- 0x03,0xF0,0x03,0x01,0x06,0x47,0x01,0xF7, /* 00000870 ".....G.." */
- 0x03,0xF7,0x03,0x01,0x01,0x22,0x40,0x00, /* 00000878 "....."@." */
- 0x2A,0x04,0x00,0x79,0x00,0x5B,0x82,0x35, /* 00000880 "*..y.[.5" */
- 0x55,0x41,0x52,0x31,0x08,0x5F,0x48,0x49, /* 00000888 "UAR1._HI" */
- 0x44,0x0C,0x41,0xD0,0x05,0x01,0x08,0x5F, /* 00000890 "D.A...._" */
- 0x55,0x49,0x44,0x01,0x14,0x09,0x5F,0x53, /* 00000898 "UID..._S" */
- 0x54,0x41,0x00,0xA4,0x0A,0x0F,0x08,0x5F, /* 000008A0 "TA....._" */
- 0x43,0x52,0x53,0x11,0x10,0x0A,0x0D,0x47, /* 000008A8 "CRS....G" */
- 0x01,0xF8,0x03,0xF8,0x03,0x01,0x08,0x22, /* 000008B0 "......."" */
- 0x10,0x00,0x79,0x00,0x5B,0x82,0x36,0x4C, /* 000008B8 "..y.[.6L" */
- 0x54,0x50,0x31,0x08,0x5F,0x48,0x49,0x44, /* 000008C0 "TP1._HID" */
- 0x0C,0x41,0xD0,0x04,0x00,0x08,0x5F,0x55, /* 000008C8 ".A...._U" */
- 0x49,0x44,0x0A,0x02,0x14,0x09,0x5F,0x53, /* 000008D0 "ID...._S" */
- 0x54,0x41,0x00,0xA4,0x0A,0x0F,0x08,0x5F, /* 000008D8 "TA....._" */
- 0x43,0x52,0x53,0x11,0x10,0x0A,0x0D,0x47, /* 000008E0 "CRS....G" */
- 0x01,0x78,0x03,0x78,0x03,0x08,0x08,0x22, /* 000008E8 ".x.x..."" */
- 0x80,0x00,0x79,0x00,
+ 0x4E,0x00,0x14,0x44,0x08,0x5F,0x43,0x52, /* 00000128 "N..D._CR" */
+ 0x53,0x00,0x08,0x50,0x52,0x54,0x30,0x11, /* 00000130 "S..PRT0." */
+ 0x42,0x07,0x0A,0x6E,0x88,0x0D,0x00,0x02, /* 00000138 "B..n...." */
+ 0x0F,0x00,0x00,0x00,0x00,0x00,0xFF,0x00, /* 00000140 "........" */
+ 0x00,0x00,0x00,0x01,0x47,0x01,0xF8,0x0C, /* 00000148 "....G..." */
+ 0xF8,0x0C,0x01,0x08,0x88,0x0D,0x00,0x01, /* 00000150 "........" */
+ 0x0C,0x03,0x00,0x00,0x00,0x00,0xF7,0x0C, /* 00000158 "........" */
+ 0x00,0x00,0xF8,0x0C,0x88,0x0D,0x00,0x01, /* 00000160 "........" */
+ 0x0C,0x03,0x00,0x00,0x00,0x0D,0xFF,0xFF, /* 00000168 "........" */
+ 0x00,0x00,0x00,0xF3,0x87,0x17,0x00,0x00, /* 00000170 "........" */
+ 0x0C,0x03,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000178 "........" */
+ 0x0A,0x00,0xFF,0xFF,0x0B,0x00,0x00,0x00, /* 00000180 "........" */
+ 0x00,0x00,0x00,0x00,0x02,0x00,0x87,0x17, /* 00000188 "........" */
+ 0x00,0x00,0x0D,0x03,0x00,0x00,0x00,0x00, /* 00000190 "........" */
+ 0x00,0x00,0x00,0xF0,0xFF,0xFF,0xFF,0xF4, /* 00000198 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05, /* 000001A0 "........" */
+ 0x79,0x00,0xA4,0x50,0x52,0x54,0x30,0x08, /* 000001A8 "y..PRT0." */
+ 0x42,0x55,0x46,0x41,0x11,0x09,0x0A,0x06, /* 000001B0 "BUFA...." */
+ 0x23,0x60,0x0C,0x18,0x79,0x00,0x08,0x42, /* 000001B8 "#`..y..B" */
+ 0x55,0x46,0x42,0x11,0x09,0x0A,0x06,0x23, /* 000001C0 "UFB....#" */
+ 0x00,0x00,0x18,0x79,0x00,0x8B,0x42,0x55, /* 000001C8 "...y..BU" */
+ 0x46,0x42,0x01,0x49,0x52,0x51,0x56,0x5B, /* 000001D0 "FB.IRQV[" */
+ 0x82,0x48,0x08,0x4C,0x4E,0x4B,0x41,0x08, /* 000001D8 ".H.LNKA." */
+ 0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x0C, /* 000001E0 "_HID.A.." */
+ 0x0F,0x08,0x5F,0x55,0x49,0x44,0x01,0x14, /* 000001E8 ".._UID.." */
+ 0x1C,0x5F,0x53,0x54,0x41,0x00,0x7B,0x50, /* 000001F0 "._STA.{P" */
+ 0x49,0x52,0x41,0x0A,0x80,0x60,0xA0,0x08, /* 000001F8 "IRA..`.." */
+ 0x93,0x60,0x0A,0x80,0xA4,0x0A,0x09,0xA1, /* 00000200 ".`......" */
+ 0x04,0xA4,0x0A,0x0B,0x14,0x0B,0x5F,0x50, /* 00000208 "......_P" */
+ 0x52,0x53,0x00,0xA4,0x42,0x55,0x46,0x41, /* 00000210 "RS..BUFA" */
+ 0x14,0x11,0x5F,0x44,0x49,0x53,0x00,0x7D, /* 00000218 ".._DIS.}" */
+ 0x50,0x49,0x52,0x41,0x0A,0x80,0x50,0x49, /* 00000220 "PIRA..PI" */
+ 0x52,0x41,0x14,0x1A,0x5F,0x43,0x52,0x53, /* 00000228 "RA.._CRS" */
+ 0x00,0x7B,0x50,0x49,0x52,0x41,0x0A,0x0F, /* 00000230 ".{PIRA.." */
+ 0x60,0x79,0x01,0x60,0x49,0x52,0x51,0x56, /* 00000238 "`y.`IRQV" */
+ 0xA4,0x42,0x55,0x46,0x42,0x14,0x1B,0x5F, /* 00000240 ".BUFB.._" */
+ 0x53,0x52,0x53,0x01,0x8B,0x68,0x01,0x49, /* 00000248 "SRS..h.I" */
+ 0x52,0x51,0x31,0x82,0x49,0x52,0x51,0x31, /* 00000250 "RQ1.IRQ1" */
+ 0x60,0x76,0x60,0x70,0x60,0x50,0x49,0x52, /* 00000258 "`v`p`PIR" */
+ 0x41,0x5B,0x82,0x49,0x08,0x4C,0x4E,0x4B, /* 00000260 "A[.I.LNK" */
+ 0x42,0x08,0x5F,0x48,0x49,0x44,0x0C,0x41, /* 00000268 "B._HID.A" */
+ 0xD0,0x0C,0x0F,0x08,0x5F,0x55,0x49,0x44, /* 00000270 "...._UID" */
+ 0x0A,0x02,0x14,0x1C,0x5F,0x53,0x54,0x41, /* 00000278 "...._STA" */
+ 0x00,0x7B,0x50,0x49,0x52,0x42,0x0A,0x80, /* 00000280 ".{PIRB.." */
+ 0x60,0xA0,0x08,0x93,0x60,0x0A,0x80,0xA4, /* 00000288 "`...`..." */
+ 0x0A,0x09,0xA1,0x04,0xA4,0x0A,0x0B,0x14, /* 00000290 "........" */
+ 0x0B,0x5F,0x50,0x52,0x53,0x00,0xA4,0x42, /* 00000298 "._PRS..B" */
+ 0x55,0x46,0x41,0x14,0x11,0x5F,0x44,0x49, /* 000002A0 "UFA.._DI" */
+ 0x53,0x00,0x7D,0x50,0x49,0x52,0x42,0x0A, /* 000002A8 "S.}PIRB." */
+ 0x80,0x50,0x49,0x52,0x42,0x14,0x1A,0x5F, /* 000002B0 ".PIRB.._" */
+ 0x43,0x52,0x53,0x00,0x7B,0x50,0x49,0x52, /* 000002B8 "CRS.{PIR" */
+ 0x42,0x0A,0x0F,0x60,0x79,0x01,0x60,0x49, /* 000002C0 "B..`y.`I" */
+ 0x52,0x51,0x56,0xA4,0x42,0x55,0x46,0x42, /* 000002C8 "RQV.BUFB" */
+ 0x14,0x1B,0x5F,0x53,0x52,0x53,0x01,0x8B, /* 000002D0 ".._SRS.." */
+ 0x68,0x01,0x49,0x52,0x51,0x31,0x82,0x49, /* 000002D8 "h.IRQ1.I" */
+ 0x52,0x51,0x31,0x60,0x76,0x60,0x70,0x60, /* 000002E0 "RQ1`v`p`" */
+ 0x50,0x49,0x52,0x42,0x5B,0x82,0x49,0x08, /* 000002E8 "PIRB[.I." */
+ 0x4C,0x4E,0x4B,0x43,0x08,0x5F,0x48,0x49, /* 000002F0 "LNKC._HI" */
+ 0x44,0x0C,0x41,0xD0,0x0C,0x0F,0x08,0x5F, /* 000002F8 "D.A...._" */
+ 0x55,0x49,0x44,0x0A,0x03,0x14,0x1C,0x5F, /* 00000300 "UID...._" */
+ 0x53,0x54,0x41,0x00,0x7B,0x50,0x49,0x52, /* 00000308 "STA.{PIR" */
+ 0x43,0x0A,0x80,0x60,0xA0,0x08,0x93,0x60, /* 00000310 "C..`...`" */
+ 0x0A,0x80,0xA4,0x0A,0x09,0xA1,0x04,0xA4, /* 00000318 "........" */
+ 0x0A,0x0B,0x14,0x0B,0x5F,0x50,0x52,0x53, /* 00000320 "...._PRS" */
+ 0x00,0xA4,0x42,0x55,0x46,0x41,0x14,0x11, /* 00000328 "..BUFA.." */
+ 0x5F,0x44,0x49,0x53,0x00,0x7D,0x50,0x49, /* 00000330 "_DIS.}PI" */
+ 0x52,0x43,0x0A,0x80,0x50,0x49,0x52,0x43, /* 00000338 "RC..PIRC" */
+ 0x14,0x1A,0x5F,0x43,0x52,0x53,0x00,0x7B, /* 00000340 ".._CRS.{" */
+ 0x50,0x49,0x52,0x43,0x0A,0x0F,0x60,0x79, /* 00000348 "PIRC..`y" */
+ 0x01,0x60,0x49,0x52,0x51,0x56,0xA4,0x42, /* 00000350 ".`IRQV.B" */
+ 0x55,0x46,0x42,0x14,0x1B,0x5F,0x53,0x52, /* 00000358 "UFB.._SR" */
+ 0x53,0x01,0x8B,0x68,0x01,0x49,0x52,0x51, /* 00000360 "S..h.IRQ" */
+ 0x31,0x82,0x49,0x52,0x51,0x31,0x60,0x76, /* 00000368 "1.IRQ1`v" */
+ 0x60,0x70,0x60,0x50,0x49,0x52,0x43,0x5B, /* 00000370 "`p`PIRC[" */
+ 0x82,0x49,0x08,0x4C,0x4E,0x4B,0x44,0x08, /* 00000378 ".I.LNKD." */
+ 0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x0C, /* 00000380 "_HID.A.." */
+ 0x0F,0x08,0x5F,0x55,0x49,0x44,0x0A,0x04, /* 00000388 ".._UID.." */
+ 0x14,0x1C,0x5F,0x53,0x54,0x41,0x00,0x7B, /* 00000390 ".._STA.{" */
+ 0x50,0x49,0x52,0x44,0x0A,0x80,0x60,0xA0, /* 00000398 "PIRD..`." */
+ 0x08,0x93,0x60,0x0A,0x80,0xA4,0x0A,0x09, /* 000003A0 "..`....." */
+ 0xA1,0x04,0xA4,0x0A,0x0B,0x14,0x0B,0x5F, /* 000003A8 "......._" */
+ 0x50,0x52,0x53,0x00,0xA4,0x42,0x55,0x46, /* 000003B0 "PRS..BUF" */
+ 0x41,0x14,0x11,0x5F,0x44,0x49,0x53,0x00, /* 000003B8 "A.._DIS." */
+ 0x7D,0x50,0x49,0x52,0x44,0x0A,0x80,0x50, /* 000003C0 "}PIRD..P" */
+ 0x49,0x52,0x44,0x14,0x1A,0x5F,0x43,0x52, /* 000003C8 "IRD.._CR" */
+ 0x53,0x00,0x7B,0x50,0x49,0x52,0x44,0x0A, /* 000003D0 "S.{PIRD." */
+ 0x0F,0x60,0x79,0x01,0x60,0x49,0x52,0x51, /* 000003D8 ".`y.`IRQ" */
+ 0x56,0xA4,0x42,0x55,0x46,0x42,0x14,0x1B, /* 000003E0 "V.BUFB.." */
+ 0x5F,0x53,0x52,0x53,0x01,0x8B,0x68,0x01, /* 000003E8 "_SRS..h." */
+ 0x49,0x52,0x51,0x31,0x82,0x49,0x52,0x51, /* 000003F0 "IRQ1.IRQ" */
+ 0x31,0x60,0x76,0x60,0x70,0x60,0x50,0x49, /* 000003F8 "1`v`p`PI" */
+ 0x52,0x44,0x14,0x16,0x5F,0x50,0x52,0x54, /* 00000400 "RD.._PRT" */
+ 0x00,0xA0,0x0A,0x50,0x49,0x43,0x44,0xA4, /* 00000408 "...PICD." */
+ 0x50,0x52,0x54,0x41,0xA4,0x50,0x52,0x54, /* 00000410 "PRTA.PRT" */
+ 0x50,0x08,0x50,0x52,0x54,0x50,0x12,0x49, /* 00000418 "P.PRTP.I" */
+ 0x36,0x3C,0x12,0x0D,0x04,0x0C,0xFF,0xFF, /* 00000420 "6<......" */
+ 0x01,0x00,0x00,0x4C,0x4E,0x4B,0x42,0x00, /* 00000428 "...LNKB." */
+ 0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x01,0x00, /* 00000430 "........" */
+ 0x01,0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0E, /* 00000438 ".LNKC..." */
+ 0x04,0x0C,0xFF,0xFF,0x01,0x00,0x0A,0x02, /* 00000440 "........" */
+ 0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0E,0x04, /* 00000448 "LNKD...." */
+ 0x0C,0xFF,0xFF,0x01,0x00,0x0A,0x03,0x4C, /* 00000450 ".......L" */
+ 0x4E,0x4B,0x41,0x00,0x12,0x0D,0x04,0x0C, /* 00000458 "NKA....." */
+ 0xFF,0xFF,0x02,0x00,0x00,0x4C,0x4E,0x4B, /* 00000460 ".....LNK" */
+ 0x43,0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF, /* 00000468 "C......." */
+ 0x02,0x00,0x01,0x4C,0x4E,0x4B,0x44,0x00, /* 00000470 "...LNKD." */
+ 0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x02,0x00, /* 00000478 "........" */
+ 0x0A,0x02,0x4C,0x4E,0x4B,0x41,0x00,0x12, /* 00000480 "..LNKA.." */
+ 0x0E,0x04,0x0C,0xFF,0xFF,0x02,0x00,0x0A, /* 00000488 "........" */
+ 0x03,0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0D, /* 00000490 ".LNKB..." */
+ 0x04,0x0C,0xFF,0xFF,0x03,0x00,0x00,0x4C, /* 00000498 ".......L" */
+ 0x4E,0x4B,0x44,0x00,0x12,0x0D,0x04,0x0C, /* 000004A0 "NKD....." */
+ 0xFF,0xFF,0x03,0x00,0x01,0x4C,0x4E,0x4B, /* 000004A8 ".....LNK" */
+ 0x41,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF, /* 000004B0 "A......." */
+ 0x03,0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x42, /* 000004B8 "....LNKB" */
+ 0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x03, /* 000004C0 "........" */
+ 0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x43,0x00, /* 000004C8 "...LNKC." */
+ 0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x04,0x00, /* 000004D0 "........" */
+ 0x00,0x4C,0x4E,0x4B,0x41,0x00,0x12,0x0D, /* 000004D8 ".LNKA..." */
+ 0x04,0x0C,0xFF,0xFF,0x04,0x00,0x01,0x4C, /* 000004E0 ".......L" */
+ 0x4E,0x4B,0x42,0x00,0x12,0x0E,0x04,0x0C, /* 000004E8 "NKB....." */
+ 0xFF,0xFF,0x04,0x00,0x0A,0x02,0x4C,0x4E, /* 000004F0 "......LN" */
+ 0x4B,0x43,0x00,0x12,0x0E,0x04,0x0C,0xFF, /* 000004F8 "KC......" */
+ 0xFF,0x04,0x00,0x0A,0x03,0x4C,0x4E,0x4B, /* 00000500 ".....LNK" */
+ 0x44,0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF, /* 00000508 "D......." */
+ 0x05,0x00,0x00,0x4C,0x4E,0x4B,0x42,0x00, /* 00000510 "...LNKB." */
+ 0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x05,0x00, /* 00000518 "........" */
+ 0x01,0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0E, /* 00000520 ".LNKC..." */
+ 0x04,0x0C,0xFF,0xFF,0x05,0x00,0x0A,0x02, /* 00000528 "........" */
+ 0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0E,0x04, /* 00000530 "LNKD...." */
+ 0x0C,0xFF,0xFF,0x05,0x00,0x0A,0x03,0x4C, /* 00000538 ".......L" */
+ 0x4E,0x4B,0x41,0x00,0x12,0x0D,0x04,0x0C, /* 00000540 "NKA....." */
+ 0xFF,0xFF,0x06,0x00,0x00,0x4C,0x4E,0x4B, /* 00000548 ".....LNK" */
+ 0x43,0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF, /* 00000550 "C......." */
+ 0x06,0x00,0x01,0x4C,0x4E,0x4B,0x44,0x00, /* 00000558 "...LNKD." */
+ 0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x06,0x00, /* 00000560 "........" */
+ 0x0A,0x02,0x4C,0x4E,0x4B,0x41,0x00,0x12, /* 00000568 "..LNKA.." */
+ 0x0E,0x04,0x0C,0xFF,0xFF,0x06,0x00,0x0A, /* 00000570 "........" */
+ 0x03,0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0D, /* 00000578 ".LNKB..." */
+ 0x04,0x0C,0xFF,0xFF,0x07,0x00,0x00,0x4C, /* 00000580 ".......L" */
+ 0x4E,0x4B,0x44,0x00,0x12,0x0D,0x04,0x0C, /* 00000588 "NKD....." */
+ 0xFF,0xFF,0x07,0x00,0x01,0x4C,0x4E,0x4B, /* 00000590 ".....LNK" */
+ 0x41,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF, /* 00000598 "A......." */
+ 0x07,0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x42, /* 000005A0 "....LNKB" */
+ 0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x07, /* 000005A8 "........" */
+ 0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x43,0x00, /* 000005B0 "...LNKC." */
+ 0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x08,0x00, /* 000005B8 "........" */
+ 0x00,0x4C,0x4E,0x4B,0x41,0x00,0x12,0x0D, /* 000005C0 ".LNKA..." */
+ 0x04,0x0C,0xFF,0xFF,0x08,0x00,0x01,0x4C, /* 000005C8 ".......L" */
+ 0x4E,0x4B,0x42,0x00,0x12,0x0E,0x04,0x0C, /* 000005D0 "NKB....." */
+ 0xFF,0xFF,0x08,0x00,0x0A,0x02,0x4C,0x4E, /* 000005D8 "......LN" */
+ 0x4B,0x43,0x00,0x12,0x0E,0x04,0x0C,0xFF, /* 000005E0 "KC......" */
+ 0xFF,0x08,0x00,0x0A,0x03,0x4C,0x4E,0x4B, /* 000005E8 ".....LNK" */
+ 0x44,0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF, /* 000005F0 "D......." */
+ 0x09,0x00,0x00,0x4C,0x4E,0x4B,0x42,0x00, /* 000005F8 "...LNKB." */
+ 0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x09,0x00, /* 00000600 "........" */
+ 0x01,0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0E, /* 00000608 ".LNKC..." */
+ 0x04,0x0C,0xFF,0xFF,0x09,0x00,0x0A,0x02, /* 00000610 "........" */
+ 0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0E,0x04, /* 00000618 "LNKD...." */
+ 0x0C,0xFF,0xFF,0x09,0x00,0x0A,0x03,0x4C, /* 00000620 ".......L" */
+ 0x4E,0x4B,0x41,0x00,0x12,0x0D,0x04,0x0C, /* 00000628 "NKA....." */
+ 0xFF,0xFF,0x0A,0x00,0x00,0x4C,0x4E,0x4B, /* 00000630 ".....LNK" */
+ 0x43,0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF, /* 00000638 "C......." */
+ 0x0A,0x00,0x01,0x4C,0x4E,0x4B,0x44,0x00, /* 00000640 "...LNKD." */
+ 0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x0A,0x00, /* 00000648 "........" */
+ 0x0A,0x02,0x4C,0x4E,0x4B,0x41,0x00,0x12, /* 00000650 "..LNKA.." */
+ 0x0E,0x04,0x0C,0xFF,0xFF,0x0A,0x00,0x0A, /* 00000658 "........" */
+ 0x03,0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0D, /* 00000660 ".LNKB..." */
+ 0x04,0x0C,0xFF,0xFF,0x0B,0x00,0x00,0x4C, /* 00000668 ".......L" */
+ 0x4E,0x4B,0x44,0x00,0x12,0x0D,0x04,0x0C, /* 00000670 "NKD....." */
+ 0xFF,0xFF,0x0B,0x00,0x01,0x4C,0x4E,0x4B, /* 00000678 ".....LNK" */
+ 0x41,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF, /* 00000680 "A......." */
+ 0x0B,0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x42, /* 00000688 "....LNKB" */
+ 0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x0B, /* 00000690 "........" */
+ 0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x43,0x00, /* 00000698 "...LNKC." */
+ 0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x0C,0x00, /* 000006A0 "........" */
+ 0x00,0x4C,0x4E,0x4B,0x41,0x00,0x12,0x0D, /* 000006A8 ".LNKA..." */
+ 0x04,0x0C,0xFF,0xFF,0x0C,0x00,0x01,0x4C, /* 000006B0 ".......L" */
+ 0x4E,0x4B,0x42,0x00,0x12,0x0E,0x04,0x0C, /* 000006B8 "NKB....." */
+ 0xFF,0xFF,0x0C,0x00,0x0A,0x02,0x4C,0x4E, /* 000006C0 "......LN" */
+ 0x4B,0x43,0x00,0x12,0x0E,0x04,0x0C,0xFF, /* 000006C8 "KC......" */
+ 0xFF,0x0C,0x00,0x0A,0x03,0x4C,0x4E,0x4B, /* 000006D0 ".....LNK" */
+ 0x44,0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF, /* 000006D8 "D......." */
+ 0x0D,0x00,0x00,0x4C,0x4E,0x4B,0x42,0x00, /* 000006E0 "...LNKB." */
+ 0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x0D,0x00, /* 000006E8 "........" */
+ 0x01,0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0E, /* 000006F0 ".LNKC..." */
+ 0x04,0x0C,0xFF,0xFF,0x0D,0x00,0x0A,0x02, /* 000006F8 "........" */
+ 0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0E,0x04, /* 00000700 "LNKD...." */
+ 0x0C,0xFF,0xFF,0x0D,0x00,0x0A,0x03,0x4C, /* 00000708 ".......L" */
+ 0x4E,0x4B,0x41,0x00,0x12,0x0D,0x04,0x0C, /* 00000710 "NKA....." */
+ 0xFF,0xFF,0x0E,0x00,0x00,0x4C,0x4E,0x4B, /* 00000718 ".....LNK" */
+ 0x43,0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF, /* 00000720 "C......." */
+ 0x0E,0x00,0x01,0x4C,0x4E,0x4B,0x44,0x00, /* 00000728 "...LNKD." */
+ 0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x0E,0x00, /* 00000730 "........" */
+ 0x0A,0x02,0x4C,0x4E,0x4B,0x41,0x00,0x12, /* 00000738 "..LNKA.." */
+ 0x0E,0x04,0x0C,0xFF,0xFF,0x0E,0x00,0x0A, /* 00000740 "........" */
+ 0x03,0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0D, /* 00000748 ".LNKB..." */
+ 0x04,0x0C,0xFF,0xFF,0x0F,0x00,0x00,0x4C, /* 00000750 ".......L" */
+ 0x4E,0x4B,0x44,0x00,0x12,0x0D,0x04,0x0C, /* 00000758 "NKD....." */
+ 0xFF,0xFF,0x0F,0x00,0x01,0x4C,0x4E,0x4B, /* 00000760 ".....LNK" */
+ 0x41,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF, /* 00000768 "A......." */
+ 0x0F,0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x42, /* 00000770 "....LNKB" */
+ 0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x0F, /* 00000778 "........" */
+ 0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x43,0x00, /* 00000780 "...LNKC." */
+ 0x08,0x50,0x52,0x54,0x41,0x12,0x41,0x2F, /* 00000788 ".PRTA.A/" */
+ 0x3C,0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x01, /* 00000790 "<......." */
+ 0x00,0x00,0x00,0x0A,0x14,0x12,0x0B,0x04, /* 00000798 "........" */
+ 0x0C,0xFF,0xFF,0x01,0x00,0x01,0x00,0x0A, /* 000007A0 "........" */
+ 0x15,0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x01, /* 000007A8 "........" */
+ 0x00,0x0A,0x02,0x00,0x0A,0x16,0x12,0x0C, /* 000007B0 "........" */
+ 0x04,0x0C,0xFF,0xFF,0x01,0x00,0x0A,0x03, /* 000007B8 "........" */
+ 0x00,0x0A,0x17,0x12,0x0B,0x04,0x0C,0xFF, /* 000007C0 "........" */
+ 0xFF,0x02,0x00,0x00,0x00,0x0A,0x18,0x12, /* 000007C8 "........" */
+ 0x0B,0x04,0x0C,0xFF,0xFF,0x02,0x00,0x01, /* 000007D0 "........" */
+ 0x00,0x0A,0x19,0x12,0x0C,0x04,0x0C,0xFF, /* 000007D8 "........" */
+ 0xFF,0x02,0x00,0x0A,0x02,0x00,0x0A,0x1A, /* 000007E0 "........" */
+ 0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x02,0x00, /* 000007E8 "........" */
+ 0x0A,0x03,0x00,0x0A,0x1B,0x12,0x0B,0x04, /* 000007F0 "........" */
+ 0x0C,0xFF,0xFF,0x03,0x00,0x00,0x00,0x0A, /* 000007F8 "........" */
+ 0x1C,0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x03, /* 00000800 "........" */
+ 0x00,0x01,0x00,0x0A,0x1D,0x12,0x0C,0x04, /* 00000808 "........" */
+ 0x0C,0xFF,0xFF,0x03,0x00,0x0A,0x02,0x00, /* 00000810 "........" */
+ 0x0A,0x1E,0x12,0x0C,0x04,0x0C,0xFF,0xFF, /* 00000818 "........" */
+ 0x03,0x00,0x0A,0x03,0x00,0x0A,0x1F,0x12, /* 00000820 "........" */
+ 0x0B,0x04,0x0C,0xFF,0xFF,0x04,0x00,0x00, /* 00000828 "........" */
+ 0x00,0x0A,0x20,0x12,0x0B,0x04,0x0C,0xFF, /* 00000830 ".. ....." */
+ 0xFF,0x04,0x00,0x01,0x00,0x0A,0x21,0x12, /* 00000838 "......!." */
+ 0x0C,0x04,0x0C,0xFF,0xFF,0x04,0x00,0x0A, /* 00000840 "........" */
+ 0x02,0x00,0x0A,0x22,0x12,0x0C,0x04,0x0C, /* 00000848 "..."...." */
+ 0xFF,0xFF,0x04,0x00,0x0A,0x03,0x00,0x0A, /* 00000850 "........" */
+ 0x23,0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x05, /* 00000858 "#......." */
+ 0x00,0x00,0x00,0x0A,0x24,0x12,0x0B,0x04, /* 00000860 "....$..." */
+ 0x0C,0xFF,0xFF,0x05,0x00,0x01,0x00,0x0A, /* 00000868 "........" */
+ 0x25,0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x05, /* 00000870 "%......." */
+ 0x00,0x0A,0x02,0x00,0x0A,0x26,0x12,0x0C, /* 00000878 ".....&.." */
+ 0x04,0x0C,0xFF,0xFF,0x05,0x00,0x0A,0x03, /* 00000880 "........" */
+ 0x00,0x0A,0x27,0x12,0x0B,0x04,0x0C,0xFF, /* 00000888 "..'....." */
+ 0xFF,0x06,0x00,0x00,0x00,0x0A,0x28,0x12, /* 00000890 "......(." */
+ 0x0B,0x04,0x0C,0xFF,0xFF,0x06,0x00,0x01, /* 00000898 "........" */
+ 0x00,0x0A,0x29,0x12,0x0C,0x04,0x0C,0xFF, /* 000008A0 "..)....." */
+ 0xFF,0x06,0x00,0x0A,0x02,0x00,0x0A,0x2A, /* 000008A8 ".......*" */
+ 0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x06,0x00, /* 000008B0 "........" */
+ 0x0A,0x03,0x00,0x0A,0x2B,0x12,0x0B,0x04, /* 000008B8 "....+..." */
+ 0x0C,0xFF,0xFF,0x07,0x00,0x00,0x00,0x0A, /* 000008C0 "........" */
+ 0x2C,0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x07, /* 000008C8 ",......." */
+ 0x00,0x01,0x00,0x0A,0x2D,0x12,0x0C,0x04, /* 000008D0 "....-..." */
+ 0x0C,0xFF,0xFF,0x07,0x00,0x0A,0x02,0x00, /* 000008D8 "........" */
+ 0x0A,0x2E,0x12,0x0C,0x04,0x0C,0xFF,0xFF, /* 000008E0 "........" */
+ 0x07,0x00,0x0A,0x03,0x00,0x0A,0x2F,0x12, /* 000008E8 "....../." */
+ 0x0B,0x04,0x0C,0xFF,0xFF,0x08,0x00,0x00, /* 000008F0 "........" */
+ 0x00,0x0A,0x11,0x12,0x0B,0x04,0x0C,0xFF, /* 000008F8 "........" */
+ 0xFF,0x08,0x00,0x01,0x00,0x0A,0x12,0x12, /* 00000900 "........" */
+ 0x0C,0x04,0x0C,0xFF,0xFF,0x08,0x00,0x0A, /* 00000908 "........" */
+ 0x02,0x00,0x0A,0x13,0x12,0x0C,0x04,0x0C, /* 00000910 "........" */
+ 0xFF,0xFF,0x08,0x00,0x0A,0x03,0x00,0x0A, /* 00000918 "........" */
+ 0x14,0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x09, /* 00000920 "........" */
+ 0x00,0x00,0x00,0x0A,0x15,0x12,0x0B,0x04, /* 00000928 "........" */
+ 0x0C,0xFF,0xFF,0x09,0x00,0x01,0x00,0x0A, /* 00000930 "........" */
+ 0x16,0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x09, /* 00000938 "........" */
+ 0x00,0x0A,0x02,0x00,0x0A,0x17,0x12,0x0C, /* 00000940 "........" */
+ 0x04,0x0C,0xFF,0xFF,0x09,0x00,0x0A,0x03, /* 00000948 "........" */
+ 0x00,0x0A,0x18,0x12,0x0B,0x04,0x0C,0xFF, /* 00000950 "........" */
+ 0xFF,0x0A,0x00,0x00,0x00,0x0A,0x19,0x12, /* 00000958 "........" */
+ 0x0B,0x04,0x0C,0xFF,0xFF,0x0A,0x00,0x01, /* 00000960 "........" */
+ 0x00,0x0A,0x1A,0x12,0x0C,0x04,0x0C,0xFF, /* 00000968 "........" */
+ 0xFF,0x0A,0x00,0x0A,0x02,0x00,0x0A,0x1B, /* 00000970 "........" */
+ 0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x0A,0x00, /* 00000978 "........" */
+ 0x0A,0x03,0x00,0x0A,0x1C,0x12,0x0B,0x04, /* 00000980 "........" */
+ 0x0C,0xFF,0xFF,0x0B,0x00,0x00,0x00,0x0A, /* 00000988 "........" */
+ 0x1D,0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x0B, /* 00000990 "........" */
+ 0x00,0x01,0x00,0x0A,0x1E,0x12,0x0C,0x04, /* 00000998 "........" */
+ 0x0C,0xFF,0xFF,0x0B,0x00,0x0A,0x02,0x00, /* 000009A0 "........" */
+ 0x0A,0x1F,0x12,0x0C,0x04,0x0C,0xFF,0xFF, /* 000009A8 "........" */
+ 0x0B,0x00,0x0A,0x03,0x00,0x0A,0x20,0x12, /* 000009B0 "...... ." */
+ 0x0B,0x04,0x0C,0xFF,0xFF,0x0C,0x00,0x00, /* 000009B8 "........" */
+ 0x00,0x0A,0x21,0x12,0x0B,0x04,0x0C,0xFF, /* 000009C0 "..!....." */
+ 0xFF,0x0C,0x00,0x01,0x00,0x0A,0x22,0x12, /* 000009C8 "......"." */
+ 0x0C,0x04,0x0C,0xFF,0xFF,0x0C,0x00,0x0A, /* 000009D0 "........" */
+ 0x02,0x00,0x0A,0x23,0x12,0x0C,0x04,0x0C, /* 000009D8 "...#...." */
+ 0xFF,0xFF,0x0C,0x00,0x0A,0x03,0x00,0x0A, /* 000009E0 "........" */
+ 0x24,0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x0D, /* 000009E8 "$......." */
+ 0x00,0x00,0x00,0x0A,0x25,0x12,0x0B,0x04, /* 000009F0 "....%..." */
+ 0x0C,0xFF,0xFF,0x0D,0x00,0x01,0x00,0x0A, /* 000009F8 "........" */
+ 0x26,0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x0D, /* 00000A00 "&......." */
+ 0x00,0x0A,0x02,0x00,0x0A,0x27,0x12,0x0C, /* 00000A08 ".....'.." */
+ 0x04,0x0C,0xFF,0xFF,0x0D,0x00,0x0A,0x03, /* 00000A10 "........" */
+ 0x00,0x0A,0x28,0x12,0x0B,0x04,0x0C,0xFF, /* 00000A18 "..(....." */
+ 0xFF,0x0E,0x00,0x00,0x00,0x0A,0x29,0x12, /* 00000A20 "......)." */
+ 0x0B,0x04,0x0C,0xFF,0xFF,0x0E,0x00,0x01, /* 00000A28 "........" */
+ 0x00,0x0A,0x2A,0x12,0x0C,0x04,0x0C,0xFF, /* 00000A30 "..*....." */
+ 0xFF,0x0E,0x00,0x0A,0x02,0x00,0x0A,0x2B, /* 00000A38 ".......+" */
+ 0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x0E,0x00, /* 00000A40 "........" */
+ 0x0A,0x03,0x00,0x0A,0x2C,0x12,0x0B,0x04, /* 00000A48 "....,..." */
+ 0x0C,0xFF,0xFF,0x0F,0x00,0x00,0x00,0x0A, /* 00000A50 "........" */
+ 0x2D,0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x0F, /* 00000A58 "-......." */
+ 0x00,0x01,0x00,0x0A,0x2E,0x12,0x0C,0x04, /* 00000A60 "........" */
+ 0x0C,0xFF,0xFF,0x0F,0x00,0x0A,0x02,0x00, /* 00000A68 "........" */
+ 0x0A,0x2F,0x12,0x0C,0x04,0x0C,0xFF,0xFF, /* 00000A70 "./......" */
+ 0x0F,0x00,0x0A,0x03,0x00,0x0A,0x10,0x5B, /* 00000A78 ".......[" */
+ 0x82,0x4C,0x31,0x49,0x53,0x41,0x5F,0x08, /* 00000A80 ".L1ISA_." */
+ 0x5F,0x41,0x44,0x52,0x0C,0x00,0x00,0x01, /* 00000A88 "_ADR...." */
+ 0x00,0x5B,0x80,0x50,0x49,0x52,0x51,0x02, /* 00000A90 ".[.PIRQ." */
+ 0x0A,0x60,0x0A,0x04,0x10,0x2E,0x5C,0x00, /* 00000A98 ".`....\." */
+ 0x5B,0x81,0x29,0x5C,0x2F,0x04,0x5F,0x53, /* 00000AA0 "[.)\/._S" */
+ 0x42,0x5F,0x50,0x43,0x49,0x30,0x49,0x53, /* 00000AA8 "B_PCI0IS" */
+ 0x41,0x5F,0x50,0x49,0x52,0x51,0x01,0x50, /* 00000AB0 "A_PIRQ.P" */
+ 0x49,0x52,0x41,0x08,0x50,0x49,0x52,0x42, /* 00000AB8 "IRA.PIRB" */
+ 0x08,0x50,0x49,0x52,0x43,0x08,0x50,0x49, /* 00000AC0 ".PIRC.PI" */
+ 0x52,0x44,0x08,0x5B,0x82,0x46,0x0B,0x53, /* 00000AC8 "RD.[.F.S" */
+ 0x59,0x53,0x52,0x08,0x5F,0x48,0x49,0x44, /* 00000AD0 "YSR._HID" */
+ 0x0C,0x41,0xD0,0x0C,0x02,0x08,0x5F,0x55, /* 00000AD8 ".A...._U" */
+ 0x49,0x44,0x01,0x08,0x43,0x52,0x53,0x5F, /* 00000AE0 "ID..CRS_" */
+ 0x11,0x4E,0x08,0x0A,0x8A,0x47,0x01,0x10, /* 00000AE8 ".N...G.." */
+ 0x00,0x10,0x00,0x00,0x10,0x47,0x01,0x22, /* 00000AF0 ".....G."" */
+ 0x00,0x22,0x00,0x00,0x0C,0x47,0x01,0x30, /* 00000AF8 "."...G.0" */
+ 0x00,0x30,0x00,0x00,0x10,0x47,0x01,0x44, /* 00000B00 ".0...G.D" */
+ 0x00,0x44,0x00,0x00,0x1C,0x47,0x01,0x62, /* 00000B08 ".D...G.b" */
+ 0x00,0x62,0x00,0x00,0x02,0x47,0x01,0x65, /* 00000B10 ".b...G.e" */
+ 0x00,0x65,0x00,0x00,0x0B,0x47,0x01,0x72, /* 00000B18 ".e...G.r" */
+ 0x00,0x72,0x00,0x00,0x0E,0x47,0x01,0x80, /* 00000B20 ".r...G.." */
+ 0x00,0x80,0x00,0x00,0x01,0x47,0x01,0x84, /* 00000B28 ".....G.." */
+ 0x00,0x84,0x00,0x00,0x03,0x47,0x01,0x88, /* 00000B30 ".....G.." */
+ 0x00,0x88,0x00,0x00,0x01,0x47,0x01,0x8C, /* 00000B38 ".....G.." */
+ 0x00,0x8C,0x00,0x00,0x03,0x47,0x01,0x90, /* 00000B40 ".....G.." */
+ 0x00,0x90,0x00,0x00,0x10,0x47,0x01,0xA2, /* 00000B48 ".....G.." */
+ 0x00,0xA2,0x00,0x00,0x1C,0x47,0x01,0xE0, /* 00000B50 ".....G.." */
+ 0x00,0xE0,0x00,0x00,0x10,0x47,0x01,0xA0, /* 00000B58 ".....G.." */
+ 0x08,0xA0,0x08,0x00,0x04,0x47,0x01,0xC0, /* 00000B60 ".....G.." */
+ 0x0C,0xC0,0x0C,0x00,0x10,0x47,0x01,0xD0, /* 00000B68 ".....G.." */
+ 0x04,0xD0,0x04,0x00,0x02,0x79,0x00,0x14, /* 00000B70 ".....y.." */
+ 0x0B,0x5F,0x43,0x52,0x53,0x00,0xA4,0x43, /* 00000B78 "._CRS..C" */
+ 0x52,0x53,0x5F,0x5B,0x82,0x2B,0x50,0x49, /* 00000B80 "RS_[.+PI" */
+ 0x43,0x5F,0x08,0x5F,0x48,0x49,0x44,0x0B, /* 00000B88 "C_._HID." */
+ 0x41,0xD0,0x08,0x5F,0x43,0x52,0x53,0x11, /* 00000B90 "A.._CRS." */
+ 0x18,0x0A,0x15,0x47,0x01,0x20,0x00,0x20, /* 00000B98 "...G. . " */
+ 0x00,0x01,0x02,0x47,0x01,0xA0,0x00,0xA0, /* 00000BA0 "...G...." */
+ 0x00,0x01,0x02,0x22,0x04,0x00,0x79,0x00, /* 00000BA8 "..."..y." */
+ 0x5B,0x82,0x47,0x05,0x44,0x4D,0x41,0x30, /* 00000BB0 "[.G.DMA0" */
+ 0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0, /* 00000BB8 "._HID.A." */
+ 0x02,0x00,0x08,0x5F,0x43,0x52,0x53,0x11, /* 00000BC0 "..._CRS." */
+ 0x41,0x04,0x0A,0x3D,0x2A,0x10,0x04,0x47, /* 00000BC8 "A..=*..G" */
+ 0x01,0x00,0x00,0x00,0x00,0x00,0x10,0x47, /* 00000BD0 ".......G" */
+ 0x01,0x81,0x00,0x81,0x00,0x00,0x03,0x47, /* 00000BD8 ".......G" */
+ 0x01,0x87,0x00,0x87,0x00,0x00,0x01,0x47, /* 00000BE0 ".......G" */
+ 0x01,0x89,0x00,0x89,0x00,0x00,0x03,0x47, /* 00000BE8 ".......G" */
+ 0x01,0x8F,0x00,0x8F,0x00,0x00,0x01,0x47, /* 00000BF0 ".......G" */
+ 0x01,0xC0,0x00,0xC0,0x00,0x00,0x20,0x47, /* 00000BF8 "...... G" */
+ 0x01,0x80,0x04,0x80,0x04,0x00,0x10,0x79, /* 00000C00 ".......y" */
+ 0x00,0x5B,0x82,0x25,0x54,0x4D,0x52,0x5F, /* 00000C08 ".[.%TMR_" */
+ 0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0, /* 00000C10 "._HID.A." */
+ 0x01,0x00,0x08,0x5F,0x43,0x52,0x53,0x11, /* 00000C18 "..._CRS." */
+ 0x10,0x0A,0x0D,0x47,0x01,0x40,0x00,0x40, /* 00000C20 "...G.@.@" */
+ 0x00,0x00,0x04,0x22,0x01,0x00,0x79,0x00, /* 00000C28 "..."..y." */
+ 0x5B,0x82,0x25,0x52,0x54,0x43,0x5F,0x08, /* 00000C30 "[.%RTC_." */
+ 0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x0B, /* 00000C38 "_HID.A.." */
+ 0x00,0x08,0x5F,0x43,0x52,0x53,0x11,0x10, /* 00000C40 ".._CRS.." */
+ 0x0A,0x0D,0x47,0x01,0x70,0x00,0x70,0x00, /* 00000C48 "..G.p.p." */
+ 0x00,0x02,0x22,0x00,0x01,0x79,0x00,0x5B, /* 00000C50 ".."..y.[" */
+ 0x82,0x22,0x53,0x50,0x4B,0x52,0x08,0x5F, /* 00000C58 "."SPKR._" */
+ 0x48,0x49,0x44,0x0C,0x41,0xD0,0x08,0x00, /* 00000C60 "HID.A..." */
+ 0x08,0x5F,0x43,0x52,0x53,0x11,0x0D,0x0A, /* 00000C68 "._CRS..." */
+ 0x0A,0x47,0x01,0x61,0x00,0x61,0x00,0x00, /* 00000C70 ".G.a.a.." */
+ 0x01,0x79,0x00,0x5B,0x82,0x31,0x50,0x53, /* 00000C78 ".y.[.1PS" */
+ 0x32,0x4D,0x08,0x5F,0x48,0x49,0x44,0x0C, /* 00000C80 "2M._HID." */
+ 0x41,0xD0,0x0F,0x13,0x08,0x5F,0x43,0x49, /* 00000C88 "A...._CI" */
+ 0x44,0x0C,0x41,0xD0,0x0F,0x13,0x14,0x09, /* 00000C90 "D.A....." */
+ 0x5F,0x53,0x54,0x41,0x00,0xA4,0x0A,0x0F, /* 00000C98 "_STA...." */
+ 0x08,0x5F,0x43,0x52,0x53,0x11,0x08,0x0A, /* 00000CA0 "._CRS..." */
+ 0x05,0x22,0x00,0x10,0x79,0x00,0x5B,0x82, /* 00000CA8 "."..y.[." */
+ 0x42,0x04,0x50,0x53,0x32,0x4B,0x08,0x5F, /* 00000CB0 "B.PS2K._" */
+ 0x48,0x49,0x44,0x0C,0x41,0xD0,0x03,0x03, /* 00000CB8 "HID.A..." */
+ 0x08,0x5F,0x43,0x49,0x44,0x0C,0x41,0xD0, /* 00000CC0 "._CID.A." */
+ 0x03,0x0B,0x14,0x09,0x5F,0x53,0x54,0x41, /* 00000CC8 "...._STA" */
+ 0x00,0xA4,0x0A,0x0F,0x08,0x5F,0x43,0x52, /* 00000CD0 "....._CR" */
+ 0x53,0x11,0x18,0x0A,0x15,0x47,0x01,0x60, /* 00000CD8 "S....G.`" */
+ 0x00,0x60,0x00,0x00,0x01,0x47,0x01,0x64, /* 00000CE0 ".`...G.d" */
+ 0x00,0x64,0x00,0x00,0x01,0x22,0x02,0x00, /* 00000CE8 ".d...".." */
+ 0x79,0x00,0x5B,0x82,0x3A,0x46,0x44,0x43, /* 00000CF0 "y.[.:FDC" */
+ 0x30,0x08,0x5F,0x48,0x49,0x44,0x0C,0x41, /* 00000CF8 "0._HID.A" */
+ 0xD0,0x07,0x00,0x14,0x09,0x5F,0x53,0x54, /* 00000D00 "....._ST" */
+ 0x41,0x00,0xA4,0x0A,0x0F,0x08,0x5F,0x43, /* 00000D08 "A....._C" */
+ 0x52,0x53,0x11,0x1B,0x0A,0x18,0x47,0x01, /* 00000D10 "RS....G." */
+ 0xF0,0x03,0xF0,0x03,0x01,0x06,0x47,0x01, /* 00000D18 "......G." */
+ 0xF7,0x03,0xF7,0x03,0x01,0x01,0x22,0x40, /* 00000D20 "......"@" */
+ 0x00,0x2A,0x04,0x00,0x79,0x00,0x5B,0x82, /* 00000D28 ".*..y.[." */
+ 0x35,0x55,0x41,0x52,0x31,0x08,0x5F,0x48, /* 00000D30 "5UAR1._H" */
+ 0x49,0x44,0x0C,0x41,0xD0,0x05,0x01,0x08, /* 00000D38 "ID.A...." */
+ 0x5F,0x55,0x49,0x44,0x01,0x14,0x09,0x5F, /* 00000D40 "_UID..._" */
+ 0x53,0x54,0x41,0x00,0xA4,0x0A,0x0F,0x08, /* 00000D48 "STA....." */
+ 0x5F,0x43,0x52,0x53,0x11,0x10,0x0A,0x0D, /* 00000D50 "_CRS...." */
+ 0x47,0x01,0xF8,0x03,0xF8,0x03,0x01,0x08, /* 00000D58 "G......." */
+ 0x22,0x10,0x00,0x79,0x00,0x5B,0x82,0x36, /* 00000D60 ""..y.[.6" */
+ 0x4C,0x54,0x50,0x31,0x08,0x5F,0x48,0x49, /* 00000D68 "LTP1._HI" */
+ 0x44,0x0C,0x41,0xD0,0x04,0x00,0x08,0x5F, /* 00000D70 "D.A...._" */
+ 0x55,0x49,0x44,0x0A,0x02,0x14,0x09,0x5F, /* 00000D78 "UID...._" */
+ 0x53,0x54,0x41,0x00,0xA4,0x0A,0x0F,0x08, /* 00000D80 "STA....." */
+ 0x5F,0x43,0x52,0x53,0x11,0x10,0x0A,0x0D, /* 00000D88 "_CRS...." */
+ 0x47,0x01,0x78,0x03,0x78,0x03,0x08,0x08, /* 00000D90 "G.x.x..." */
+ 0x22,0x80,0x00,0x79,0x00,
};
int DsdtLen=sizeof(AmlCode);
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4
tools/firmware/hvmloader/acpi/static_tables.c
--- a/tools/firmware/hvmloader/acpi/static_tables.c Mon Nov 27 10:10:57
2006 -0700
+++ b/tools/firmware/hvmloader/acpi/static_tables.c Tue Nov 28 10:37:36
2006 -0700
@@ -17,47 +17,8 @@
*/
#include "acpi2_0.h"
+#include "../config.h"
#include <xen/hvm/ioreq.h>
-
-/*
- * Multiple APIC Description Table (MADT).
- */
-
-struct acpi_20_madt Madt = {
- .header = {
- .header = {
- .signature = ACPI_2_0_MADT_SIGNATURE,
- .length = sizeof(struct acpi_20_madt),
- .revision = ACPI_2_0_MADT_REVISION,
- .oem_id = ACPI_OEM_ID,
- .oem_table_id = ACPI_OEM_TABLE_ID,
- .oem_revision = ACPI_OEM_REVISION,
- .creator_id = ACPI_CREATOR_ID,
- .creator_revision = ACPI_CREATOR_REVISION
- },
- .lapic_addr = 0xFEE00000,
- .flags = ACPI_PCAT_COMPAT
- },
-
- /* IO APIC */
- .io_apic = {
- [0] = {
- .type = ACPI_IO_APIC,
- .length = sizeof(struct acpi_20_madt_ioapic),
- .ioapic_addr = 0xFEC00000
- }
- },
-
- /* Local APIC entries for up to 32 processors. */
- .lapic = {
- [0] = {
- .type = ACPI_PROCESSOR_LOCAL_APIC,
- .length = sizeof(struct acpi_20_madt_lapic),
- .flags = 0x00000001
- }
- }
-};
-
/*
* Firmware ACPI Control Structure (FACS).
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/firmware/hvmloader/acpi_utils.c
--- a/tools/firmware/hvmloader/acpi_utils.c Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/firmware/hvmloader/acpi_utils.c Tue Nov 28 10:37:36 2006 -0700
@@ -78,14 +78,15 @@ static void acpi_tpm_tis_probe(unsigned
sizeof(tis_did_vid_rid)) != 0 )
return;
- puts("TIS is available\n");
+ printf("TIS is available\n");
addr = acpi_xsdt_add_entry(acpi_start, freemem, limit,
AmlCode_TPM, sizeof(AmlCode_TPM));
if ( addr == NULL )
return;
/* legacy systems need an RSDT entry */
- acpi_rsdt_add_entry_pointer(acpi_start, addr);
+ if ( acpi_rsdt_add_entry_pointer(acpi_start, addr) != 1 )
+ return;
/* add ACPI TCPA table */
addr = acpi_xsdt_add_entry(acpi_start, freemem, limit,
@@ -108,7 +109,8 @@ static void acpi_tpm_tis_probe(unsigned
tcpa->header.length);
}
- acpi_rsdt_add_entry_pointer(acpi_start, addr);
+ if ( acpi_rsdt_add_entry_pointer(acpi_start, addr) != 1 )
+ return;
}
@@ -125,23 +127,57 @@ void acpi_update(unsigned char *acpi_sta
}
+/*
+ * Search for the RSDP in memory below the BIOS
+ */
+struct acpi_20_rsdp *acpi_rsdp_get(unsigned char *acpi_start)
+{
+ int offset = 0;
+ int found = 0;
+ static int displayed = 0;
+ struct acpi_20_rsdp *rsdp;
+
+ while ( &acpi_start[offset] < (unsigned char *)0xf0000 )
+ {
+ rsdp = (struct acpi_20_rsdp *)&acpi_start[offset];
+ if ( rsdp->signature == ACPI_2_0_RSDP_SIGNATURE )
+ {
+ found = 1;
+ break;
+ }
+ offset += 0x10;
+ }
+
+ if ( !found )
+ rsdp = NULL;
+
+ if ( !displayed )
+ {
+ if ( rsdp )
+ printf("Found RSDP at %lx\n",(long)rsdp);
+ else
+ printf("ERROR: RSDP was not found\n");
+ displayed = 1;
+ }
+
+ return rsdp;
+}
+
+
struct acpi_20_rsdt *acpi_rsdt_get(unsigned char *acpi_start)
{
struct acpi_20_rsdp *rsdp;
struct acpi_20_rsdt *rsdt;
- rsdp = (struct acpi_20_rsdp *)(acpi_start + sizeof(struct acpi_20_facs));
- if ( rsdp->signature != ACPI_2_0_RSDP_SIGNATURE )
- {
- puts("Bad RSDP signature\n");
- return NULL;
- }
+ rsdp = acpi_rsdp_get(acpi_start);
+ if (!rsdp)
+ return NULL;
rsdt = (struct acpi_20_rsdt *)
(acpi_start + rsdp->rsdt_address - ACPI_PHYSICAL_ADDRESS);
if ( rsdt->header.signature != ACPI_2_0_RSDT_SIGNATURE )
{
- puts("Bad RSDT signature\n");
+ printf("Bad RSDT signature\n");
return NULL;
}
@@ -189,18 +225,15 @@ struct acpi_20_xsdt *acpi_xsdt_get(unsig
struct acpi_20_rsdp *rsdp;
struct acpi_20_xsdt *xsdt;
- rsdp = (struct acpi_20_rsdp *)(acpi_start + sizeof(struct acpi_20_facs));
- if ( rsdp->signature != ACPI_2_0_RSDP_SIGNATURE )
- {
- puts("Bad RSDP signature\n");
- return NULL;
- }
+ rsdp = acpi_rsdp_get(acpi_start);
+ if (!rsdp)
+ return NULL;
xsdt = (struct acpi_20_xsdt *)
(acpi_start + rsdp->xsdt_address - ACPI_PHYSICAL_ADDRESS);
if ( xsdt->header.signature != ACPI_2_0_XSDT_SIGNATURE )
{
- puts("Bad XSDT signature\n");
+ printf("Bad XSDT signature\n");
return NULL;
}
return xsdt;
@@ -270,11 +303,12 @@ static unsigned char *acpi_xsdt_add_entr
if ( found )
{
/* memory below hard limit ? */
- if (*freemem + table_size <= limit) {
- puts("Copying SSDT entry!\n");
+ if ( (*freemem + table_size) <= limit )
+ {
addr = *freemem;
memcpy(addr, table, table_size);
- *freemem += table_size;
+ printf("Copied dyn. ACPI entry to %lx\n",(long)addr);
+ *freemem += ((table_size + 0xf) & ~0xf);
acpi_xsdt_add_entry_pointer(acpi_start, addr);
}
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/firmware/hvmloader/hvmloader.c
--- a/tools/firmware/hvmloader/hvmloader.c Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/firmware/hvmloader/hvmloader.c Tue Nov 28 10:37:36 2006 -0700
@@ -1,12 +1,10 @@
/*
* hvmloader.c: HVM ROMBIOS/VGABIOS/ACPI/VMXAssist image loader.
*
- * A quicky so that we can boot rom images as if they were a Linux kernel.
- * This code will copy the rom images (ROMBIOS/VGABIOS/VM86) into their
- * respective spaces and transfer control to VM86 to execute the BIOSes.
- *
* Leendert van Doorn, leendert@xxxxxxxxxxxxxx
* Copyright (c) 2005, International Business Machines Corporation.
+ *
+ * Copyright (c) 2006, Keir Fraser, XenSource Inc.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -27,202 +25,336 @@
#include "util.h"
#include "acpi_utils.h"
#include "smbios.h"
+#include "config.h"
+#include "apic_regs.h"
+#include "pci_regs.h"
#include <xen/version.h>
#include <xen/hvm/params.h>
+#include <xen/hvm/e820.h>
/* memory map */
-#define HYPERCALL_PHYSICAL_ADDRESS 0x00080000
-#define VGABIOS_PHYSICAL_ADDRESS 0x000C0000
-#define VMXASSIST_PHYSICAL_ADDRESS 0x000D0000
-#define ROMBIOS_PHYSICAL_ADDRESS 0x000F0000
+#define HYPERCALL_PHYSICAL_ADDRESS 0x00080000
+#define VGABIOS_PHYSICAL_ADDRESS 0x000C0000
+#define VMXASSIST_PHYSICAL_ADDRESS 0x000D0000
+#define ROMBIOS_PHYSICAL_ADDRESS 0x000F0000
/* invoke SVM's paged realmode support */
-#define SVM_VMMCALL_RESET_TO_REALMODE 0x80000001
+#define SVM_VMMCALL_RESET_TO_REALMODE 0x80000001
/*
* C runtime start off
*/
asm(
-" .text \n"
-" .globl _start \n"
-"_start: \n"
-" cld \n"
-" cli \n"
-" lgdt gdt_desr \n"
-" movl $stack_top, %esp \n"
-" movl %esp, %ebp \n"
-" call main \n"
-" jmp halt \n"
-" \n"
-"gdt_desr: \n"
-" .word gdt_end - gdt - 1 \n"
-" .long gdt \n"
-" \n"
-" .align 8 \n"
-"gdt: \n"
-" .quad 0x0000000000000000 \n"
-" .quad 0x00CF92000000FFFF \n"
-" .quad 0x00CF9A000000FFFF \n"
-"gdt_end: \n"
-" \n"
-"halt: \n"
-" sti \n"
-" jmp . \n"
-" \n"
-" .bss \n"
-" .align 8 \n"
-"stack: \n"
-" .skip 0x4000 \n"
-"stack_top: \n"
-);
-
-extern int get_acpi_enabled(void);
-extern int acpi_madt_update(unsigned char* acpi_start);
+ " .text \n"
+ " .globl _start \n"
+ "_start: \n"
+ " cld \n"
+ " cli \n"
+ " lgdt gdt_desr \n"
+ " movl $stack_top, %esp \n"
+ " movl %esp, %ebp \n"
+ " call main \n"
+ " ud2 \n"
+ " \n"
+ "gdt_desr: \n"
+ " .word gdt_end - gdt - 1 \n"
+ " .long gdt \n"
+ " \n"
+ " .align 8 \n"
+ "gdt: \n"
+ " .quad 0x0000000000000000 \n"
+ " .quad 0x00CF92000000FFFF \n"
+ " .quad 0x00CF9A000000FFFF \n"
+ "gdt_end: \n"
+ " \n"
+ " .bss \n"
+ " .align 8 \n"
+ "stack: \n"
+ " .skip 0x4000 \n"
+ "stack_top: \n"
+ );
+
extern void create_mp_tables(void);
-struct hvm_info_table *get_hvm_info_table(void);
static int
cirrus_check(void)
{
- outw(0x3C4, 0x9206);
- return inb(0x3C5) == 0x12;
+ outw(0x3C4, 0x9206);
+ return inb(0x3C5) == 0x12;
}
static int
vmmcall(int function, int edi, int esi, int edx, int ecx, int ebx)
{
- int eax;
-
- __asm__ __volatile__(
- ".byte 0x0F,0x01,0xD9"
- : "=a" (eax)
- : "a"(function),
- "b"(ebx), "c"(ecx), "d"(edx), "D"(edi), "S"(esi)
- );
- return eax;
+ int eax;
+
+ __asm__ __volatile__ (
+ ".byte 0x0F,0x01,0xD9"
+ : "=a" (eax)
+ : "a"(function),
+ "b"(ebx), "c"(ecx), "d"(edx), "D"(edi), "S"(esi) );
+ return eax;
}
static int
check_amd(void)
{
- char id[12];
-
- __asm__ __volatile__(
- "cpuid"
- : "=b" (*(int *)(&id[0])),
- "=c" (*(int *)(&id[8])),
- "=d" (*(int *)(&id[4]))
- : "a" (0)
- );
- return __builtin_memcmp(id, "AuthenticAMD", 12) == 0;
+ char id[12];
+
+ __asm__ __volatile__ (
+ "cpuid"
+ : "=b" (*(int *)(&id[0])),
+ "=c" (*(int *)(&id[8])),
+ "=d" (*(int *)(&id[4]))
+ : "a" (0) );
+ return __builtin_memcmp(id, "AuthenticAMD", 12) == 0;
}
static void
wrmsr(uint32_t idx, uint64_t v)
{
- __asm__ __volatile__(
- "wrmsr"
- : : "c" (idx), "a" ((uint32_t)v), "d" ((uint32_t)(v>>32)) );
+ __asm__ __volatile__ (
+ "wrmsr"
+ : : "c" (idx), "a" ((uint32_t)v), "d" ((uint32_t)(v>>32)) );
}
static void
init_hypercalls(void)
{
- uint32_t eax, ebx, ecx, edx;
- unsigned long i;
- char signature[13], number[13];
- xen_extraversion_t extraversion;
-
- cpuid(0x40000000, &eax, &ebx, &ecx, &edx);
-
- *(uint32_t *)(signature + 0) = ebx;
- *(uint32_t *)(signature + 4) = ecx;
- *(uint32_t *)(signature + 8) = edx;
- signature[12] = '\0';
-
- if (strcmp("XenVMMXenVMM", signature) || (eax < 0x40000002)) {
- puts("FATAL: Xen hypervisor not detected\n");
- __asm__ __volatile__( "ud2" );
- }
-
- cpuid(0x40000001, &eax, &ebx, &ecx, &edx);
-
- puts("Detected Xen v");
- puts(itoa(number, eax >> 16));
- puts(".");
- puts(itoa(number, eax & 0xffff));
-
- cpuid(0x40000002, &eax, &ebx, &ecx, &edx);
-
- for (i = 0; i < eax; i++)
- wrmsr(ebx, HYPERCALL_PHYSICAL_ADDRESS + (i << 12) + i);
-
- hypercall_xen_version(XENVER_extraversion, extraversion);
- puts(extraversion);
- puts("\n");
-}
-
-int
-main(void)
-{
- puts("HVM Loader\n");
-
- init_hypercalls();
-
- puts("Writing SMBIOS tables ...\n");
- hvm_write_smbios_tables();
-
- puts("Loading ROMBIOS ...\n");
- memcpy((void *)ROMBIOS_PHYSICAL_ADDRESS, rombios, sizeof(rombios));
-
+ uint32_t eax, ebx, ecx, edx;
+ unsigned long i;
+ char signature[13];
+ xen_extraversion_t extraversion;
+
+ cpuid(0x40000000, &eax, &ebx, &ecx, &edx);
+
+ *(uint32_t *)(signature + 0) = ebx;
+ *(uint32_t *)(signature + 4) = ecx;
+ *(uint32_t *)(signature + 8) = edx;
+ signature[12] = '\0';
+
+ if ( strcmp("XenVMMXenVMM", signature) || (eax < 0x40000002) )
+ {
+ printf("FATAL: Xen hypervisor not detected\n");
+ __asm__ __volatile__( "ud2" );
+ }
+
+ /* Fill in hypercall transfer pages. */
+ cpuid(0x40000002, &eax, &ebx, &ecx, &edx);
+ for ( i = 0; i < eax; i++ )
+ wrmsr(ebx, HYPERCALL_PHYSICAL_ADDRESS + (i << 12) + i);
+
+ /* Print version information. */
+ cpuid(0x40000001, &eax, &ebx, &ecx, &edx);
+ hypercall_xen_version(XENVER_extraversion, extraversion);
+ printf("Detected Xen v%u.%u%s\n", eax >> 16, eax & 0xffff, extraversion);
+}
+
+static void apic_setup(void)
+{
+ /* Set the IOAPIC ID to tha static value used in the MP/ACPI tables. */
+ ioapic_write(0x00, IOAPIC_ID);
+
+ /* Set up Virtual Wire mode. */
+ lapic_write(APIC_SPIV, APIC_SPIV_APIC_ENABLED | 0xFF);
+ lapic_write(APIC_LVT0, APIC_MODE_EXTINT << 8);
+ lapic_write(APIC_LVT1, APIC_MODE_NMI << 8);
+}
+
+static void pci_setup(void)
+{
+ uint32_t devfn, bar_reg, bar_data, bar_sz, cmd;
+ uint32_t *base, io_base = 0xc000, mem_base = HVM_BELOW_4G_MMIO_START;
+ uint16_t class, vendor_id, device_id;
+ unsigned int bar, pin, link, isa_irq;
+
+ /* Program PCI-ISA bridge with appropriate link routes. */
+ link = 0;
+ for ( isa_irq = 0; isa_irq < 15; isa_irq++ )
+ {
+ if ( !(PCI_ISA_IRQ_MASK & (1U << isa_irq)) )
+ continue;
+ pci_writeb(PCI_ISA_DEVFN, 0x60 + link, isa_irq);
+ printf("PCI-ISA link %u routed to IRQ%u\n", link, isa_irq);
+ if ( link++ == 4 )
+ break;
+ }
+
+ /* Program ELCR to match PCI-wired IRQs. */
+ outb(0x4d0, (uint8_t)(PCI_ISA_IRQ_MASK >> 0));
+ outb(0x4d1, (uint8_t)(PCI_ISA_IRQ_MASK >> 8));
+
+ /* Scan the PCI bus and map resources. */
+ for ( devfn = 0; devfn < 128; devfn++ )
+ {
+ class = pci_readw(devfn, PCI_CLASS_DEVICE);
+ vendor_id = pci_readw(devfn, PCI_VENDOR_ID);
+ device_id = pci_readw(devfn, PCI_DEVICE_ID);
+ if ( (vendor_id == 0xffff) && (device_id == 0xffff) )
+ continue;
+
+ ASSERT((devfn != PCI_ISA_DEVFN) ||
+ ((vendor_id == 0x8086) && (device_id == 0x7000)));
+
+ switch ( class )
+ {
+ case 0x0680:
+ ASSERT((vendor_id == 0x8086) && (device_id == 0x7113));
+ /*
+ * PIIX4 ACPI PM. Special device with special PCI config space.
+ * No ordinary BARs.
+ */
+ pci_writew(devfn, 0x20, 0x0000); /* No smb bus IO enable */
+ pci_writew(devfn, 0x22, 0x0000);
+ pci_writew(devfn, 0x3c, 0x0009); /* Hardcoded IRQ9 */
+ pci_writew(devfn, 0x3d, 0x0001);
+ break;
+ case 0x0101:
+ /* PIIX3 IDE */
+ ASSERT((vendor_id == 0x8086) && (device_id == 0x7010));
+ pci_writew(devfn, 0x40, 0x8000); /* enable IDE0 */
+ pci_writew(devfn, 0x42, 0x8000); /* enable IDE1 */
+ /* fall through */
+ default:
+ /* Default memory mappings. */
+ for ( bar = 0; bar < 7; bar++ )
+ {
+ bar_reg = PCI_BASE_ADDRESS_0 + 4*bar;
+ if ( bar == 6 )
+ bar_reg = PCI_ROM_ADDRESS;
+
+ bar_data = pci_readl(devfn, bar_reg);
+
+ pci_writel(devfn, bar_reg, ~0);
+ bar_sz = pci_readl(devfn, bar_reg);
+ if ( bar_sz == 0 )
+ continue;
+
+ if ( (bar_data & PCI_BASE_ADDRESS_SPACE) ==
+ PCI_BASE_ADDRESS_SPACE_MEMORY )
+ {
+ base = &mem_base;
+ bar_sz &= PCI_BASE_ADDRESS_MEM_MASK;
+ bar_data &= ~PCI_BASE_ADDRESS_MEM_MASK;
+ }
+ else
+ {
+ base = &io_base;
+ bar_sz &= PCI_BASE_ADDRESS_IO_MASK & 0xffff;
+ bar_data &= ~PCI_BASE_ADDRESS_IO_MASK;
+ }
+ bar_sz &= ~(bar_sz - 1);
+
+ *base = (*base + bar_sz - 1) & ~(bar_sz - 1);
+ bar_data |= *base;
+ *base += bar_sz;
+
+ pci_writel(devfn, bar_reg, bar_data);
+ printf("pci dev %02x:%x bar %02x size %08x: %08x\n",
+ devfn>>3, devfn&7, bar_reg, bar_sz, bar_data);
+
+ /* Now enable the memory or I/O mapping. */
+ cmd = pci_readw(devfn, PCI_COMMAND);
+ if ( (bar_reg == PCI_ROM_ADDRESS) ||
+ ((bar_data & PCI_BASE_ADDRESS_SPACE) ==
+ PCI_BASE_ADDRESS_SPACE_MEMORY) )
+ cmd |= PCI_COMMAND_MEMORY;
+ else
+ cmd |= PCI_COMMAND_IO;
+ pci_writew(devfn, PCI_COMMAND, cmd);
+ }
+ break;
+ }
+
+ /* Map the interrupt. */
+ pin = pci_readb(devfn, PCI_INTERRUPT_PIN);
+ if ( pin != 0 )
+ {
+ /* This is the barber's pole mapping used by Xen. */
+ link = ((pin - 1) + (devfn >> 3)) & 3;
+ isa_irq = pci_readb(PCI_ISA_DEVFN, 0x60 + link);
+ pci_writeb(devfn, PCI_INTERRUPT_LINE, isa_irq);
+ printf("pci dev %02x:%x INT%c->IRQ%u\n",
+ devfn>>3, devfn&7, 'A'+pin-1, isa_irq);
+ }
+ }
+}
+
+int main(void)
+{
+ int acpi_sz;
+ uint8_t *freemem;
+
+ printf("HVM Loader\n");
+
+ init_hypercalls();
+
+ printf("Writing SMBIOS tables ...\n");
+ hvm_write_smbios_tables();
+
+ printf("Loading ROMBIOS ...\n");
+ memcpy((void *)ROMBIOS_PHYSICAL_ADDRESS, rombios, sizeof(rombios));
+
+ apic_setup();
+ pci_setup();
+
+ if ( (get_vcpu_nr() > 1) || get_apic_mode() )
create_mp_tables();
-
- if (cirrus_check()) {
- puts("Loading Cirrus VGABIOS ...\n");
- memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
- vgabios_cirrusvga, sizeof(vgabios_cirrusvga));
- } else {
- puts("Loading Standard VGABIOS ...\n");
- memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
- vgabios_stdvga, sizeof(vgabios_stdvga));
- }
-
- if (get_acpi_enabled() != 0) {
- puts("Loading ACPI ...\n");
- acpi_madt_update((unsigned char *) acpi);
- if (ACPI_PHYSICAL_ADDRESS+sizeof(acpi) <= 0xF0000) {
- unsigned char *freemem = (unsigned char *)
- (ACPI_PHYSICAL_ADDRESS + sizeof(acpi));
- /*
- * Make sure acpi table does not overlap rombios
- * currently acpi less than 8K will be OK.
- */
- memcpy((void *)ACPI_PHYSICAL_ADDRESS, acpi,
- sizeof(acpi));
- acpi_update((unsigned char *)ACPI_PHYSICAL_ADDRESS,
- sizeof(acpi),
- (unsigned char *)0xF0000,
- &freemem);
- }
- }
-
- if (check_amd()) {
- /* AMD implies this is SVM */
- puts("SVM go ...\n");
- vmmcall(SVM_VMMCALL_RESET_TO_REALMODE, 0, 0, 0, 0, 0);
- } else {
- puts("Loading VMXAssist ...\n");
- memcpy((void *)VMXASSIST_PHYSICAL_ADDRESS,
- vmxassist, sizeof(vmxassist));
-
- puts("VMX go ...\n");
- __asm__ __volatile__(
- "jmp *%%eax"
- : : "a" (VMXASSIST_PHYSICAL_ADDRESS), "d" (0)
- );
- }
-
- puts("Failed to invoke ROMBIOS\n");
- return 0;
-}
-
+
+ if ( cirrus_check() )
+ {
+ printf("Loading Cirrus VGABIOS ...\n");
+ memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
+ vgabios_cirrusvga, sizeof(vgabios_cirrusvga));
+ }
+ else
+ {
+ printf("Loading Standard VGABIOS ...\n");
+ memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
+ vgabios_stdvga, sizeof(vgabios_stdvga));
+ }
+
+ if ( get_acpi_enabled() != 0 )
+ {
+ printf("Loading ACPI ...\n");
+ acpi_sz = acpi_build_tables((uint8_t *)ACPI_PHYSICAL_ADDRESS);
+ freemem = (uint8_t *)ACPI_PHYSICAL_ADDRESS + acpi_sz;
+ ASSERT(freemem <= (uint8_t *)0xF0000);
+ acpi_update((unsigned char *)ACPI_PHYSICAL_ADDRESS,
+ freemem - (uint8_t *)ACPI_PHYSICAL_ADDRESS,
+ (unsigned char *)0xF0000,
+ &freemem);
+ }
+
+ if ( check_amd() )
+ {
+ /* AMD implies this is SVM */
+ printf("SVM go ...\n");
+ vmmcall(SVM_VMMCALL_RESET_TO_REALMODE, 0, 0, 0, 0, 0);
+ }
+ else
+ {
+ printf("Loading VMXAssist ...\n");
+ memcpy((void *)VMXASSIST_PHYSICAL_ADDRESS,
+ vmxassist, sizeof(vmxassist));
+
+ printf("VMX go ...\n");
+ __asm__ __volatile__(
+ "jmp *%%eax"
+ : : "a" (VMXASSIST_PHYSICAL_ADDRESS), "d" (0)
+ );
+ }
+
+ printf("Failed to invoke ROMBIOS\n");
+ return 0;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/firmware/hvmloader/mp_tables.c
--- a/tools/firmware/hvmloader/mp_tables.c Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/firmware/hvmloader/mp_tables.c Tue Nov 28 10:37:36 2006 -0700
@@ -28,6 +28,8 @@
* Place - Suite 330, Boston, MA 02111-1307 USA.
*/
+#include <acpi_utils.h>
+#include "config.h"
/* FIXME find a header that already has types defined!!! */
typedef unsigned char uint8_t;
@@ -44,11 +46,11 @@ typedef signed long int64_t;
typedef signed long int64_t;
#endif
-#define ROMBIOS_SEG 0xF000
-#define ROMBIOS_BEGIN 0x000F0000
-#define ROMBIOS_SIZE 0x00010000
-#define ROMBIOS_MAXOFFSET 0x0000FFFF
-#define ROMBIOS_END (ROMBIOS_BEGIN + ROMBIOS_SIZE)
+#define ROMBIOS_SEG 0xF000
+#define ROMBIOS_BEGIN 0x000F0000
+#define ROMBIOS_SIZE 0x00010000
+#define ROMBIOS_MAXOFFSET 0x0000FFFF
+#define ROMBIOS_END (ROMBIOS_BEGIN + ROMBIOS_SIZE)
/* number of non-processor MP table entries */
#define NR_NONPROC_ENTRIES 18
@@ -77,20 +79,13 @@ typedef signed long int64_t;
#define BUS_TYPE_LENGTH 6
#define BUS_TYPE_STR_ISA "ISA "
-
-#define LAPIC_BASE_ADDR 0xFEE00000
-
-#define IOAPIC_VERSION 0x11
-#define IOAPIC_BASE_ADDR 0xFEC00000
-#define IOAPIC_FLAG_ENABLED (1U << 0)
+#define BUS_ID_ISA 0
#define INTR_TYPE_INT 0
#define INTR_TYPE_NMI 1
#define INTR_TYPE_SMI 2
#define INTR_TYPE_EXTINT 3
-#define INTR_FLAGS 0
-
#define INTR_MAX_NR 16
#include "util.h"
@@ -103,232 +98,203 @@ extern int get_vcpu_nr(void); /* for th
/* MP Floating Pointer Structure */
struct mp_floating_pointer_struct {
- uint8_t signature[4];
- uint32_t mp_table;
- uint8_t length;
- uint8_t revision;
- uint8_t checksum;
- uint8_t feature[5];
+ uint8_t signature[4];
+ uint32_t mp_table;
+ uint8_t length;
+ uint8_t revision;
+ uint8_t checksum;
+ uint8_t feature[5];
};
/* MP Configuration Table */
struct mp_config_table {
- uint8_t signature[4];
- uint16_t length;
- uint8_t revision;
- uint8_t checksum;
- uint8_t oem_id[8];
- uint8_t vendor_id[12];
- uint32_t oem_table;
- uint16_t oem_table_sz;
- uint16_t nr_entries;
- uint32_t lapic;
- uint16_t extended_length;
- uint8_t extended_checksum;
- uint8_t reserved;
+ uint8_t signature[4];
+ uint16_t length;
+ uint8_t revision;
+ uint8_t checksum;
+ uint8_t oem_id[8];
+ uint8_t vendor_id[12];
+ uint32_t oem_table;
+ uint16_t oem_table_sz;
+ uint16_t nr_entries;
+ uint32_t lapic;
+ uint16_t extended_length;
+ uint8_t extended_checksum;
+ uint8_t reserved;
};
/* MP Processor Entry */
struct mp_proc_entry {
- uint8_t type;
- uint8_t lapic_id;
- uint8_t lapic_version;
- uint8_t cpu_flags;
- uint32_t cpu_signature;
- uint32_t feature_flags;
- uint8_t reserved[8];
+ uint8_t type;
+ uint8_t lapic_id;
+ uint8_t lapic_version;
+ uint8_t cpu_flags;
+ uint32_t cpu_signature;
+ uint32_t feature_flags;
+ uint8_t reserved[8];
};
/* MP Bus Entry */
struct mp_bus_entry {
- uint8_t type;
- uint8_t bus_id;
- uint8_t bus_type_str[6];
+ uint8_t type;
+ uint8_t bus_id;
+ uint8_t bus_type_str[6];
};
/* MP IOAPIC Entry */
struct mp_ioapic_entry {
- uint8_t type;
- uint8_t ioapic_id;
- uint8_t ioapic_version;
- uint8_t ioapic_flags;
- uint32_t ioapic_addr;
+ uint8_t type;
+ uint8_t ioapic_id;
+ uint8_t ioapic_version;
+ uint8_t ioapic_flags;
+ uint32_t ioapic_addr;
};
/* MP IO Interrupt Entry */
struct mp_io_intr_entry {
- uint8_t type;
- uint8_t intr_type;
- uint16_t io_intr_flags;
- uint8_t src_bus_id;
- uint8_t src_bus_irq;
- uint8_t dst_ioapic_id;
- uint8_t dst_ioapic_intin;
+ uint8_t type;
+ uint8_t intr_type;
+ uint16_t io_intr_flags;
+ uint8_t src_bus_id;
+ uint8_t src_bus_irq;
+ uint8_t dst_ioapic_id;
+ uint8_t dst_ioapic_intin;
};
/* MP Local Interrupt Entry */
struct mp_local_intr_entry {
- uint8_t type;
- uint8_t intr_type;
- uint16_t local_intr_flags;
- uint8_t src_bus_id;
- uint8_t src_bus_irq;
- uint8_t dst_lapic_id;
- uint8_t dst_lapic_lintin;
-};
-
-
-/*
- * fill_mp_config_table - fills in the information for the MP config table
- *
- * When calculating the length and nr_entries fields, keep in mind that there
- * are always 18 non-processor entries and N processor entries
- *
- * N vcpu entries
- * 1 bus entry
- * 1 IOAPIC entry
- * + 16 IO intr. entries
- * ----------------------
- * 18 + N total entries
- */
-void fill_mp_config_table(struct mp_config_table *mpct)
-{
- int vcpu_nr;
-
- vcpu_nr = get_vcpu_nr();
-
- /* fill in the MP configuration table signature, "PCMP" */
- mpct->signature[0] = 'P';
- mpct->signature[1] = 'C';
- mpct->signature[2] = 'M';
- mpct->signature[3] = 'P';
-
- mpct->length = sizeof(struct mp_config_table)
- + vcpu_nr * sizeof(struct mp_proc_entry)
- + sizeof(struct mp_ioapic_entry)
- + sizeof(struct mp_bus_entry)
- + 16 * sizeof(struct mp_local_intr_entry);
-
- mpct->revision = 4;
-
- /*
- * We'll fill in the checksum later after all of the
- * entries have been created
- */
- mpct->checksum = 0;
-
- /* fill in the OEM ID string, "_HVMCPU_" */
- mpct->oem_id[0] = '_'; mpct->oem_id[3] = 'M'; mpct->oem_id[6] = 'U';
- mpct->oem_id[1] = 'H'; mpct->oem_id[4] = 'C'; mpct->oem_id[7] = '_';
- mpct->oem_id[2] = 'V'; mpct->oem_id[5] = 'P';
-
- /* fill in the Vendor ID string, "XEN " */
- mpct->vendor_id[0] = 'X'; mpct->vendor_id[6] = ' ';
- mpct->vendor_id[1] = 'E'; mpct->vendor_id[7] = ' ';
- mpct->vendor_id[2] = 'N'; mpct->vendor_id[8] = ' ';
- mpct->vendor_id[3] = ' '; mpct->vendor_id[9] = ' ';
- mpct->vendor_id[4] = ' '; mpct->vendor_id[10] = ' ';
- mpct->vendor_id[5] = ' '; mpct->vendor_id[11] = ' ';
-
- mpct->oem_table = 0;
- mpct->oem_table_sz = 0;
-
- mpct->nr_entries = vcpu_nr + NR_NONPROC_ENTRIES;
-
- mpct->lapic = LAPIC_BASE_ADDR;
- mpct->extended_length = 0;
- mpct->extended_checksum = 0;
-}
-
-
-/* calculates the checksum for the MP configuration table */
-void fill_mp_config_table_checksum(struct mp_config_table *mpct)
-{
- int i;
- uint8_t checksum;
-
- checksum = 0;
- for (i = 0; i < mpct->length; ++i)
- checksum += ((uint8_t *)(mpct))[i];
- mpct->checksum = -checksum;
-}
-
+ uint8_t type;
+ uint8_t intr_type;
+ uint16_t local_intr_flags;
+ uint8_t src_bus_id;
+ uint8_t src_bus_irq;
+ uint8_t dst_lapic_id;
+ uint8_t dst_lapic_lintin;
+};
+
+
+void fill_mp_config_table(struct mp_config_table *mpct, int length)
+{
+ int vcpu_nr, i;
+ uint8_t checksum;
+
+ vcpu_nr = get_vcpu_nr();
+
+ /* fill in the MP configuration table signature, "PCMP" */
+ mpct->signature[0] = 'P';
+ mpct->signature[1] = 'C';
+ mpct->signature[2] = 'M';
+ mpct->signature[3] = 'P';
+
+ mpct->length = length;
+
+ mpct->revision = 4;
+
+ /* fill in the OEM ID string, "_HVMCPU_" */
+ mpct->oem_id[0] = '_'; mpct->oem_id[3] = 'M'; mpct->oem_id[6] = 'U';
+ mpct->oem_id[1] = 'H'; mpct->oem_id[4] = 'C'; mpct->oem_id[7] = '_';
+ mpct->oem_id[2] = 'V'; mpct->oem_id[5] = 'P';
+
+ /* fill in the Vendor ID string, "XEN " */
+ mpct->vendor_id[0] = 'X'; mpct->vendor_id[6] = ' ';
+ mpct->vendor_id[1] = 'E'; mpct->vendor_id[7] = ' ';
+ mpct->vendor_id[2] = 'N'; mpct->vendor_id[8] = ' ';
+ mpct->vendor_id[3] = ' '; mpct->vendor_id[9] = ' ';
+ mpct->vendor_id[4] = ' '; mpct->vendor_id[10] = ' ';
+ mpct->vendor_id[5] = ' '; mpct->vendor_id[11] = ' ';
+
+ mpct->oem_table = 0;
+ mpct->oem_table_sz = 0;
+
+ mpct->nr_entries = vcpu_nr + NR_NONPROC_ENTRIES;
+
+ mpct->lapic = LAPIC_BASE_ADDRESS;
+ mpct->extended_length = 0;
+ mpct->extended_checksum = 0;
+
+ /* Finally, fill in the checksum. */
+ mpct->checksum = checksum = 0;
+ for ( i = 0; i < length; i++ )
+ checksum += ((uint8_t *)(mpct))[i];
+ mpct->checksum = -checksum;
+}
/* fills in an MP processor entry for VCPU 'vcpu_id' */
void fill_mp_proc_entry(struct mp_proc_entry *mppe, int vcpu_id)
{
- mppe->type = ENTRY_TYPE_PROCESSOR;
- mppe->lapic_id = vcpu_id;
- mppe->lapic_version = 0x11;
- mppe->cpu_flags = CPU_FLAG_ENABLED;
- if (vcpu_id == 0)
- mppe->cpu_flags |= CPU_FLAG_BSP;
- mppe->cpu_signature = CPU_SIGNATURE;
- mppe->feature_flags = CPU_FEATURES;
+ mppe->type = ENTRY_TYPE_PROCESSOR;
+ mppe->lapic_id = vcpu_id + 1;
+ mppe->lapic_version = 0x11;
+ mppe->cpu_flags = CPU_FLAG_ENABLED;
+ if ( vcpu_id == 0 )
+ mppe->cpu_flags |= CPU_FLAG_BSP;
+ mppe->cpu_signature = CPU_SIGNATURE;
+ mppe->feature_flags = CPU_FEATURES;
}
/* fills in an MP bus entry of type 'type' and bus ID 'bus_id' */
void fill_mp_bus_entry(struct mp_bus_entry *mpbe, int bus_id, const char *type)
{
- int i;
-
- mpbe->type = ENTRY_TYPE_BUS;
- mpbe->bus_id = bus_id;
- for (i = 0; i < BUS_TYPE_LENGTH; ++i)
- mpbe->bus_type_str[i] = type[i]; /* FIXME length check? */
+ int i;
+
+ mpbe->type = ENTRY_TYPE_BUS;
+ mpbe->bus_id = bus_id;
+ for ( i = 0; i < BUS_TYPE_LENGTH; i++ )
+ mpbe->bus_type_str[i] = type[i]; /* FIXME length check? */
}
/* fills in an MP IOAPIC entry for IOAPIC 'ioapic_id' */
-void fill_mp_ioapic_entry(struct mp_ioapic_entry *mpie, int ioapic_id)
-{
- mpie->type = ENTRY_TYPE_IOAPIC;
- mpie->ioapic_id = ioapic_id;
- mpie->ioapic_version = IOAPIC_VERSION;
- mpie->ioapic_flags = IOAPIC_FLAG_ENABLED;
- mpie->ioapic_addr = IOAPIC_BASE_ADDR;
+void fill_mp_ioapic_entry(struct mp_ioapic_entry *mpie)
+{
+ mpie->type = ENTRY_TYPE_IOAPIC;
+ mpie->ioapic_id = IOAPIC_ID;
+ mpie->ioapic_version = IOAPIC_VERSION;
+ mpie->ioapic_flags = 1; /* enabled */
+ mpie->ioapic_addr = IOAPIC_BASE_ADDRESS;
}
/* fills in an IO interrupt entry for IOAPIC 'ioapic_id' */
-void fill_mp_io_intr_entry(struct mp_io_intr_entry *mpiie,
- int src_bus_irq, int ioapic_id, int dst_ioapic_intin)
-{
- mpiie->type = ENTRY_TYPE_IO_INTR;
- mpiie->intr_type = INTR_TYPE_INT;
- mpiie->io_intr_flags = INTR_FLAGS;
- mpiie->src_bus_id = 0;
- mpiie->src_bus_irq = src_bus_irq;
- mpiie->dst_ioapic_id = ioapic_id;
- mpiie->dst_ioapic_intin = dst_ioapic_intin;
+void fill_mp_io_intr_entry(
+ struct mp_io_intr_entry *mpiie,
+ int src_bus_id, int src_bus_irq, int ioapic_id, int dst_ioapic_intin)
+{
+ mpiie->type = ENTRY_TYPE_IO_INTR;
+ mpiie->intr_type = INTR_TYPE_INT;
+ mpiie->io_intr_flags = (PCI_ISA_IRQ_MASK & (1U<<src_bus_irq)) ? 0xf : 0x0;
+ mpiie->src_bus_id = src_bus_id;
+ mpiie->src_bus_irq = src_bus_irq;
+ mpiie->dst_ioapic_id = ioapic_id;
+ mpiie->dst_ioapic_intin = dst_ioapic_intin;
}
/* fill in the mp floating processor structure */
void fill_mpfps(struct mp_floating_pointer_struct *mpfps, uint32_t mpct)
{
- int i;
- uint8_t checksum;
-
-
- mpfps->signature[0] = '_';
- mpfps->signature[1] = 'M';
- mpfps->signature[2] = 'P';
- mpfps->signature[3] = '_';
-
- mpfps->mp_table = mpct;
- mpfps->length = 1;
- mpfps->revision = 4;
- mpfps->checksum = 0;
- for (i = 0; i < 5; ++i)
- mpfps->feature[i] = 0;
-
- /* compute the checksum for our new table */
- checksum = 0;
- for (i = 0; i < sizeof(struct mp_floating_pointer_struct); ++i)
- checksum += ((uint8_t *)(mpfps))[i];
- mpfps->checksum = -checksum;
+ int i;
+ uint8_t checksum;
+
+
+ mpfps->signature[0] = '_';
+ mpfps->signature[1] = 'M';
+ mpfps->signature[2] = 'P';
+ mpfps->signature[3] = '_';
+
+ mpfps->mp_table = mpct;
+ mpfps->length = 1;
+ mpfps->revision = 4;
+ mpfps->checksum = 0;
+ for (i = 0; i < 5; ++i)
+ mpfps->feature[i] = 0;
+
+ /* compute the checksum for our new table */
+ checksum = 0;
+ for ( i = 0; i < sizeof(struct mp_floating_pointer_struct); i++ )
+ checksum += ((uint8_t *)(mpfps))[i];
+ mpfps->checksum = -checksum;
}
@@ -340,88 +306,87 @@ void fill_mpfps(struct mp_floating_point
*/
void* get_mp_table_start(void)
{
- char *bios_mem;
- for (bios_mem = (char *)ROMBIOS_BEGIN;
- bios_mem != (char *)ROMBIOS_END;
- ++bios_mem)
- if (bios_mem[0] == '_' && bios_mem[1] == '_' &&
- bios_mem[2] == '_' && bios_mem[3] == 'H' &&
- bios_mem[4] == 'V' && bios_mem[5] == 'M' &&
- bios_mem[6] == 'M' && bios_mem[7] == 'P')
- return bios_mem;
-
- return (void *)-1;
+ char *bios_mem;
+
+ for ( bios_mem = (char *)ROMBIOS_BEGIN;
+ bios_mem != (char *)ROMBIOS_END;
+ bios_mem++ )
+ {
+ if ( bios_mem[0] == '_' && bios_mem[1] == '_' &&
+ bios_mem[2] == '_' && bios_mem[3] == 'H' &&
+ bios_mem[4] == 'V' && bios_mem[5] == 'M' &&
+ bios_mem[6] == 'M' && bios_mem[7] == 'P' )
+ return bios_mem;
+ }
+
+ return NULL;
}
/* recalculate the new ROMBIOS checksum after adding MP tables */
void reset_bios_checksum(void)
{
- uint32_t i;
- uint8_t checksum;
-
- checksum = 0;
- for (i = 0; i < ROMBIOS_MAXOFFSET; ++i)
- checksum += ((uint8_t *)(ROMBIOS_BEGIN))[i];
-
- *((uint8_t *)(ROMBIOS_BEGIN + ROMBIOS_MAXOFFSET)) = -checksum;
+ uint32_t i;
+ uint8_t checksum;
+
+ checksum = 0;
+ for (i = 0; i < ROMBIOS_MAXOFFSET; ++i)
+ checksum += ((uint8_t *)(ROMBIOS_BEGIN))[i];
+
+ *((uint8_t *)(ROMBIOS_BEGIN + ROMBIOS_MAXOFFSET)) = -checksum;
}
/* create_mp_tables - creates MP tables for the guest based upon config data */
void create_mp_tables(void)
{
- void *mp_table_base;
- char *p;
- struct mp_config_table *mp_config_table;
- int vcpu_nr;
- int i;
-
- vcpu_nr = get_vcpu_nr();
-
- puts("Creating MP tables ...\n");
-
- /* find the 'safe' place in ROMBIOS for the MP tables */
- mp_table_base = get_mp_table_start();
- if (mp_table_base == (void *)-1) {
- puts("Couldn't find start point for MP tables\n");
- return;
- }
- p = mp_table_base;
-
- fill_mp_config_table((struct mp_config_table *)p);
-
- /* save the location of the MP config table for a little later*/
- mp_config_table = (struct mp_config_table *)p;
- p += sizeof(struct mp_config_table);
-
- for (i = 0; i < vcpu_nr; ++i) {
- fill_mp_proc_entry((struct mp_proc_entry *)p, i);
- p += sizeof(struct mp_proc_entry);
- }
-
- fill_mp_bus_entry((struct mp_bus_entry *)p, 0, BUS_TYPE_STR_ISA);
- p += sizeof(struct mp_bus_entry);
-
- fill_mp_ioapic_entry((struct mp_ioapic_entry *)p, vcpu_nr);
- p += sizeof(struct mp_ioapic_entry);
-
- for (i = 0; i < INTR_MAX_NR; ++i) {
- fill_mp_io_intr_entry((struct mp_io_intr_entry *)p,
- i, vcpu_nr, i);
- p += sizeof(struct mp_io_intr_entry);
- }
-
- /* find the next 16-byte boundary to place the mp floating pointer */
- while ((unsigned long)p & 0xF)
- ++p;
-
- fill_mpfps((struct mp_floating_pointer_struct *)p,
- (uint32_t)mp_table_base);
-
- /* calculate the MP configuration table's checksum */
- fill_mp_config_table_checksum(mp_config_table);
-
- /* finally, recalculate the ROMBIOS checksum */
- reset_bios_checksum();
-}
+ void *mp_table_base;
+ char *p;
+ int vcpu_nr, i, length;
+
+ vcpu_nr = get_vcpu_nr();
+
+ printf("Creating MP tables ...\n");
+
+ /* Find the 'safe' place in ROMBIOS for the MP tables. */
+ mp_table_base = get_mp_table_start();
+ if ( mp_table_base == NULL )
+ {
+ printf("Couldn't find start point for MP tables\n");
+ return;
+ }
+
+ p = mp_table_base + sizeof(struct mp_config_table);
+
+ for ( i = 0; i < vcpu_nr; i++ )
+ {
+ fill_mp_proc_entry((struct mp_proc_entry *)p, i);
+ p += sizeof(struct mp_proc_entry);
+ }
+
+ fill_mp_bus_entry((struct mp_bus_entry *)p, BUS_ID_ISA, BUS_TYPE_STR_ISA);
+ p += sizeof(struct mp_bus_entry);
+
+ fill_mp_ioapic_entry((struct mp_ioapic_entry *)p);
+ p += sizeof(struct mp_ioapic_entry);
+
+ for ( i = 0; i < 16; i++ )
+ {
+ if ( i == 2 ) continue; /* skip the slave PIC connection */
+ fill_mp_io_intr_entry((struct mp_io_intr_entry *)p,
+ BUS_ID_ISA, i, IOAPIC_ID, i);
+ p += sizeof(struct mp_io_intr_entry);
+ }
+
+ length = p - (char *)mp_table_base;
+
+ /* find the next 16-byte boundary to place the mp floating pointer */
+ while ( (unsigned long)p & 0xF )
+ p++;
+
+ fill_mpfps((struct mp_floating_pointer_struct *)p,
+ (uint32_t)mp_table_base);
+
+ fill_mp_config_table((struct mp_config_table *)mp_table_base, length);
+ reset_bios_checksum();
+}
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/firmware/hvmloader/smbios.c
--- a/tools/firmware/hvmloader/smbios.c Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/firmware/hvmloader/smbios.c Tue Nov 28 10:37:36 2006 -0700
@@ -30,29 +30,29 @@
static size_t
write_smbios_tables(void *start,
- uint32_t vcpus, uint64_t memsize,
- uint8_t uuid[16], char *xen_version,
- uint32_t xen_major_version, uint32_t xen_minor_version);
+ uint32_t vcpus, uint64_t memsize,
+ uint8_t uuid[16], char *xen_version,
+ uint32_t xen_major_version, uint32_t xen_minor_version);
static void
get_cpu_manufacturer(char *buf, int len);
static void
smbios_entry_point_init(void *start,
- uint16_t max_structure_size,
- uint16_t structure_table_length,
- uint32_t structure_table_address,
- uint16_t number_of_structures);
+ uint16_t max_structure_size,
+ uint16_t structure_table_length,
+ uint32_t structure_table_address,
+ uint16_t number_of_structures);
static void *
smbios_type_0_init(void *start, const char *xen_version,
- uint32_t xen_major_version, uint32_t xen_minor_version);
+ uint32_t xen_major_version, uint32_t xen_minor_version);
static void *
smbios_type_1_init(void *start, const char *xen_version,
- uint8_t uuid[16]);
+ uint8_t uuid[16]);
static void *
smbios_type_3_init(void *start);
static void *
smbios_type_4_init(void *start, unsigned int cpu_number,
- char *cpu_manufacturer);
+ char *cpu_manufacturer);
static void *
smbios_type_16_init(void *start, uint32_t memory_size_mb);
static void *
@@ -69,64 +69,64 @@ static void
static void
get_cpu_manufacturer(char *buf, int len)
{
- char id[12];
- uint32_t eax = 0;
-
- cpuid(0, &eax, (uint32_t *)&id[0], (uint32_t *)&id[8],
- (uint32_t *)&id[4]);
-
- if (memcmp(id, "GenuineIntel", 12) == 0)
- strncpy(buf, "Intel", len);
- else if (memcmp(id, "AuthenticAMD", 12) == 0)
- strncpy(buf, "AMD", len);
- else
- strncpy(buf, "unknown", len);
+ char id[12];
+ uint32_t eax = 0;
+
+ cpuid(0, &eax, (uint32_t *)&id[0], (uint32_t *)&id[8],
+ (uint32_t *)&id[4]);
+
+ if (memcmp(id, "GenuineIntel", 12) == 0)
+ strncpy(buf, "Intel", len);
+ else if (memcmp(id, "AuthenticAMD", 12) == 0)
+ strncpy(buf, "AMD", len);
+ else
+ strncpy(buf, "unknown", len);
}
static size_t
write_smbios_tables(void *start,
- uint32_t vcpus, uint64_t memsize,
- uint8_t uuid[16], char *xen_version,
- uint32_t xen_major_version, uint32_t xen_minor_version)
-{
- unsigned cpu_num, nr_structs = 0, max_struct_size = 0;
- char *p, *q;
- char cpu_manufacturer[15];
-
- get_cpu_manufacturer(cpu_manufacturer, 15);
-
- p = (char *)start + sizeof(struct smbios_entry_point);
-
-#define do_struct(fn) do { \
- q = (fn); \
- nr_structs++; \
- if ((q - p) > max_struct_size) \
- max_struct_size = q - p; \
- p = q; \
+ uint32_t vcpus, uint64_t memsize,
+ uint8_t uuid[16], char *xen_version,
+ uint32_t xen_major_version, uint32_t xen_minor_version)
+{
+ unsigned cpu_num, nr_structs = 0, max_struct_size = 0;
+ char *p, *q;
+ char cpu_manufacturer[15];
+
+ get_cpu_manufacturer(cpu_manufacturer, 15);
+
+ p = (char *)start + sizeof(struct smbios_entry_point);
+
+#define do_struct(fn) do { \
+ q = (fn); \
+ nr_structs++; \
+ if ( (q - p) > max_struct_size ) \
+ max_struct_size = q - p; \
+ p = q; \
} while (0)
- do_struct(smbios_type_0_init(p, xen_version, xen_major_version,
- xen_minor_version));
- do_struct(smbios_type_1_init(p, xen_version, uuid));
- do_struct(smbios_type_3_init(p));
- for (cpu_num = 1; cpu_num <= vcpus; cpu_num++)
- do_struct(smbios_type_4_init(p, cpu_num, cpu_manufacturer));
- do_struct(smbios_type_16_init(p, memsize));
- do_struct(smbios_type_17_init(p, memsize));
- do_struct(smbios_type_19_init(p, memsize));
- do_struct(smbios_type_20_init(p, memsize));
- do_struct(smbios_type_32_init(p));
- do_struct(smbios_type_127_init(p));
+ do_struct(smbios_type_0_init(p, xen_version, xen_major_version,
+ xen_minor_version));
+ do_struct(smbios_type_1_init(p, xen_version, uuid));
+ do_struct(smbios_type_3_init(p));
+ for ( cpu_num = 1; cpu_num <= vcpus; cpu_num++ )
+ do_struct(smbios_type_4_init(p, cpu_num, cpu_manufacturer));
+ do_struct(smbios_type_16_init(p, memsize));
+ do_struct(smbios_type_17_init(p, memsize));
+ do_struct(smbios_type_19_init(p, memsize));
+ do_struct(smbios_type_20_init(p, memsize));
+ do_struct(smbios_type_32_init(p));
+ do_struct(smbios_type_127_init(p));
#undef do_struct
- smbios_entry_point_init(
- start, max_struct_size,
- (p - (char *)start) - sizeof(struct smbios_entry_point),
- SMBIOS_PHYSICAL_ADDRESS + sizeof(struct smbios_entry_point),
- nr_structs);
-
- return (size_t)((char *)p - (char *)start);
+ smbios_entry_point_init(
+ start, max_struct_size,
+ (p - (char *)start) - sizeof(struct smbios_entry_point),
+ SMBIOS_PHYSICAL_ADDRESS + sizeof(struct smbios_entry_point),
+ nr_structs);
+
+ return (size_t)((char *)p - (char *)start);
}
/* This tries to figure out how much pseudo-physical memory (in MB)
@@ -142,428 +142,439 @@ static uint64_t
static uint64_t
get_memsize(void)
{
- struct e820entry *map = NULL;
- uint8_t num_entries = 0;
- uint64_t memsize = 0;
- uint8_t i;
-
- map = (struct e820entry *) (E820_MAP_PAGE + E820_MAP_OFFSET);
- num_entries = *((uint8_t *) (E820_MAP_PAGE + E820_MAP_NR_OFFSET));
-
- /* walk through e820map, ignoring any entries that aren't marked
- as usable or reserved. */
-
- for (i = 0; i < num_entries; i++) {
- if (map->type == E820_RAM || map->type == E820_RESERVED)
- memsize += map->size;
- map++;
- }
-
- /* Round up to the nearest MB. The user specifies domU
- pseudo-physical memory in megabytes, so not doing this
- could easily lead to reporting one less MB than the user
- specified. */
- if (memsize & ((1<<20)-1))
- memsize = (memsize >> 20) + 1;
- else
- memsize = (memsize >> 20);
-
- return memsize;
+ struct e820entry *map = NULL;
+ uint8_t num_entries = 0;
+ uint64_t memsize = 0;
+ uint8_t i;
+
+ map = (struct e820entry *) (E820_MAP_PAGE + E820_MAP_OFFSET);
+ num_entries = *((uint8_t *) (E820_MAP_PAGE + E820_MAP_NR_OFFSET));
+
+ /* walk through e820map, ignoring any entries that aren't marked
+ as usable or reserved. */
+
+ for ( i = 0; i < num_entries; i++ )
+ {
+ if (map->type == E820_RAM || map->type == E820_RESERVED)
+ memsize += map->size;
+ map++;
+ }
+
+ /* Round up to the nearest MB. The user specifies domU
+ pseudo-physical memory in megabytes, so not doing this
+ could easily lead to reporting one less MB than the user
+ specified. */
+ if ( memsize & ((1<<20)-1) )
+ memsize = (memsize >> 20) + 1;
+ else
+ memsize = (memsize >> 20);
+
+ return memsize;
}
void
hvm_write_smbios_tables(void)
{
- uint8_t uuid[16]; /* ** This will break if xen_domain_handle_t is
- not uint8_t[16]. ** */
- uint16_t xen_major_version, xen_minor_version;
- uint32_t xen_version;
- char xen_extra_version[XEN_EXTRAVERSION_LEN];
- /* guess conservatively on buffer length for Xen version string */
- char xen_version_str[80];
- /* temporary variables used to build up Xen version string */
- char *p = NULL; /* points to next point of insertion */
- unsigned len = 0; /* length of string already composed */
- char *tmp = NULL; /* holds result of itoa() */
- unsigned tmp_len; /* length of next string to add */
-
- hypercall_xen_version(XENVER_guest_handle, uuid);
-
- /* xen_version major and minor */
- xen_version = hypercall_xen_version(XENVER_version, NULL);
- xen_major_version = (uint16_t) (xen_version >> 16);
- xen_minor_version = (uint16_t) xen_version;
-
- hypercall_xen_version(XENVER_extraversion, xen_extra_version);
-
- /* build up human-readable Xen version string */
- p = xen_version_str;
- len = 0;
-
- itoa(tmp, xen_major_version);
- tmp_len = strlen(tmp);
- len += tmp_len;
- if (len >= sizeof(xen_version_str))
- goto error_out;
- strcpy(p, tmp);
- p += tmp_len;
-
- len++;
- if (len >= sizeof(xen_version_str))
- goto error_out;
- *p = '.';
- p++;
-
- itoa(tmp, xen_minor_version);
- tmp_len = strlen(tmp);
- len += tmp_len;
- if (len >= sizeof(xen_version_str))
- goto error_out;
- strcpy(p, tmp);
- p += tmp_len;
-
- tmp_len = strlen(xen_extra_version);
- len += tmp_len;
- if (len >= sizeof(xen_version_str))
- goto error_out;
- strcpy(p, xen_extra_version);
- p += tmp_len;
-
- xen_version_str[sizeof(xen_version_str)-1] = '\0';
-
- /* NB. 0xC0000 is a safe large memory area for scratch. */
- len = write_smbios_tables((void *)0xC0000,
- get_vcpu_nr(), get_memsize(),
- uuid, xen_version_str,
- xen_major_version, xen_minor_version);
- if (len > SMBIOS_SIZE_LIMIT)
- goto error_out;
- /* Okay, not too large: copy out of scratch to final location. */
- memcpy((void *)SMBIOS_PHYSICAL_ADDRESS, (void *)0xC0000, len);
-
- return;
+ uint8_t uuid[16]; /* ** This will break if xen_domain_handle_t is
+ not uint8_t[16]. ** */
+ uint16_t xen_major_version, xen_minor_version;
+ uint32_t xen_version;
+ char xen_extra_version[XEN_EXTRAVERSION_LEN];
+ /* guess conservatively on buffer length for Xen version string */
+ char xen_version_str[80];
+ /* temporary variables used to build up Xen version string */
+ char *p = NULL; /* points to next point of insertion */
+ unsigned len = 0; /* length of string already composed */
+ char *tmp = NULL; /* holds result of itoa() */
+ unsigned tmp_len; /* length of next string to add */
+
+ hypercall_xen_version(XENVER_guest_handle, uuid);
+
+ /* xen_version major and minor */
+ xen_version = hypercall_xen_version(XENVER_version, NULL);
+ xen_major_version = (uint16_t) (xen_version >> 16);
+ xen_minor_version = (uint16_t) xen_version;
+
+ hypercall_xen_version(XENVER_extraversion, xen_extra_version);
+
+ /* build up human-readable Xen version string */
+ p = xen_version_str;
+ len = 0;
+
+ itoa(tmp, xen_major_version);
+ tmp_len = strlen(tmp);
+ len += tmp_len;
+ if ( len >= sizeof(xen_version_str) )
+ goto error_out;
+ strcpy(p, tmp);
+ p += tmp_len;
+
+ len++;
+ if ( len >= sizeof(xen_version_str) )
+ goto error_out;
+ *p = '.';
+ p++;
+
+ itoa(tmp, xen_minor_version);
+ tmp_len = strlen(tmp);
+ len += tmp_len;
+ if ( len >= sizeof(xen_version_str) )
+ goto error_out;
+ strcpy(p, tmp);
+ p += tmp_len;
+
+ tmp_len = strlen(xen_extra_version);
+ len += tmp_len;
+ if ( len >= sizeof(xen_version_str) )
+ goto error_out;
+ strcpy(p, xen_extra_version);
+ p += tmp_len;
+
+ xen_version_str[sizeof(xen_version_str)-1] = '\0';
+
+ /* NB. 0xC0000 is a safe large memory area for scratch. */
+ len = write_smbios_tables((void *)0xC0000,
+ get_vcpu_nr(), get_memsize(),
+ uuid, xen_version_str,
+ xen_major_version, xen_minor_version);
+ if ( len > SMBIOS_SIZE_LIMIT )
+ goto error_out;
+ /* Okay, not too large: copy out of scratch to final location. */
+ memcpy((void *)SMBIOS_PHYSICAL_ADDRESS, (void *)0xC0000, len);
+
+ return;
error_out:
- puts("Could not write SMBIOS tables, error in hvmloader.c:"
- "hvm_write_smbios_tables()\n");
+ printf("Could not write SMBIOS tables, error in hvmloader.c:"
+ "hvm_write_smbios_tables()\n");
}
static void
smbios_entry_point_init(void *start,
- uint16_t max_structure_size,
- uint16_t structure_table_length,
- uint32_t structure_table_address,
- uint16_t number_of_structures)
-{
- uint8_t sum;
- int i;
- struct smbios_entry_point *ep = (struct smbios_entry_point *)start;
-
- strncpy(ep->anchor_string, "_SM_", 4);
- ep->length = 0x1f;
- ep->smbios_major_version = 2;
- ep->smbios_minor_version = 4;
- ep->max_structure_size = max_structure_size;
- ep->entry_point_revision = 0;
- memset(ep->formatted_area, 0, 5);
- strncpy(ep->intermediate_anchor_string, "_DMI_", 5);
-
- ep->structure_table_length = structure_table_length;
- ep->structure_table_address = structure_table_address;
- ep->number_of_structures = number_of_structures;
- ep->smbios_bcd_revision = 0x24;
-
- ep->checksum = 0;
- ep->intermediate_checksum = 0;
-
- sum = 0;
- for (i = 0; i < 0x10; ++i)
- sum += ((int8_t *)start)[i];
- ep->checksum = -sum;
-
- sum = 0;
- for (i = 0x10; i < ep->length; ++i)
- sum += ((int8_t *)start)[i];
- ep->intermediate_checksum = -sum;
+ uint16_t max_structure_size,
+ uint16_t structure_table_length,
+ uint32_t structure_table_address,
+ uint16_t number_of_structures)
+{
+ uint8_t sum;
+ int i;
+ struct smbios_entry_point *ep = (struct smbios_entry_point *)start;
+
+ strncpy(ep->anchor_string, "_SM_", 4);
+ ep->length = 0x1f;
+ ep->smbios_major_version = 2;
+ ep->smbios_minor_version = 4;
+ ep->max_structure_size = max_structure_size;
+ ep->entry_point_revision = 0;
+ memset(ep->formatted_area, 0, 5);
+ strncpy(ep->intermediate_anchor_string, "_DMI_", 5);
+
+ ep->structure_table_length = structure_table_length;
+ ep->structure_table_address = structure_table_address;
+ ep->number_of_structures = number_of_structures;
+ ep->smbios_bcd_revision = 0x24;
+
+ ep->checksum = 0;
+ ep->intermediate_checksum = 0;
+
+ sum = 0;
+ for ( i = 0; i < 0x10; i++ )
+ sum += ((int8_t *)start)[i];
+ ep->checksum = -sum;
+
+ sum = 0;
+ for ( i = 0x10; i < ep->length; i++ )
+ sum += ((int8_t *)start)[i];
+ ep->intermediate_checksum = -sum;
}
/* Type 0 -- BIOS Information */
static void *
smbios_type_0_init(void *start, const char *xen_version,
- uint32_t xen_major_version, uint32_t xen_minor_version)
-{
- struct smbios_type_0 *p = (struct smbios_type_0 *)start;
-
- p->header.type = 0;
- p->header.length = sizeof(struct smbios_type_0);
- p->header.handle = 0;
-
- p->vendor_str = 1;
- p->version_str = 2;
- p->starting_address_segment = 0xe800;
- p->release_date_str = 0;
- p->rom_size = 0;
-
- memset(p->characteristics, 0, 8);
- p->characteristics[7] = 0x08; /* BIOS characteristics not supported */
- p->characteristics_extension_bytes[0] = 0;
- p->characteristics_extension_bytes[1] = 0;
-
- p->major_release = (uint8_t) xen_major_version;
- p->minor_release = (uint8_t) xen_minor_version;
- p->embedded_controller_major = 0xff;
- p->embedded_controller_minor = 0xff;
-
- start += sizeof(struct smbios_type_0);
- strcpy((char *)start, "Xen");
- start += strlen("Xen") + 1;
- strcpy((char *)start, xen_version);
- start += strlen(xen_version) + 1;
-
- *((uint8_t *)start) = 0;
- return start + 1;
+ uint32_t xen_major_version, uint32_t xen_minor_version)
+{
+ struct smbios_type_0 *p = (struct smbios_type_0 *)start;
+
+ p->header.type = 0;
+ p->header.length = sizeof(struct smbios_type_0);
+ p->header.handle = 0;
+
+ p->vendor_str = 1;
+ p->version_str = 2;
+ p->starting_address_segment = 0xe800;
+ p->release_date_str = 0;
+ p->rom_size = 0;
+
+ memset(p->characteristics, 0, 8);
+ p->characteristics[7] = 0x08; /* BIOS characteristics not supported */
+ p->characteristics_extension_bytes[0] = 0;
+ p->characteristics_extension_bytes[1] = 0;
+
+ p->major_release = (uint8_t) xen_major_version;
+ p->minor_release = (uint8_t) xen_minor_version;
+ p->embedded_controller_major = 0xff;
+ p->embedded_controller_minor = 0xff;
+
+ start += sizeof(struct smbios_type_0);
+ strcpy((char *)start, "Xen");
+ start += strlen("Xen") + 1;
+ strcpy((char *)start, xen_version);
+ start += strlen(xen_version) + 1;
+
+ *((uint8_t *)start) = 0;
+ return start + 1;
}
/* Type 1 -- System Information */
static void *
smbios_type_1_init(void *start, const char *xen_version,
- uint8_t uuid[16])
-{
- char uuid_str[37];
- struct smbios_type_1 *p = (struct smbios_type_1 *)start;
- p->header.type = 1;
- p->header.length = sizeof(struct smbios_type_1);
- p->header.handle = 0x100;
-
- p->manufacturer_str = 1;
- p->product_name_str = 2;
- p->version_str = 3;
- p->serial_number_str = 4;
-
- memcpy(p->uuid, uuid, 16);
-
- p->wake_up_type = 0x06; /* power switch */
- p->sku_str = 0;
- p->family_str = 0;
-
- start += sizeof(struct smbios_type_1);
-
- strcpy((char *)start, "Xen");
- start += strlen("Xen") + 1;
- strcpy((char *)start, "HVM domU");
- start += strlen("HVM domU") + 1;
- strcpy((char *)start, xen_version);
- start += strlen(xen_version) + 1;
- uuid_to_string(uuid_str, uuid);
- strcpy((char *)start, uuid_str);
- start += strlen(uuid_str) + 1;
- *((uint8_t *)start) = 0;
-
- return start+1;
+ uint8_t uuid[16])
+{
+ char uuid_str[37];
+ struct smbios_type_1 *p = (struct smbios_type_1 *)start;
+ p->header.type = 1;
+ p->header.length = sizeof(struct smbios_type_1);
+ p->header.handle = 0x100;
+
+ p->manufacturer_str = 1;
+ p->product_name_str = 2;
+ p->version_str = 3;
+ p->serial_number_str = 4;
+
+ memcpy(p->uuid, uuid, 16);
+
+ p->wake_up_type = 0x06; /* power switch */
+ p->sku_str = 0;
+ p->family_str = 0;
+
+ start += sizeof(struct smbios_type_1);
+
+ strcpy((char *)start, "Xen");
+ start += strlen("Xen") + 1;
+ strcpy((char *)start, "HVM domU");
+ start += strlen("HVM domU") + 1;
+ strcpy((char *)start, xen_version);
+ start += strlen(xen_version) + 1;
+ uuid_to_string(uuid_str, uuid);
+ strcpy((char *)start, uuid_str);
+ start += strlen(uuid_str) + 1;
+ *((uint8_t *)start) = 0;
+
+ return start+1;
}
/* Type 3 -- System Enclosure */
static void *
smbios_type_3_init(void *start)
{
- struct smbios_type_3 *p = (struct smbios_type_3 *)start;
-
- p->header.type = 3;
- p->header.length = sizeof(struct smbios_type_3);
- p->header.handle = 0x300;
-
- p->manufacturer_str = 1;
- p->type = 0x01; /* other */
- p->version_str = 0;
- p->serial_number_str = 0;
- p->asset_tag_str = 0;
- p->boot_up_state = 0x03; /* safe */
- p->power_supply_state = 0x03; /* safe */
- p->thermal_state = 0x03; /* safe */
- p->security_status = 0x02; /* unknown */
-
- start += sizeof(struct smbios_type_3);
-
- strcpy((char *)start, "Xen");
- start += strlen("Xen") + 1;
- *((uint8_t *)start) = 0;
- return start+1;
+ struct smbios_type_3 *p = (struct smbios_type_3 *)start;
+
+ p->header.type = 3;
+ p->header.length = sizeof(struct smbios_type_3);
+ p->header.handle = 0x300;
+
+ p->manufacturer_str = 1;
+ p->type = 0x01; /* other */
+ p->version_str = 0;
+ p->serial_number_str = 0;
+ p->asset_tag_str = 0;
+ p->boot_up_state = 0x03; /* safe */
+ p->power_supply_state = 0x03; /* safe */
+ p->thermal_state = 0x03; /* safe */
+ p->security_status = 0x02; /* unknown */
+
+ start += sizeof(struct smbios_type_3);
+
+ strcpy((char *)start, "Xen");
+ start += strlen("Xen") + 1;
+ *((uint8_t *)start) = 0;
+ return start+1;
}
/* Type 4 -- Processor Information */
static void *
smbios_type_4_init(void *start, unsigned int cpu_number, char
*cpu_manufacturer)
{
- char buf[80];
- struct smbios_type_4 *p = (struct smbios_type_4 *)start;
- uint32_t eax, ebx, ecx, edx;
-
- p->header.type = 4;
- p->header.length = sizeof(struct smbios_type_4);
- p->header.handle = 0x400 + cpu_number;
-
- p->socket_designation_str = 1;
- p->processor_type = 0x03; /* CPU */
- p->processor_family = 0x01; /* other */
- p->manufacturer_str = 2;
-
- cpuid(1, &eax, &ebx, &ecx, &edx);
-
- p->cpuid[0] = eax;
- p->cpuid[1] = edx;
-
- p->version_str = 0;
- p->voltage = 0;
- p->external_clock = 0;
-
- p->max_speed = 0; /* unknown */
- p->current_speed = 0; /* unknown */
-
- p->status = 0x41; /* socket populated, CPU enabled */
- p->upgrade = 0x01; /* other */
-
- start += sizeof(struct smbios_type_4);
-
- strncpy(buf, "CPU ", sizeof(buf));
- if ((sizeof(buf) - strlen("CPU ")) >= 3)
- itoa(buf + strlen("CPU "), cpu_number);
-
- strcpy((char *)start, buf);
- start += strlen(buf) + 1;
-
- strcpy((char *)start, cpu_manufacturer);
- start += strlen(cpu_manufacturer) + 1;
-
- *((uint8_t *)start) = 0;
- return start+1;
+ char buf[80];
+ struct smbios_type_4 *p = (struct smbios_type_4 *)start;
+ uint32_t eax, ebx, ecx, edx;
+
+ p->header.type = 4;
+ p->header.length = sizeof(struct smbios_type_4);
+ p->header.handle = 0x400 + cpu_number;
+
+ p->socket_designation_str = 1;
+ p->processor_type = 0x03; /* CPU */
+ p->processor_family = 0x01; /* other */
+ p->manufacturer_str = 2;
+
+ cpuid(1, &eax, &ebx, &ecx, &edx);
+
+ p->cpuid[0] = eax;
+ p->cpuid[1] = edx;
+
+ p->version_str = 0;
+ p->voltage = 0;
+ p->external_clock = 0;
+
+ p->max_speed = 0; /* unknown */
+ p->current_speed = 0; /* unknown */
+
+ p->status = 0x41; /* socket populated, CPU enabled */
+ p->upgrade = 0x01; /* other */
+
+ start += sizeof(struct smbios_type_4);
+
+ strncpy(buf, "CPU ", sizeof(buf));
+ if ( (sizeof(buf) - strlen("CPU ")) >= 3 )
+ itoa(buf + strlen("CPU "), cpu_number);
+
+ strcpy((char *)start, buf);
+ start += strlen(buf) + 1;
+
+ strcpy((char *)start, cpu_manufacturer);
+ start += strlen(cpu_manufacturer) + 1;
+
+ *((uint8_t *)start) = 0;
+ return start+1;
}
/* Type 16 -- Physical Memory Array */
static void *
smbios_type_16_init(void *start, uint32_t memsize)
{
- struct smbios_type_16 *p = (struct smbios_type_16*)start;
-
- p->header.type = 16;
- p->header.handle = 0x1000;
- p->header.length = sizeof(struct smbios_type_16);
-
- p->location = 0x01; /* other */
- p->use = 0x03; /* system memory */
- p->error_correction = 0x01; /* other */
- p->maximum_capacity = memsize * 1024;
- p->memory_error_information_handle = 0xfffe; /* none provided */
- p->number_of_memory_devices = 1;
-
- start += sizeof(struct smbios_type_16);
- *((uint16_t *)start) = 0;
- return start + 2;
+ struct smbios_type_16 *p = (struct smbios_type_16*)start;
+
+ p->header.type = 16;
+ p->header.handle = 0x1000;
+ p->header.length = sizeof(struct smbios_type_16);
+
+ p->location = 0x01; /* other */
+ p->use = 0x03; /* system memory */
+ p->error_correction = 0x01; /* other */
+ p->maximum_capacity = memsize * 1024;
+ p->memory_error_information_handle = 0xfffe; /* none provided */
+ p->number_of_memory_devices = 1;
+
+ start += sizeof(struct smbios_type_16);
+ *((uint16_t *)start) = 0;
+ return start + 2;
}
/* Type 17 -- Memory Device */
static void *
smbios_type_17_init(void *start, uint32_t memory_size_mb)
{
- struct smbios_type_17 *p = (struct smbios_type_17 *)start;
-
- p->header.type = 17;
- p->header.length = sizeof(struct smbios_type_17);
- p->header.handle = 0x1100;
-
- p->physical_memory_array_handle = 0x1000;
- p->total_width = 64;
- p->data_width = 64;
- /* truncate memory_size_mb to 16 bits and clear most significant
- bit [indicates size in MB] */
- p->size = (uint16_t) memory_size_mb & 0x7fff;
- p->form_factor = 0x09; /* DIMM */
- p->device_set = 0;
- p->device_locator_str = 1;
- p->bank_locator_str = 0;
- p->memory_type = 0x07; /* RAM */
- p->type_detail = 0;
-
- start += sizeof(struct smbios_type_17);
- strcpy((char *)start, "DIMM 1");
- start += strlen("DIMM 1") + 1;
- *((uint8_t *)start) = 0;
-
- return start+1;
+ struct smbios_type_17 *p = (struct smbios_type_17 *)start;
+
+ p->header.type = 17;
+ p->header.length = sizeof(struct smbios_type_17);
+ p->header.handle = 0x1100;
+
+ p->physical_memory_array_handle = 0x1000;
+ p->total_width = 64;
+ p->data_width = 64;
+ /* truncate memory_size_mb to 16 bits and clear most significant
+ bit [indicates size in MB] */
+ p->size = (uint16_t) memory_size_mb & 0x7fff;
+ p->form_factor = 0x09; /* DIMM */
+ p->device_set = 0;
+ p->device_locator_str = 1;
+ p->bank_locator_str = 0;
+ p->memory_type = 0x07; /* RAM */
+ p->type_detail = 0;
+
+ start += sizeof(struct smbios_type_17);
+ strcpy((char *)start, "DIMM 1");
+ start += strlen("DIMM 1") + 1;
+ *((uint8_t *)start) = 0;
+
+ return start+1;
}
/* Type 19 -- Memory Array Mapped Address */
static void *
smbios_type_19_init(void *start, uint32_t memory_size_mb)
{
- struct smbios_type_19 *p = (struct smbios_type_19 *)start;
-
- p->header.type = 19;
- p->header.length = sizeof(struct smbios_type_19);
- p->header.handle = 0x1300;
-
- p->starting_address = 0;
- p->ending_address = (memory_size_mb-1) * 1024;
- p->memory_array_handle = 0x1000;
- p->partition_width = 1;
-
- start += sizeof(struct smbios_type_19);
- *((uint16_t *)start) = 0;
- return start + 2;
+ struct smbios_type_19 *p = (struct smbios_type_19 *)start;
+
+ p->header.type = 19;
+ p->header.length = sizeof(struct smbios_type_19);
+ p->header.handle = 0x1300;
+
+ p->starting_address = 0;
+ p->ending_address = (memory_size_mb-1) * 1024;
+ p->memory_array_handle = 0x1000;
+ p->partition_width = 1;
+
+ start += sizeof(struct smbios_type_19);
+ *((uint16_t *)start) = 0;
+ return start + 2;
}
/* Type 20 -- Memory Device Mapped Address */
static void *
smbios_type_20_init(void *start, uint32_t memory_size_mb)
{
- struct smbios_type_20 *p = (struct smbios_type_20 *)start;
-
- p->header.type = 20;
- p->header.length = sizeof(struct smbios_type_20);
- p->header.handle = 0x1400;
-
- p->starting_address = 0;
- p->ending_address = (memory_size_mb-1)*1024;
- p->memory_device_handle = 0x1100;
- p->memory_array_mapped_address_handle = 0x1300;
- p->partition_row_position = 1;
- p->interleave_position = 0;
- p->interleaved_data_depth = 0;
-
- start += sizeof(struct smbios_type_20);
-
- *((uint16_t *)start) = 0;
- return start+2;
+ struct smbios_type_20 *p = (struct smbios_type_20 *)start;
+
+ p->header.type = 20;
+ p->header.length = sizeof(struct smbios_type_20);
+ p->header.handle = 0x1400;
+
+ p->starting_address = 0;
+ p->ending_address = (memory_size_mb-1)*1024;
+ p->memory_device_handle = 0x1100;
+ p->memory_array_mapped_address_handle = 0x1300;
+ p->partition_row_position = 1;
+ p->interleave_position = 0;
+ p->interleaved_data_depth = 0;
+
+ start += sizeof(struct smbios_type_20);
+
+ *((uint16_t *)start) = 0;
+ return start+2;
}
/* Type 32 -- System Boot Information */
static void *
smbios_type_32_init(void *start)
{
- struct smbios_type_32 *p = (struct smbios_type_32 *)start;
-
- p->header.type = 32;
- p->header.length = sizeof(struct smbios_type_32);
- p->header.handle = 0x2000;
- memset(p->reserved, 0, 6);
- p->boot_status = 0; /* no errors detected */
-
- start += sizeof(struct smbios_type_32);
- *((uint16_t *)start) = 0;
- return start+2;
+ struct smbios_type_32 *p = (struct smbios_type_32 *)start;
+
+ p->header.type = 32;
+ p->header.length = sizeof(struct smbios_type_32);
+ p->header.handle = 0x2000;
+ memset(p->reserved, 0, 6);
+ p->boot_status = 0; /* no errors detected */
+
+ start += sizeof(struct smbios_type_32);
+ *((uint16_t *)start) = 0;
+ return start+2;
}
/* Type 127 -- End of Table */
static void *
smbios_type_127_init(void *start)
{
- struct smbios_type_127 *p = (struct smbios_type_127 *)start;
-
- p->header.type = 127;
- p->header.length = sizeof(struct smbios_type_127);
- p->header.handle = 0x7f00;
-
- start += sizeof(struct smbios_type_127);
- *((uint16_t *)start) = 0;
- return start + 2;
-}
+ struct smbios_type_127 *p = (struct smbios_type_127 *)start;
+
+ p->header.type = 127;
+ p->header.length = sizeof(struct smbios_type_127);
+ p->header.handle = 0x7f00;
+
+ start += sizeof(struct smbios_type_127);
+ *((uint16_t *)start) = 0;
+ return start + 2;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/firmware/hvmloader/util.c
--- a/tools/firmware/hvmloader/util.c Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/firmware/hvmloader/util.c Tue Nov 28 10:37:36 2006 -0700
@@ -20,175 +20,194 @@
#include "acpi/acpi2_0.h" /* for ACPI_PHYSICAL_ADDRESS */
#include "util.h"
+#include "config.h"
#include <stdint.h>
+#include <xenctrl.h>
+#include <xen/hvm/hvm_info_table.h>
+
+void outb(uint16_t addr, uint8_t val)
+{
+ __asm__ __volatile__ ( "outb %%al, %%dx" :: "d"(addr), "a"(val) );
+}
void outw(uint16_t addr, uint16_t val)
{
- __asm__ __volatile__ ("outw %%ax, %%dx" :: "d"(addr), "a"(val));
-}
-
-void outb(uint16_t addr, uint8_t val)
-{
- __asm__ __volatile__ ("outb %%al, %%dx" :: "d"(addr), "a"(val));
+ __asm__ __volatile__ ( "outw %%ax, %%dx" :: "d"(addr), "a"(val) );
+}
+
+void outl(uint16_t addr, uint32_t val)
+{
+ __asm__ __volatile__ ( "outl %%eax, %%dx" :: "d"(addr), "a"(val) );
}
uint8_t inb(uint16_t addr)
{
- uint8_t val;
- __asm__ __volatile__ ("inb %w1,%0" : "=a" (val) : "Nd" (addr));
- return val;
+ uint8_t val;
+ __asm__ __volatile__ ( "inb %%dx,%%al" : "=a" (val) : "d" (addr) );
+ return val;
+}
+
+uint16_t inw(uint16_t addr)
+{
+ uint16_t val;
+ __asm__ __volatile__ ( "inw %%dx,%%ax" : "=a" (val) : "d" (addr) );
+ return val;
+}
+
+uint32_t inl(uint16_t addr)
+{
+ uint32_t val;
+ __asm__ __volatile__ ( "inl %%dx,%%eax" : "=a" (val) : "d" (addr) );
+ return val;
}
char *itoa(char *a, unsigned int i)
{
- unsigned int _i = i, x = 0;
-
- do {
- x++;
- _i /= 10;
- } while (_i != 0);
-
- a += x;
- *a-- = '\0';
-
- do {
- *a-- = (i % 10) + '0';
- i /= 10;
- } while (i != 0);
-
- return a + 1;
+ unsigned int _i = i, x = 0;
+
+ do {
+ x++;
+ _i /= 10;
+ } while ( _i != 0 );
+
+ a += x;
+ *a-- = '\0';
+
+ do {
+ *a-- = (i % 10) + '0';
+ i /= 10;
+ } while ( i != 0 );
+
+ return a + 1;
}
int strcmp(const char *cs, const char *ct)
{
- signed char res;
-
- while (((res = *cs - *ct++) == 0) && (*cs++ != '\0'))
- continue;
-
- return res;
+ signed char res;
+
+ while ( ((res = *cs - *ct++) == 0) && (*cs++ != '\0') )
+ continue;
+
+ return res;
}
void *memcpy(void *dest, const void *src, unsigned n)
{
- int t0, t1, t2;
-
- __asm__ __volatile__(
- "cld\n"
- "rep; movsl\n"
- "testb $2,%b4\n"
- "je 1f\n"
- "movsw\n"
- "1: testb $1,%b4\n"
- "je 2f\n"
- "movsb\n"
- "2:"
- : "=&c" (t0), "=&D" (t1), "=&S" (t2)
- : "0" (n/4), "q" (n), "1" ((long) dest), "2" ((long) src)
- : "memory"
- );
- return dest;
+ int t0, t1, t2;
+
+ __asm__ __volatile__ (
+ "cld\n"
+ "rep; movsl\n"
+ "testb $2,%b4\n"
+ "je 1f\n"
+ "movsw\n"
+ "1: testb $1,%b4\n"
+ "je 2f\n"
+ "movsb\n"
+ "2:"
+ : "=&c" (t0), "=&D" (t1), "=&S" (t2)
+ : "0" (n/4), "q" (n), "1" ((long) dest), "2" ((long) src)
+ : "memory" );
+ return dest;
}
void *memmove(void *dest, const void *src, unsigned n)
{
- if ((long)dest > (long)src) {
- n--;
- while (n > 0) {
- ((char *)dest)[n] = ((char *)src)[n];
- n--;
- }
- } else {
- memcpy(dest, src, n);
- }
- return dest;
-}
-
-
-
-
-void puts(const char *s)
-{
- while (*s)
- outb(0xE9, *s++);
+ if ( (long)dest > (long)src )
+ {
+ n--;
+ while ( n > 0 )
+ {
+ ((char *)dest)[n] = ((char *)src)[n];
+ n--;
+ }
+ }
+ else
+ {
+ memcpy(dest, src, n);
+ }
+ return dest;
}
char *
strcpy(char *dest, const char *src)
{
- char *p = dest;
- while (*src)
- *p++ = *src++;
- *p = 0;
- return dest;
+ char *p = dest;
+ while ( *src )
+ *p++ = *src++;
+ *p = 0;
+ return dest;
}
char *
strncpy(char *dest, const char *src, unsigned n)
{
- int i = 0;
- char *p = dest;
-
- /* write non-NUL characters from src into dest until we run
- out of room in dest or encounter a NUL in src */
- while (i < n && *src) {
- *p++ = *src++;
- ++i;
- }
-
- /* pad remaining bytes of dest with NUL bytes */
- while (i < n) {
- *p++ = 0;
- ++i;
- }
-
- return dest;
+ int i = 0;
+ char *p = dest;
+
+ /* write non-NUL characters from src into dest until we run
+ out of room in dest or encounter a NUL in src */
+ while ( (i < n) && *src )
+ {
+ *p++ = *src++;
+ i++;
+ }
+
+ /* pad remaining bytes of dest with NUL bytes */
+ while ( i < n )
+ {
+ *p++ = 0;
+ i++;
+ }
+
+ return dest;
}
unsigned
strlen(const char *s)
{
- int i = 0;
- while (*s++)
- ++i;
- return i;
+ int i = 0;
+ while ( *s++ )
+ i++;
+ return i;
}
void *
memset(void *s, int c, unsigned n)
{
- uint8_t b = (uint8_t) c;
- uint8_t *p = (uint8_t *)s;
- int i;
- for (i = 0; i < n; ++i)
- *p++ = b;
- return s;
+ uint8_t b = (uint8_t) c;
+ uint8_t *p = (uint8_t *)s;
+ int i;
+ for ( i = 0; i < n; i++ )
+ *p++ = b;
+ return s;
}
int
memcmp(const void *s1, const void *s2, unsigned n)
{
- unsigned i;
- uint8_t *p1 = (uint8_t *) s1;
- uint8_t *p2 = (uint8_t *) s2;
-
- for (i = 0; i < n; ++i) {
- if (p1[i] < p2[i])
- return -1;
- else if (p1[i] > p2[i])
- return 1;
- }
-
- return 0;
+ unsigned i;
+ uint8_t *p1 = (uint8_t *) s1;
+ uint8_t *p2 = (uint8_t *) s2;
+
+ for ( i = 0; i < n; i++ )
+ {
+ if ( p1[i] < p2[i] )
+ return -1;
+ else if ( p1[i] > p2[i] )
+ return 1;
+ }
+
+ return 0;
}
void
cpuid(uint32_t idx, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
{
- __asm__ __volatile__(
- "cpuid"
- : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx)
- : "0" (idx) );
+ __asm__ __volatile__ (
+ "cpuid"
+ : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx)
+ : "0" (idx) );
}
/* Write a two-character hex representation of 'byte' to digits[].
@@ -196,18 +215,18 @@ void
void
byte_to_hex(char *digits, uint8_t byte)
{
- uint8_t nybbel = byte >> 4;
-
- if (nybbel > 9)
- digits[0] = 'a' + nybbel-10;
- else
- digits[0] = '0' + nybbel;
-
- nybbel = byte & 0x0f;
- if (nybbel > 9)
- digits[1] = 'a' + nybbel-10;
- else
- digits[1] = '0' + nybbel;
+ uint8_t nybbel = byte >> 4;
+
+ if ( nybbel > 9 )
+ digits[0] = 'a' + nybbel-10;
+ else
+ digits[0] = '0' + nybbel;
+
+ nybbel = byte & 0x0f;
+ if ( nybbel > 9 )
+ digits[1] = 'a' + nybbel-10;
+ else
+ digits[1] = '0' + nybbel;
}
/* Convert an array of 16 unsigned bytes to a DCE/OSF formatted UUID
@@ -217,34 +236,39 @@ void
void
uuid_to_string(char *dest, uint8_t *uuid)
{
- int i = 0;
- char *p = dest;
-
- for (i = 0; i < 4; ++i) {
- byte_to_hex(p, uuid[i]);
- p += 2;
- }
- *p++ = '-';
- for (i = 4; i < 6; ++i) {
- byte_to_hex(p, uuid[i]);
- p += 2;
- }
- *p++ = '-';
- for (i = 6; i < 8; ++i) {
- byte_to_hex(p, uuid[i]);
- p += 2;
- }
- *p++ = '-';
- for (i = 8; i < 10; ++i) {
- byte_to_hex(p, uuid[i]);
- p += 2;
- }
- *p++ = '-';
- for (i = 10; i < 16; ++i) {
- byte_to_hex(p, uuid[i]);
- p += 2;
- }
- *p = 0;
+ int i = 0;
+ char *p = dest;
+
+ for ( i = 0; i < 4; i++ )
+ {
+ byte_to_hex(p, uuid[i]);
+ p += 2;
+ }
+ *p++ = '-';
+ for ( i = 4; i < 6; i++ )
+ {
+ byte_to_hex(p, uuid[i]);
+ p += 2;
+ }
+ *p++ = '-';
+ for ( i = 6; i < 8; i++ )
+ {
+ byte_to_hex(p, uuid[i]);
+ p += 2;
+ }
+ *p++ = '-';
+ for ( i = 8; i < 10; i++ )
+ {
+ byte_to_hex(p, uuid[i]);
+ p += 2;
+ }
+ *p++ = '-';
+ for ( i = 10; i < 16; i++ )
+ {
+ byte_to_hex(p, uuid[i]);
+ p += 2;
+ }
+ *p = '\0';
}
#include <xen/hvm/e820.h>
@@ -252,31 +276,286 @@ uuid_to_string(char *dest, uint8_t *uuid
#define E820_MAP ((struct e820entry *)(E820_MAP_PAGE + E820_MAP_OFFSET))
uint64_t e820_malloc(uint64_t size, uint32_t type, uint64_t mask)
{
- uint64_t addr = 0;
- int c = *E820_MAP_NR - 1;
- struct e820entry *e820entry = (struct e820entry *)E820_MAP;
-
- while (c >= 0) {
- if (e820entry[c].type == E820_RAM &&
- (e820entry[c].addr & (~mask)) == 0 &&
- e820entry[c].size >= size) {
- addr = e820entry[c].addr;
- if (e820entry[c].size != size) {
- (*E820_MAP_NR)++;
- memmove(&e820entry[c+1],
- &e820entry[c],
- (*E820_MAP_NR - c) *
- sizeof(struct e820entry));
- e820entry[c].size -= size;
- addr += e820entry[c].size;
- c++;
- }
- e820entry[c].addr = addr;
- e820entry[c].size = size;
- e820entry[c].type = type;
- break;
- }
- c--;
- }
- return addr;
-}
+ uint64_t addr = 0;
+ int c = *E820_MAP_NR - 1;
+ struct e820entry *e820entry = (struct e820entry *)E820_MAP;
+
+ while ( c >= 0 )
+ {
+ if ( (e820entry[c].type == E820_RAM) &&
+ ((e820entry[c].addr & (~mask)) == 0) &&
+ (e820entry[c].size >= size) )
+ {
+ addr = e820entry[c].addr;
+ if ( e820entry[c].size != size )
+ {
+ (*E820_MAP_NR)++;
+ memmove(&e820entry[c+1],
+ &e820entry[c],
+ (*E820_MAP_NR - c) *
+ sizeof(struct e820entry));
+ e820entry[c].size -= size;
+ addr += e820entry[c].size;
+ c++;
+ }
+ e820entry[c].addr = addr;
+ e820entry[c].size = size;
+ e820entry[c].type = type;
+ break;
+ }
+ c--;
+ }
+ return addr;
+}
+
+uint32_t ioapic_read(uint32_t reg)
+{
+ *(volatile uint32_t *)(IOAPIC_BASE_ADDRESS + 0x00) = reg;
+ return *(volatile uint32_t *)(IOAPIC_BASE_ADDRESS + 0x10);
+}
+
+void ioapic_write(uint32_t reg, uint32_t val)
+{
+ *(volatile uint32_t *)(IOAPIC_BASE_ADDRESS + 0x00) = reg;
+ *(volatile uint32_t *)(IOAPIC_BASE_ADDRESS + 0x10) = val;
+}
+
+uint32_t lapic_read(uint32_t reg)
+{
+ return *(volatile uint32_t *)(LAPIC_BASE_ADDRESS + reg);
+}
+
+void lapic_write(uint32_t reg, uint32_t val)
+{
+ *(volatile uint32_t *)(LAPIC_BASE_ADDRESS + reg) = val;
+}
+
+#define PCI_CONF1_ADDRESS(bus, devfn, reg) \
+ (0x80000000 | (bus << 16) | (devfn << 8) | (reg & ~3))
+
+uint32_t pci_read(uint32_t devfn, uint32_t reg, uint32_t len)
+{
+ outl(0xcf8, PCI_CONF1_ADDRESS(0, devfn, reg));
+
+ switch ( len )
+ {
+ case 1: return inb(0xcfc + (reg & 3));
+ case 2: return inw(0xcfc + (reg & 2));
+ }
+
+ return inl(0xcfc);
+}
+
+void pci_write(uint32_t devfn, uint32_t reg, uint32_t len, uint32_t val)
+{
+ outl(0xcf8, PCI_CONF1_ADDRESS(0, devfn, reg));
+
+ switch ( len )
+ {
+ case 1: outb(0xcfc + (reg & 3), val); break;
+ case 2: outw(0xcfc + (reg & 2), val); break;
+ case 4: outl(0xcfc, val); break;
+ }
+}
+
+static char *printnum(char *p, unsigned long num, int base)
+{
+ unsigned long n;
+
+ if ( (n = num/base) > 0 )
+ p = printnum(p, n, base);
+ *p++ = "0123456789abcdef"[(int)(num % base)];
+ *p = '\0';
+ return p;
+}
+
+static void _doprint(void (*put)(char), char const *fmt, va_list ap)
+{
+ register char *str, c;
+ int lflag, zflag, nflag;
+ char buffer[17];
+ unsigned value;
+ int i, slen, pad;
+
+ for ( ; *fmt != '\0'; fmt++ )
+ {
+ if ( *fmt != '%' )
+ {
+ put(*fmt);
+ continue;
+ }
+
+ pad = zflag = nflag = lflag = 0;
+ c = *++fmt;
+ if ( (c == '-') || isdigit(c) )
+ {
+ if ( c == '-' )
+ {
+ nflag = 1;
+ c = *++fmt;
+ }
+ zflag = c == '0';
+ for ( pad = 0; isdigit(c); c = *++fmt )
+ pad = (pad * 10) + c - '0';
+ }
+ if ( c == 'l' ) /* long extension */
+ {
+ lflag = 1;
+ c = *++fmt;
+ }
+ if ( (c == 'd') || (c == 'u') || (c == 'o') || (c == 'x') )
+ {
+ if ( lflag )
+ value = va_arg(ap, unsigned);
+ else
+ value = (unsigned) va_arg(ap, unsigned int);
+ str = buffer;
+ printnum(str, value,
+ c == 'o' ? 8 : (c == 'x' ? 16 : 10));
+ goto printn;
+ }
+ else if ( (c == 'O') || (c == 'D') || (c == 'X') )
+ {
+ value = va_arg(ap, unsigned);
+ str = buffer;
+ printnum(str, value,
+ c == 'O' ? 8 : (c == 'X' ? 16 : 10));
+ printn:
+ slen = strlen(str);
+ for ( i = pad - slen; i > 0; i-- )
+ put(zflag ? '0' : ' ');
+ while ( *str )
+ put(*str++);
+ }
+ else if ( c == 's' )
+ {
+ str = va_arg(ap, char *);
+ slen = strlen(str);
+ if ( nflag == 0 )
+ for ( i = pad - slen; i > 0; i-- )
+ put(' ');
+ while ( *str )
+ put(*str++);
+ if ( nflag )
+ for ( i = pad - slen; i > 0; i-- )
+ put(' ');
+ }
+ else if ( c == 'c' )
+ {
+ put(va_arg(ap, int));
+ }
+ else
+ {
+ put(*fmt);
+ }
+ }
+}
+
+static void putchar(char c)
+{
+ outb(0xe9, c);
+}
+
+int printf(const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ _doprint(putchar, fmt, ap);
+ va_end(ap);
+
+ return 0;
+}
+
+int vprintf(const char *fmt, va_list ap)
+{
+ _doprint(putchar, fmt, ap);
+ return 0;
+}
+
+void __assert_failed(char *assertion, char *file, int line)
+{
+ printf("HVMLoader assertion '%s' failed at %s:%d\n",
+ assertion, file, line);
+ for ( ; ; )
+ __asm__ __volatile__ ( "ud2" );
+}
+
+void __bug(char *file, int line)
+{
+ printf("HVMLoader bug at %s:%d\n", file, line);
+ for ( ; ; )
+ __asm__ __volatile__ ( "ud2" );
+}
+
+static int validate_hvm_info(struct hvm_info_table *t)
+{
+ char signature[] = "HVM INFO";
+ uint8_t *ptr = (uint8_t *)t;
+ uint8_t sum = 0;
+ int i;
+
+ /* strncmp(t->signature, "HVM INFO", 8) */
+ for ( i = 0; i < 8; i++ )
+ {
+ if ( signature[i] != t->signature[i] )
+ {
+ printf("Bad hvm info signature\n");
+ return 0;
+ }
+ }
+
+ for ( i = 0; i < t->length; i++ )
+ sum += ptr[i];
+
+ return (sum == 0);
+}
+
+static struct hvm_info_table *get_hvm_info_table(void)
+{
+ static struct hvm_info_table *table;
+ struct hvm_info_table *t;
+
+ if ( table != NULL )
+ return table;
+
+ t = (struct hvm_info_table *)HVM_INFO_PADDR;
+
+ if ( !validate_hvm_info(t) )
+ {
+ printf("Bad hvm info table\n");
+ return NULL;
+ }
+
+ table = t;
+
+ return table;
+}
+
+int get_vcpu_nr(void)
+{
+ struct hvm_info_table *t = get_hvm_info_table();
+ return (t ? t->nr_vcpus : 1);
+}
+
+int get_acpi_enabled(void)
+{
+ struct hvm_info_table *t = get_hvm_info_table();
+ return (t ? t->acpi_enabled : 1);
+}
+
+int get_apic_mode(void)
+{
+ struct hvm_info_table *t = get_hvm_info_table();
+ return (t ? t->apic_mode : 1);
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/firmware/hvmloader/util.h
--- a/tools/firmware/hvmloader/util.h Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/firmware/hvmloader/util.h Tue Nov 28 10:37:36 2006 -0700
@@ -1,19 +1,52 @@
#ifndef __HVMLOADER_UTIL_H__
#define __HVMLOADER_UTIL_H__
+#include <stdarg.h>
+
+#undef offsetof
+#define offsetof(t, m) ((unsigned long)&((t *)0)->m)
+
+extern void __assert_failed(char *assertion, char *file, int line)
+ __attribute__((noreturn));
+#define ASSERT(p) \
+ do { if (!(p)) __assert_failed(#p, __FILE__, __LINE__); } while (0)
+extern void __bug(char *file, int line) __attribute__((noreturn));
+#define BUG() __bug()
+
/* I/O output */
+void outb(uint16_t addr, uint8_t val);
void outw(uint16_t addr, uint16_t val);
-void outb(uint16_t addr, uint8_t val);
+void outl(uint16_t addr, uint32_t val);
/* I/O input */
-uint8_t inb(uint16_t addr);
+uint8_t inb(uint16_t addr);
+uint16_t inw(uint16_t addr);
+uint32_t inl(uint16_t addr);
+
+/* APIC access */
+uint32_t ioapic_read(uint32_t reg);
+void ioapic_write(uint32_t reg, uint32_t val);
+uint32_t lapic_read(uint32_t reg);
+void lapic_write(uint32_t reg, uint32_t val);
+
+/* PCI access */
+uint32_t pci_read(uint32_t devfn, uint32_t reg, uint32_t len);
+#define pci_readb(devfn, reg) ((uint8_t) pci_read(devfn, reg, 1))
+#define pci_readw(devfn, reg) ((uint16_t)pci_read(devfn, reg, 2))
+#define pci_readl(devfn, reg) ((uint32_t)pci_read(devfn, reg, 4))
+void pci_write(uint32_t devfn, uint32_t reg, uint32_t len, uint32_t val);
+#define pci_writeb(devfn, reg, val) (pci_write(devfn, reg, 1, (uint8_t) val))
+#define pci_writew(devfn, reg, val) (pci_write(devfn, reg, 2, (uint16_t)val))
+#define pci_writel(devfn, reg, val) (pci_write(devfn, reg, 4, (uint32_t)val))
/* Do cpuid instruction, with operation 'idx' */
void cpuid(uint32_t idx, uint32_t *eax, uint32_t *ebx,
uint32_t *ecx, uint32_t *edx);
-/* Return number of vcpus. */
+/* HVM-builder info. */
int get_vcpu_nr(void);
+int get_acpi_enabled(void);
+int get_apic_mode(void);
/* String and memory functions */
int strcmp(const char *cs, const char *ct);
@@ -31,15 +64,16 @@ void byte_to_hex(char *digits, uint8_t b
void byte_to_hex(char *digits, uint8_t byte);
/* Convert an array of 16 unsigned bytes to a DCE/OSF formatted UUID
- string.
-
- Pre-condition: sizeof(dest) >= 37 */
+ string. Pre-condition: sizeof(dest) >= 37 */
void uuid_to_string(char *dest, uint8_t *uuid);
/* Debug output */
-void puts(const char *s);
+int printf(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
+int vprintf(const char *fmt, va_list ap);
/* Allocate region of specified type in the e820 table. */
uint64_t e820_malloc(uint64_t size, uint32_t type, uint64_t mask);
+#define isdigit(c) ((c) >= '0' && (c) <= '9')
+
#endif /* __HVMLOADER_UTIL_H__ */
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/firmware/rombios/rombios.c
--- a/tools/firmware/rombios/rombios.c Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/firmware/rombios/rombios.c Tue Nov 28 10:37:36 2006 -0700
@@ -9103,79 +9103,79 @@ pci_routing_table_structure:
;; first slot entry PCI-to-ISA (embedded)
db 0 ;; pci bus number
db 0x08 ;; pci device number (bit 7-3)
- db 0x60 ;; link value INTA#: pointer into PCI2ISA config space
- dw 0xdef8 ;; IRQ bitmap INTA#
- db 0x61 ;; link value INTB#
- dw 0xdef8 ;; IRQ bitmap INTB#
- db 0x62 ;; link value INTC#
- dw 0xdef8 ;; IRQ bitmap INTC#
- db 0x63 ;; link value INTD#
- dw 0xdef8 ;; IRQ bitmap INTD#
+ db 0x61 ;; link value INTA#: pointer into PCI2ISA config space
+ dw 0x0c60 ;; IRQ bitmap INTA#
+ db 0x62 ;; link value INTB#
+ dw 0x0c60 ;; IRQ bitmap INTB#
+ db 0x63 ;; link value INTC#
+ dw 0x0c60 ;; IRQ bitmap INTC#
+ db 0x60 ;; link value INTD#
+ dw 0x0c60 ;; IRQ bitmap INTD#
db 0 ;; physical slot (0 = embedded)
db 0 ;; reserved
;; second slot entry: 1st PCI slot
db 0 ;; pci bus number
db 0x10 ;; pci device number (bit 7-3)
- db 0x61 ;; link value INTA#
- dw 0xdef8 ;; IRQ bitmap INTA#
- db 0x62 ;; link value INTB#
- dw 0xdef8 ;; IRQ bitmap INTB#
- db 0x63 ;; link value INTC#
- dw 0xdef8 ;; IRQ bitmap INTC#
- db 0x60 ;; link value INTD#
- dw 0xdef8 ;; IRQ bitmap INTD#
+ db 0x62 ;; link value INTA#
+ dw 0x0c60 ;; IRQ bitmap INTA#
+ db 0x63 ;; link value INTB#
+ dw 0x0c60 ;; IRQ bitmap INTB#
+ db 0x60 ;; link value INTC#
+ dw 0x0c60 ;; IRQ bitmap INTC#
+ db 0x61 ;; link value INTD#
+ dw 0x0c60 ;; IRQ bitmap INTD#
db 1 ;; physical slot (0 = embedded)
db 0 ;; reserved
;; third slot entry: 2nd PCI slot
db 0 ;; pci bus number
db 0x18 ;; pci device number (bit 7-3)
- db 0x62 ;; link value INTA#
- dw 0xdef8 ;; IRQ bitmap INTA#
- db 0x63 ;; link value INTB#
- dw 0xdef8 ;; IRQ bitmap INTB#
- db 0x60 ;; link value INTC#
- dw 0xdef8 ;; IRQ bitmap INTC#
- db 0x61 ;; link value INTD#
- dw 0xdef8 ;; IRQ bitmap INTD#
+ db 0x63 ;; link value INTA#
+ dw 0x0c60 ;; IRQ bitmap INTA#
+ db 0x60 ;; link value INTB#
+ dw 0x0c60 ;; IRQ bitmap INTB#
+ db 0x61 ;; link value INTC#
+ dw 0x0c60 ;; IRQ bitmap INTC#
+ db 0x62 ;; link value INTD#
+ dw 0x0c60 ;; IRQ bitmap INTD#
db 2 ;; physical slot (0 = embedded)
db 0 ;; reserved
;; 4th slot entry: 3rd PCI slot
db 0 ;; pci bus number
db 0x20 ;; pci device number (bit 7-3)
- db 0x63 ;; link value INTA#
- dw 0xdef8 ;; IRQ bitmap INTA#
- db 0x60 ;; link value INTB#
- dw 0xdef8 ;; IRQ bitmap INTB#
- db 0x61 ;; link value INTC#
- dw 0xdef8 ;; IRQ bitmap INTC#
- db 0x62 ;; link value INTD#
- dw 0xdef8 ;; IRQ bitmap INTD#
+ db 0x60 ;; link value INTA#
+ dw 0x0c60 ;; IRQ bitmap INTA#
+ db 0x61 ;; link value INTB#
+ dw 0x0c60 ;; IRQ bitmap INTB#
+ db 0x62 ;; link value INTC#
+ dw 0x0c60 ;; IRQ bitmap INTC#
+ db 0x63 ;; link value INTD#
+ dw 0x0c60 ;; IRQ bitmap INTD#
db 3 ;; physical slot (0 = embedded)
db 0 ;; reserved
;; 5th slot entry: 4rd PCI slot
db 0 ;; pci bus number
db 0x28 ;; pci device number (bit 7-3)
- db 0x60 ;; link value INTA#
- dw 0xdef8 ;; IRQ bitmap INTA#
- db 0x61 ;; link value INTB#
- dw 0xdef8 ;; IRQ bitmap INTB#
- db 0x62 ;; link value INTC#
- dw 0xdef8 ;; IRQ bitmap INTC#
- db 0x63 ;; link value INTD#
- dw 0xdef8 ;; IRQ bitmap INTD#
+ db 0x61 ;; link value INTA#
+ dw 0x0c60 ;; IRQ bitmap INTA#
+ db 0x62 ;; link value INTB#
+ dw 0x0c60 ;; IRQ bitmap INTB#
+ db 0x63 ;; link value INTC#
+ dw 0x0c60 ;; IRQ bitmap INTC#
+ db 0x60 ;; link value INTD#
+ dw 0x0c60 ;; IRQ bitmap INTD#
db 4 ;; physical slot (0 = embedded)
db 0 ;; reserved
;; 6th slot entry: 5rd PCI slot
db 0 ;; pci bus number
db 0x30 ;; pci device number (bit 7-3)
- db 0x61 ;; link value INTA#
- dw 0xdef8 ;; IRQ bitmap INTA#
- db 0x62 ;; link value INTB#
- dw 0xdef8 ;; IRQ bitmap INTB#
- db 0x63 ;; link value INTC#
- dw 0xdef8 ;; IRQ bitmap INTC#
- db 0x60 ;; link value INTD#
- dw 0xdef8 ;; IRQ bitmap INTD#
+ db 0x62 ;; link value INTA#
+ dw 0x0c60 ;; IRQ bitmap INTA#
+ db 0x63 ;; link value INTB#
+ dw 0x0c60 ;; IRQ bitmap INTB#
+ db 0x60 ;; link value INTC#
+ dw 0x0c60 ;; IRQ bitmap INTC#
+ db 0x61 ;; link value INTD#
+ dw 0x0c60 ;; IRQ bitmap INTD#
db 5 ;; physical slot (0 = embedded)
db 0 ;; reserved
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/firmware/vmxassist/util.c
--- a/tools/firmware/vmxassist/util.c Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/firmware/vmxassist/util.c Tue Nov 28 10:37:36 2006 -0700
@@ -62,14 +62,15 @@ dump_regs(struct regs *regs)
regs->eax, regs->ecx, regs->edx, regs->ebx);
printf("esp %8x ebp %8x esi %8x edi %8x\n",
regs->esp, regs->ebp, regs->esi, regs->edi);
- printf("eip %8x eflags %8x cs %8x ds %8x\n",
- regs->eip, regs->eflags, regs->cs, regs->ds);
- printf("es %8x fs %8x uss %8x uesp %8x\n",
- regs->es, regs->fs, regs->uss, regs->uesp);
+ printf("es %8x ds %8x fs %8x gs %8x\n",
+ regs->es, regs->ds, regs->fs, regs->gs);
+ printf("trapno %8x errno %8x\n", regs->trapno, regs->errno);
+ printf("eip %8x cs %8x eflags %8x\n",
+ regs->eip, regs->cs, regs->eflags);
+ printf("uesp %8x uss %8x \n",
+ regs->uesp, regs->uss);
printf("ves %8x vds %8x vfs %8x vgs %8x\n",
regs->ves, regs->vds, regs->vfs, regs->vgs);
- if (regs->trapno != -1 || regs->errno != -1)
- printf("trapno %8x errno %8x\n", regs->trapno, regs->errno);
printf("cr0 %8lx cr2 %8x cr3 %8lx cr4 %8lx\n",
(long)oldctx.cr0, get_cr2(),
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/firmware/vmxassist/vm86.h
--- a/tools/firmware/vmxassist/vm86.h Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/firmware/vmxassist/vm86.h Tue Nov 28 10:37:36 2006 -0700
@@ -33,11 +33,11 @@
#ifndef __ASSEMBLY__
struct regs {
- unsigned edi, esi, ebp, esp, ebx, edx, ecx, eax;
- unsigned ds, es, fs, gs;
- unsigned trapno, errno;
- unsigned eip, cs, eflags, uesp, uss;
- unsigned ves, vds, vfs, vgs;
+ unsigned edi, esi, ebp, esp, ebx, edx, ecx, eax;
+ unsigned es, ds, fs, gs;
+ unsigned trapno, errno;
+ unsigned eip, cs, eflags, uesp, uss;
+ unsigned ves, vds, vfs, vgs;
};
enum vm86_mode {
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/ioemu/Makefile.target
--- a/tools/ioemu/Makefile.target Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/ioemu/Makefile.target Tue Nov 28 10:37:36 2006 -0700
@@ -298,7 +298,7 @@ ifeq ($(ARCH),ia64)
ifeq ($(ARCH),ia64)
LIBOBJS=helper2.o exec-dm.o i8259-dm.o
else
-LIBOBJS=helper2.o exec-dm.o i8259-dm.o rtc-dm.o
+LIBOBJS=helper2.o exec-dm.o i8259-dm.o rtc-dm.o piix_pci-dm.o
endif
all: $(PROGS)
@@ -360,11 +360,11 @@ ifeq ($(TARGET_BASE_ARCH), i386)
# Hardware support
VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
ifeq ($(ARCH),ia64)
-VL_OBJS+= fdc.o mc146818rtc.o serial.o pc.o
+VL_OBJS+= fdc.o mc146818rtc.o serial.o pc.o piix_pci.o
else
VL_OBJS+= fdc.o serial.o pc.o
endif
-VL_OBJS+= cirrus_vga.o mixeng.o parallel.o acpi.o piix_pci.o
+VL_OBJS+= cirrus_vga.o mixeng.o parallel.o acpi.o
VL_OBJS+= usb-uhci.o
VL_OBJS+= piix4acpi.o
VL_OBJS+= xenstore.o
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/ioemu/hw/fdc.c
--- a/tools/ioemu/hw/fdc.c Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/ioemu/hw/fdc.c Tue Nov 28 10:37:36 2006 -0700
@@ -898,7 +898,7 @@ static void fdctrl_start_transfer (fdctr
fdctrl->data_len = fdctrl->fifo[8];
} else {
int tmp;
- fdctrl->data_len = 128 << fdctrl->fifo[5];
+ fdctrl->data_len = 128 << (fdctrl->fifo[5] > 7 ? 7 : fdctrl->fifo[5]);
tmp = (cur_drv->last_sect - ks + 1);
if (fdctrl->fifo[0] & 0x80)
tmp += cur_drv->last_sect;
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/ioemu/hw/pci.c
--- a/tools/ioemu/hw/pci.c Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/ioemu/hw/pci.c Tue Nov 28 10:37:36 2006 -0700
@@ -221,16 +221,23 @@ uint32_t pci_default_read_config(PCIDevi
uint32_t address, int len)
{
uint32_t val;
+
switch(len) {
+ default:
+ case 4:
+ if (address <= 0xfc) {
+ val = le32_to_cpu(*(uint32_t *)(d->config + address));
+ break;
+ }
+ /* fall through */
+ case 2:
+ if (address <= 0xfe) {
+ val = le16_to_cpu(*(uint16_t *)(d->config + address));
+ break;
+ }
+ /* fall through */
case 1:
val = d->config[address];
- break;
- case 2:
- val = le16_to_cpu(*(uint16_t *)(d->config + address));
- break;
- default:
- case 4:
- val = le32_to_cpu(*(uint32_t *)(d->config + address));
break;
}
return val;
@@ -333,7 +340,8 @@ void pci_default_write_config(PCIDevice
d->config[addr] = val;
}
- addr++;
+ if (++addr > 0xff)
+ break;
val >>= 8;
}
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/ioemu/target-i386-dm/i8259-dm.c
--- a/tools/ioemu/target-i386-dm/i8259-dm.c Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/ioemu/target-i386-dm/i8259-dm.c Tue Nov 28 10:37:36 2006 -0700
@@ -33,7 +33,7 @@ struct PicState2 {
void pic_set_irq_new(void *opaque, int irq, int level)
{
- xc_hvm_set_irq_level(xc_handle, domid, irq, level);
+ xc_hvm_set_isa_irq_level(xc_handle, domid, irq, level);
}
/* obsolete function */
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/ioemu/vl.c
--- a/tools/ioemu/vl.c Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/ioemu/vl.c Tue Nov 28 10:37:36 2006 -0700
@@ -2530,6 +2530,7 @@ static CharDriverState *qemu_chr_open_tc
int is_waitconnect = 1;
const char *ptr;
struct sockaddr_in saddr;
+ int opt;
if (parse_host_port(&saddr, host_str) < 0)
goto fail;
@@ -2598,6 +2599,8 @@ static CharDriverState *qemu_chr_open_tc
}
}
s->fd = fd;
+ opt = 1;
+ setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char *)&opt, sizeof(opt));
if (s->connected)
tcp_chr_connect(chr);
else
@@ -5784,9 +5787,6 @@ int set_mm_mapping(int xc_handle, uint32
unsigned long nr_pages, unsigned int address_bits,
xen_pfn_t *extent_start)
{
-#if 0
- int i;
-#endif
xc_dominfo_t info;
int err = 0;
@@ -5804,19 +5804,6 @@ int set_mm_mapping(int xc_handle, uint32
fprintf(stderr, "Failed to populate physmap\n");
return -1;
}
-
- err = xc_domain_translate_gpfn_list(xc_handle, domid, nr_pages,
- extent_start, extent_start);
- if (err) {
- fprintf(stderr, "Failed to translate gpfn list\n");
- return -1;
- }
-
-#if 0 /* Generates lots of log file output - turn on for debugging */
- for (i = 0; i < nr_pages; i++)
- fprintf(stderr, "set_map result i %x result %lx\n", i,
- extent_start[i]);
-#endif
return 0;
}
@@ -6422,12 +6409,6 @@ int main(int argc, char **argv)
#if defined(__i386__) || defined(__x86_64__)
for ( i = 0; i < tmp_nr_pages; i++)
page_array[i] = i;
- if (xc_domain_translate_gpfn_list(xc_handle, domid, tmp_nr_pages,
- page_array, page_array)) {
- fprintf(logfile, "xc_domain_translate_gpfn_list returned error %d\n",
- errno);
- exit(-1);
- }
phys_ram_base = xc_map_foreign_batch(xc_handle, domid,
PROT_READ|PROT_WRITE, page_array,
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/libfsimage/ext2fs/fsys_ext2fs.c
--- a/tools/libfsimage/ext2fs/fsys_ext2fs.c Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/libfsimage/ext2fs/fsys_ext2fs.c Tue Nov 28 10:37:36 2006 -0700
@@ -278,12 +278,19 @@ ffz (unsigned long word)
#elif defined(__powerpc__)
+#ifdef __powerpc64__
+#define PPC_CNTLZL "cntlzd"
+#else
+#define PPC_CNTLZL "cntlzw"
+#endif
+#define BITS_PER_LONG (sizeof(long) * 8)
+
static __inline__ int
__ilog2(unsigned long x)
{
int lz;
- asm (PPC_CNTLZL "%0,%1" : "=r" (lz) : "r" (x));
+ asm (PPC_CNTLZL " %0,%1" : "=r" (lz) : "r" (x));
return BITS_PER_LONG - 1 - lz;
}
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/libfsimage/reiserfs/fsys_reiserfs.c
--- a/tools/libfsimage/reiserfs/fsys_reiserfs.c Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/libfsimage/reiserfs/fsys_reiserfs.c Tue Nov 28 10:37:36 2006 -0700
@@ -403,12 +403,19 @@ grub_log2 (unsigned long word)
#elif defined(__powerpc__)
+#ifdef __powerpc64__
+#define PPC_CNTLZL "cntlzd"
+#else
+#define PPC_CNTLZL "cntlzw"
+#endif
+#define BITS_PER_LONG (sizeof(long) * 8)
+
static __inline__ int
__ilog2(unsigned long x)
{
int lz;
- asm (PPC_CNTLZL "%0,%1" : "=r" (lz) : "r" (x));
+ asm (PPC_CNTLZL " %0,%1" : "=r" (lz) : "r" (x));
return BITS_PER_LONG - 1 - lz;
}
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/libxc/xc_domain.c
--- a/tools/libxc/xc_domain.c Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/libxc/xc_domain.c Tue Nov 28 10:37:36 2006 -0700
@@ -428,22 +428,6 @@ int xc_domain_memory_populate_physmap(in
}
return err;
-}
-
-int xc_domain_translate_gpfn_list(int xc_handle,
- uint32_t domid,
- unsigned long nr_gpfns,
- xen_pfn_t *gpfn_list,
- xen_pfn_t *mfn_list)
-{
- struct xen_translate_gpfn_list op = {
- .domid = domid,
- .nr_gpfns = nr_gpfns,
- };
- set_xen_guest_handle(op.gpfn_list, gpfn_list);
- set_xen_guest_handle(op.mfn_list, mfn_list);
-
- return xc_memory_op(xc_handle, XENMEM_translate_gpfn_list, &op);
}
int xc_domain_max_vcpus(int xc_handle, uint32_t domid, unsigned int max)
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/libxc/xc_hvm_build.c
--- a/tools/libxc/xc_hvm_build.c Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/libxc/xc_hvm_build.c Tue Nov 28 10:37:36 2006 -0700
@@ -15,6 +15,8 @@
#include <xen/hvm/params.h>
#include <xen/hvm/e820.h>
+#define SCRATCH_PFN 0xFFFFF
+
#define HVM_LOADER_ENTR_ADDR 0x00100000
static int
parseelfimage(
@@ -24,8 +26,8 @@ loadelfimage(
char *elfbase, int xch, uint32_t dom, unsigned long *parray,
struct domain_setup_info *dsi);
-static void xc_set_hvm_param(int handle,
- domid_t dom, int param, unsigned long value)
+int xc_set_hvm_param(
+ int handle, domid_t dom, int param, unsigned long value)
{
DECLARE_HYPERCALL;
xen_hvm_param_t arg;
@@ -38,14 +40,30 @@ static void xc_set_hvm_param(int handle,
arg.index = param;
arg.value = value;
if ( lock_pages(&arg, sizeof(arg)) != 0 )
- {
- PERROR("Could not lock memory for set parameter");
- return;
- }
+ return -1;
rc = do_xen_hypercall(handle, &hypercall);
unlock_pages(&arg, sizeof(arg));
- if (rc < 0)
- PERROR("set HVM parameter failed (%d)", rc);
+ return rc;
+}
+
+int xc_get_hvm_param(
+ int handle, domid_t dom, int param, unsigned long *value)
+{
+ DECLARE_HYPERCALL;
+ xen_hvm_param_t arg;
+ int rc;
+
+ hypercall.op = __HYPERVISOR_hvm_op;
+ hypercall.arg[0] = HVMOP_get_param;
+ hypercall.arg[1] = (unsigned long)&arg;
+ arg.domid = dom;
+ arg.index = param;
+ if ( lock_pages(&arg, sizeof(arg)) != 0 )
+ return -1;
+ rc = do_xen_hypercall(handle, &hypercall);
+ unlock_pages(&arg, sizeof(arg));
+ *value = arg.value;
+ return rc;
}
static void build_e820map(void *e820_page, unsigned long long mem_size)
@@ -126,67 +144,16 @@ static void build_e820map(void *e820_pag
*(((unsigned char *)e820_page) + E820_MAP_NR_OFFSET) = nr_map;
}
-static void set_hvm_info_checksum(struct hvm_info_table *t)
-{
- uint8_t *ptr = (uint8_t *)t, sum = 0;
- unsigned int i;
-
- t->checksum = 0;
-
- for (i = 0; i < t->length; i++)
- sum += *ptr++;
-
- t->checksum = -sum;
-}
-
-/*
- * Use E820 reserved memory 0x9F800 to pass HVM info to hvmloader
- * hvmloader will use this info to set BIOS accordingly
- */
-static int set_hvm_info(int xc_handle, uint32_t dom,
- xen_pfn_t *pfn_list, unsigned int vcpus,
- unsigned int acpi)
-{
- char *va_map;
- struct hvm_info_table *va_hvm;
-
- va_map = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
- PROT_READ | PROT_WRITE,
- pfn_list[HVM_INFO_PFN]);
-
- if ( va_map == NULL )
- return -1;
-
- va_hvm = (struct hvm_info_table *)(va_map + HVM_INFO_OFFSET);
- memset(va_hvm, 0, sizeof(*va_hvm));
-
- strncpy(va_hvm->signature, "HVM INFO", 8);
- va_hvm->length = sizeof(struct hvm_info_table);
- va_hvm->acpi_enabled = acpi;
- va_hvm->nr_vcpus = vcpus;
-
- set_hvm_info_checksum(va_hvm);
-
- munmap(va_map, PAGE_SIZE);
-
- return 0;
-}
-
static int setup_guest(int xc_handle,
uint32_t dom, int memsize,
char *image, unsigned long image_size,
- vcpu_guest_context_t *ctxt,
- unsigned long shared_info_frame,
- unsigned int vcpus,
- unsigned int pae,
- unsigned int acpi,
- unsigned int store_evtchn,
- unsigned long *store_mfn)
+ vcpu_guest_context_t *ctxt)
{
xen_pfn_t *page_array = NULL;
unsigned long i, nr_pages = (unsigned long)memsize << (20 - PAGE_SHIFT);
unsigned long shared_page_nr;
- shared_info_t *shared_info;
+ struct xen_add_to_physmap xatp;
+ struct shared_info *shared_info;
void *e820_page;
struct domain_setup_info dsi;
uint64_t v_end;
@@ -245,38 +212,27 @@ static int setup_guest(int xc_handle,
goto error_out;
}
- if ( xc_domain_translate_gpfn_list(xc_handle, dom, nr_pages,
- page_array, page_array) )
- {
- PERROR("Could not translate addresses of HVM guest.\n");
- goto error_out;
- }
-
loadelfimage(image, xc_handle, dom, page_array, &dsi);
-
- if ( set_hvm_info(xc_handle, dom, page_array, vcpus, acpi) )
- {
- ERROR("Couldn't set hvm info for HVM guest.\n");
- goto error_out;
- }
-
- xc_set_hvm_param(xc_handle, dom, HVM_PARAM_PAE_ENABLED, pae);
if ( (e820_page = xc_map_foreign_range(
xc_handle, dom, PAGE_SIZE, PROT_READ | PROT_WRITE,
- page_array[E820_MAP_PAGE >> PAGE_SHIFT])) == NULL )
+ E820_MAP_PAGE >> PAGE_SHIFT)) == NULL )
goto error_out;
memset(e820_page, 0, PAGE_SIZE);
build_e820map(e820_page, v_end);
munmap(e820_page, PAGE_SIZE);
- /* shared_info page starts its life empty. */
- if ( (shared_info = xc_map_foreign_range(
- xc_handle, dom, PAGE_SIZE, PROT_READ | PROT_WRITE,
- shared_info_frame)) == NULL )
+ /* Map and initialise shared_info page. */
+ xatp.domid = dom;
+ xatp.space = XENMAPSPACE_shared_info;
+ xatp.idx = 0;
+ xatp.gpfn = SCRATCH_PFN;
+ if ( (xc_memory_op(xc_handle, XENMEM_add_to_physmap, &xatp) != 0) ||
+ ((shared_info = xc_map_foreign_range(
+ xc_handle, dom, PAGE_SIZE, PROT_READ | PROT_WRITE,
+ SCRATCH_PFN)) == NULL) )
goto error_out;
memset(shared_info, 0, PAGE_SIZE);
- /* Mask all upcalls... */
for ( i = 0; i < MAX_VIRT_CPUS; i++ )
shared_info->vcpu_info[i].evtchn_upcall_mask = 1;
memset(&shared_info->evtchn_mask[0], 0xff,
@@ -289,14 +245,12 @@ static int setup_guest(int xc_handle,
shared_page_nr = (v_end >> PAGE_SHIFT) - 1;
/* Paranoia: clean pages. */
- if ( xc_clear_domain_page(xc_handle, dom, page_array[shared_page_nr]) ||
- xc_clear_domain_page(xc_handle, dom, page_array[shared_page_nr-1]) ||
- xc_clear_domain_page(xc_handle, dom, page_array[shared_page_nr-2]) )
- goto error_out;
-
- *store_mfn = page_array[shared_page_nr - 1];
+ if ( xc_clear_domain_page(xc_handle, dom, shared_page_nr) ||
+ xc_clear_domain_page(xc_handle, dom, shared_page_nr-1) ||
+ xc_clear_domain_page(xc_handle, dom, shared_page_nr-2) )
+ goto error_out;
+
xc_set_hvm_param(xc_handle, dom, HVM_PARAM_STORE_PFN, shared_page_nr-1);
- xc_set_hvm_param(xc_handle, dom, HVM_PARAM_STORE_EVTCHN, store_evtchn);
xc_set_hvm_param(xc_handle, dom, HVM_PARAM_BUFIOREQ_PFN, shared_page_nr-2);
xc_set_hvm_param(xc_handle, dom, HVM_PARAM_IOREQ_PFN, shared_page_nr);
@@ -315,14 +269,9 @@ static int xc_hvm_build_internal(int xc_
uint32_t domid,
int memsize,
char *image,
- unsigned long image_size,
- unsigned int vcpus,
- unsigned int pae,
- unsigned int acpi,
- unsigned int store_evtchn,
- unsigned long *store_mfn)
-{
- struct xen_domctl launch_domctl, domctl;
+ unsigned long image_size)
+{
+ struct xen_domctl launch_domctl;
vcpu_guest_context_t ctxt;
int rc;
@@ -332,20 +281,9 @@ static int xc_hvm_build_internal(int xc_
goto error_out;
}
- domctl.cmd = XEN_DOMCTL_getdomaininfo;
- domctl.domain = (domid_t)domid;
- if ( (xc_domctl(xc_handle, &domctl) < 0) ||
- ((uint16_t)domctl.domain != domid) )
- {
- PERROR("Could not get info on domain");
- goto error_out;
- }
-
memset(&ctxt, 0, sizeof(ctxt));
- if ( setup_guest(xc_handle, domid, memsize, image, image_size,
- &ctxt, domctl.u.getdomaininfo.shared_info_frame,
- vcpus, pae, acpi, store_evtchn, store_mfn) < 0)
+ if ( setup_guest(xc_handle, domid, memsize, image, image_size, &ctxt) < 0 )
{
ERROR("Error constructing guest OS");
goto error_out;
@@ -507,12 +445,7 @@ int xc_hvm_build(int xc_handle,
int xc_hvm_build(int xc_handle,
uint32_t domid,
int memsize,
- const char *image_name,
- unsigned int vcpus,
- unsigned int pae,
- unsigned int acpi,
- unsigned int store_evtchn,
- unsigned long *store_mfn)
+ const char *image_name)
{
char *image;
int sts;
@@ -522,10 +455,7 @@ int xc_hvm_build(int xc_handle,
((image = xc_read_image(image_name, &image_size)) == NULL) )
return -1;
- sts = xc_hvm_build_internal(xc_handle, domid, memsize,
- image, image_size,
- vcpus, pae, acpi,
- store_evtchn, store_mfn);
+ sts = xc_hvm_build_internal(xc_handle, domid, memsize, image, image_size);
free(image);
@@ -542,12 +472,7 @@ int xc_hvm_build_mem(int xc_handle,
uint32_t domid,
int memsize,
const char *image_buffer,
- unsigned long image_size,
- unsigned int vcpus,
- unsigned int pae,
- unsigned int acpi,
- unsigned int store_evtchn,
- unsigned long *store_mfn)
+ unsigned long image_size)
{
int sts;
unsigned long img_len;
@@ -569,9 +494,7 @@ int xc_hvm_build_mem(int xc_handle,
}
sts = xc_hvm_build_internal(xc_handle, domid, memsize,
- img, img_len,
- vcpus, pae, acpi,
- store_evtchn, store_mfn);
+ img, img_len);
/* xc_inflate_buffer may return the original buffer pointer (for
for already inflated buffers), so exercise some care in freeing */
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/libxc/xc_linux_build.c
--- a/tools/libxc/xc_linux_build.c Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/libxc/xc_linux_build.c Tue Nov 28 10:37:36 2006 -0700
@@ -509,12 +509,6 @@ static int setup_guest(int xc_handle,
PERROR("Could not allocate memory for PV guest.\n");
goto error_out;
}
- if ( xc_domain_translate_gpfn_list(xc_handle, dom, nr_pages,
- page_array, page_array) )
- {
- PERROR("Could not translate addresses of PV guest.\n");
- goto error_out;
- }
dsi.v_start = round_pgdown(dsi.v_start);
vinitrd_start = round_pgup(dsi.v_end);
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/libxc/xc_linux_restore.c
--- a/tools/libxc/xc_linux_restore.c Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/libxc/xc_linux_restore.c Tue Nov 28 10:37:36 2006 -0700
@@ -265,13 +265,16 @@ int xc_linux_restore(int xc_handle, int
}
shared_info_frame = domctl.u.getdomaininfo.shared_info_frame;
- if(xc_domain_setmaxmem(xc_handle, dom, PFN_TO_KB(max_pfn)) != 0) {
+ if (xc_domain_setmaxmem(xc_handle, dom, PFN_TO_KB(max_pfn)) != 0) {
errno = ENOMEM;
goto out;
}
- if(xc_domain_memory_increase_reservation(
- xc_handle, dom, max_pfn, 0, 0, NULL) != 0) {
+ for ( pfn = 0; pfn < max_pfn; pfn++ )
+ p2m[pfn] = pfn;
+
+ if (xc_domain_memory_populate_physmap(xc_handle, dom, max_pfn,
+ 0, 0, p2m) != 0) {
ERROR("Failed to increase reservation by %lx KB", PFN_TO_KB(max_pfn));
errno = ENOMEM;
goto out;
@@ -279,17 +282,10 @@ int xc_linux_restore(int xc_handle, int
DPRINTF("Increased domain reservation by %lx KB\n", PFN_TO_KB(max_pfn));
- /* Build the pfn-to-mfn table. We choose MFN ordering returned by Xen. */
- if (xc_get_pfn_list(xc_handle, dom, p2m, max_pfn) != max_pfn) {
- ERROR("Did not read correct number of frame numbers for new dom");
- goto out;
- }
-
if(!(mmu = xc_init_mmu_updates(xc_handle, dom))) {
ERROR("Could not initialise for MMU updates");
goto out;
}
-
DPRINTF("Reloading memory pages: 0%%\n");
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/libxc/xc_misc.c
--- a/tools/libxc/xc_misc.c Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/libxc/xc_misc.c Tue Nov 28 10:37:36 2006 -0700
@@ -90,19 +90,83 @@ int xc_perfc_control(int xc_handle,
return rc;
}
-int xc_hvm_set_irq_level(int xc_handle, domid_t dom, int irq, int level)
+int xc_hvm_set_pci_intx_level(
+ int xc_handle, domid_t dom,
+ uint8_t domain, uint8_t bus, uint8_t device, uint8_t intx,
+ unsigned int level)
{
DECLARE_HYPERCALL;
- struct xen_hvm_set_irq_level arg;
+ struct xen_hvm_set_pci_intx_level arg;
int rc;
hypercall.op = __HYPERVISOR_hvm_op;
- hypercall.arg[0] = HVMOP_set_irq_level;
+ hypercall.arg[0] = HVMOP_set_pci_intx_level;
hypercall.arg[1] = (unsigned long)&arg;
- arg.domid = dom;
- arg.irq = irq;
- arg.level = level;
+ arg.domid = dom;
+ arg.domain = domain;
+ arg.bus = bus;
+ arg.device = device;
+ arg.intx = intx;
+ arg.level = level;
+
+ if ( mlock(&arg, sizeof(arg)) != 0 )
+ {
+ PERROR("Could not lock memory");
+ return -1;
+ }
+
+ rc = do_xen_hypercall(xc_handle, &hypercall);
+
+ safe_munlock(&arg, sizeof(arg));
+
+ return rc;
+}
+
+int xc_hvm_set_isa_irq_level(
+ int xc_handle, domid_t dom,
+ uint8_t isa_irq,
+ unsigned int level)
+{
+ DECLARE_HYPERCALL;
+ struct xen_hvm_set_isa_irq_level arg;
+ int rc;
+
+ hypercall.op = __HYPERVISOR_hvm_op;
+ hypercall.arg[0] = HVMOP_set_isa_irq_level;
+ hypercall.arg[1] = (unsigned long)&arg;
+
+ arg.domid = dom;
+ arg.isa_irq = isa_irq;
+ arg.level = level;
+
+ if ( mlock(&arg, sizeof(arg)) != 0 )
+ {
+ PERROR("Could not lock memory");
+ return -1;
+ }
+
+ rc = do_xen_hypercall(xc_handle, &hypercall);
+
+ safe_munlock(&arg, sizeof(arg));
+
+ return rc;
+}
+
+int xc_hvm_set_pci_link_route(
+ int xc_handle, domid_t dom, uint8_t link, uint8_t isa_irq)
+{
+ DECLARE_HYPERCALL;
+ struct xen_hvm_set_pci_link_route arg;
+ int rc;
+
+ hypercall.op = __HYPERVISOR_hvm_op;
+ hypercall.arg[0] = HVMOP_set_pci_link_route;
+ hypercall.arg[1] = (unsigned long)&arg;
+
+ arg.domid = dom;
+ arg.link = link;
+ arg.isa_irq = isa_irq;
if ( mlock(&arg, sizeof(arg)) != 0 )
{
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/libxc/xc_private.c
--- a/tools/libxc/xc_private.c Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/libxc/xc_private.c Tue Nov 28 10:37:36 2006 -0700
@@ -134,10 +134,7 @@ int xc_memory_op(int xc_handle,
DECLARE_HYPERCALL;
struct xen_memory_reservation *reservation = arg;
struct xen_machphys_mfn_list *xmml = arg;
- struct xen_translate_gpfn_list *trans = arg;
xen_pfn_t *extent_start;
- xen_pfn_t *gpfn_list;
- xen_pfn_t *mfn_list;
long ret = -EINVAL;
hypercall.op = __HYPERVISOR_memory_op;
@@ -183,28 +180,6 @@ int xc_memory_op(int xc_handle,
if ( lock_pages(arg, sizeof(struct xen_add_to_physmap)) )
{
PERROR("Could not lock");
- goto out1;
- }
- break;
- case XENMEM_translate_gpfn_list:
- if ( lock_pages(trans, sizeof(*trans)) != 0 )
- {
- PERROR("Could not lock");
- goto out1;
- }
- get_xen_guest_handle(gpfn_list, trans->gpfn_list);
- if ( lock_pages(gpfn_list, trans->nr_gpfns * sizeof(xen_pfn_t)) != 0 )
- {
- PERROR("Could not lock");
- unlock_pages(trans, sizeof(*trans));
- goto out1;
- }
- get_xen_guest_handle(mfn_list, trans->mfn_list);
- if ( lock_pages(mfn_list, trans->nr_gpfns * sizeof(xen_pfn_t)) != 0 )
- {
- PERROR("Could not lock");
- unlock_pages(gpfn_list, trans->nr_gpfns * sizeof(xen_pfn_t));
- unlock_pages(trans, sizeof(*trans));
goto out1;
}
break;
@@ -231,13 +206,6 @@ int xc_memory_op(int xc_handle,
break;
case XENMEM_add_to_physmap:
unlock_pages(arg, sizeof(struct xen_add_to_physmap));
- break;
- case XENMEM_translate_gpfn_list:
- get_xen_guest_handle(mfn_list, trans->mfn_list);
- unlock_pages(mfn_list, trans->nr_gpfns * sizeof(xen_pfn_t));
- get_xen_guest_handle(gpfn_list, trans->gpfn_list);
- unlock_pages(gpfn_list, trans->nr_gpfns * sizeof(xen_pfn_t));
- unlock_pages(trans, sizeof(*trans));
break;
}
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/libxc/xenctrl.h Tue Nov 28 10:37:36 2006 -0700
@@ -439,12 +439,6 @@ int xc_domain_memory_populate_physmap(in
unsigned int address_bits,
xen_pfn_t *extent_start);
-int xc_domain_translate_gpfn_list(int xc_handle,
- uint32_t domid,
- unsigned long nr_gpfns,
- xen_pfn_t *gpfn_list,
- xen_pfn_t *mfn_list);
-
int xc_domain_ioport_permission(int xc_handle,
uint32_t domid,
uint32_t first_port,
@@ -666,6 +660,16 @@ evtchn_port_t xc_evtchn_pending(int xce_
*/
int xc_evtchn_unmask(int xce_handle, evtchn_port_t port);
-int xc_hvm_set_irq_level(int xce_handle, domid_t dom, int irq, int level);
+int xc_hvm_set_pci_intx_level(
+ int xce_handle, domid_t dom,
+ uint8_t domain, uint8_t bus, uint8_t device, uint8_t intx,
+ unsigned int level);
+int xc_hvm_set_isa_irq_level(
+ int xce_handle, domid_t dom,
+ uint8_t isa_irq,
+ unsigned int level);
+
+int xc_hvm_set_pci_link_route(
+ int xce_handle, domid_t dom, uint8_t link, uint8_t isa_irq);
#endif
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/libxc/xenguest.h
--- a/tools/libxc/xenguest.h Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/libxc/xenguest.h Tue Nov 28 10:37:36 2006 -0700
@@ -109,22 +109,17 @@ int xc_hvm_build(int xc_handle,
int xc_hvm_build(int xc_handle,
uint32_t domid,
int memsize,
- const char *image_name,
- unsigned int vcpus,
- unsigned int pae,
- unsigned int acpi,
- unsigned int store_evtchn,
- unsigned long *store_mfn);
+ const char *image_name);
int xc_hvm_build_mem(int xc_handle,
uint32_t domid,
int memsize,
const char *image_buffer,
- unsigned long image_size,
- unsigned int vcpus,
- unsigned int pae,
- unsigned int acpi,
- unsigned int store_evtchn,
- unsigned long *store_mfn);
+ unsigned long image_size);
+
+int xc_set_hvm_param(
+ int handle, domid_t dom, int param, unsigned long value);
+int xc_get_hvm_param(
+ int handle, domid_t dom, int param, unsigned long *value);
#endif /* XENGUEST_H */
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/libxc/xg_private.c
--- a/tools/libxc/xg_private.c Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/libxc/xg_private.c Tue Nov 28 10:37:36 2006 -0700
@@ -192,12 +192,7 @@ __attribute__((weak)) int xc_hvm_build(
int xc_handle,
uint32_t domid,
int memsize,
- const char *image_name,
- unsigned int vcpus,
- unsigned int pae,
- unsigned int acpi,
- unsigned int store_evtchn,
- unsigned long *store_mfn)
+ const char *image_name)
{
return -ENOSYS;
}
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/python/README.XendConfig
--- a/tools/python/README.XendConfig Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/python/README.XendConfig Tue Nov 28 10:37:36 2006 -0700
@@ -123,6 +123,7 @@ otherConfig
image.hvm.vncconsole
image.hvm.pae
image.hvm.acpi (also in image.devices)
+ image.hvm.apic
image.hvm.devices.boot
image.hvm.devices.fda
image.hvm.devices.fdb
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/python/README.sxpcfg
--- a/tools/python/README.sxpcfg Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/python/README.sxpcfg Tue Nov 28 10:37:36 2006 -0700
@@ -56,6 +56,7 @@ image
- vncconsole
- pae
- acpi
+ - apic
(parseDeviceModel)
- boot
- fda
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/python/xen/lowlevel/xc/xc.c Tue Nov 28 10:37:36 2006 -0700
@@ -13,10 +13,13 @@
#include <netinet/tcp.h>
#include <sys/types.h>
#include <sys/socket.h>
+#include <sys/mman.h>
#include <netdb.h>
#include <arpa/inet.h>
#include "xenctrl.h"
+#include <xen/hvm/hvm_info_table.h>
+#include <xen/hvm/params.h>
/* Needed for Python versions earlier than 2.3. */
#ifndef PyMODINIT_FUNC
@@ -371,25 +374,45 @@ static PyObject *pyxc_hvm_build(XcObject
PyObject *kwds)
{
uint32_t dom;
+ struct hvm_info_table *va_hvm;
+ uint8_t *va_map, sum;
char *image;
- int store_evtchn;
- int memsize;
- int vcpus = 1;
- int pae = 0;
- int acpi = 0;
- unsigned long store_mfn = 0;
+ int i, store_evtchn, memsize, vcpus = 1, pae = 0, acpi = 0, apic = 1;
+ unsigned long store_mfn;
static char *kwd_list[] = { "domid", "store_evtchn",
"memsize", "image", "vcpus", "pae", "acpi",
- NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiisiii", kwd_list,
+ "apic", NULL };
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiis|iiii", kwd_list,
&dom, &store_evtchn, &memsize,
- &image, &vcpus, &pae, &acpi) )
- return NULL;
-
- if ( xc_hvm_build(self->xc_handle, dom, memsize, image,
- vcpus, pae, acpi, store_evtchn, &store_mfn) != 0 )
- return PyErr_SetFromErrno(xc_error);
+ &image, &vcpus, &pae, &acpi, &apic) )
+ return NULL;
+
+ if ( xc_hvm_build(self->xc_handle, dom, memsize, image) != 0 )
+ return PyErr_SetFromErrno(xc_error);
+
+ /* Set up the HVM info table. */
+ va_map = xc_map_foreign_range(self->xc_handle, dom, PAGE_SIZE,
+ PROT_READ | PROT_WRITE,
+ HVM_INFO_PFN);
+ if ( va_map == NULL )
+ return PyErr_SetFromErrno(xc_error);
+ va_hvm = (struct hvm_info_table *)(va_map + HVM_INFO_OFFSET);
+ memset(va_hvm, 0, sizeof(*va_hvm));
+ strncpy(va_hvm->signature, "HVM INFO", 8);
+ va_hvm->length = sizeof(struct hvm_info_table);
+ va_hvm->acpi_enabled = acpi;
+ va_hvm->apic_mode = apic;
+ va_hvm->nr_vcpus = vcpus;
+ for ( i = 0, sum = 0; i < va_hvm->length; i++ )
+ sum += ((uint8_t *)va_hvm)[i];
+ va_hvm->checksum = -sum;
+ munmap(va_map, PAGE_SIZE);
+
+ xc_get_hvm_param(self->xc_handle, dom, HVM_PARAM_STORE_PFN, &store_mfn);
+ xc_set_hvm_param(self->xc_handle, dom, HVM_PARAM_PAE_ENABLED, pae);
+ xc_set_hvm_param(self->xc_handle, dom, HVM_PARAM_STORE_EVTCHN,
+ store_evtchn);
return Py_BuildValue("{s:i}", "store_mfn", store_mfn);
}
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/python/xen/util/xmlrpclib2.py
--- a/tools/python/xen/util/xmlrpclib2.py Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/python/xen/util/xmlrpclib2.py Tue Nov 28 10:37:36 2006 -0700
@@ -30,6 +30,7 @@ import SocketServer
import SocketServer
import xmlrpclib, socket, os, stat
+from xen.web import connection
from xen.xend.XendLogging import log
try:
@@ -70,6 +71,11 @@ class XMLRPCRequestHandler(SimpleXMLRPCR
class XMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
protocol_version = "HTTP/1.1"
+ def __init__(self, hosts_allowed, request, client_address, server):
+ self.hosts_allowed = hosts_allowed
+ SimpleXMLRPCRequestHandler.__init__(self, request, client_address,
+ server)
+
# this is inspired by SimpleXMLRPCRequestHandler's do_POST but differs
# in a few non-trivial ways
# 1) we never generate internal server errors. We let the exception
@@ -77,6 +83,11 @@ class XMLRPCRequestHandler(SimpleXMLRPCR
# 2) we don't bother checking for a _dispatch function since we don't
# use one
def do_POST(self):
+ addrport = self.client_address
+ if not connection.hostAllowed(addrport, self.hosts_allowed):
+ self.connection.shutdown(1)
+ return
+
data = self.rfile.read(int(self.headers["content-length"]))
rsp = self.server._marshaled_dispatch(data)
@@ -150,9 +161,14 @@ class TCPXMLRPCServer(SocketServer.Threa
class TCPXMLRPCServer(SocketServer.ThreadingMixIn, SimpleXMLRPCServer):
allow_reuse_address = True
- def __init__(self, addr, requestHandler=XMLRPCRequestHandler,
+ def __init__(self, addr, allowed, requestHandler=None,
logRequests = 1):
- SimpleXMLRPCServer.__init__(self, addr, requestHandler, logRequests)
+ if requestHandler is None:
+ requestHandler = XMLRPCRequestHandler
+ SimpleXMLRPCServer.__init__(self, addr,
+ (lambda x, y, z:
+ requestHandler(allowed, x, y, z)),
+ logRequests)
flags = fcntl.fcntl(self.fileno(), fcntl.F_GETFD)
flags |= fcntl.FD_CLOEXEC
@@ -217,7 +233,7 @@ class UnixXMLRPCServer(TCPXMLRPCServer):
class UnixXMLRPCServer(TCPXMLRPCServer):
address_family = socket.AF_UNIX
- def __init__(self, addr, logRequests = 1):
+ def __init__(self, addr, allowed, logRequests = 1):
parent = os.path.dirname(addr)
if os.path.exists(parent):
os.chown(parent, os.geteuid(), os.getegid())
@@ -226,5 +242,6 @@ class UnixXMLRPCServer(TCPXMLRPCServer):
os.unlink(addr)
else:
os.makedirs(parent, stat.S_IRWXU)
- TCPXMLRPCServer.__init__(self, addr, UnixXMLRPCRequestHandler,
- logRequests)
+
+ TCPXMLRPCServer.__init__(self, addr, allowed,
+ UnixXMLRPCRequestHandler, logRequests)
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/python/xen/web/connection.py
--- a/tools/python/xen/web/connection.py Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/python/xen/web/connection.py Tue Nov 28 10:37:36 2006 -0700
@@ -24,6 +24,8 @@ import fcntl
from errno import EAGAIN, EINTR, EWOULDBLOCK
+from xen.xend.XendLogging import log
+
"""General classes to support server and client sockets, without
specifying what kind of socket they are. There are subclasses
for TCP and unix-domain sockets (see tcp.py and unix.py).
@@ -76,7 +78,7 @@ class SocketListener:
Accepts connections and runs a thread for each one.
"""
- def __init__(self, protocol_class, hosts_allow = ''):
+ def __init__(self, protocol_class):
self.protocol_class = protocol_class
self.sock = self.createSocket()
threading.Thread(target=self.main).start()
@@ -111,3 +113,15 @@ class SocketListener:
break
finally:
self.close()
+
+
+def hostAllowed(addrport, hosts_allowed):
+ if hosts_allowed is None:
+ return True
+ else:
+ fqdn = socket.getfqdn(addrport[0])
+ for h in hosts_allowed:
+ if h.match(fqdn) or h.match(addrport[0]):
+ return True
+ log.warn("Rejected connection from %s (%s).", addrport[0], fqdn)
+ return False
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/python/xen/web/tcp.py
--- a/tools/python/xen/web/tcp.py Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/python/xen/web/tcp.py Tue Nov 28 10:37:36 2006 -0700
@@ -57,20 +57,10 @@ class TCPListener(connection.SocketListe
def acceptConnection(self, sock, addrport):
addr = addrport[0]
- if self.hosts_allow is None:
- connection.SocketServerConnection(sock, self.protocol_class)
+ if connection.hostAllowed(addrport, self.hosts_allow):
+ connection.SocketServerConnection(sock, self.protocol_class)
else:
- fqdn = socket.getfqdn(addr)
- for h in self.hosts_allow:
- if h.match(fqdn) or h.match(addr):
- log.debug("Match %s %s", fqdn, h.pattern)
- connection.SocketServerConnection(sock,
- self.protocol_class)
- return
-
try:
- log.warn("Rejected connection from %s:%d (%s) for port %d.",
- addr, addrport[1], fqdn, self.port)
sock.close()
except:
pass
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/python/xen/xend/XendAPI.py
--- a/tools/python/xen/xend/XendAPI.py Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/python/xen/xend/XendAPI.py Tue Nov 28 10:37:36 2006 -0700
@@ -26,6 +26,9 @@ from xen.xend.XendLogging import log
from xen.xend.XendAPIConstants import *
from xen.util.xmlrpclib2 import stringify
+
+AUTH_NONE = 'none'
+AUTH_PAM = 'pam'
# ------------------------------------------
# Utility Methods for Xen API Implementation
@@ -257,8 +260,8 @@ def do_vm_func(fn_name, vm_ref, *args):
"""
xendom = XendDomain.instance()
fn = getattr(xendom, fn_name)
- return xen_api_success(xendom.do_legacy_api_with_uuid(
- fn, vm_ref, *args))
+ xendom.do_legacy_api_with_uuid(fn, vm_ref, *args)
+ return xen_api_success_void()
class XendAPI:
@@ -275,12 +278,13 @@ class XendAPI:
is set to the XMLRPC function name which the method implements.
"""
- def __init__(self):
+ def __init__(self, auth):
"""Initialised Xen API wrapper by making sure all functions
have the correct validation decorators such as L{valid_host}
and L{session_required}.
"""
-
+ self.auth = auth
+
classes = {
'session': (session_required,),
'host': (valid_host, session_required),
@@ -388,7 +392,9 @@ class XendAPI:
def session_login_with_password(self, username, password):
try:
- session = auth_manager().login_with_password(username, password)
+ session = (self.auth == AUTH_NONE and
+ auth_manager().login_unconditionally(username) or
+ auth_manager().login_with_password(username, password))
return xen_api_success(session)
except XendError, e:
return xen_api_error(XEND_ERROR_AUTHENTICATION_FAILED)
@@ -1391,9 +1397,12 @@ class XendAPI:
xendom = XendDomain.instance()
if xendom.is_valid_vm(vtpm_struct['VM']):
dom = xendom.get_vm_by_uuid(vtpm_struct['VM'])
- vtpm_ref = dom.create_vtpm(vtpm_struct)
- xendom.managed_config_save(dom)
- return xen_api_success(vtpm_ref)
+ try:
+ vtpm_ref = dom.create_vtpm(vtpm_struct)
+ xendom.managed_config_save(dom)
+ return xen_api_success(vtpm_ref)
+ except XendError:
+ return xen_api_error(XEND_ERROR_TODO)
else:
return xen_api_error(XEND_ERROR_DOMAIN_INVALID)
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/python/xen/xend/XendAuthSessions.py
--- a/tools/python/xen/xend/XendAuthSessions.py Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/python/xen/xend/XendAuthSessions.py Tue Nov 28 10:37:36 2006 -0700
@@ -37,6 +37,16 @@ class XendAuthSessions:
def init(self):
pass
+ def login_unconditionally(self, username):
+ """Returns a session UUID if valid.
+
+ @rtype: string
+ @return: Session UUID
+ """
+ new_session = uuid.createString()
+ self.sessions[new_session] = (username, time.time())
+ return new_session
+
def login_with_password(self, username, password):
"""Returns a session UUID if valid, otherwise raises an error.
@@ -45,9 +55,7 @@ class XendAuthSessions:
@return: Session UUID
"""
if self.is_authorized(username, password):
- new_session = uuid.createString()
- self.sessions[new_session] = (username, time.time())
- return new_session
+ return login_unconditionally(username)
raise XendError("Login failed")
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/python/xen/xend/XendCheckpoint.py
--- a/tools/python/xen/xend/XendCheckpoint.py Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/python/xen/xend/XendCheckpoint.py Tue Nov 28 10:37:36 2006 -0700
@@ -16,7 +16,7 @@ import xen.lowlevel.xc
import xen.lowlevel.xc
from xen.xend import balloon, sxp
-from xen.xend.XendError import XendError
+from xen.xend.XendError import XendError, VmError
from xen.xend.XendLogging import log
from xen.xend.XendConstants import *
from xen.xend.XendConfig import XendConfig
@@ -36,6 +36,7 @@ def write_exact(fd, buf, errmsg):
def write_exact(fd, buf, errmsg):
if os.write(fd, buf) != len(buf):
raise XendError(errmsg)
+
def read_exact(fd, size, errmsg):
buf = ''
@@ -48,7 +49,6 @@ def read_exact(fd, size, errmsg):
size = size - len(readstr)
buf = buf + readstr
return buf
-
def save(fd, dominfo, network, live, dst):
@@ -97,9 +97,17 @@ def save(fd, dominfo, network, live, dst
forkHelper(cmd, fd, saveInputHandler, False)
dominfo.destroyDomain()
+ try:
+ dominfo.setName(domain_name)
+ except VmError:
+ # Ignore this. The name conflict (hopefully) arises because we
+ # are doing localhost migration; if we are doing a suspend of a
+ # persistent VM, we need the rename, and don't expect the
+ # conflict. This needs more thought.
+ pass
except Exception, exn:
- log.exception("Save failed on domain %s (%d).", domain_name,
+ log.exception("Save failed on domain %s (%s).", domain_name,
dominfo.getDomid())
try:
dominfo.setName(domain_name)
@@ -108,7 +116,7 @@ def save(fd, dominfo, network, live, dst
raise Exception, exn
-def restore(xd, fd, dominfo = None):
+def restore(xd, fd, dominfo = None, paused = False):
signature = read_exact(fd, len(SIGNATURE),
"not a valid guest state file: signature read")
if signature != SIGNATURE:
@@ -164,7 +172,8 @@ def restore(xd, fd, dominfo = None):
os.read(fd, 1) # Wait for source to close connection
dominfo.waitForDevices() # Wait for backends to set up
- dominfo.unpause()
+ if not paused:
+ dominfo.unpause()
dominfo.completeRestore(handler.store_mfn, handler.console_mfn)
@@ -234,4 +243,9 @@ def slurp(infile):
if line == "":
break
else:
- log.error('%s', line.strip())
+ line = line.strip()
+ m = re.match(r"^ERROR: (.*)", line)
+ if m is None:
+ log.info('%s', line)
+ else:
+ log.error('%s', m.group(1))
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/python/xen/xend/XendClient.py
--- a/tools/python/xen/xend/XendClient.py Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/python/xen/xend/XendClient.py Tue Nov 28 10:37:36 2006 -0700
@@ -22,6 +22,7 @@ import sys
import sys
XML_RPC_SOCKET = "/var/run/xend/xmlrpc.sock"
+XEN_API_SOCKET = "/var/run/xend/xen-api.sock"
ERROR_INTERNAL = 1
ERROR_GENERIC = 2
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/python/xen/xend/XendConfig.py Tue Nov 28 10:37:36 2006 -0700
@@ -685,15 +685,15 @@ class XendConfig(dict):
# TODO: domid/dom is the same thing but called differently
# depending if it is from xenstore or sxpr.
- if domain.getDomid() != None:
+ if domain.getDomid() is not None:
sxpr.append(['domid', domain.getDomid()])
for cfg, typefunc in ROUNDTRIPPING_CONFIG_ENTRIES:
if cfg in self:
- if self[cfg] != None:
+ if self[cfg] is not None:
sxpr.append([cfg, self[cfg]])
- if 'image' in self and self['image'] != None:
+ if 'image' in self and self['image'] is not None:
sxpr.append(['image', self['image']])
if 'security' in self and self['security']:
sxpr.append(['security', self['security']])
@@ -714,7 +714,9 @@ class XendConfig(dict):
else:
sxpr.append(['status', str(DOM_STATE_HALTED)])
- sxpr.append(['state', self._get_old_state_string()])
+ if domain.getDomid() is not None:
+ sxpr.append(['state', self._get_old_state_string()])
+
sxpr.append(['memory_dynamic_max', self.get('memory_dynamic_max',
self['memory'])])
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/python/xen/xend/XendConstants.py
--- a/tools/python/xen/xend/XendConstants.py Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/python/xen/xend/XendConstants.py Tue Nov 28 10:37:36 2006 -0700
@@ -89,6 +89,12 @@ DEV_MIGRATE_STEP3 = 3
DEV_MIGRATE_STEP3 = 3
#
+# VTPM-related constants
+#
+
+VTPM_DELETE_SCRIPT = '/etc/xen/scripts/vtpm-delete'
+
+#
# Xenstore Constants
#
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/python/xen/xend/XendDevices.py
--- a/tools/python/xen/xend/XendDevices.py Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/python/xen/xend/XendDevices.py Tue Nov 28 10:37:36 2006 -0700
@@ -71,3 +71,13 @@ class XendDevices:
make_controller = classmethod(make_controller)
+ def destroy_device_state(cls, domain):
+ """Destroy the state of (external) devices. This is necessary
+ to do when a VM's configuration is destroyed.
+
+ @param domain: domain this controller is handling devices for.
+ @type domain: XendDomainInfo
+ """
+ tpmif.destroy_vtpmstate(domain.getName())
+
+ destroy_device_state = classmethod(destroy_device_state)
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/python/xen/xend/XendDomain.py Tue Nov 28 10:37:36 2006 -0700
@@ -35,8 +35,12 @@ from xen.xend.XendConfig import XendConf
from xen.xend.XendConfig import XendConfig
from xen.xend.XendError import XendError, XendInvalidDomain, VmError
from xen.xend.XendLogging import log
+from xen.xend.XendAPIConstants import XEN_API_VM_POWER_STATE
from xen.xend.XendConstants import XS_VMROOT
-from xen.xend.XendConstants import DOM_STATE_HALTED, DOM_STATE_RUNNING
+from xen.xend.XendConstants import DOM_STATE_HALTED, DOM_STATE_PAUSED
+from xen.xend.XendConstants import DOM_STATE_RUNNING, DOM_STATE_SUSPENDED
+from xen.xend.XendConstants import DOM_STATE_SHUTDOWN, DOM_STATE_UNKNOWN
+from xen.xend.XendDevices import XendDevices
from xen.xend.xenstore.xstransact import xstransact
from xen.xend.xenstore.xswatch import xswatch
@@ -53,6 +57,16 @@ DOM0_UUID = "00000000-0000-0000-0000-000
DOM0_UUID = "00000000-0000-0000-0000-000000000000"
DOM0_NAME = "Domain-0"
DOM0_ID = 0
+
+POWER_STATE_NAMES = dict([(x, XEN_API_VM_POWER_STATE[x])
+ for x in [DOM_STATE_HALTED,
+ DOM_STATE_PAUSED,
+ DOM_STATE_RUNNING,
+ DOM_STATE_SUSPENDED,
+ DOM_STATE_SHUTDOWN,
+ DOM_STATE_UNKNOWN]])
+POWER_STATE_ALL = 'all'
+
class XendDomain:
"""Index of all domains. Singleton.
@@ -563,8 +577,7 @@ class XendDomain:
log.debug('Shutting down domain: %s' % dom.getName())
dom.shutdown("poweroff")
elif shutdownAction == 'suspend':
- chkfile = self._managed_check_point_path(dom.getName())
- self.domain_save(dom.domid, chkfile)
+ self.domain_suspend(dom.getName())
finally:
self.domains_lock.release()
@@ -687,12 +700,18 @@ class XendDomain:
# ------------------------------------------------------------
# Xen Legacy API
- def list(self):
+ def list(self, state = DOM_STATE_RUNNING):
"""Get list of domain objects.
+ @param: the state in which the VMs should be -- one of the
+ DOM_STATE_XYZ constants, or the corresponding name, or 'all'.
@return: domains
@rtype: list of XendDomainInfo
"""
+ if type(state) == int:
+ state = POWER_STATE_NAMES[state]
+ state = state.lower()
+
self.domains_lock.acquire()
try:
self._refresh()
@@ -707,28 +726,37 @@ class XendDomain:
if dom_uuid not in active_uuids:
inactive_domains.append(dom)
- return active_domains + inactive_domains
- finally:
- self.domains_lock.release()
-
-
- def list_sorted(self):
+ if state == POWER_STATE_ALL:
+ return active_domains + inactive_domains
+ else:
+ return filter(lambda x:
+ POWER_STATE_NAMES[x.state].lower() == state,
+ active_domains + inactive_domains)
+ finally:
+ self.domains_lock.release()
+
+
+ def list_sorted(self, state = DOM_STATE_RUNNING):
"""Get list of domain objects, sorted by name.
+ @param: the state in which the VMs should be -- one of the
+ DOM_STATE_XYZ constants, or the corresponding name, or 'all'.
@return: domain objects
@rtype: list of XendDomainInfo
"""
- doms = self.list()
+ doms = self.list(state)
doms.sort(lambda x, y: cmp(x.getName(), y.getName()))
return doms
- def list_names(self):
+ def list_names(self, state = DOM_STATE_RUNNING):
"""Get list of domain names.
+ @param: the state in which the VMs should be -- one of the
+ DOM_STATE_XYZ constants, or the corresponding name, or 'all'.
@return: domain names
@rtype: list of strings.
"""
- return [d.getName() for d in self.list_sorted()]
+ return [d.getName() for d in self.list_sorted(state)]
def domain_suspend(self, domname):
"""Suspends a domain that is persistently managed by Xend
@@ -750,11 +778,13 @@ class XendDomain:
if dominfo.state != DOM_STATE_RUNNING:
raise XendError("Cannot suspend domain that is not running.")
- if not os.path.exists(self._managed_config_path(domname)):
+ dom_uuid = dominfo.get_uuid()
+
+ if not os.path.exists(self._managed_config_path(dom_uuid)):
raise XendError("Domain is not managed by Xend lifecycle " +
"support.")
-
- path = self._managed_check_point_path(domname)
+
+ path = self._managed_check_point_path(dom_uuid)
fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC)
try:
# For now we don't support 'live checkpoint'
@@ -773,36 +803,42 @@ class XendDomain:
@rtype: None
@raise XendError: If failed to restore.
"""
- try:
- dominfo = self.domain_lookup_nr(domname)
-
- if not dominfo:
- raise XendInvalidDomain(domname)
-
- if dominfo.getDomid() == DOM0_ID:
- raise XendError("Cannot save privileged domain %s" % domname)
-
- if dominfo.state != DOM_STATE_HALTED:
- raise XendError("Cannot suspend domain that is not running.")
-
- chkpath = self._managed_check_point_path(domname)
- if not os.path.exists(chkpath):
- raise XendError("Domain was not suspended by Xend")
-
- # Restore that replaces the existing XendDomainInfo
+ self.domains_lock.acquire()
+ try:
try:
- log.debug('Current DomainInfo state: %d' % dominfo.state)
- XendCheckpoint.restore(self,
- os.open(chkpath, os.O_RDONLY),
- dominfo)
- os.unlink(chkpath)
- except OSError, ex:
- raise XendError("Failed to read stored checkpoint file")
- except IOError, ex:
- raise XendError("Failed to delete checkpoint file")
- except Exception, ex:
- log.exception("Exception occurred when resuming")
- raise XendError("Error occurred when resuming: %s" % str(ex))
+ dominfo = self.domain_lookup_nr(domname)
+
+ if not dominfo:
+ raise XendInvalidDomain(domname)
+
+ if dominfo.getDomid() == DOM0_ID:
+ raise XendError("Cannot save privileged domain %s" %
domname)
+
+ if dominfo.state != DOM_STATE_HALTED:
+ raise XendError("Cannot suspend domain that is not
running.")
+
+ dom_uuid = dominfo.get_uuid()
+ chkpath = self._managed_check_point_path(dom_uuid)
+ if not os.path.exists(chkpath):
+ raise XendError("Domain was not suspended by Xend")
+
+ # Restore that replaces the existing XendDomainInfo
+ try:
+ log.debug('Current DomainInfo state: %d' % dominfo.state)
+ XendCheckpoint.restore(self,
+ os.open(chkpath, os.O_RDONLY),
+ dominfo)
+ self._add_domain(dominfo)
+ os.unlink(chkpath)
+ except OSError, ex:
+ raise XendError("Failed to read stored checkpoint file")
+ except IOError, ex:
+ raise XendError("Failed to delete checkpoint file")
+ except Exception, ex:
+ log.exception("Exception occurred when resuming")
+ raise XendError("Error occurred when resuming: %s" % str(ex))
+ finally:
+ self.domains_lock.release()
def domain_create(self, config):
@@ -898,7 +934,7 @@ class XendDomain:
self._managed_domain_unregister(dominfo)
self._remove_domain(dominfo)
-
+ XendDevices.destroy_device_state(dominfo)
except Exception, ex:
raise XendError(str(ex))
finally:
@@ -915,7 +951,7 @@ class XendDomain:
# !!!
raise XendError("Unsupported")
- def domain_restore(self, src):
+ def domain_restore(self, src, paused=False):
"""Restore a domain from file.
@param src: filename of checkpoint file to restore from
@@ -927,14 +963,14 @@ class XendDomain:
try:
fd = os.open(src, os.O_RDONLY)
try:
- return self.domain_restore_fd(fd)
+ return self.domain_restore_fd(fd, paused=paused)
finally:
os.close(fd)
except OSError, ex:
raise XendError("can't read guest state file %s: %s" %
(src, ex[1]))
- def domain_restore_fd(self, fd):
+ def domain_restore_fd(self, fd, paused=False):
"""Restore a domain from the given file descriptor.
@param fd: file descriptor of the checkpoint file
@@ -944,7 +980,7 @@ class XendDomain:
"""
try:
- return XendCheckpoint.restore(self, fd)
+ return XendCheckpoint.restore(self, fd, paused=paused)
except:
# I don't really want to log this exception here, but the error
# handling in the relocation-socket handling code (relocate.py) is
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/python/xen/xend/XendDomainInfo.py Tue Nov 28 10:37:36 2006 -0700
@@ -1318,7 +1318,7 @@ class XendDomainInfo:
self._createDevices()
- if self.info['bootloader']:
+ if self.info['bootloader'] not in [None, 'kernel_external']:
self.image.cleanupBootloading()
self.info['start_time'] = time.time()
@@ -1326,7 +1326,8 @@ class XendDomainInfo:
self._stateSet(DOM_STATE_RUNNING)
except RuntimeError, exn:
log.exception("XendDomainInfo.initDomain: exception occurred")
- if self.info['bootloader'] and self.image is not None:
+ if self.info['bootloader'] not in [None, 'kernel_external'] \
+ and self.image is not None:
self.image.cleanupBootloading()
raise VmError(str(exn))
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/python/xen/xend/XendNode.py
--- a/tools/python/xen/xend/XendNode.py Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/python/xen/xend/XendNode.py Tue Nov 28 10:37:36 2006 -0700
@@ -196,7 +196,7 @@ class XendNode:
return [[k, info[k]] for k in ITEM_ORDER]
def xendinfo(self):
- return [['xend_config_format', 2]]
+ return [['xend_config_format', 3]]
# dictionary version of *info() functions to get rid of
# SXPisms.
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/python/xen/xend/XendRoot.py
--- a/tools/python/xen/xend/XendRoot.py Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/python/xen/xend/XendRoot.py Tue Nov 28 10:37:36 2006 -0700
@@ -53,6 +53,9 @@ class XendRoot:
"""Default level of information to be logged."""
loglevel_default = 'DEBUG'
+
+ """Default Xen-API server configuration. """
+ xen_api_server_default = [['unix']]
"""Default for the flag indicating whether xend should run an http server
(deprecated)."""
@@ -189,6 +192,12 @@ class XendRoot:
except Exception:
raise XendError("invalid xend config %s: expected int: %s" %
(name, v))
+ def get_xen_api_server(self):
+ """Get the Xen-API server configuration.
+ """
+ return self.get_config_value('xen-api-server',
+ self.xen_api_server_default)
+
def get_xend_http_server(self):
"""Get the flag indicating whether xend should run an http server.
"""
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/python/xen/xend/image.py Tue Nov 28 10:37:36 2006 -0700
@@ -252,7 +252,6 @@ class HVMImageHandler(ImageHandler):
ImageHandler.__init__(self, vm, imageConfig, deviceConfig)
self.shutdownWatch = None
-
def configure(self, imageConfig, deviceConfig):
ImageHandler.configure(self, imageConfig, deviceConfig)
@@ -277,9 +276,9 @@ class HVMImageHandler(ImageHandler):
self.dmargs += self.configVNC(imageConfig)
- self.pae = int(sxp.child_value(imageConfig, 'pae', 0))
-
- self.acpi = int(sxp.child_value(imageConfig, 'acpi', 0))
+ self.pae = int(sxp.child_value(imageConfig, 'pae', 1))
+ self.acpi = int(sxp.child_value(imageConfig, 'acpi', 1))
+ self.apic = int(sxp.child_value(imageConfig, 'apic', 1))
def buildDomain(self):
store_evtchn = self.vm.getStorePort()
@@ -293,6 +292,7 @@ class HVMImageHandler(ImageHandler):
log.debug("vcpus = %d", self.vm.getVCpuCount())
log.debug("pae = %d", self.pae)
log.debug("acpi = %d", self.acpi)
+ log.debug("apic = %d", self.apic)
self.register_shutdown_watch()
@@ -302,7 +302,8 @@ class HVMImageHandler(ImageHandler):
memsize = mem_mb,
vcpus = self.vm.getVCpuCount(),
pae = self.pae,
- acpi = self.acpi)
+ acpi = self.acpi,
+ apic = self.apic)
# Return a list of cmd line args to the device models based on the
# xm config file
@@ -377,8 +378,8 @@ class HVMImageHandler(ImageHandler):
return ret
if vnc:
- vncdisplay = sxp.child_value(config, 'vncdisplay',
- int(self.vm.getDomid()))
+ vncdisplay = int(sxp.child_value(config, 'vncdisplay',
+ self.vm.getDomid()))
vncunused = sxp.child_value(config, 'vncunused')
if vncunused:
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/python/xen/xend/server/SrvDomain.py
--- a/tools/python/xen/xend/server/SrvDomain.py Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/python/xen/xend/server/SrvDomain.py Tue Nov 28 10:37:36 2006 -0700
@@ -81,6 +81,18 @@ class SrvDomain(SrvDir):
def do_save(self, _, req):
return self.xd.domain_save(self.dom.domid, req.args['file'][0])
+
+ def op_dump(self, op, req):
+ self.acceptCommand(req)
+ return req.threadRequest(self.do_dump, op, req)
+
+ def do_dump(self, _, req):
+ fn = FormFn(self.xd.domain_dump,
+ [['dom', 'int'],
+ ['file', 'str'],
+ ['live', 'int'],
+ ['crash', 'int']])
+ return fn(req.args, {'dom': self.dom.domid})
def op_migrate(self, op, req):
return req.threadRequest(self.do_migrate, op, req)
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/python/xen/xend/server/SrvServer.py
--- a/tools/python/xen/xend/server/SrvServer.py Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/python/xen/xend/server/SrvServer.py Tue Nov 28 10:37:36 2006 -0700
@@ -41,15 +41,17 @@
# todo Support command-line args.
import fcntl
+import re
import time
import signal
from threading import Thread
from xen.web.httpserver import HttpServer, UnixHttpServer
-from xen.xend import XendRoot
+from xen.xend import XendRoot, XendAPI
from xen.xend import Vifctl
from xen.xend.XendLogging import log
+from xen.xend.XendClient import XEN_API_SOCKET
from xen.web.SrvDir import SrvDir
from SrvRoot import SrvRoot
@@ -62,12 +64,14 @@ class XendServers:
def __init__(self):
self.servers = []
+ self.cleaningUp = False
def add(self, server):
self.servers.append(server)
def cleanup(self, signum = 0, frame = None):
log.debug("SrvServer.cleanup()")
+ self.cleaningUp = True
for server in self.servers:
try:
server.shutdown()
@@ -84,7 +88,9 @@ class XendServers:
Vifctl.network('start')
threads = []
for server in self.servers:
- thread = Thread(target=server.run)
+ thread = Thread(target=server.run, name=server.__class__.__name__)
+ if isinstance(server, HttpServer):
+ thread.setDaemon(True)
thread.start()
threads.append(thread)
@@ -117,12 +123,16 @@ class XendServers:
# Reason: The above will cause python signal handlers to be
# blocked so we're not able to catch SIGTERM in any
# way for cleanup
- runningThreads = len([t for t in threads if t.isAlive()])
- while runningThreads > 0:
+ runningThreads = threads
+ while len(runningThreads) > 0:
try:
for t in threads:
t.join(1.0)
- runningThreads = len([t for t in threads if t.isAlive()])
+ runningThreads = [t for t in threads
+ if t.isAlive() and not t.isDaemon()]
+ if self.cleaningUp and len(runningThreads) > 0:
+ log.debug("Waiting for %s." %
+ [x.getName() for x in runningThreads])
except:
pass
@@ -140,9 +150,42 @@ def create():
log.info('unix path=' + path)
servers.add(UnixHttpServer(root, path))
+ api_cfg = xroot.get_xen_api_server()
+ if api_cfg:
+ try:
+ addrs = [(str(x[0]).split(':'),
+ len(x) > 1 and x[1] or XendAPI.AUTH_NONE,
+ len(x) > 2 and x[2] and map(re.compile, x[2].split(" "))
+ or None)
+ for x in api_cfg]
+ for addrport, auth, allowed in addrs:
+ if auth not in [XendAPI.AUTH_PAM, XendAPI.AUTH_NONE]:
+ log.error('Xen-API server configuration %s is invalid, ' +
+ 'as %s is not a valid authentication type.',
+ api_cfg, auth)
+ break
+
+ if len(addrport) == 1:
+ if addrport[0] == 'unix':
+ servers.add(XMLRPCServer(auth,
+ path = XEN_API_SOCKET,
+ hosts_allowed = allowed))
+ else:
+ servers.add(
+ XMLRPCServer(auth, True, '', int(addrport[0]),
+ hosts_allowed = allowed))
+ else:
+ addr, port = addrport
+ servers.add(XMLRPCServer(auth, True, addr, int(port),
+ hosts_allowed = allowed))
+ except ValueError, exn:
+ log.error('Xen-API server configuration %s is invalid.', api_cfg)
+ except TypeError, exn:
+ log.error('Xen-API server configuration %s is invalid.', api_cfg)
+
if xroot.get_xend_tcp_xmlrpc_server():
- servers.add(XMLRPCServer(True))
+ servers.add(XMLRPCServer(XendAPI.AUTH_PAM, True))
if xroot.get_xend_unix_xmlrpc_server():
- servers.add(XMLRPCServer())
+ servers.add(XMLRPCServer(XendAPI.AUTH_PAM))
return servers
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4
tools/python/xen/xend/server/XMLRPCServer.py
--- a/tools/python/xen/xend/server/XMLRPCServer.py Mon Nov 27 10:10:57
2006 -0700
+++ b/tools/python/xen/xend/server/XMLRPCServer.py Tue Nov 28 10:37:36
2006 -0700
@@ -20,11 +20,11 @@ import xmlrpclib
import xmlrpclib
from xen.util.xmlrpclib2 import UnixXMLRPCServer, TCPXMLRPCServer
-from xen.xend import XendDomain, XendDomainInfo, XendNode
+from xen.xend import XendAPI, XendDomain, XendDomainInfo, XendNode
from xen.xend import XendLogging, XendDmesg
from xen.xend.XendClient import XML_RPC_SOCKET
+from xen.xend.XendConstants import DOM_STATE_RUNNING
from xen.xend.XendLogging import log
-from xen.xend.XendAPI import XendAPI
from xen.xend.XendError import XendInvalidDomain
# vcpu_avail is a long and is not needed by the clients. It's far easier
@@ -53,19 +53,22 @@ def domain(domid, full = 0):
info = lookup(domid)
return fixup_sxpr(info.sxpr(not full))
-def domains(detail=1, full = 0):
- if detail < 1:
- return XendDomain.instance().list_names()
+def domains(detail = True, full = False):
+ return domains_with_state(detail, DOM_STATE_RUNNING, full)
+
+def domains_with_state(detail, state, full):
+ if detail:
+ domains = XendDomain.instance().list_sorted(state)
+ return map(lambda dom: fixup_sxpr(dom.sxpr(not full)), domains)
else:
- domains = XendDomain.instance().list_sorted()
- return map(lambda dom: fixup_sxpr(dom.sxpr(not full)), domains)
+ return XendDomain.instance().list_names(state)
def domain_create(config):
info = XendDomain.instance().domain_create(config)
return fixup_sxpr(info.sxpr())
-def domain_restore(src):
- info = XendDomain.instance().domain_restore(src)
+def domain_restore(src, paused=False):
+ info = XendDomain.instance().domain_restore(src, paused)
return fixup_sxpr(info.sxpr())
def get_log():
@@ -84,23 +87,38 @@ exclude = ['domain_create', 'domain_rest
exclude = ['domain_create', 'domain_restore']
class XMLRPCServer:
- def __init__(self, use_tcp=False, host = "localhost", port = 8006,
- path = XML_RPC_SOCKET):
+ def __init__(self, auth, use_tcp=False, host = "localhost", port = 8006,
+ path = XML_RPC_SOCKET, hosts_allowed = None):
self.use_tcp = use_tcp
self.port = port
self.host = host
self.path = path
+ self.hosts_allowed = hosts_allowed
self.ready = False
self.running = True
- self.xenapi = XendAPI()
+ self.auth = auth
+ self.xenapi = XendAPI.XendAPI(auth)
def run(self):
+ authmsg = (self.auth == XendAPI.AUTH_NONE and
+ "; authentication has been disabled for this server." or
+ ".")
+
if self.use_tcp:
+ log.info("Opening TCP XML-RPC server on %s%d%s",
+ self.host and '%s:' % self.host or
+ 'all interfaces, port ',
+ self.port, authmsg)
self.server = TCPXMLRPCServer((self.host, self.port),
+ self.hosts_allowed,
logRequests = False)
else:
- self.server = UnixXMLRPCServer(self.path, logRequests = False)
+ log.info("Opening Unix domain socket XML-RPC server on %s%s",
+ self.path, authmsg)
+ self.server = UnixXMLRPCServer(self.path, self.hosts_allowed,
+ logRequests = False)
+
# Register Xen API Functions
# -------------------------------------------------------------------
@@ -139,6 +157,8 @@ class XMLRPCServer:
# A few special cases
self.server.register_function(domain, 'xend.domain')
self.server.register_function(domains, 'xend.domains')
+ self.server.register_function(domains_with_state,
+ 'xend.domains_with_state')
self.server.register_function(get_log, 'xend.node.log')
self.server.register_function(domain_create, 'xend.domain.create')
self.server.register_function(domain_restore, 'xend.domain.restore')
diff -r 7e7846ea4ab3 -r 4f4d358aa5e4 tools/python/xen/xend/server/tpmif.py
--- a/tools/python/xen/xend/server/tpmif.py Mon Nov 27 10:10:57 2006 -0700
+++ b/tools/python/xen/xend/server/tpmif.py Tue Nov 28 10:37:36 2006 -0700
@@ -25,13 +25,17 @@ from xen.xend import XendRoot
from xen.xend import XendRoot
from xen.xend.XendLogging import log
from xen.xend.XendError import XendError
-from xen.xend.XendConstants import DEV_MIGRATE_TEST
+from xen.xend.XendConstants import DEV_MIGRATE_TEST, VTPM_DELETE_SCRIPT
from xen.xend.server.DevController import DevController
import os
import re
xroot = XendRoot.instance()
+
+def destroy_vtpmstate(name):
+ if os.path.exists(VTPM_DELETE_SCRIPT):
+ os.system(VTPM_DELETE_SCRIPT + " " + name)
class TPMifController(DevController):
"""TPM interface controller. Handles all TPM devices for a domain.
@@ -79,7 +83,7 @@ class TPMifController(DevController):
if uuid:
result['uuid'] = uuid
if type:
- result['type'] == type
+ result['type'] = type
return result
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|