debuggers.hg

changeset 22:46f8fc57b1a4

REFRESH to unstable changeset 19194. No debugger fixes/enhancements
author Mukesh Rathor
date Wed Feb 11 16:25:03 2009 -0800 (2009-02-11)
parents 6a005b5de47d
children 183d253550f3
files .hgignore Config.mk Makefile buildconfigs/mk.linux-2.6-common buildconfigs/src.tarball docs/check_pkgs docs/man/xm.pod.1 docs/misc/dump-core-format.txt docs/misc/vtd.txt docs/misc/xen-error-handling.txt extras/mini-os/Makefile extras/mini-os/arch/ia64/arch.mk extras/mini-os/arch/ia64/common.c extras/mini-os/arch/ia64/debug.c extras/mini-os/arch/ia64/efi.c extras/mini-os/arch/ia64/fw.S extras/mini-os/arch/ia64/ia64.S extras/mini-os/arch/ia64/ivt.S extras/mini-os/arch/ia64/minios-ia64.lds extras/mini-os/arch/ia64/mm.c extras/mini-os/arch/ia64/sal.c extras/mini-os/arch/ia64/time.c extras/mini-os/arch/ia64/xencomm.c extras/mini-os/arch/x86/mm.c extras/mini-os/fs-front.c extras/mini-os/include/ia64/atomic.h extras/mini-os/include/ia64/endian.h extras/mini-os/include/ia64/hypercall-ia64.h extras/mini-os/include/ia64/ia64_cpu.h extras/mini-os/include/ia64/os.h extras/mini-os/include/posix/net/if.h extras/mini-os/include/sched.h extras/mini-os/include/wait.h extras/mini-os/include/xenbus.h extras/mini-os/kernel.c extras/mini-os/lib/sys.c extras/mini-os/minios.mk extras/mini-os/xenbus/xenbus.c stubdom/Makefile stubdom/README stubdom/grub/mini-os.c stubdom/stubdom-dm tools/Makefile tools/Rules.mk tools/blktap/drivers/Makefile tools/console/Makefile tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/Makefile.in tools/examples/Makefile tools/examples/blktap tools/examples/block tools/examples/block-common.sh tools/examples/block-enbd tools/examples/block-nbd tools/examples/external-device-migrate tools/examples/init.d/sysconfig.xendomains tools/examples/init.d/xend tools/examples/init.d/xendomains tools/examples/locking.sh tools/examples/logging.sh tools/examples/network-bridge tools/examples/network-nat tools/examples/network-route tools/examples/vif-bridge tools/examples/vif-common.sh tools/examples/vif-nat tools/examples/vif-route tools/examples/vscsi tools/examples/vtpm tools/examples/vtpm-common.sh tools/examples/vtpm-delete tools/examples/vtpm-hotplug-common.sh tools/examples/vtpm-impl tools/examples/vtpm-migration.sh tools/examples/xen-backend.agent tools/examples/xen-backend.rules tools/examples/xen-hotplug-cleanup tools/examples/xen-hotplug-common.sh tools/examples/xen-network-common.sh tools/examples/xen-script-common.sh tools/examples/xmexample.hvm tools/firmware/Makefile tools/firmware/Rules.mk tools/firmware/hvmloader/32bitbios_support.c tools/firmware/hvmloader/Makefile tools/firmware/hvmloader/acpi/Makefile tools/firmware/hvmloader/acpi/build.c tools/firmware/hvmloader/acpi/dsdt.asl tools/firmware/hvmloader/acpi/dsdt.c tools/firmware/hvmloader/cacheattr.c tools/firmware/hvmloader/config.h tools/firmware/hvmloader/e820.h tools/firmware/hvmloader/hvmloader.c tools/firmware/hvmloader/mp_tables.c tools/firmware/hvmloader/smbios.c tools/firmware/hvmloader/smp.c tools/firmware/hvmloader/util.c tools/firmware/hvmloader/util.h tools/firmware/rombios/32bit/32bitbios.c tools/firmware/rombios/32bit/Makefile tools/firmware/rombios/32bit/pmm.c tools/firmware/rombios/32bit/rombios_compat.h tools/firmware/rombios/32bit/tcgbios/Makefile tools/firmware/rombios/32bit/tcgbios/tcgbios.c tools/firmware/rombios/32bitgateway.c tools/firmware/rombios/32bitgateway.h tools/firmware/rombios/32bitprotos.h tools/firmware/rombios/Makefile tools/firmware/rombios/rombios.c tools/firmware/rombios/rombios.h tools/firmware/rombios/tcgbios.c tools/firmware/vgabios/vbe.c tools/firmware/vgabios/vbe.h tools/firmware/vgabios/vbetables-gen.c tools/firmware/vgabios/vgabios.c tools/flask/libflask/Makefile tools/flask/loadpolicy/Makefile tools/flask/policy/policy/modules/xen/xen.te tools/fs-back/Makefile tools/hotplug/Linux/Makefile tools/hotplug/Linux/blktap tools/hotplug/Linux/block tools/hotplug/Linux/block-common.sh tools/hotplug/Linux/block-enbd tools/hotplug/Linux/block-nbd tools/hotplug/Linux/external-device-migrate tools/hotplug/Linux/locking.sh tools/hotplug/Linux/logging.sh tools/hotplug/Linux/network-bridge tools/hotplug/Linux/network-nat tools/hotplug/Linux/network-route tools/hotplug/Linux/vif-bridge tools/hotplug/Linux/vif-common.sh tools/hotplug/Linux/vif-nat tools/hotplug/Linux/vif-route tools/hotplug/Linux/vscsi tools/hotplug/Linux/vtpm tools/hotplug/Linux/vtpm-common.sh tools/hotplug/Linux/vtpm-delete tools/hotplug/Linux/vtpm-hotplug-common.sh tools/hotplug/Linux/vtpm-impl tools/hotplug/Linux/vtpm-migration.sh tools/hotplug/Linux/xen-backend.agent tools/hotplug/Linux/xen-backend.rules tools/hotplug/Linux/xen-hotplug-cleanup tools/hotplug/Linux/xen-hotplug-common.sh tools/hotplug/Linux/xen-network-common.sh tools/hotplug/Linux/xen-script-common.sh tools/hotplug/Makefile tools/hotplug/NetBSD/Makefile tools/hotplug/NetBSD/block-nbsd tools/hotplug/NetBSD/qemu-ifup-nbsd tools/hotplug/NetBSD/vif-bridge-nbsd tools/hotplug/NetBSD/vif-ip-nbsd tools/hotplug/common/Makefile tools/include/Makefile tools/libaio/src/Makefile tools/libfsimage/Rules.mk tools/libfsimage/common/Makefile tools/libxc/Makefile tools/libxc/ia64/xc_ia64_hvm_build.c tools/libxc/ia64/xc_ia64_linux_restore.c tools/libxc/xc_core.c tools/libxc/xc_core.h tools/libxc/xc_core_ia64.c tools/libxc/xc_core_x86.c tools/libxc/xc_core_x86.h tools/libxc/xc_cpufeature.h tools/libxc/xc_cpuid_x86.c tools/libxc/xc_dom.h tools/libxc/xc_dom_core.c tools/libxc/xc_dom_x86.c tools/libxc/xc_domain.c tools/libxc/xc_domain_restore.c tools/libxc/xc_domain_save.c tools/libxc/xc_elf.h tools/libxc/xc_hvm_build.c tools/libxc/xc_pagetab.c tools/libxc/xc_pm.c tools/libxc/xc_private.c tools/libxc/xc_private.h tools/libxc/xc_ptrace.c tools/libxc/xc_ptrace_core.c tools/libxc/xenctrl.h tools/libxc/xenguest.h tools/libxc/xg_private.c tools/misc/Makefile tools/misc/xen-detect.c tools/misc/xenpm.c tools/pygrub/Makefile tools/python/Makefile tools/python/xen/lowlevel/acm/acm.c tools/python/xen/lowlevel/flask/flask.c tools/python/xen/lowlevel/xc/xc.c tools/python/xen/lowlevel/xs/xs.c tools/python/xen/util/diagnose.py tools/python/xen/util/oshelp.py tools/python/xen/util/pci.py tools/python/xen/util/rwlock.py tools/python/xen/xend/XendAPI.py tools/python/xen/xend/XendAPIStore.py tools/python/xen/xend/XendCheckpoint.py tools/python/xen/xend/XendConfig.py tools/python/xen/xend/XendDPCI.py tools/python/xen/xend/XendDomain.py tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xend/balloon.py tools/python/xen/xend/image.py tools/python/xen/xend/osdep.py tools/python/xen/xend/server/DevConstants.py tools/python/xen/xend/server/DevController.py tools/python/xen/xend/server/blkif.py tools/python/xen/xend/server/iopif.py tools/python/xen/xend/server/irqif.py tools/python/xen/xend/server/pciif.py tools/python/xen/xend/server/pciquirk.py tools/python/xen/xend/server/relocate.py tools/python/xen/xend/server/vscsiif.py tools/python/xen/xm/addlabel.py tools/python/xen/xm/create.dtd tools/python/xen/xm/create.py tools/python/xen/xm/main.py tools/python/xen/xm/xenapi_create.py tools/tests/blowfish.mk tools/vnet/Makefile tools/vnet/libxutil/Makefile tools/vtpm/Makefile tools/vtpm/Rules.mk tools/vtpm_manager/Rules.mk tools/xcutils/Makefile tools/xcutils/readnotes.c tools/xcutils/xc_save.c tools/xenmon/Makefile tools/xenpmd/Makefile tools/xenpmd/xenpmd.c tools/xenstat/libxenstat/Makefile tools/xenstat/libxenstat/src/xenstat_linux.c tools/xenstat/xentop/Makefile tools/xenstat/xentop/xentop.c tools/xenstore/Makefile tools/xentrace/Makefile tools/xentrace/xenctx.c unmodified_drivers/linux-2.6/Makefile unmodified_drivers/linux-2.6/balloon/Kbuild unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h unmodified_drivers/linux-2.6/mkbuildtree unmodified_drivers/linux-2.6/overrides.mk unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c unmodified_drivers/linux-2.6/platform-pci/platform-compat.c unmodified_drivers/linux-2.6/scsifront/Kbuild unmodified_drivers/linux-2.6/scsifront/Makefile xen/Rules.mk xen/arch/ia64/Makefile xen/arch/ia64/Rules.mk xen/arch/ia64/linux-xen/acpi.c xen/arch/ia64/linux-xen/head.S xen/arch/ia64/linux-xen/mm_contig.c xen/arch/ia64/linux-xen/smp.c xen/arch/ia64/linux-xen/smpboot.c xen/arch/ia64/tools/p2m_foreign/Makefile xen/arch/ia64/tools/p2m_foreign/p2m_foreign.c xen/arch/ia64/vmx/sioemu.c xen/arch/ia64/vmx/viosapic.c xen/arch/ia64/vmx/vmmu.c xen/arch/ia64/vmx/vmx_fault.c xen/arch/ia64/vmx/vmx_init.c xen/arch/ia64/vmx/vmx_ivt.S xen/arch/ia64/vmx/vtlb.c xen/arch/ia64/xen/cpufreq/cpufreq.c xen/arch/ia64/xen/dom0_ops.c xen/arch/ia64/xen/dom_fw_asm.S xen/arch/ia64/xen/dom_fw_common.c xen/arch/ia64/xen/domain.c xen/arch/ia64/xen/faults.c xen/arch/ia64/xen/fw_emul.c xen/arch/ia64/xen/hypercall.c xen/arch/ia64/xen/irq.c xen/arch/ia64/xen/ivt.S xen/arch/ia64/xen/machine_kexec.c xen/arch/ia64/xen/mm.c xen/arch/ia64/xen/regionreg.c xen/arch/ia64/xen/vcpu.c xen/arch/ia64/xen/xenmem.c xen/arch/ia64/xen/xensetup.c xen/arch/x86/Makefile xen/arch/x86/Rules.mk xen/arch/x86/acpi/boot.c xen/arch/x86/acpi/cpu_idle.c xen/arch/x86/acpi/cpufreq/cpufreq.c xen/arch/x86/acpi/cpufreq/powernow.c xen/arch/x86/acpi/cpuidle_menu.c xen/arch/x86/acpi/power.c xen/arch/x86/acpi/suspend.c xen/arch/x86/apic.c xen/arch/x86/boot/Makefile xen/arch/x86/boot/build32.mk xen/arch/x86/boot/head.S xen/arch/x86/boot/mkelf32.c xen/arch/x86/boot/reloc.c xen/arch/x86/boot/wakeup.S xen/arch/x86/bzimage.c xen/arch/x86/copy_page.S xen/arch/x86/cpu/amd.c xen/arch/x86/cpu/common.c xen/arch/x86/cpu/intel.c xen/arch/x86/cpu/mcheck/Makefile xen/arch/x86/cpu/mcheck/amd_k8.c xen/arch/x86/cpu/mcheck/amd_nonfatal.c xen/arch/x86/cpu/mcheck/k7.c xen/arch/x86/cpu/mcheck/mce.c xen/arch/x86/cpu/mcheck/mce.h xen/arch/x86/cpu/mcheck/mce_intel.c xen/arch/x86/cpu/mcheck/non-fatal.c xen/arch/x86/cpu/mcheck/p4.c xen/arch/x86/cpu/mcheck/p5.c xen/arch/x86/cpu/mcheck/p6.c xen/arch/x86/cpu/mcheck/x86_mca.h xen/arch/x86/domain.c xen/arch/x86/domain_build.c xen/arch/x86/domctl.c xen/arch/x86/e820.c xen/arch/x86/hpet.c xen/arch/x86/hvm/emulate.c xen/arch/x86/hvm/hvm.c xen/arch/x86/hvm/mtrr.c xen/arch/x86/hvm/svm/intr.c xen/arch/x86/hvm/svm/svm.c xen/arch/x86/hvm/svm/vmcb.c xen/arch/x86/hvm/vioapic.c xen/arch/x86/hvm/viridian.c xen/arch/x86/hvm/vlapic.c xen/arch/x86/hvm/vmsi.c xen/arch/x86/hvm/vmx/entry.S xen/arch/x86/hvm/vmx/intr.c xen/arch/x86/hvm/vmx/realmode.c xen/arch/x86/hvm/vmx/vmcs.c xen/arch/x86/hvm/vmx/vmx.c xen/arch/x86/hvm/vmx/vpmu_core2.c xen/arch/x86/hvm/vpt.c xen/arch/x86/i8259.c xen/arch/x86/io_apic.c xen/arch/x86/irq.c xen/arch/x86/machine_kexec.c xen/arch/x86/microcode.c xen/arch/x86/microcode_amd.c xen/arch/x86/microcode_intel.c xen/arch/x86/mm.c xen/arch/x86/mm/Makefile xen/arch/x86/mm/guest_walk.c xen/arch/x86/mm/hap/Makefile xen/arch/x86/mm/hap/guest_walk.c xen/arch/x86/mm/hap/hap.c xen/arch/x86/mm/hap/p2m-ept.c xen/arch/x86/mm/hap/private.h xen/arch/x86/mm/p2m.c xen/arch/x86/mm/page-guest32.h xen/arch/x86/mm/paging.c xen/arch/x86/mm/shadow/Makefile xen/arch/x86/mm/shadow/common.c xen/arch/x86/mm/shadow/multi.c xen/arch/x86/mm/shadow/private.h xen/arch/x86/mm/shadow/types.h xen/arch/x86/msi.c xen/arch/x86/nmi.c xen/arch/x86/numa.c xen/arch/x86/oprofile/nmi_int.c xen/arch/x86/oprofile/op_model_p4.c xen/arch/x86/oprofile/op_model_ppro.c xen/arch/x86/oprofile/op_x86_model.h xen/arch/x86/physdev.c xen/arch/x86/platform_hypercall.c xen/arch/x86/rwlock.c xen/arch/x86/setup.c xen/arch/x86/smpboot.c xen/arch/x86/tboot.c xen/arch/x86/time.c xen/arch/x86/traps.c xen/arch/x86/x86_32/asm-offsets.c xen/arch/x86/x86_32/domain_page.c xen/arch/x86/x86_32/machine_kexec.c xen/arch/x86/x86_32/mm.c xen/arch/x86/x86_32/xen.lds.S xen/arch/x86/x86_64/Makefile xen/arch/x86/x86_64/asm-offsets.c xen/arch/x86/x86_64/compat/entry.S xen/arch/x86/x86_64/compat/mm.c xen/arch/x86/x86_64/entry.S xen/arch/x86/x86_64/machine_kexec.c xen/arch/x86/x86_64/mm.c xen/arch/x86/x86_64/physdev.c xen/arch/x86/x86_64/xen.lds.S xen/arch/x86/x86_emulate/x86_emulate.c xen/arch/x86/x86_emulate/x86_emulate.h xen/common/Makefile xen/common/compat/Makefile xen/common/compat/memory.c xen/common/domain.c xen/common/event_channel.c xen/common/grant_table.c xen/common/hvm/save.c xen/common/inflate.c xen/common/kernel.c xen/common/kexec.c xen/common/keyhandler.c xen/common/libelf/libelf-dominfo.c xen/common/libelf/libelf-private.h xen/common/memory.c xen/common/page_alloc.c xen/common/schedule.c xen/common/spinlock.c xen/common/sysctl.c xen/common/timer.c xen/common/trace.c xen/common/xenoprof.c xen/common/xmalloc_tlsf.c xen/drivers/acpi/pmstat.c xen/drivers/acpi/reboot.c xen/drivers/char/console.c xen/drivers/char/ns16550.c xen/drivers/char/serial.c xen/drivers/cpufreq/Makefile xen/drivers/cpufreq/cpufreq.c xen/drivers/cpufreq/cpufreq_misc_governors.c xen/drivers/cpufreq/cpufreq_ondemand.c xen/drivers/cpufreq/utility.c xen/drivers/passthrough/amd/iommu_init.c xen/drivers/passthrough/amd/iommu_intr.c xen/drivers/passthrough/amd/iommu_map.c xen/drivers/passthrough/amd/pci_amd_iommu.c xen/drivers/passthrough/io.c xen/drivers/passthrough/iommu.c xen/drivers/passthrough/pci.c xen/drivers/passthrough/vtd/dmar.c xen/drivers/passthrough/vtd/dmar.h xen/drivers/passthrough/vtd/ia64/vtd.c xen/drivers/passthrough/vtd/intremap.c xen/drivers/passthrough/vtd/iommu.c xen/drivers/passthrough/vtd/iommu.h xen/drivers/passthrough/vtd/qinval.c xen/drivers/passthrough/vtd/vtd.h xen/drivers/passthrough/vtd/x86/vtd.c xen/drivers/video/vesa.c xen/drivers/video/vga.c xen/include/Makefile xen/include/acpi/cpufreq/cpufreq.h xen/include/acpi/cpufreq/processor_perf.h xen/include/asm-ia64/bug.h xen/include/asm-ia64/bundle.h xen/include/asm-ia64/config.h xen/include/asm-ia64/dom_fw.h xen/include/asm-ia64/dom_fw_common.h xen/include/asm-ia64/domain.h xen/include/asm-ia64/hardirq.h xen/include/asm-ia64/hvm/iommu.h xen/include/asm-ia64/hvm/irq.h xen/include/asm-ia64/linux-xen/asm/acpi.h xen/include/asm-ia64/linux-xen/asm/iosapic.h xen/include/asm-ia64/linux-xen/asm/smp.h xen/include/asm-ia64/linux-xen/asm/spinlock.h xen/include/asm-ia64/linux-xen/linux/efi.h xen/include/asm-ia64/linux/asm/irq.h xen/include/asm-ia64/mm.h xen/include/asm-ia64/tlbflush.h xen/include/asm-ia64/viosapic.h xen/include/asm-ia64/vmx.h xen/include/asm-ia64/xenpage.h xen/include/asm-x86/acpi.h xen/include/asm-x86/apicdef.h xen/include/asm-x86/config.h xen/include/asm-x86/cpufeature.h xen/include/asm-x86/domain.h xen/include/asm-x86/e820.h xen/include/asm-x86/fixmap.h xen/include/asm-x86/guest_pt.h xen/include/asm-x86/hpet.h xen/include/asm-x86/hvm/hvm.h xen/include/asm-x86/hvm/irq.h xen/include/asm-x86/hvm/svm/amd-iommu-proto.h xen/include/asm-x86/hvm/trace.h xen/include/asm-x86/hvm/vcpu.h xen/include/asm-x86/hvm/vlapic.h xen/include/asm-x86/hvm/vmx/vmcs.h xen/include/asm-x86/hvm/vmx/vmx.h xen/include/asm-x86/hvm/vmx/vpmu.h xen/include/asm-x86/hvm/vmx/vpmu_core2.h xen/include/asm-x86/iocap.h xen/include/asm-x86/irq.h xen/include/asm-x86/mach-default/irq_vectors.h xen/include/asm-x86/microcode.h xen/include/asm-x86/mm.h xen/include/asm-x86/msi.h xen/include/asm-x86/msr-index.h xen/include/asm-x86/mtrr.h xen/include/asm-x86/p2m.h xen/include/asm-x86/page.h xen/include/asm-x86/paging.h xen/include/asm-x86/perfc.h xen/include/asm-x86/perfc_defn.h xen/include/asm-x86/pirq.h xen/include/asm-x86/processor.h xen/include/asm-x86/rwlock.h xen/include/asm-x86/smp.h xen/include/asm-x86/spinlock.h xen/include/asm-x86/system.h xen/include/asm-x86/tboot.h xen/include/asm-x86/time.h xen/include/asm-x86/x86_32/page.h xen/include/asm-x86/x86_32/system.h xen/include/asm-x86/x86_64/page.h xen/include/asm-x86/x86_64/system.h xen/include/asm-x86/xenoprof.h xen/include/public/arch-ia64.h xen/include/public/arch-ia64/hvm/save.h xen/include/public/arch-x86/hvm/save.h xen/include/public/arch-x86/xen-mca.h xen/include/public/domctl.h xen/include/public/elfnote.h xen/include/public/elfstructs.h xen/include/public/features.h xen/include/public/grant_table.h xen/include/public/hvm/hvm_info_table.h xen/include/public/hvm/params.h xen/include/public/io/pciif.h xen/include/public/kexec.h xen/include/public/libelf.h xen/include/public/memory.h xen/include/public/physdev.h xen/include/public/sysctl.h xen/include/public/trace.h xen/include/public/xen.h xen/include/xen/cpuidle.h xen/include/xen/domain.h xen/include/xen/domain_page.h xen/include/xen/elf.h xen/include/xen/elfstructs.h xen/include/xen/event.h xen/include/xen/grant_table.h xen/include/xen/hvm/iommu.h xen/include/xen/hvm/irq.h xen/include/xen/hvm/save.h xen/include/xen/hypercall.h xen/include/xen/iocap.h xen/include/xen/iommu.h xen/include/xen/irq.h xen/include/xen/kexec.h xen/include/xen/lib.h xen/include/xen/libelf.h xen/include/xen/mm.h xen/include/xen/pci.h xen/include/xen/sched.h xen/include/xen/spinlock.h xen/include/xen/time.h xen/include/xen/timer.h xen/include/xen/xenoprof.h xen/include/xlat.lst xen/include/xsm/xsm.h xen/kdb/kdb_cmds.c xen/tools/symbols.c xen/xsm/dummy.c xen/xsm/flask/hooks.c
line diff
     1.1 --- a/.hgignore	Mon Nov 10 15:52:15 2008 -0800
     1.2 +++ b/.hgignore	Wed Feb 11 16:25:03 2009 -0800
     1.3 @@ -260,6 +260,7 @@
     1.4  ^xen/arch/x86/asm-offsets\.s$
     1.5  ^xen/arch/x86/boot/mkelf32$
     1.6  ^xen/arch/x86/xen\.lds$
     1.7 +^xen/arch/x86/boot/reloc.S$
     1.8  ^xen/ddb/.*$
     1.9  ^xen/include/asm$
    1.10  ^xen/include/asm-.*/asm-offsets\.h$
    1.11 @@ -283,15 +284,6 @@
    1.12  ^xen/arch/ia64/asm-xsi-offsets\.s$
    1.13  ^xen/arch/ia64/map\.out$
    1.14  ^xen/arch/ia64/xen\.lds\.s$
    1.15 -^xen/arch/powerpc/dom0\.bin$
    1.16 -^xen/arch/powerpc/asm-offsets\.s$
    1.17 -^xen/arch/powerpc/firmware$
    1.18 -^xen/arch/powerpc/firmware.dbg$
    1.19 -^xen/arch/powerpc/firmware_image.bin$
    1.20 -^xen/arch/powerpc/xen\.lds$
    1.21 -^xen/arch/powerpc/\.xen-syms$
    1.22 -^xen/arch/powerpc/xen-syms\.S$
    1.23 -^xen/arch/powerpc/cmdline.dep$
    1.24  ^unmodified_drivers/linux-2.6/\.tmp_versions
    1.25  ^unmodified_drivers/linux-2.6/.*\.cmd$
    1.26  ^unmodified_drivers/linux-2.6/.*\.ko$
     2.1 --- a/Config.mk	Mon Nov 10 15:52:15 2008 -0800
     2.2 +++ b/Config.mk	Wed Feb 11 16:25:03 2009 -0800
     2.3 @@ -1,7 +1,7 @@
     2.4  # -*- mode: Makefile; -*-
     2.5  
     2.6 -# A debug build of Xen and tools?
     2.7 -debug ?= n
     2.8 +# A debug build of Xen and tools? TEMPORARILY ENABLED
     2.9 +debug ?= y
    2.10  
    2.11  XEN_COMPILE_ARCH    ?= $(shell uname -m | sed -e s/i.86/x86_32/ \
    2.12                           -e s/i86pc/x86_32/ -e s/amd64/x86_64/)
    2.13 @@ -38,6 +38,15 @@ endif
    2.14  cc-option = $(shell if test -z "`$(1) $(2) -S -o /dev/null -xc \
    2.15                /dev/null 2>&1`"; then echo "$(2)"; else echo "$(3)"; fi ;)
    2.16  
    2.17 +# cc-option-add: Add an option to compilation flags, but only if supported.
    2.18 +# Usage: $(call cc-option-add CFLAGS,CC,-march=winchip-c6)
    2.19 +cc-option-add = $(eval $(call cc-option-add-closure,$(1),$(2),$(3)))
    2.20 +define cc-option-add-closure
    2.21 +    ifneq ($$(call cc-option,$$($(2)),$(3),n),n)
    2.22 +        $(1) += $(3)
    2.23 +    endif
    2.24 +endef
    2.25 +
    2.26  # cc-ver: Check compiler is at least specified version. Return boolean 'y'/'n'.
    2.27  # Usage: ifeq ($(call cc-ver,$(CC),0x030400),y)
    2.28  cc-ver = $(shell if [ $$((`$(1) -dumpversion | awk -F. \
    2.29 @@ -91,8 +100,8 @@ CFLAGS += -Wall -Wstrict-prototypes
    2.30  # result of any casted expression causes a warning.
    2.31  CFLAGS += -Wno-unused-value
    2.32  
    2.33 -HOSTCFLAGS += $(call cc-option,$(HOSTCC),-Wdeclaration-after-statement,)
    2.34 -CFLAGS     += $(call cc-option,$(CC),-Wdeclaration-after-statement,)
    2.35 +$(call cc-option-add,HOSTCFLAGS,HOSTCC,-Wdeclaration-after-statement)
    2.36 +$(call cc-option-add,CFLAGS,CC,-Wdeclaration-after-statement)
    2.37  
    2.38  LDFLAGS += $(foreach i, $(EXTRA_LIB), -L$(i)) 
    2.39  CFLAGS += $(foreach i, $(EXTRA_INCLUDES), -I$(i))
    2.40 @@ -103,6 +112,11 @@ XSM_ENABLE ?= n
    2.41  FLASK_ENABLE ?= n
    2.42  ACM_SECURITY ?= n
    2.43  
    2.44 +XEN_EXTFILES_URL=http://xenbits.xensource.com/xen-extfiles
    2.45 +# All the files at that location were downloaded from elsewhere on
    2.46 +# the internet.  The original download URL is preserved as a comment
    2.47 +# near the place in the Xen Makefiles where the file is used.
    2.48 +
    2.49  QEMU_REMOTE=http://xenbits.xensource.com/git-http/qemu-xen-unstable.git
    2.50  
    2.51  # Specify which qemu-dm to use. This may be `ioemu' to use the old
     3.1 --- a/Makefile	Mon Nov 10 15:52:15 2008 -0800
     3.2 +++ b/Makefile	Wed Feb 11 16:25:03 2009 -0800
     3.3 @@ -240,7 +240,8 @@ linux26:
     3.4  #
     3.5  
     3.6  TBOOT_TARFILE = tboot-20080613.tar.gz
     3.7 -TBOOT_BASE_URL = http://downloads.sourceforge.net/tboot
     3.8 +#TBOOT_BASE_URL = http://downloads.sourceforge.net/tboot
     3.9 +TBOOT_BASE_URL = $(XEN_EXTFILES_URL)
    3.10  
    3.11  .PHONY: build-tboot
    3.12  build-tboot: download_tboot
     4.1 --- a/buildconfigs/mk.linux-2.6-common	Mon Nov 10 15:52:15 2008 -0800
     4.2 +++ b/buildconfigs/mk.linux-2.6-common	Wed Feb 11 16:25:03 2009 -0800
     4.3 @@ -100,10 +100,10 @@ ifneq ($(EXTRAVERSION),)
     4.4  endif
     4.5  	$(__NONINT_CONFIG) $(MAKE) -C $(LINUX_SRCDIR) ARCH=$(LINUX_ARCH) oldconfig O=$$(/bin/pwd)/$(LINUX_DIR)
     4.6  	@set -e ; if [ ! -f $(LINUX_DIR)/Makefile ] ; then \
     4.7 -	    echo "***********************************"; \
     4.8 +	    echo "==================================="; \
     4.9  	    echo "oldconfig did not create a Makefile"; \
    4.10  	    echo "Generating $(LINUX_DIR)/Makefile   "; \
    4.11 -	    echo "***********************************"; \
    4.12 +	    echo "==================================="; \
    4.13  	    ( echo "# Automatically generated: don't edit"; \
    4.14  	      echo ""; \
    4.15  	      echo "VERSION = 2"; \
     5.1 --- a/buildconfigs/src.tarball	Mon Nov 10 15:52:15 2008 -0800
     5.2 +++ b/buildconfigs/src.tarball	Wed Feb 11 16:25:03 2009 -0800
     5.3 @@ -10,7 +10,7 @@ vpath linux-%.tar.bz2 $(LINUX_SRC_PATH)
     5.4  # download a pristine Linux kernel tarball if there isn't one in LINUX_SRC_PATH
     5.5  linux-%.tar.bz2:
     5.6  	@echo "Cannot find $@ in path $(LINUX_SRC_PATH)"
     5.7 -	wget $(XEN_LINUX_MIRROR)/$@ -O./$@
     5.8 +	false wget $(XEN_LINUX_MIRROR)/$@ -O./$@
     5.9  
    5.10  # XXX create a pristine tree for diff -Nurp convenience
    5.11  
     6.1 --- a/docs/check_pkgs	Mon Nov 10 15:52:15 2008 -0800
     6.2 +++ b/docs/check_pkgs	Wed Feb 11 16:25:03 2009 -0800
     6.3 @@ -2,12 +2,12 @@
     6.4  silent_which ()
     6.5  {
     6.6          which $1 1>/dev/null 2>/dev/null || {
     6.7 -                echo "*************************************************"
     6.8 -                echo "*************************************************"
     6.9 -                echo "* WARNING: Package '$1' is required"
    6.10 -                echo "*          to build Xen documentation"
    6.11 -                echo "*************************************************"
    6.12 -                echo "*************************************************"
    6.13 +                echo "================================================="
    6.14 +                echo "================================================="
    6.15 +                echo "= WARNING: Package '$1' is required"
    6.16 +                echo "=          to build Xen documentation"
    6.17 +                echo "================================================="
    6.18 +                echo "================================================="
    6.19          }
    6.20          which $1 1>/dev/null 2>/dev/null
    6.21  }
     7.1 --- a/docs/man/xm.pod.1	Mon Nov 10 15:52:15 2008 -0800
     7.2 +++ b/docs/man/xm.pod.1	Wed Feb 11 16:25:03 2009 -0800
     7.3 @@ -67,6 +67,8 @@ The attached console will perform much l
     7.4  so running curses based interfaces over the console B<is not
     7.5  advised>.  Vi tends to get very odd when using it over this interface.
     7.6  
     7.7 +Use the key combination Ctrl+] to detach the domain console.
     7.8 +
     7.9  =item B<create> I<configfile> [I<OPTIONS>] [I<vars>]..
    7.10  
    7.11  The create subcommand requires a config file and can optionally take a
     8.1 --- a/docs/misc/dump-core-format.txt	Mon Nov 10 15:52:15 2008 -0800
     8.2 +++ b/docs/misc/dump-core-format.txt	Wed Feb 11 16:25:03 2009 -0800
     8.3 @@ -30,8 +30,13 @@ The elf header members are set as follow
     8.4          e_ident[EI_OSABI] = ELFOSABI_SYSV = 0
     8.5          e_type = ET_CORE = 4
     8.6  ELFCLASS64 is always used independent of architecture.
     8.7 -e_ident[EI_DATA] and e_flags are set according to the dumping system's
     8.8 -architecture. Other members are set as usual.
     8.9 +e_ident[EI_DATA] is set as follows
    8.10 +  For x86 PV domain case, it is set according to the guest configuration
    8.11 +  (i.e. if guest is 32bit it is set to EM_386 even when the dom0 is 64 bit.)
    8.12 +  For other domain case (x86 HVM domain case and ia64 domain case),
    8.13 +  it is set according to the dumping system's architecture.
    8.14 +e_flags is set according to the dumping system's architecture.
    8.15 +Other members are set as usual.
    8.16  
    8.17  Sections
    8.18  --------
    8.19 @@ -241,3 +246,7 @@ Currently only (major, minor) = (0, 1) i
    8.20    The format version isn't bumped because analysis tools can distinguish it.
    8.21  - .xen_ia64_mapped_regs section was made only for ia64 PV domain.
    8.22    In case of IA64 HVM domain, this section doesn't exist.
    8.23 +- elf header e_ident[EI_DATA]
    8.24 +  On x86 PV domain case, it is set according to the guest configuration.
    8.25 +  I.e. 32-on-64 case, the file will be set EM_386 instead of EM_X86_64.
    8.26 +  This is the same as 32-on-32 case, so there is no impact on analysis tools.
     9.1 --- a/docs/misc/vtd.txt	Mon Nov 10 15:52:15 2008 -0800
     9.2 +++ b/docs/misc/vtd.txt	Wed Feb 11 16:25:03 2009 -0800
     9.3 @@ -38,6 +38,30 @@ Enable MSI/MSI-x for assigned devices
     9.4  Add "msi=1" option in kernel line of host grub.
     9.5  
     9.6  
     9.7 +MSI-INTx translation for passthrough devices in HVM
     9.8 +---------------------------------------------------
     9.9 +
    9.10 +If the assigned device uses a physical IRQ that is shared by more than
    9.11 +one device among multiple domains, there may be significant impact on
    9.12 +device performance. Unfortunately, this is quite a common case if the
    9.13 +IO-APIC (INTx) IRQ is used. MSI can avoid this issue, but was only
    9.14 +available if the guest enables it.
    9.15 +
    9.16 +With MSI-INTx translation turned on, Xen enables device MSI if it's
    9.17 +available, regardless of whether the guest uses INTx or MSI. If the
    9.18 +guest uses INTx IRQ, Xen will inject a translated INTx IRQ to guest's
    9.19 +virtual ioapic whenever an MSI message is received. This reduces the
    9.20 +interrupt sharing of the system. If the guest OS enables MSI or MSI-X,
    9.21 +the translation is automatically turned off.
    9.22 +
    9.23 +To enable or disable MSI-INTx translation globally, add "pci_msitranslate"
    9.24 +in the config file:
    9.25 +	pci_msitranslate = 1         (default is 1)
    9.26 +
    9.27 +To override for a specific device:
    9.28 +	pci = [ '01:00.0,msitranslate=0', '03:00.0' ]
    9.29 +
    9.30 +
    9.31  Caveat on Conventional PCI Device Passthrough
    9.32  ---------------------------------------------
    9.33  
    9.34 @@ -80,6 +104,11 @@ 2 virtual PCI slots (6~7) are reserved i
    9.35  
    9.36  	[root@vt-vtd ~]# xm pci-attach HVMDomainVtd 0:2:0.0 7
    9.37  
    9.38 +    To specify options for the device, use -o or --options=. Following command would disable MSI-INTx translation for the device
    9.39 +
    9.40 +	[root@vt-vtd ~]# xm pci-attach -o msitranslate=0 0:2:0.0 7
    9.41 +
    9.42 +
    9.43  VTd hotplug usage model:
    9.44  ------------------------
    9.45  
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/docs/misc/xen-error-handling.txt	Wed Feb 11 16:25:03 2009 -0800
    10.3 @@ -0,0 +1,88 @@
    10.4 +Error handling in Xen
    10.5 +---------------------
    10.6 +
    10.7 +1. domain_crash()
    10.8 +-----------------
    10.9 +Crash the specified domain due to buggy or unsupported behaviour of the
   10.10 +guest. This should not be used where the hypervisor itself is in
   10.11 +error, even if the scope of that error affects only a single
   10.12 +domain. BUG() is a more appropriate failure method for hypervisor
   10.13 +bugs. To repeat: domain_crash() is the correct response for erroneous
   10.14 +or unsupported *guest* behaviour!
   10.15 +
   10.16 +Note that this should be used in most cases in preference to
   10.17 +domain_crash_synchronous(): domain_crash() returns to the caller,
   10.18 +allowing the crash to be deferred for the currently executing VCPU
   10.19 +until certain resources (notably, spinlocks) have been released.
   10.20 +
   10.21 +Example usages:
   10.22 + * Unrecoverable guest kernel stack overflows
   10.23 + * Unsupported corners of HVM device models
   10.24 +
   10.25 +2. BUG()
   10.26 +--------
   10.27 +Crashes the host system with an informative file/line error message
   10.28 +and a backtrace. Use this to check consistency assumptions within the
   10.29 +hypervisor.
   10.30 +
   10.31 +Be careful not to use BUG() (or BUG_ON(), or ASSERT()) for failures
   10.32 +*outside* the hypervisor software -- in particular, guest bugs (where
   10.33 +domain_crash() is more appropriate) or non-critical BIOS or hardware
   10.34 +errors (where retry or feature disable are more appropriate).
   10.35 +
   10.36 +Example usage: In arch/x86/hvm/i8254.c an I/O port handler includes
   10.37 +the check BUG_ON(bytes != 1). We choose this extreme reaction to the
   10.38 +unexpected error case because, although it could be handled by failing
   10.39 +the I/O access or crashing the domain, it is indicative of an
   10.40 +unexpected inconsistency in the hypervisor itself (since the I/O
   10.41 +handler was only registered for single-byte accesses).
   10.42 +
   10.43 +
   10.44 +3. BUG_ON()
   10.45 +-----------
   10.46 +BUG_ON(...) is merely a convenient short form for "if (...) BUG()". It
   10.47 +is most commonly used as an 'always on' alternative to ASSERT().
   10.48 +
   10.49 +
   10.50 +4. ASSERT()
   10.51 +-----------
   10.52 +Similar to BUG_ON(), except that it is only enabled for debug builds
   10.53 +of the hypervisor. Typically ASSERT() is used only where the (usually
   10.54 +small) overheads of an always-on debug check might be considered
   10.55 +excessive. A good example might be within inner loops of time-critical
   10.56 +functions, or where an assertion is extreme paranoia (considered
   10.57 +*particularly* unlikely ever to fail).
   10.58 +
   10.59 +In general, if in doubt, use BUG_ON() in preference to ASSERT().
   10.60 +
   10.61 +
   10.62 +5. panic()
   10.63 +----------
   10.64 +Like BUG() and ASSERT() this will crash and reboot the host
   10.65 +system. However it does this after printing only an error message with
   10.66 +no extra diagnostic information such as a backtrace. panic() is
   10.67 +generally used where an unsupported system configuration is detected,
   10.68 +particularly during boot, and where extra diagnostic information about
   10.69 +CPU context would not be useful. It may also be used before exception
   10.70 +handling is enabled during Xen bootstrap (on x86, BUG() and ASSERT()
   10.71 +depend on Xen's exception-handling capabilities).
   10.72 +
   10.73 +Example usage: Most commonly for out-of-memory errors during
   10.74 +bootstrap. The failure is unexpected since a host should always have
   10.75 +enough memory to boot Xen, but if the failure does occur then the
   10.76 +context of the failed memory allocation itself is not very
   10.77 +interesting.
   10.78 +
   10.79 +
   10.80 +6. Feature disable
   10.81 +------------------
   10.82 +A possible approach to dealing with boot-time errors, rather than
   10.83 +crashing the hypervisor. It's particularly appropriate when parsing
   10.84 +non-critical BIOS tables and detecting extended hardware features.
   10.85 +
   10.86 +
   10.87 +7. BUILD_BUG_ON()
   10.88 +-----------------
   10.89 +Useful for assertions which can be evaluated at compile time. For
   10.90 +example, making explicit assumptions about size and alignment of C
   10.91 +structures.
    11.1 --- a/extras/mini-os/Makefile	Mon Nov 10 15:52:15 2008 -0800
    11.2 +++ b/extras/mini-os/Makefile	Wed Feb 11 16:25:03 2009 -0800
    11.3 @@ -93,8 +93,12 @@ endif
    11.4  $(OBJ_DIR)/$(TARGET)_app.o: $(APP_OBJS) app.lds
    11.5  	$(LD) -r -d $(LDFLAGS) -\( $^ -\) $(APP_LDLIBS) --undefined main -o $@
    11.6  
    11.7 -$(OBJ_DIR)/$(TARGET): links $(OBJS) $(OBJ_DIR)/$(TARGET)_app.o arch_lib
    11.8 -	$(LD) -r $(LDFLAGS) $(HEAD_OBJ) $(OBJ_DIR)/$(TARGET)_app.o $(OBJS) $(LDARCHLIB) $(LDLIBS) -o $@.o
    11.9 +ifneq ($(APP_OBJS),)
   11.10 +APP_O=$(OBJ_DIR)/$(TARGET)_app.o 
   11.11 +endif
   11.12 +
   11.13 +$(OBJ_DIR)/$(TARGET): links $(OBJS) $(APP_O) arch_lib
   11.14 +	$(LD) -r $(LDFLAGS) $(HEAD_OBJ) $(APP_O) $(OBJS) $(LDARCHLIB) $(LDLIBS) -o $@.o
   11.15  	$(OBJCOPY) -w -G $(GLOBAL_PREFIX)* -G _start $@.o $@.o
   11.16  	$(LD) $(LDFLAGS) $(LDFLAGS_FINAL) $@.o $(EXTRA_OBJS) -o $@
   11.17  	gzip -f -9 -c $@ >$@.gz
    12.1 --- a/extras/mini-os/arch/ia64/arch.mk	Mon Nov 10 15:52:15 2008 -0800
    12.2 +++ b/extras/mini-os/arch/ia64/arch.mk	Wed Feb 11 16:25:03 2009 -0800
    12.3 @@ -1,5 +1,3 @@
    12.4 -# Build for Big Endian?
    12.5 -BIGENDIAN ?= n
    12.6  
    12.7  ARCH_CFLAGS := -mfixed-range=f2-f5,f12-f15,f32-f127 -mconstant-gp
    12.8  ARCH_CFLAGS += -O2
    12.9 @@ -9,12 +7,3 @@ ARCH_ASFLAGS += -fno-builtin -fno-common
   12.10  
   12.11  ARCH_LDFLAGS = -warn-common
   12.12  
   12.13 -# Next lines are for big endian code !
   12.14 -ifeq ($(BIGENDIAN),y)
   12.15 -ARCH_CFLAGS += -mbig-endian -Wa,-mbe -Wa,-mlp64
   12.16 -ARCH_CFLAGS += -DBIG_ENDIAN
   12.17 -ARCH_ASFLAGS += -Wa,-mbe
   12.18 -ARCH_ASFLAGS += -DBIG_ENDIAN
   12.19 -ARCH_LDFLAGS = -EB -d
   12.20 -endif
   12.21 -
    13.1 --- a/extras/mini-os/arch/ia64/common.c	Mon Nov 10 15:52:15 2008 -0800
    13.2 +++ b/extras/mini-os/arch/ia64/common.c	Wed Feb 11 16:25:03 2009 -0800
    13.3 @@ -116,8 +116,8 @@ registerCallback(void)
    13.4  {
    13.5  	struct callback_register event =
    13.6  	{
    13.7 -		.type = SWAP(CALLBACKTYPE_event),
    13.8 -		.address = SWAP((unsigned long)&hypervisor_callback),
    13.9 +		.type = CALLBACKTYPE_event,
   13.10 +		.address = (unsigned long)&hypervisor_callback,
   13.11  	};
   13.12  	HYPERVISOR_callback_op(CALLBACKOP_register, &event);
   13.13  }
   13.14 @@ -126,46 +126,44 @@ static void
   13.15  init_start_info(start_info_t* xen_start_info)
   13.16  {
   13.17  	/* Make a copy of the start_info structure */
   13.18 -	start_info.nr_pages = SWAP(xen_start_info->nr_pages);
   13.19 -	start_info.shared_info = SWAP(xen_start_info->shared_info);
   13.20 -	start_info.flags = SWAP(xen_start_info->flags);
   13.21 -	start_info.store_mfn = SWAP(xen_start_info->store_mfn);
   13.22 -	start_info.store_evtchn	= SWAP(xen_start_info->store_evtchn);
   13.23 -	start_info.console.domU.mfn = SWAP(xen_start_info->console.domU.mfn);
   13.24 +	start_info.nr_pages = xen_start_info->nr_pages;
   13.25 +	start_info.shared_info = xen_start_info->shared_info;
   13.26 +	start_info.flags = xen_start_info->flags;
   13.27 +	start_info.store_mfn = xen_start_info->store_mfn;
   13.28 +	start_info.store_evtchn	= xen_start_info->store_evtchn;
   13.29 +	start_info.console.domU.mfn = xen_start_info->console.domU.mfn;
   13.30  	start_info.console.domU.evtchn =
   13.31 -				SWAP(xen_start_info->console.domU.evtchn);
   13.32 -	start_info.pt_base = SWAP(xen_start_info->pt_base);
   13.33 -	start_info.nr_pt_frames	= SWAP(xen_start_info->nr_pt_frames);
   13.34 -	start_info.mfn_list = SWAP(xen_start_info->mfn_list);
   13.35 -	start_info.mod_start = SWAP(xen_start_info->mod_start);
   13.36 -	start_info.mod_len = SWAP(xen_start_info->mod_len);
   13.37 +				xen_start_info->console.domU.evtchn;
   13.38 +	start_info.pt_base = xen_start_info->pt_base;
   13.39 +	start_info.nr_pt_frames	= xen_start_info->nr_pt_frames;
   13.40 +	start_info.mfn_list = xen_start_info->mfn_list;
   13.41 +	start_info.mod_start = xen_start_info->mod_start;
   13.42 +	start_info.mod_len = xen_start_info->mod_len;
   13.43  }
   13.44  
   13.45  static void
   13.46  init_boot_params(void)
   13.47  {
   13.48 -	ia64BootParamG.command_line = SWAP(ia64_boot_paramP->command_line);
   13.49 -	ia64BootParamG.efi_systab = SWAP(ia64_boot_paramP->efi_systab);
   13.50 -	ia64BootParamG.efi_memmap = SWAP(ia64_boot_paramP->efi_memmap);
   13.51 -	ia64BootParamG.efi_memmap_size =
   13.52 -				SWAP(ia64_boot_paramP->efi_memmap_size);
   13.53 -	ia64BootParamG.efi_memdesc_size	=
   13.54 -				SWAP(ia64_boot_paramP->efi_memdesc_size);
   13.55 +	ia64BootParamG.command_line = ia64_boot_paramP->command_line;
   13.56 +	ia64BootParamG.efi_systab = ia64_boot_paramP->efi_systab;
   13.57 +	ia64BootParamG.efi_memmap = ia64_boot_paramP->efi_memmap;
   13.58 +	ia64BootParamG.efi_memmap_size = ia64_boot_paramP->efi_memmap_size;
   13.59 +	ia64BootParamG.efi_memdesc_size	= ia64_boot_paramP->efi_memdesc_size;
   13.60  	ia64BootParamG.efi_memdesc_version =
   13.61 -				SWAP(ia64_boot_paramP->efi_memdesc_version);
   13.62 +				ia64_boot_paramP->efi_memdesc_version;
   13.63  	ia64BootParamG.console_info.num_cols =
   13.64 -				SWAP(ia64_boot_paramP->console_info.num_cols);
   13.65 +				ia64_boot_paramP->console_info.num_cols;
   13.66  	ia64BootParamG.console_info.num_rows =
   13.67 -				SWAP(ia64_boot_paramP->console_info.num_rows);
   13.68 +				ia64_boot_paramP->console_info.num_rows;
   13.69  	ia64BootParamG.console_info.orig_x =
   13.70 -				SWAP(ia64_boot_paramP->console_info.orig_x);
   13.71 +				ia64_boot_paramP->console_info.orig_x;
   13.72  	ia64BootParamG.console_info.orig_y =
   13.73 -				SWAP(ia64_boot_paramP->console_info.orig_y);
   13.74 -	ia64BootParamG.fpswa = SWAP(ia64_boot_paramP->fpswa);
   13.75 -	ia64BootParamG.initrd_start = SWAP(ia64_boot_paramP->initrd_start);
   13.76 -	ia64BootParamG.initrd_size = SWAP(ia64_boot_paramP->initrd_size);
   13.77 -	ia64BootParamG.domain_start = SWAP(ia64_boot_paramP->domain_start);
   13.78 -	ia64BootParamG.domain_size = SWAP(ia64_boot_paramP->domain_size);
   13.79 +				ia64_boot_paramP->console_info.orig_y;
   13.80 +	ia64BootParamG.fpswa = ia64_boot_paramP->fpswa;
   13.81 +	ia64BootParamG.initrd_start = ia64_boot_paramP->initrd_start;
   13.82 +	ia64BootParamG.initrd_size = ia64_boot_paramP->initrd_size;
   13.83 +	ia64BootParamG.domain_start = ia64_boot_paramP->domain_start;
   13.84 +	ia64BootParamG.domain_size = ia64_boot_paramP->domain_size;
   13.85  
   13.86  	/*
   13.87  	 * Copy and parse the boot command line.
    14.1 --- a/extras/mini-os/arch/ia64/debug.c	Mon Nov 10 15:52:15 2008 -0800
    14.2 +++ b/extras/mini-os/arch/ia64/debug.c	Wed Feb 11 16:25:03 2009 -0800
    14.3 @@ -102,7 +102,6 @@ static const char *ia64_vector_names[] =
    14.4  
    14.5  typedef struct
    14.6  {
    14.7 -#if !defined(BIG_ENDIAN)
    14.8  	uint64_t sof	:7;	/* 0-6 size of frame */
    14.9  	uint64_t sol	:7;	/* 7-13 size of locals (in + loc) */
   14.10  	uint64_t sor	:4;
   14.11 @@ -111,16 +110,6 @@ typedef struct
   14.12  	uint64_t rrb_pr	:6;
   14.13  	uint64_t res	:25;	/* reserved */
   14.14  	uint64_t v	:1;	/* The v bit */
   14.15 -#else /* !BIG_ENDIAN */
   14.16 -	uint64_t v	:1;	/* The v bit */
   14.17 -	uint64_t res	:25;	/* reserved */
   14.18 -	uint64_t rrb_pr	:6;
   14.19 -	uint64_t rrb_fr	:7;
   14.20 -	uint64_t rrb_gr	:7;
   14.21 -	uint64_t sor	:4;
   14.22 -	uint64_t sol	:7;	/* 7-13 size of locals (in + loc) */
   14.23 -	uint64_t sof	:7;	/* 0-6 size of frame */
   14.24 -#endif /* BIG_ENDIAN */
   14.25  } ifs_t;
   14.26  
   14.27  void
    15.1 --- a/extras/mini-os/arch/ia64/efi.c	Mon Nov 10 15:52:15 2008 -0800
    15.2 +++ b/extras/mini-os/arch/ia64/efi.c	Wed Feb 11 16:25:03 2009 -0800
    15.3 @@ -49,13 +49,6 @@ efi_get_time(efi_time_t* tmP)
    15.4  		printk("efi.getTime() failed\n");
    15.5  		return 0;
    15.6  	}
    15.7 -
    15.8 -#if defined(BIG_ENDIAN)
    15.9 -	tmP->Year = SWAP(tmP->Year);
   15.10 -	tmP->TimeZone = SWAP(tmP->TimeZone);
   15.11 -	tmP->Nanosecond = SWAP(tmP->Nanosecond);
   15.12 -#endif
   15.13 -
   15.14  	return 1;
   15.15  }
   15.16  
   15.17 @@ -65,17 +58,7 @@ efi_get_time(efi_time_t* tmP)
   15.18  static int
   15.19  efi_guid_cmp(efi_guid_t* a_le, efi_guid_t* b)
   15.20  {
   15.21 -#if defined(BIG_ENDIAN)
   15.22 -	if(SWAP(a_le->Data1) != b->Data1)
   15.23 -		return 1;
   15.24 -	if(SWAP(a_le->Data2) != b->Data2)
   15.25 -		return 1;
   15.26 -	if(SWAP(a_le->Data3) != b->Data3)
   15.27 -		return 1;
   15.28 -	return memcmp(a_le->Data4, b->Data4, sizeof(uint8_t)*8);
   15.29 -#else
   15.30  	return memcmp(a_le, b, sizeof(efi_guid_t));
   15.31 -#endif
   15.32  }
   15.33  
   15.34  void
   15.35 @@ -99,20 +82,20 @@ init_efi(void)
   15.36  	efiSysTableP = (efi_system_table_t*)__va(ia64BootParamG.efi_systab);
   15.37  	machineFwG.efi.efiSysTableP = efiSysTableP;
   15.38  	PRINT_BV("EfiSystemTable at: %p\n", efiSysTableP);
   15.39 -	fwP = (uint16_t*) __va(SWAP(efiSysTableP->FirmwareVendor));
   15.40 +	fwP = (uint16_t*) __va(efiSysTableP->FirmwareVendor);
   15.41  	if (fwP) {
   15.42  		for (i = 0; i < (int)sizeof(fwVendor) - 1 && *fwP; ++i)
   15.43 -			fwVendor[i] = SWAP(*fwP++);
   15.44 +			fwVendor[i] = *fwP++;
   15.45  		fwVendor[i] = '\0';
   15.46  	}
   15.47  	PRINT_BV("  EFI-FirmwareVendor        : %s\n", fwVendor);
   15.48  	PRINT_BV("  EFI-FirmwareRevision      : %d\n",
   15.49 -		 SWAP(efiSysTableP->FirmwareRevision));
   15.50 +		 efiSysTableP->FirmwareRevision);
   15.51  	PRINT_BV("  EFI-SystemTable-Revision  : %d.%d\n",
   15.52 -		 SWAP(efiSysTableP->Hdr.Revision)>>16,
   15.53 -		 SWAP(efiSysTableP->Hdr.Revision)&0xffff);
   15.54 +		 efiSysTableP->Hdr.Revision >> 16,
   15.55 +		 efiSysTableP->Hdr.Revision & 0xffff);
   15.56  	rsP = (efi_runtime_services_t*)
   15.57 -		__va(SWAP(efiSysTableP->RuntimeServices));
   15.58 +		__va(efiSysTableP->RuntimeServices);
   15.59  	mdcnt = ia64BootParamG.efi_memmap_size /
   15.60  		ia64BootParamG.efi_memdesc_size;
   15.61  	memdP = (efi_memory_descriptor_t*) __va(ia64BootParamG.efi_memmap);
   15.62 @@ -123,10 +106,10 @@ init_efi(void)
   15.63  	     mdP = NextMemoryDescriptor(mdP, ia64BootParamG.efi_memdesc_size)) {
   15.64  		/* Relocate runtime memory segments for firmware. */
   15.65  		PRINT_BV("  %d. Type: %x  Attributes: 0x%lx\n",
   15.66 -			 i, SWAP(mdP->Type), SWAP(mdP->Attribute));
   15.67 +			 i, mdP->Type, mdP->Attribute);
   15.68  		PRINT_BV("     PhysStart: 0x%lx  NumPages: 0x%lx\n",
   15.69 -			 SWAP(mdP->PhysicalStart), SWAP(mdP->NumberOfPages));
   15.70 -		switch (SWAP(mdP->Type)) {
   15.71 +			 mdP->PhysicalStart, mdP->NumberOfPages);
   15.72 +		switch (mdP->Type) {
   15.73  			case EfiRuntimeServicesData:
   15.74  				PRINT_BV("     -> EfiRuntimeServicesData\n");
   15.75  				break;
   15.76 @@ -139,18 +122,17 @@ init_efi(void)
   15.77  			case EfiConventionalMemory:
   15.78  				PRINT_BV("     -> EfiConventionalMemory\n");
   15.79  				PRINT_BV("        start: 0x%lx end: 0x%lx\n",
   15.80 -					SWAP(mdP->PhysicalStart),
   15.81 -					SWAP(mdP->PhysicalStart)+
   15.82 -					SWAP(mdP->NumberOfPages)*EFI_PAGE_SIZE);
   15.83 +					mdP->PhysicalStart,
   15.84 +					mdP->PhysicalStart +
   15.85 +					mdP->NumberOfPages * EFI_PAGE_SIZE);
   15.86  				if (numConvMem) {
   15.87  					printk("     Currently only one efi "
   15.88  						"memory chunk supported !!!\n");
   15.89  					break;
   15.90  				}
   15.91 -				machineFwG.mach_mem_start =
   15.92 -					SWAP(mdP->PhysicalStart);
   15.93 +				machineFwG.mach_mem_start = mdP->PhysicalStart;
   15.94  				machineFwG.mach_mem_size =
   15.95 -					SWAP(mdP->NumberOfPages)*EFI_PAGE_SIZE;
   15.96 +					mdP->NumberOfPages * EFI_PAGE_SIZE;
   15.97  				numConvMem++;
   15.98  				break;
   15.99  			case EfiMemoryMappedIOPortSpace:
  15.100 @@ -158,7 +140,7 @@ init_efi(void)
  15.101  				break;
  15.102  			case EfiPalCode:
  15.103                         		machineFwG.ia64_pal_base =
  15.104 -					__va(SWAP(mdP->PhysicalStart));
  15.105 +					__va(mdP->PhysicalStart);
  15.106  				PRINT_BV("     -> EfiPalCode\n"
  15.107  					 "        start : %p\n",
  15.108  					 machineFwG.ia64_pal_base);
  15.109 @@ -170,12 +152,11 @@ init_efi(void)
  15.110  		 * virtual addressing and the efi runtime functions
  15.111  		 * may be called directly.
  15.112  		 */
  15.113 -		if (SWAP(mdP->Attribute) & EFI_MEMORY_RUNTIME) {
  15.114 -			if (SWAP(mdP->Attribute) & EFI_MEMORY_WB)
  15.115 -				mdP->VirtualStart =
  15.116 -					SWAP(__va(mdP->PhysicalStart));
  15.117 +		if (mdP->Attribute & EFI_MEMORY_RUNTIME) {
  15.118 +			if (mdP->Attribute & EFI_MEMORY_WB)
  15.119 +				mdP->VirtualStart = __va(mdP->PhysicalStart);
  15.120  			else {
  15.121 -				if (SWAP(mdP->Attribute) & EFI_MEMORY_UC)
  15.122 +				if (mdP->Attribute & EFI_MEMORY_UC)
  15.123  					printk("efi_init: RuntimeMemory with "
  15.124  						"UC attribute !!!!!!\n");
  15.125  					/*
  15.126 @@ -187,7 +168,7 @@ init_efi(void)
  15.127  	}
  15.128  	/* Now switch efi runtime stuff to virtual addressing. */
  15.129  	status = ia64_call_efi_physical(
  15.130 -			(void*)__va(SWAP((uint64_t)rsP->SetVirtualAddressMap)),
  15.131 +			(void*)__va((uint64_t)rsP->SetVirtualAddressMap),
  15.132  			ia64BootParamG.efi_memmap_size,
  15.133  			ia64BootParamG.efi_memdesc_size,
  15.134  			ia64BootParamG.efi_memdesc_version,
  15.135 @@ -200,35 +181,35 @@ init_efi(void)
  15.136  	}
  15.137  	/* Getting efi function pointer for getEfiTime. */
  15.138  	machineFwG.efi.getTimeF =
  15.139 -		(efi_get_time_t)__va(SWAP((uint64_t)rsP->GetTime));
  15.140 +		(efi_get_time_t)__va((uint64_t)rsP->GetTime);
  15.141  	/* Getting efi function pointer for resetSystem. */
  15.142  	machineFwG.efi.resetSystemF =
  15.143 -		(efi_reset_system_t)__va(SWAP((uint64_t)rsP->ResetSystem));
  15.144 +		(efi_reset_system_t)__va((uint64_t)rsP->ResetSystem);
  15.145  
  15.146  	/* Scanning the Configuration table of the EfiSystemTable. */
  15.147  	PRINT_BV("NumberOfConfigTableEntries: %ld\n",
  15.148 -		 SWAP(efiSysTableP->NumberOfTableEntries));
  15.149 +		 efiSysTableP->NumberOfTableEntries);
  15.150  
  15.151  	confP = (efi_configuration_table_t*)
  15.152 -			__va(SWAP(efiSysTableP->ConfigurationTable));
  15.153 -	for (i = 0; i < SWAP(efiSysTableP->NumberOfTableEntries); i++) {
  15.154 +			__va(efiSysTableP->ConfigurationTable);
  15.155 +	for (i = 0; i < efiSysTableP->NumberOfTableEntries; i++) {
  15.156  		if (!efi_guid_cmp(&confP[i].VendorGuid, &sal)) {
  15.157  			machineFwG.ia64_sal_tableP = (sal_system_table_t*)
  15.158 -				__va(SWAP((uint64_t) confP[i].VendorTable));
  15.159 +				__va((uint64_t) confP[i].VendorTable);
  15.160  			PRINT_BV("  Found SalSystemTable at: 0x%lx\n",
  15.161  				 (uint64_t) machineFwG.ia64_sal_tableP);
  15.162  			continue;
  15.163  		}
  15.164  		if (!efi_guid_cmp(&confP[i].VendorGuid, &acpi)) {
  15.165  			machineFwG.ia64_efi_acpi_table =
  15.166 -				__va(SWAP((uint64_t) confP[i].VendorTable));
  15.167 +				__va((uint64_t) confP[i].VendorTable);
  15.168  			PRINT_BV("  Found AcpiTable at:      0x%lx\n",
  15.169  				 (uint64_t) machineFwG.ia64_efi_acpi_table);
  15.170  			continue;
  15.171  		}
  15.172  		if (!efi_guid_cmp(&confP[i].VendorGuid, &acpi20)) {
  15.173  			machineFwG.ia64_efi_acpi20_table =
  15.174 -				__va(SWAP((uint64_t) confP[i].VendorTable));
  15.175 +				__va((uint64_t) confP[i].VendorTable);
  15.176  			PRINT_BV("  Found Acpi20Table at:    0x%lx\n",
  15.177  				 (uint64_t) machineFwG.ia64_efi_acpi20_table);
  15.178  			continue;
    16.1 --- a/extras/mini-os/arch/ia64/fw.S	Mon Nov 10 15:52:15 2008 -0800
    16.2 +++ b/extras/mini-os/arch/ia64/fw.S	Wed Feb 11 16:25:03 2009 -0800
    16.3 @@ -155,11 +155,6 @@ ENTRY(ia64_call_efi_physical)
    16.4  	ld8	r14=[in0],8		// function address
    16.5  	;;
    16.6  	ld8	gp=[in0]		// function gp value
    16.7 -#if defined(BIG_ENDIAN)
    16.8 -	mux1	r14=r14,@rev		// swap because mini-os is in BE
    16.9 -	mov	ar.rsc=3
   16.10 -	;;
   16.11 -#endif
   16.12  	mov	out0=in1
   16.13  	mov	out1=in2
   16.14  	mov	out2=in3
   16.15 @@ -167,19 +162,7 @@ ENTRY(ia64_call_efi_physical)
   16.16  	mov	out4=in5
   16.17  	mov	b6=r14
   16.18  	;;
   16.19 -#if defined(BIG_ENDIAN)
   16.20 -	mux1	gp=gp,@rev		// swap because mini-os is in BE
   16.21 -	rum IA64_PSR_BE
   16.22 -	;;
   16.23 -#endif
   16.24 -
   16.25  	br.call.sptk.many rp=b6		// call EFI procedure
   16.26 -
   16.27 -#if defined(BIG_ENDIAN)
   16.28 -	;;
   16.29 -	sum IA64_PSR_BE
   16.30 -	mov	ar.rsc=IA64_RSE_EAGER
   16.31 -#endif
   16.32  	mov	gp=loc3			// restore kernel gp
   16.33  	mov	r14=loc2		// psr to restore mode
   16.34  	;;
   16.35 @@ -227,16 +210,8 @@ 1:	mov	palret=ip		// for return address
   16.36  	mov	b0=palret
   16.37  	rsm	psr.i			// disable interrupts
   16.38  	;;
   16.39 -#if defined(BIG_ENDIAN)
   16.40 -	rum	IA64_PSR_BE		// set psr.be==0
   16.41 -	;;
   16.42 -#endif
   16.43  	br.cond.sptk b6			// call into firmware
   16.44  	;;
   16.45 -#if defined(BIG_ENDIAN)
   16.46 -	sum	IA64_PSR_BE		// set psr.be==1
   16.47 -	;;
   16.48 -#endif
   16.49  	ssm	psr.i			// enable interrupts
   16.50  	;;
   16.51  2:	mov	psr.l=psrsave
   16.52 @@ -271,25 +246,9 @@ ENTRY(ia64_call_efi_func)
   16.53  	;;
   16.54  	ld8	gp=[in0]		// function gp value
   16.55  	;;
   16.56 -#if defined(BIG_ENDIAN)
   16.57 -	mux1	r14=r14,@rev		// swap if mini-os is in BE
   16.58 -	mux1	gp=gp,@rev		// swap if mini-os is in BE
   16.59 -#endif
   16.60 -	;;
   16.61  	mov	b6=r14
   16.62 -
   16.63 -#if defined(BIG_ENDIAN)
   16.64 -	rum	IA64_PSR_BE
   16.65 -	;;
   16.66 -#endif
   16.67 -
   16.68  	br.call.sptk.many rp=b6		// call EFI procedure
   16.69  	
   16.70 -#if defined(BIG_ENDIAN)
   16.71 -	sum	IA64_PSR_BE
   16.72 -	;;
   16.73 -#endif
   16.74 -	
   16.75  	mov	ar.pfs=loc0
   16.76  	mov	gp=loc1
   16.77  	mov	rp=loc2
    17.1 --- a/extras/mini-os/arch/ia64/ia64.S	Mon Nov 10 15:52:15 2008 -0800
    17.2 +++ b/extras/mini-os/arch/ia64/ia64.S	Wed Feb 11 16:25:03 2009 -0800
    17.3 @@ -205,10 +205,6 @@ 1:	/* now we are in virtual mode */
    17.4  	START_INFO_PFN_ld	r14=[r15]	// load the start_info_pfn
    17.5  	add	r16=7, r0
    17.6  	;;
    17.7 -#if defined(BIG_ENDIAN)
    17.8 -	mux1	r14=r14,@rev		// swap because mini-os is in BE
    17.9 -#endif
   17.10 -	;;
   17.11  	shl	r15=r14,PAGE_SHIFT_XEN_16K	// pfn << PAGE_SHIFT_XEN_16K
   17.12  	shl	r16=r16,IA64_RR_IDX_POS		// (7<<IA64_RR_IDX_POS)
   17.13  	;;
    18.1 --- a/extras/mini-os/arch/ia64/ivt.S	Mon Nov 10 15:52:15 2008 -0800
    18.2 +++ b/extras/mini-os/arch/ia64/ivt.S	Wed Feb 11 16:25:03 2009 -0800
    18.3 @@ -87,11 +87,6 @@ ENTRY(save_tf_rse_switch)
    18.4  	;;
    18.5  	ld8	r21=[r21]		// XEN.ipsr
    18.6  	ld8	r22=[r22];;		// XEN.iip
    18.7 -#if defined(BIG_ENDIAN)
    18.8 -	mux1	r21=r21,@rev		// swap because mini-os is in BE
    18.9 -	mux1	r22=r22,@rev		// swap because mini-os is in BE
   18.10 -	;;
   18.11 -#endif
   18.12  	add	r19=TF_IPSR,r18
   18.13  	add	r20=TF_IIP,r18
   18.14  	;;
   18.15 @@ -129,10 +124,6 @@ ENTRY(save_tf_rse_switch)
   18.16  	//bsw.1		// switch to bank 1 for saving these registers.
   18.17  	movl r30=XSI_BANKNUM		// Switch to bank 1.
   18.18  	mov r31=1;;
   18.19 -#if defined(BIG_ENDIAN)
   18.20 -	mux1	r31=r31,@rev		// swap because mini-os is in BE
   18.21 -	;;
   18.22 -#endif
   18.23  	st4 [r30]=r31
   18.24  	;;
   18.25  	/*
   18.26 @@ -143,38 +134,13 @@ ENTRY(save_tf_rse_switch)
   18.27  	movl r30=XSI_BANK1_R16;
   18.28  	movl r31=XSI_BANK1_R16+8;; 
   18.29  	ld8 r16=[r30],16; ld8 r17=[r31],16;;
   18.30 -#if defined(BIG_ENDIAN)			// swap because mini-os is in BE
   18.31 -	mux1	r16=r16,@rev; mux1 r17=r17,@rev;;
   18.32 -#endif
   18.33  	ld8 r18=[r30],16; ld8 r19=[r31],16;;
   18.34 -#if defined(BIG_ENDIAN)			// swap because mini-os is in BE
   18.35 -	mux1	r18=r18,@rev; mux1 r19=r19,@rev;;
   18.36 -#endif
   18.37  	ld8 r20=[r30],16; ld8 r21=[r31],16;;
   18.38 -#if defined(BIG_ENDIAN)			// swap because mini-os is in BE
   18.39 -	mux1	r20=r20,@rev; mux1 r21=r21,@rev;;
   18.40 -#endif
   18.41  	ld8 r22=[r30],16; ld8 r23=[r31],16;;
   18.42 -#if defined(BIG_ENDIAN)			// swap because mini-os is in BE
   18.43 -	mux1	r22=r22,@rev; mux1 r23=r23,@rev;;
   18.44 -#endif
   18.45  	ld8 r24=[r30],16; ld8 r25=[r31],16;;
   18.46 -#if defined(BIG_ENDIAN)			// swap because mini-os is in BE
   18.47 -	mux1	r24=r24,@rev; mux1 r25=r25,@rev;;
   18.48 -#endif
   18.49  	ld8 r26=[r30],16; ld8 r27=[r31],16;;
   18.50 -#if defined(BIG_ENDIAN)			// swap because mini-os is in BE
   18.51 -	mux1	r26=r26,@rev; mux1 r27=r27,@rev;;
   18.52 -#endif
   18.53  	ld8 r28=[r30],16; ld8 r29=[r31],16;;
   18.54 -#if defined(BIG_ENDIAN)			// swap because mini-os is in BE
   18.55 -	mux1	r28=r28,@rev; mux1 r29=r29,@rev;;
   18.56 -#endif
   18.57  	ld8 r30=[r30]; ld8 r31=[r31];;
   18.58 -#if defined(BIG_ENDIAN)			// swap because mini-os is in BE
   18.59 -	mux1	r30=r30,@rev; mux1 r31=r31,@rev;;
   18.60 -#endif
   18.61 -
   18.62  	add	r2=TF_GREG16,r14
   18.63  	add	r3=TF_GREG17,r14
   18.64  	;;
   18.65 @@ -251,10 +217,6 @@ ENTRY(save_tf_rse_switch)
   18.66  	;;
   18.67  	ld8	r21=[r8]
   18.68  	;;
   18.69 -#if defined(BIG_ENDIAN)			// swap because mini-os is in BE
   18.70 -	mux1	r21=r21,@rev
   18.71 -	;;
   18.72 -#endif
   18.73  	st8	[r19]=r21		// store cr.ifs
   18.74  	dep.z	r22=r21,0,38		// copy ifm part from ifs.ifm
   18.75  	;;
   18.76 @@ -330,12 +292,6 @@ ENTRY(restore_tf_rse_switch)
   18.77  	;;
   18.78  	ld8	r21=[r19]		// load cr.ipsr
   18.79  	ld8	r22=[r20]		// load cr.iip
   18.80 -#if defined(BIG_ENDIAN)			// swap because mini-os is in BE
   18.81 -	;;
   18.82 -	mux1	r21=r21,@rev
   18.83 -	mux1	r22=r22,@rev
   18.84 -	;;
   18.85 -#endif
   18.86  	movl	r16=XSI_IPSR		// XEN !!
   18.87  	;;
   18.88  	st8	[r16]=r21,XSI_IIP_OFS-XSI_IPSR_OFS	// XEN.ipsr
   18.89 @@ -353,9 +309,6 @@ ENTRY(restore_tf_rse_switch)
   18.90  	ld8	r22=[r19]		// ndirty
   18.91  	;;
   18.92  	shl	r21=r22,16		// value for ar.rsc
   18.93 -	//mov	r19=(MOS_IA64_RSC_BE << IA64_RSC_BE)
   18.94 -	;;
   18.95 -	or	r21=(MOS_IA64_RSC_BE << IA64_RSC_BE),r21
   18.96  	;;
   18.97  	mov	ar.rsc=r21		// setup for loadrs
   18.98  	;;
   18.99 @@ -386,10 +339,6 @@ ENTRY(restore_tf_rse_switch)
  18.100  	ld8	r21=[r19]		// load ar.pfs
  18.101  	ld8	r22=[r20]		// load cr.ifs
  18.102  	;;
  18.103 -#if defined(BIG_ENDIAN)			// swap because mini-os is in BE
  18.104 -	mux1	r22=r22,@rev
  18.105 -	;;
  18.106 -#endif
  18.107  	add	r19=TF_RSC,r18
  18.108  	mov	ar.pfs=r21
  18.109  	st8	[r16]=r22		// XEN.ifs
  18.110 @@ -429,10 +378,6 @@ ENTRY(restore_tf_rse_switch)
  18.111  	// bsw.1
  18.112  	movl r30=XSI_BANKNUM		// Switch to bank 1.
  18.113  	mov r31=1;;
  18.114 -#if defined(BIG_ENDIAN)			// swap because mini-os is in BE
  18.115 -	mux1	r31=r31,@rev
  18.116 -	;;
  18.117 -#endif
  18.118  	st4 [r30]=r31
  18.119  	;;
  18.120  	add	r2=TF_GREG16,r14
  18.121 @@ -455,51 +400,27 @@ ENTRY(restore_tf_rse_switch)
  18.122  	movl r2=XSI_BANK1_R16
  18.123  	movl r3=XSI_BANK1_R16+8
  18.124  	;;
  18.125 -#if defined(BIG_ENDIAN)			// swap because mini-os is in BE
  18.126 -	mux1	r16=r16,@rev; mux1 r17=r17,@rev;;
  18.127 -#endif
  18.128  	.mem.offset 0,0; st8.spill [r2]=r16,16
  18.129  	.mem.offset 8,0; st8.spill [r3]=r17,16
  18.130  	;;
  18.131 -#if defined(BIG_ENDIAN)			// swap because mini-os is in BE
  18.132 -	mux1	r18=r18,@rev; mux1 r19=r19,@rev;;
  18.133 -#endif
  18.134  	.mem.offset 0,0; st8.spill [r2]=r18,16
  18.135  	.mem.offset 8,0; st8.spill [r3]=r19,16
  18.136  	;;
  18.137 -#if defined(BIG_ENDIAN)			// swap because mini-os is in BE
  18.138 -	mux1	r20=r20,@rev; mux1 r21=r21,@rev;;
  18.139 -#endif
  18.140  	.mem.offset 0,0; st8.spill [r2]=r20,16
  18.141  	.mem.offset 8,0; st8.spill [r3]=r21,16
  18.142  	;;
  18.143 -#if defined(BIG_ENDIAN)			// swap because mini-os is in BE
  18.144 -	mux1	r22=r22,@rev; mux1 r23=r23,@rev;;
  18.145 -#endif
  18.146  	.mem.offset 0,0; st8.spill [r2]=r22,16
  18.147  	.mem.offset 8,0; st8.spill [r3]=r23,16
  18.148  	;;
  18.149 -#if defined(BIG_ENDIAN)			// swap because mini-os is in BE
  18.150 -	mux1	r24=r24,@rev; mux1 r25=r25,@rev;;
  18.151 -#endif
  18.152  	.mem.offset 0,0; st8.spill [r2]=r24,16
  18.153  	.mem.offset 8,0; st8.spill [r3]=r25,16
  18.154  	;;
  18.155 -#if defined(BIG_ENDIAN)			// swap because mini-os is in BE
  18.156 -	mux1	r26=r26,@rev; mux1 r27=r27,@rev;;
  18.157 -#endif
  18.158  	.mem.offset 0,0; st8.spill [r2]=r26,16
  18.159  	.mem.offset 8,0; st8.spill [r3]=r27,16
  18.160  	;;
  18.161 -#if defined(BIG_ENDIAN)			// swap because mini-os is in BE
  18.162 -	mux1	r28=r28,@rev; mux1 r29=r29,@rev;;
  18.163 -#endif
  18.164  	.mem.offset 0,0; st8.spill [r2]=r28,16
  18.165  	.mem.offset 8,0; st8.spill [r3]=r29,16
  18.166  	;;
  18.167 -#if defined(BIG_ENDIAN)			// swap because mini-os is in BE
  18.168 -	mux1	r30=r30,@rev; mux1 r31=r31,@rev;;
  18.169 -#endif
  18.170  	.mem.offset 0,0; st8.spill [r2]=r30,16
  18.171  	.mem.offset 8,0; st8.spill [r3]=r31,16
  18.172  	;;
  18.173 @@ -567,17 +488,11 @@ ENTRY(save_special_regs)
  18.174  	add	loc5=TF_IFA,in0
  18.175  	add	loc6=TF_ISR,in0
  18.176  	;;
  18.177 -#if defined(BIG_ENDIAN)			// swap because mini-os is in BE
  18.178 -	mux1	loc3=loc3,@rev; mux1 loc4=loc4,@rev;;
  18.179 -#endif
  18.180  	st8	[loc5]=loc3,TF_IIM-TF_IFA	// store cr.ifa
  18.181  	st8	[loc6]=loc4			// store cr.isr
  18.182  	;;
  18.183  	ld8	loc3=[loc1]			// load XEN.iim
  18.184  	;;
  18.185 -#if defined(BIG_ENDIAN)			// swap because mini-os is in BE
  18.186 -	mux1	loc3=loc3,@rev;;
  18.187 -#endif
  18.188  	st8	[loc5]=loc3			// store cr.iim
  18.189  	;;
  18.190  	mov	ar.pfs=loc0
  18.191 @@ -605,9 +520,6 @@ ENTRY(hypervisor_callback)
  18.192  	mov	out0=r18		// the trap frame
  18.193  	movl	r22=XSI_PSR_IC
  18.194  	mov	r23=1;;
  18.195 -#if defined(BIG_ENDIAN)			// swap because mini-os is in BE
  18.196 -	mux1	r23=r23,@rev;;
  18.197 -#endif
  18.198  	st8	[r22]=r23		// ssm psr.ic
  18.199  	;;
  18.200  	br.call.sptk.few rp = do_hypervisor_callback
  18.201 @@ -649,9 +561,6 @@ ENTRY(trap_error)
  18.202  	;;
  18.203  	movl r30=XSI_BANKNUM		// bsw.1
  18.204  	mov r31=1;;
  18.205 -#if defined(BIG_ENDIAN)			// swap because mini-os is in BE
  18.206 -	mux1	r31=r31,@rev;;
  18.207 -#endif
  18.208  	st4 [r30]=r31;;
  18.209  
  18.210  		/* Save extra interrupt registers to the trap frame. */
  18.211 @@ -664,9 +573,6 @@ ENTRY(trap_error)
  18.212  	ld8	r23=[r23]
  18.213  	mov	r25=1
  18.214  	;;
  18.215 -#if defined(BIG_ENDIAN)			// swap because mini-os is in BE
  18.216 -	mux1	r25=r25,@rev; mux1 r23=r23,@rev;;
  18.217 -#endif
  18.218  	st4	[r22]=r25		// ssm psr.ic
  18.219  	st1	[r23]=r0		// ssm psr.i
  18.220  	;;
  18.221 @@ -680,10 +586,6 @@ ENTRY(trap_error)
  18.222  	ld8 r23=[r23]
  18.223  	mov r25=1
  18.224  	;;
  18.225 -#if defined(BIG_ENDIAN)			// swap because mini-os is in BE
  18.226 -	mux1	r25=r25,@rev;;
  18.227 -	mux1	r25=r25,@rev; mux1 r23=r23,@rev;;
  18.228 -#endif
  18.229  	st1 [r23]=r25
  18.230  	st4 [r22]=r0            // note: clears both vpsr.i and vpsr.ic!
  18.231  	;;
    19.1 --- a/extras/mini-os/arch/ia64/minios-ia64.lds	Mon Nov 10 15:52:15 2008 -0800
    19.2 +++ b/extras/mini-os/arch/ia64/minios-ia64.lds	Wed Feb 11 16:25:03 2009 -0800
    19.3 @@ -52,7 +52,8 @@ SECTIONS
    19.4    .fini_array     : { *(.fini_array) }
    19.5    PROVIDE (__fini_array_end = .);
    19.6  
    19.7 -  .ctors : {
    19.8 +  .ctors : AT(ADDR(.ctors) - (((5<<(61))+0x100000000) - (1 << 20)))
    19.9 +	{
   19.10          __CTOR_LIST__ = .;
   19.11          QUAD((__CTOR_END__ - __CTOR_LIST__) / 8 - 2)
   19.12          *(.ctors)
   19.13 @@ -61,7 +62,8 @@ SECTIONS
   19.14          __CTOR_END__ = .;
   19.15          }
   19.16  
   19.17 -  .dtors : {
   19.18 +  .dtors : AT(ADDR(.dtors) - (((5<<(61))+0x100000000) - (1 << 20)))
   19.19 +        {
   19.20          __DTOR_LIST__ = .;
   19.21          QUAD((__DTOR_END__ - __DTOR_LIST__) / 8 - 2)
   19.22          *(.dtors)
    20.1 --- a/extras/mini-os/arch/ia64/mm.c	Mon Nov 10 15:52:15 2008 -0800
    20.2 +++ b/extras/mini-os/arch/ia64/mm.c	Wed Feb 11 16:25:03 2009 -0800
    20.3 @@ -153,7 +153,7 @@ map_frames_ex(unsigned long* frames, uns
    20.4          ASSERT(n == 1 || (stride == 0 && increment == 1));
    20.5          ASSERT(id == DOMID_SELF);
    20.6          ASSERT(prot == 0);
    20.7 -	return (void*) __va(SWAP(frames[0]) << PAGE_SHIFT);
    20.8 +	return (void*) __va(frames[0] << PAGE_SHIFT);
    20.9  }
   20.10  
   20.11  void arch_init_p2m(unsigned long max_pfn)
    21.1 --- a/extras/mini-os/arch/ia64/sal.c	Mon Nov 10 15:52:15 2008 -0800
    21.2 +++ b/extras/mini-os/arch/ia64/sal.c	Wed Feb 11 16:25:03 2009 -0800
    21.3 @@ -76,19 +76,19 @@ ia64_sal_init(struct sal_system_table *s
    21.4  		return;
    21.5  	}
    21.6  	p = (uint8_t *) (saltab + 1);
    21.7 -	for (i = 0; i < SWAP(saltab->sal_entry_count); i++) {
    21.8 -		switch (SWAP(*p)) {
    21.9 +	for (i = 0; i < saltab->sal_entry_count; i++) {
   21.10 +		switch (*p) {
   21.11  		case SAL_DESC_ENTRYPOINT:		// 0
   21.12  		{
   21.13  			struct sal_entrypoint_descriptor *dp;
   21.14  
   21.15  			dp = (struct sal_entrypoint_descriptor*)p;
   21.16  			ia64_pal_entry =
   21.17 -				IA64_PHYS_TO_RR7(SWAP(dp->sale_pal_proc));
   21.18 +				IA64_PHYS_TO_RR7(dp->sale_pal_proc);
   21.19  			PRINT_BV("  PAL Proc at 0x%lx\n", ia64_pal_entry);
   21.20  			sal_fdesc.func =
   21.21 -				IA64_PHYS_TO_RR7(SWAP(dp->sale_sal_proc));
   21.22 -			sal_fdesc.gp = IA64_PHYS_TO_RR7(SWAP(dp->sale_sal_gp));
   21.23 +				IA64_PHYS_TO_RR7(dp->sale_sal_proc);
   21.24 +			sal_fdesc.gp = IA64_PHYS_TO_RR7(dp->sale_sal_gp);
   21.25  			PRINT_BV("  SAL Proc at 0x%lx, GP at 0x%lx\n",
   21.26  				 sal_fdesc.func, sal_fdesc.gp);
   21.27  			ia64_sal_entry = (sal_entry_t *) &sal_fdesc;
    22.1 --- a/extras/mini-os/arch/ia64/time.c	Mon Nov 10 15:52:15 2008 -0800
    22.2 +++ b/extras/mini-os/arch/ia64/time.c	Wed Feb 11 16:25:03 2009 -0800
    22.3 @@ -197,15 +197,6 @@ calculate_frequencies(void)
    22.4  	struct ia64_pal_result pal_res;
    22.5  
    22.6  	pal_res = ia64_call_pal_static(PAL_FREQ_RATIOS, 0, 0, 0);
    22.7 -	//sal_res = ia64_sal_call(SAL_FREQ_BASE, 0, 0, 0, 0, 0, 0, 0);
    22.8 -#if defined(BIG_ENDIAN)
    22.9 -//#warning calculate_frequencies TODO
   22.10 -	/*
   22.11 -	 * I have to do an own function with switching psr.be!
   22.12 -	 * Currently it's running because it's a break into the hypervisor
   22.13 -	 * behind the call.!
   22.14 -	 */
   22.15 -#endif
   22.16  	sal_res = ia64_sal_entry(SAL_FREQ_BASE, 0, 0, 0, 0, 0, 0, 0);
   22.17  
   22.18  	if (sal_res.sal_status == 0 && pal_res.pal_status == 0) {
   22.19 @@ -260,9 +251,8 @@ init_time(void)
   22.20  	if (efi_get_time(&tm)) {
   22.21  		printk("  EFI-Time: %d.%d.%d   %d:%d:%d\n", tm.Day,
   22.22  		       tm.Month, tm.Year, tm.Hour, tm.Minute, tm.Second);
   22.23 -		os_time.tv_sec = _mktime(SWAP(tm.Year), SWAP(tm.Month),
   22.24 -					SWAP(tm.Day), SWAP(tm.Hour),
   22.25 -					SWAP(tm.Minute), SWAP(tm.Second));
   22.26 +		os_time.tv_sec = _mktime(tm.Year, tm.Month,
   22.27 +					tm.Day, tm.Hour, tm.Minute, tm.Second);
   22.28  		os_time.tv_nsec = tm.Nanosecond;
   22.29  	} else
   22.30  		printk("efi_get_time() failed\n");
    23.1 --- a/extras/mini-os/arch/ia64/xencomm.c	Mon Nov 10 15:52:15 2008 -0800
    23.2 +++ b/extras/mini-os/arch/ia64/xencomm.c	Wed Feb 11 16:25:03 2009 -0800
    23.3 @@ -24,6 +24,8 @@
    23.4  
    23.5  
    23.6  #include <os.h>
    23.7 +#include <mini-os/errno.h>
    23.8 +#include <mini-os/lib.h>
    23.9  #include <hypervisor.h>
   23.10  #include <xen/xencomm.h>
   23.11  #include <xen/grant_table.h>
   23.12 @@ -38,6 +40,7 @@ struct xencomm_mini
   23.13  
   23.14  #define xen_guest_handle(hnd)  ((hnd).p)
   23.15  
   23.16 +struct xencomm_handle;
   23.17  
   23.18  /* Translate virtual address to physical address.  */
   23.19  uint64_t
   23.20 @@ -52,6 +55,16 @@ xencomm_vaddr_to_paddr(uint64_t vaddr)
   23.21  	return 0;
   23.22  }
   23.23  
   23.24 +/* Inline version.  To be used only on linear space (kernel space).  */
   23.25 +static struct xencomm_handle *
   23.26 +xencomm_create_inline(void *buffer)
   23.27 +{
   23.28 +	unsigned long paddr;
   23.29 +
   23.30 +	paddr = xencomm_vaddr_to_paddr((unsigned long)buffer);
   23.31 +	return (struct xencomm_handle *)(paddr | XENCOMM_INLINE_FLAG);
   23.32 +}
   23.33 +
   23.34  #define min(a,b) (((a) < (b)) ? (a) : (b))
   23.35  static int
   23.36  xencomm_init_desc(struct xencomm_desc *desc, void *buffer, unsigned long bytes)
   23.37 @@ -82,7 +95,7 @@ xencomm_init_desc(struct xencomm_desc *d
   23.38  			return -EINVAL;
   23.39  		}
   23.40  
   23.41 -		desc->address[i++] = SWAP(paddr);
   23.42 +		desc->address[i++] = paddr;
   23.43  		recorded += chunksz;
   23.44  	}
   23.45  	if (recorded < bytes) {
   23.46 @@ -93,8 +106,8 @@ xencomm_init_desc(struct xencomm_desc *d
   23.47  
   23.48  	/* mark remaining addresses invalid (just for safety) */
   23.49  	while (i < desc->nr_addrs)
   23.50 -		desc->address[i++] = SWAP(XENCOMM_INVALID);
   23.51 -	desc->magic = SWAP(XENCOMM_MAGIC);
   23.52 +		desc->address[i++] = XENCOMM_INVALID;
   23.53 +	desc->magic = XENCOMM_MAGIC;
   23.54  	return 0;
   23.55  }
   23.56  
   23.57 @@ -171,15 +184,14 @@ xencommize_mini_grant_table_op(struct xe
   23.58  			return -EINVAL;
   23.59  		rc = xencomm_create_mini
   23.60  		        (xc_area, nbr_area,
   23.61 -		         (void*)SWAP((uint64_t)
   23.62 -				     xen_guest_handle(setup->frame_list)),
   23.63 -		         SWAP(setup->nr_frames)
   23.64 +		         (void*)(uint64_t) xen_guest_handle(setup->frame_list),
   23.65 +		         setup->nr_frames
   23.66  		         * sizeof(*xen_guest_handle(setup->frame_list)),
   23.67  		         &desc1);
   23.68  		if (rc)
   23.69  			return rc;
   23.70  		set_xen_guest_handle(setup->frame_list,
   23.71 -				     (void *)SWAP((uint64_t)desc1));
   23.72 +				     (void *)(uint64_t)desc1);
   23.73  		break;
   23.74  	}
   23.75  	case GNTTABOP_dump_table:
   23.76 @@ -201,6 +213,14 @@ xencommize_mini_grant_table_op(struct xe
   23.77  	return rc;
   23.78  }
   23.79  
   23.80 +static inline int
   23.81 +xencomm_arch_hypercall_grant_table_op(unsigned int cmd,
   23.82 +                                      struct xencomm_handle *uop,
   23.83 +                                      unsigned int count)
   23.84 +{
   23.85 +	return _hypercall3(int, grant_table_op, cmd, uop, count);
   23.86 +}
   23.87 +
   23.88  int
   23.89  xencomm_mini_hypercall_grant_table_op(unsigned int cmd, void *op,
   23.90                                        unsigned int count)
   23.91 @@ -263,8 +283,112 @@ HYPERVISOR_suspend(unsigned long srec)
   23.92  {
   23.93          struct sched_shutdown arg;
   23.94  
   23.95 -        arg.reason = (uint32_t)SWAP((uint32_t)SHUTDOWN_suspend);
   23.96 +        arg.reason = (uint32_t)SHUTDOWN_suspend;
   23.97  
   23.98          return xencomm_arch_hypercall_suspend(xencomm_create_inline(&arg));
   23.99  }
  23.100  
  23.101 +int
  23.102 +HYPERVISOR_event_channel_op(int cmd, void *arg)
  23.103 +{
  23.104 +	int rc;
  23.105 +	struct xencomm_handle *newArg;
  23.106 +
  23.107 +	newArg = xencomm_create_inline(arg);
  23.108 +	rc = _hypercall2(int, event_channel_op, cmd, newArg);
  23.109 +	if (unlikely(rc == -ENOSYS)) {
  23.110 +		struct evtchn_op op;
  23.111 +
  23.112 +		op.cmd = cmd;
  23.113 +		memcpy(&op.u, arg, sizeof(op.u));
  23.114 +		rc = _hypercall1(int, event_channel_op_compat, &op);
  23.115 +	}
  23.116 +	return rc;
  23.117 +}
  23.118 +
  23.119 +static int
  23.120 +xencomm_arch_xen_version(int cmd, struct xencomm_handle *arg)
  23.121 +{
  23.122 +	return _hypercall2(int, xen_version, cmd, arg);
  23.123 +}
  23.124 +
  23.125 +static int
  23.126 +xencomm_arch_xen_feature(int cmd, struct xencomm_handle *arg)
  23.127 +{
  23.128 +	struct xencomm_handle *newArg;
  23.129 +
  23.130 +	newArg = xencomm_create_inline(arg);
  23.131 +	return _hypercall2(int, xen_version, cmd, newArg);
  23.132 +}
  23.133 +
  23.134 +int
  23.135 +HYPERVISOR_xen_version(int cmd, void *arg)
  23.136 +{
  23.137 +	switch(cmd) {
  23.138 +		case XENVER_version:
  23.139 +			return xencomm_arch_xen_version(cmd, 0);
  23.140 +		case XENVER_get_features:
  23.141 +			return xencomm_arch_xen_feature(cmd, arg);
  23.142 +		default:
  23.143 +			return -1;
  23.144 +	}
  23.145 +}
  23.146 +
  23.147 +int
  23.148 +HYPERVISOR_console_io(int cmd, int count, char *str)
  23.149 +{
  23.150 +	struct xencomm_handle *newStr;
  23.151 +
  23.152 +	newStr = xencomm_create_inline(str);
  23.153 +	return _hypercall3(int, console_io, cmd, count, newStr);
  23.154 +}
  23.155 +
  23.156 +int
  23.157 +HYPERVISOR_sched_op_compat(int cmd, unsigned long arg)
  23.158 +{
  23.159 +	return _hypercall2(int, sched_op_compat, cmd, arg);
  23.160 +}
  23.161 +
  23.162 +int
  23.163 +HYPERVISOR_sched_op(int cmd, void *arg)
  23.164 +{
  23.165 +	struct xencomm_handle *newArg;
  23.166 +
  23.167 +	newArg = xencomm_create_inline(arg);
  23.168 +	return _hypercall2(int, sched_op, cmd, newArg);
  23.169 +}
  23.170 +
  23.171 +int
  23.172 +HYPERVISOR_callback_op(int cmd, void *arg)
  23.173 +{
  23.174 +	struct xencomm_handle *newArg;
  23.175 +
  23.176 +	newArg = xencomm_create_inline(arg);
  23.177 +	return _hypercall2(int, callback_op, cmd, newArg);
  23.178 +}
  23.179 +
  23.180 +int
  23.181 +HYPERVISOR_opt_feature(void *arg)
  23.182 +{
  23.183 +	struct xencomm_handle *new_arg;
  23.184 +
  23.185 +	new_arg = xencomm_create_inline(arg);
  23.186 +
  23.187 +	return _hypercall1(int, opt_feature, new_arg);
  23.188 +}
  23.189 +
  23.190 +int
  23.191 +HYPERVISOR_shutdown(unsigned int reason)
  23.192 +{
  23.193 +	struct sched_shutdown sched_shutdown = {
  23.194 +		.reason = reason
  23.195 +	};
  23.196 +
  23.197 +	int rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
  23.198 +
  23.199 +	if (rc == -ENOSYS)
  23.200 +		rc = HYPERVISOR_sched_op_compat(SCHEDOP_shutdown, reason);
  23.201 +
  23.202 +	return rc;
  23.203 +}
  23.204 +
    24.1 --- a/extras/mini-os/arch/x86/mm.c	Mon Nov 10 15:52:15 2008 -0800
    24.2 +++ b/extras/mini-os/arch/x86/mm.c	Wed Feb 11 16:25:03 2009 -0800
    24.3 @@ -420,7 +420,9 @@ static unsigned long demand_map_area_sta
    24.4  #define DEMAND_MAP_PAGES ((2ULL << 30) / PAGE_SIZE)
    24.5  #endif
    24.6  
    24.7 -#ifdef HAVE_LIBC
    24.8 +#ifndef HAVE_LIBC
    24.9 +#define HEAP_PAGES 0
   24.10 +#else
   24.11  unsigned long heap, brk, heap_mapped, heap_end;
   24.12  #ifdef __x86_64__
   24.13  #define HEAP_PAGES ((128ULL << 30) / PAGE_SIZE)
   24.14 @@ -548,9 +550,15 @@ static void clear_bootstrap(void)
   24.15  
   24.16  void arch_init_p2m(unsigned long max_pfn)
   24.17  {
   24.18 +#ifdef __x86_64__
   24.19  #define L1_P2M_SHIFT    9
   24.20  #define L2_P2M_SHIFT    18    
   24.21  #define L3_P2M_SHIFT    27    
   24.22 +#else
   24.23 +#define L1_P2M_SHIFT    10
   24.24 +#define L2_P2M_SHIFT    20    
   24.25 +#define L3_P2M_SHIFT    30    
   24.26 +#endif
   24.27  #define L1_P2M_ENTRIES  (1 << L1_P2M_SHIFT)    
   24.28  #define L2_P2M_ENTRIES  (1 << (L2_P2M_SHIFT - L1_P2M_SHIFT))    
   24.29  #define L3_P2M_ENTRIES  (1 << (L3_P2M_SHIFT - L2_P2M_SHIFT))    
   24.30 @@ -591,7 +599,7 @@ void arch_init_p2m(unsigned long max_pfn
   24.31  void arch_init_mm(unsigned long* start_pfn_p, unsigned long* max_pfn_p)
   24.32  {
   24.33  
   24.34 -    unsigned long start_pfn, max_pfn;
   24.35 +    unsigned long start_pfn, max_pfn, virt_pfns;
   24.36  
   24.37      printk("  _text:        %p\n", &_text);
   24.38      printk("  _etext:       %p\n", &_etext);
   24.39 @@ -604,7 +612,12 @@ void arch_init_mm(unsigned long* start_p
   24.40      start_pfn = PFN_UP(to_phys(start_info.pt_base)) + 
   24.41                  start_info.nr_pt_frames + 3;
   24.42      max_pfn = start_info.nr_pages;
   24.43 -   
   24.44 +
   24.45 +    /* We need room for demand mapping and heap, clip available memory */
   24.46 +    virt_pfns = DEMAND_MAP_PAGES + HEAP_PAGES;
   24.47 +    if (max_pfn + virt_pfns + 1 < max_pfn)
   24.48 +        max_pfn = -(virt_pfns + 1);
   24.49 +
   24.50      printk("  start_pfn:    %lx\n", start_pfn);
   24.51      printk("  max_pfn:      %lx\n", max_pfn);
   24.52  
    25.1 --- a/extras/mini-os/fs-front.c	Mon Nov 10 15:52:15 2008 -0800
    25.2 +++ b/extras/mini-os/fs-front.c	Wed Feb 11 16:25:03 2009 -0800
    25.3 @@ -869,18 +869,6 @@ moretodo:
    25.4      in_irq = 0;
    25.5  }
    25.6  
    25.7 -/* Small utility function to figure out our domain id */
    25.8 -static domid_t get_self_id(void)
    25.9 -{
   25.10 -    char *dom_id;
   25.11 -    domid_t ret; 
   25.12 -
   25.13 -    BUG_ON(xenbus_read(XBT_NIL, "domid", &dom_id));
   25.14 -    sscanf(dom_id, "%d", &ret);
   25.15 -
   25.16 -    return ret;
   25.17 -}
   25.18 -
   25.19  static void alloc_request_table(struct fs_import *import)
   25.20  {
   25.21      struct fs_request *requests;
   25.22 @@ -1066,7 +1054,7 @@ static int init_fs_import(struct fs_impo
   25.23      unmask_evtchn(import->local_port);
   25.24  
   25.25      
   25.26 -    self_id = get_self_id(); 
   25.27 +    self_id = xenbus_get_self_id(); 
   25.28      /* Write the frontend info to a node in our Xenbus */
   25.29      sprintf(nodename, "/local/domain/%d/device/vfs/%d", 
   25.30                          self_id, import->import_id);
    26.1 --- a/extras/mini-os/include/ia64/atomic.h	Mon Nov 10 15:52:15 2008 -0800
    26.2 +++ b/extras/mini-os/include/ia64/atomic.h	Wed Feb 11 16:25:03 2009 -0800
    26.3 @@ -427,11 +427,10 @@ atomic_readandclear_64(volatile uint64_t
    26.4  static inline void
    26.5  set_bit(int num, volatile void *addr)
    26.6  {
    26.7 -	uint32_t bit, b, old, new;
    26.8 +	uint32_t bit, old, new;
    26.9  	volatile uint32_t *p;
   26.10  	p = (volatile uint32_t *) addr + (num >> 5);
   26.11 -	b = 1 << (num & 31);
   26.12 -	bit = SWAP(b);
   26.13 +	bit = 1 << (num & 31);
   26.14  	do
   26.15  	{
   26.16  		old = *p;
   26.17 @@ -442,11 +441,10 @@ set_bit(int num, volatile void *addr)
   26.18  static __inline__ void
   26.19  clear_bit(int num, volatile void *addr)
   26.20  {
   26.21 -	uint32_t mask, m,  old, new;
   26.22 +	uint32_t mask, old, new;
   26.23  	volatile uint32_t *p;
   26.24  	p = (volatile uint32_t *) addr + (num >> 5);
   26.25 -	m = ~(1 << (num & 31));
   26.26 -	mask = SWAP(m);
   26.27 +	mask = ~(1 << (num & 31));
   26.28  	do {
   26.29  		old = *p;
   26.30  		new = old & mask;
   26.31 @@ -456,7 +454,7 @@ clear_bit(int num, volatile void *addr)
   26.32  static __inline__ int
   26.33  test_bit(int num, const volatile void *addr)
   26.34  {
   26.35 -	uint32_t val = SWAP(1);
   26.36 +	uint32_t val = 1;
   26.37          return val & (((const volatile uint32_t *) addr)[num >> 5] >> (num & 31));
   26.38  }
   26.39  
   26.40 @@ -468,12 +466,11 @@ test_bit(int num, const volatile void *a
   26.41  static inline int
   26.42  test_and_set_bit (int num, volatile void *addr)
   26.43  {
   26.44 -        uint32_t bit, b, old, new;
   26.45 +        uint32_t bit, old, new;
   26.46          volatile uint32_t *m;
   26.47  
   26.48          m = (volatile uint32_t *) addr + (num >> 5);
   26.49 -        b = 1 << (num & 31);
   26.50 -        bit = SWAP(b);
   26.51 +        bit = 1 << (num & 31);
   26.52          do {
   26.53                  old = *m;
   26.54                  new = old | bit;
   26.55 @@ -489,12 +486,11 @@ test_and_set_bit (int num, volatile void
   26.56  static
   26.57  inline int test_and_clear_bit(int num, volatile unsigned long * addr)
   26.58  {
   26.59 -        uint32_t bit, b, old, new;
   26.60 +        uint32_t bit, old, new;
   26.61          volatile uint32_t* a;
   26.62  
   26.63          a = (volatile uint32_t *) addr + (num >> 5);
   26.64 -        b = ~(1 << (num & 31));
   26.65 -        bit = SWAP(b);
   26.66 +        bit = ~(1 << (num & 31));
   26.67          do {
   26.68                  old = *a;
   26.69                  new = old & bit;
    27.1 --- a/extras/mini-os/include/ia64/endian.h	Mon Nov 10 15:52:15 2008 -0800
    27.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.3 @@ -1,75 +0,0 @@
    27.4 -/*
    27.5 - * Done by Dietmar Hahn <dietmar.hahn@fujitsu-siemens.com>
    27.6 - * Parts are taken from FreeBSD.
    27.7 - *
    27.8 - ****************************************************************************
    27.9 - * Permission is hereby granted, free of charge, to any person obtaining a copy
   27.10 - * of this software and associated documentation files (the "Software"), to
   27.11 - * deal in the Software without restriction, including without limitation the
   27.12 - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
   27.13 - * sell copies of the Software, and to permit persons to whom the Software is
   27.14 - * furnished to do so, subject to the following conditions:
   27.15 - * 
   27.16 - * The above copyright notice and this permission notice shall be included in
   27.17 - * all copies or substantial portions of the Software.
   27.18 - * 
   27.19 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
   27.20 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
   27.21 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
   27.22 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
   27.23 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
   27.24 - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
   27.25 - * DEALINGS IN THE SOFTWARE.
   27.26 - */
   27.27 -
   27.28 -
   27.29 -#if !defined(_ENDIAN_H_)
   27.30 -#define _ENDIAN_H_
   27.31 -
   27.32 -#include <mini-os/types.h>
   27.33 -
   27.34 -
   27.35 -#if !defined(__ASSEMBLY__)
   27.36 -
   27.37 -#if defined(BIG_ENDIAN)
   27.38 -
   27.39 -static __inline uint64_t
   27.40 -__bswap64(uint64_t __x)
   27.41 -{
   27.42 -	uint64_t __r;
   27.43 -	asm __volatile("mux1 %0=%1,@rev" : "=r" (__r) : "r"(__x));
   27.44 -	return __r;
   27.45 -}
   27.46 -
   27.47 -static __inline uint32_t
   27.48 -__bswap32(uint32_t __x)
   27.49 -{
   27.50 -	return (__bswap64(__x) >> 32);
   27.51 -}
   27.52 -
   27.53 -static __inline uint16_t
   27.54 -__bswap16(uint16_t __x)
   27.55 -{
   27.56 -	return (__bswap64(__x) >> 48);
   27.57 -}
   27.58 -
   27.59 -#define doswap(x,sz)  ( \
   27.60 -	((sz)==1)? (uint8_t)(x): \
   27.61 -	((sz)==2)? __bswap16(x): \
   27.62 -	((sz)==4)? __bswap32(x): \
   27.63 -	((sz)==8)? __bswap64(x): \
   27.64 -	~0l )
   27.65 -
   27.66 -#define SWAP(x)	doswap((x), sizeof((x)))
   27.67 -
   27.68 -
   27.69 -#else /* defined(BIG_ENDIAN) */
   27.70 -
   27.71 -#define SWAP(x) (x)
   27.72 -
   27.73 -#endif /* defined(BIG_ENDIAN) */
   27.74 -
   27.75 -#endif /* !defined(__ASSEMBLY__) */
   27.76 -
   27.77 -
   27.78 -#endif /* !defined(_ENDIAN_H_) */
    28.1 --- a/extras/mini-os/include/ia64/hypercall-ia64.h	Mon Nov 10 15:52:15 2008 -0800
    28.2 +++ b/extras/mini-os/include/ia64/hypercall-ia64.h	Wed Feb 11 16:25:03 2009 -0800
    28.3 @@ -34,8 +34,6 @@
    28.4  #ifndef __HYPERCALL_H__
    28.5  #define __HYPERCALL_H__
    28.6  
    28.7 -#include <mini-os/lib.h>	/* memcpy() */
    28.8 -#include <mini-os/errno.h>	/* ENOSYS() */
    28.9  #include <xen/event_channel.h>
   28.10  #include <xen/sched.h>
   28.11  #include <xen/version.h>
   28.12 @@ -114,123 +112,24 @@ extern unsigned long __hypercall(unsigne
   28.13  })
   28.14  
   28.15  
   28.16 -extern unsigned long xencomm_vaddr_to_paddr(unsigned long vaddr);
   28.17 -struct xencomm_handle;
   28.18 -
   28.19 -/* Inline version.  To be used only on linear space (kernel space).  */
   28.20 -static inline struct xencomm_handle *
   28.21 -xencomm_create_inline(void *buffer)
   28.22 -{
   28.23 -	unsigned long paddr;
   28.24 -
   28.25 -	paddr = xencomm_vaddr_to_paddr((unsigned long)buffer);
   28.26 -	return (struct xencomm_handle *)(paddr | XENCOMM_INLINE_FLAG);
   28.27 -}
   28.28 -
   28.29 -static inline int
   28.30 -xencomm_arch_event_channel_op(int cmd, void *arg)
   28.31 -{
   28.32 -	int rc;
   28.33 -	struct xencomm_handle *newArg;
   28.34 +int HYPERVISOR_event_channel_op(int cmd, void *arg);
   28.35  
   28.36 -	newArg = xencomm_create_inline(arg);
   28.37 -	rc = _hypercall2(int, event_channel_op, cmd, newArg);
   28.38 -	if (unlikely(rc == -ENOSYS)) {
   28.39 -		struct evtchn_op op;
   28.40 -
   28.41 -		op.cmd = SWAP(cmd);
   28.42 -		memcpy(&op.u, arg, sizeof(op.u));
   28.43 -		rc = _hypercall1(int, event_channel_op_compat, &op);
   28.44 -	}
   28.45 -	return rc;
   28.46 -}
   28.47 -#define HYPERVISOR_event_channel_op xencomm_arch_event_channel_op
   28.48 +int HYPERVISOR_xen_version(int cmd, void *arg);
   28.49  
   28.50 -static inline int
   28.51 -xencomm_arch_xen_version(int cmd, struct xencomm_handle *arg)
   28.52 -{
   28.53 -	return _hypercall2(int, xen_version, cmd, arg);
   28.54 -}
   28.55 -
   28.56 -static inline int
   28.57 -xencomm_arch_xen_feature(int cmd, struct xencomm_handle *arg)
   28.58 -{
   28.59 -	struct xencomm_handle *newArg;
   28.60 -
   28.61 -	newArg = xencomm_create_inline(arg);
   28.62 -	return _hypercall2(int, xen_version, cmd, newArg);
   28.63 -}
   28.64 +int HYPERVISOR_console_io(int cmd, int count, char *str);
   28.65  
   28.66 -static inline int
   28.67 -HYPERVISOR_xen_version(int cmd, void *arg)
   28.68 -{
   28.69 -	switch(cmd) {
   28.70 -		case XENVER_version:
   28.71 -			return xencomm_arch_xen_version(cmd, 0);
   28.72 -		case XENVER_get_features:
   28.73 -			return xencomm_arch_xen_feature(cmd, arg);
   28.74 -		default:
   28.75 -			return -1;
   28.76 -	}
   28.77 -}
   28.78 -
   28.79 -static inline int
   28.80 -xencomm_arch_console_io(int cmd, int count, char *str)
   28.81 -{
   28.82 -	struct xencomm_handle *newStr;
   28.83 -
   28.84 -	newStr = xencomm_create_inline(str);
   28.85 -	return _hypercall3(int, console_io, cmd, count, newStr);
   28.86 -}
   28.87 -
   28.88 -
   28.89 -#define HYPERVISOR_console_io xencomm_arch_console_io
   28.90 +int HYPERVISOR_sched_op_compat(int cmd, unsigned long arg);
   28.91  
   28.92 -static inline int
   28.93 -HYPERVISOR_sched_op_compat(int cmd, unsigned long arg)
   28.94 -{
   28.95 -	return _hypercall2(int, sched_op_compat, cmd, arg);
   28.96 -}
   28.97 -
   28.98 -static inline int
   28.99 -xencomm_arch_sched_op(int cmd, void *arg)
  28.100 -{
  28.101 -	struct xencomm_handle *newArg;
  28.102 -
  28.103 -	newArg = xencomm_create_inline(arg);
  28.104 -	return _hypercall2(int, sched_op, cmd, newArg);
  28.105 -}
  28.106 -
  28.107 -#define HYPERVISOR_sched_op xencomm_arch_sched_op
  28.108 +int HYPERVISOR_sched_op(int cmd, void *arg);
  28.109  
  28.110 -static inline int
  28.111 -xencomm_arch_callback_op(int cmd, void *arg)
  28.112 -{
  28.113 -	struct xencomm_handle *newArg;
  28.114 -
  28.115 -	newArg = xencomm_create_inline(arg);
  28.116 -	return _hypercall2(int, callback_op, cmd, newArg);
  28.117 -}
  28.118 -#define HYPERVISOR_callback_op xencomm_arch_callback_op
  28.119 -
  28.120 -static inline int
  28.121 -xencomm_arch_hypercall_grant_table_op(unsigned int cmd,
  28.122 -                                      struct xencomm_handle *uop,
  28.123 -                                      unsigned int count)
  28.124 -{
  28.125 -	return _hypercall3(int, grant_table_op, cmd, uop, count);
  28.126 -}
  28.127 +int HYPERVISOR_callback_op(int cmd, void *arg);
  28.128  
  28.129  int HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count);
  28.130  
  28.131 -static inline int
  28.132 -HYPERVISOR_opt_feature(void *arg)
  28.133 -{
  28.134 -	struct xencomm_handle *new_arg;
  28.135 +int HYPERVISOR_opt_feature(void *arg);
  28.136  
  28.137 -	new_arg = xencomm_create_inline(arg);
  28.138 +int HYPERVISOR_suspend(unsigned long srec);
  28.139  
  28.140 -	return _hypercall1(int, opt_feature, new_arg);
  28.141 -}
  28.142 +int HYPERVISOR_shutdown(unsigned int reason);
  28.143  
  28.144  #endif /* __HYPERCALL_H__ */
    29.1 --- a/extras/mini-os/include/ia64/ia64_cpu.h	Mon Nov 10 15:52:15 2008 -0800
    29.2 +++ b/extras/mini-os/include/ia64/ia64_cpu.h	Wed Feb 11 16:25:03 2009 -0800
    29.3 @@ -134,23 +134,16 @@
    29.4  #define IA64_PSR_IA		0x0000200000000000
    29.5  
    29.6  
    29.7 -/* Endianess of mini-os. */
    29.8 -#if defined(BIG_ENDIAN)
    29.9 -#define MOS_IA64_PSR_BE	IA64_PSR_BE
   29.10 -#else
   29.11 -#define MOS_IA64_PSR_BE	0
   29.12 -#endif
   29.13 -
   29.14  #define STARTUP_PSR (IA64_PSR_IT | IA64_PSR_PK | \
   29.15 -            	     IA64_PSR_DT | IA64_PSR_RT | MOS_IA64_PSR_BE | \
   29.16 +            	     IA64_PSR_DT | IA64_PSR_RT | \
   29.17  		     IA64_PSR_BN | IA64_PSR_CPL_KERN | IA64_PSR_AC)
   29.18  
   29.19  #define MOS_SYS_PSR (IA64_PSR_IC | IA64_PSR_I | IA64_PSR_IT | \
   29.20 -            	     IA64_PSR_DT | IA64_PSR_RT | MOS_IA64_PSR_BE | \
   29.21 +            	     IA64_PSR_DT | IA64_PSR_RT | \
   29.22  		     IA64_PSR_BN | IA64_PSR_CPL_KERN | IA64_PSR_AC)
   29.23  
   29.24  #define MOS_USR_PSR (IA64_PSR_IC | IA64_PSR_I | IA64_PSR_IT | \
   29.25 -            	     IA64_PSR_DT | IA64_PSR_RT | MOS_IA64_PSR_BE | \
   29.26 +            	     IA64_PSR_DT | IA64_PSR_RT | \
   29.27  		     IA64_PSR_BN | IA64_PSR_CPL_USER | IA64_PSR_AC)
   29.28  
   29.29  /*
   29.30 @@ -193,14 +186,7 @@
   29.31  #define IA64_DCR_MBZ1_V		0xffffffffffffULL
   29.32  
   29.33  
   29.34 -	/* Endianess of DCR register. */
   29.35 -#if defined(BIG_ENDIAN)
   29.36 -#define MOS_IA64_DCR_BE	(1 << IA64_DCR_BE)
   29.37 -#else
   29.38 -#define MOS_IA64_DCR_BE	(0 << IA64_DCR_BE)
   29.39 -#endif
   29.40 -
   29.41 -#define IA64_DCR_DEFAULT (MOS_IA64_DCR_BE)
   29.42 +#define IA64_DCR_DEFAULT (IA64_DCR_BE)
   29.43  
   29.44  /*
   29.45   * Vector numbers for various ia64 interrupts.
   29.46 @@ -262,18 +248,8 @@
   29.47  #define IA64_RSC_MODE_LI (0x2) 		/* Load intensive */
   29.48  #define IA64_RSC_MODE_EA (0x3) 		/* Eager */
   29.49  
   29.50 -/* RSE endian mode. */
   29.51 -#if defined(BIG_ENDIAN)
   29.52 -#define MOS_IA64_RSC_BE	1		/* Big endian rse. */
   29.53 -#else
   29.54 -#define MOS_IA64_RSC_BE	0		/* Little endian rse. */
   29.55 -#endif
   29.56 -
   29.57 -#define IA64_RSE_EAGER ((IA64_RSC_MODE_EA<<IA64_RSC_MODE) |	\
   29.58 -			   (MOS_IA64_RSC_BE << IA64_RSC_BE)	)
   29.59 -
   29.60 -#define IA64_RSE_LAZY ((IA64_RSC_MODE_LY<<IA64_RSC_MODE) |	\
   29.61 -			   (MOS_IA64_RSC_BE << IA64_RSC_BE)	)
   29.62 +#define IA64_RSE_EAGER (IA64_RSC_MODE_EA<<IA64_RSC_MODE)
   29.63 +#define IA64_RSE_LAZY (IA64_RSC_MODE_LY<<IA64_RSC_MODE)
   29.64  
   29.65  
   29.66  
   29.67 @@ -719,19 +695,6 @@ typedef struct trap_frame trap_frame_t;
   29.68   */
   29.69  typedef struct
   29.70  {
   29.71 -#if defined(BIG_ENDIAN)
   29.72 -	uint64_t pte_ig	:11;	/* bits 53..63 */
   29.73 -	uint64_t pte_ed	:1;	/* bits 52..52 */
   29.74 -	uint64_t pte_rv2:2;	/* bits 50..51 */
   29.75 -	uint64_t pte_ppn:38;	/* bits 12..49 */
   29.76 -	uint64_t pte_ar	:3;	/* bits 9..11 */
   29.77 -	uint64_t pte_pl	:2;	/* bits 7..8 */
   29.78 -	uint64_t pte_d	:1;	/* bits 6..6 */
   29.79 -	uint64_t pte_a	:1;	/* bits 5..5 */
   29.80 -	uint64_t pte_ma	:3;	/* bits 2..4 */
   29.81 -	uint64_t pte_rv1:1;	/* bits 1..1 */
   29.82 -	uint64_t pte_p	:1;	/* bits 0..0 */
   29.83 -#else
   29.84  	uint64_t pte_p	:1;	/* bits 0..0 */
   29.85  	uint64_t pte_rv1:1;	/* bits 1..1 */
   29.86  	uint64_t pte_ma	:3;	/* bits 2..4 */
   29.87 @@ -743,7 +706,6 @@ typedef struct
   29.88  	uint64_t pte_rv2:2;	/* bits 50..51 */
   29.89  	uint64_t pte_ed	:1;	/* bits 52..52 */
   29.90  	uint64_t pte_ig	:11;	/* bits 53..63 */
   29.91 -#endif
   29.92  } ia64_pte_t;
   29.93  
   29.94  
    30.1 --- a/extras/mini-os/include/ia64/os.h	Mon Nov 10 15:52:15 2008 -0800
    30.2 +++ b/extras/mini-os/include/ia64/os.h	Wed Feb 11 16:25:03 2009 -0800
    30.3 @@ -28,7 +28,6 @@
    30.4  #if !defined(__ASSEMBLY__)
    30.5  
    30.6  #include <mini-os/types.h>
    30.7 -#include "endian.h"
    30.8  #include "ia64_cpu.h"
    30.9  #include "atomic.h"
   30.10  #include "efi.h"
   30.11 @@ -192,21 +191,6 @@ static inline unsigned long
   30.12  
   30.13  extern shared_info_t *HYPERVISOR_shared_info;
   30.14  
   30.15 -static inline int
   30.16 -HYPERVISOR_shutdown(unsigned int reason)
   30.17 -{
   30.18 -	struct sched_shutdown sched_shutdown = {
   30.19 -		.reason = reason
   30.20 -	};
   30.21 -
   30.22 -	int rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
   30.23 -
   30.24 -	if (rc == -ENOSYS)
   30.25 -		rc = HYPERVISOR_sched_op_compat(SCHEDOP_shutdown, reason);
   30.26 -
   30.27 -	return rc;
   30.28 -}
   30.29 -
   30.30  
   30.31  /*
   30.32   * This code is from the originally os.h and should be put in a
   30.33 @@ -225,7 +209,7 @@ HYPERVISOR_shutdown(unsigned int reason)
   30.34  do {									\
   30.35  	vcpu_info_t *_vcpu;						\
   30.36  	_vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()];	\
   30.37 -	_vcpu->evtchn_upcall_mask = SWAP(1);				\
   30.38 +	_vcpu->evtchn_upcall_mask = 1;					\
   30.39  	barrier();							\
   30.40  } while (0)
   30.41  
   30.42 @@ -236,7 +220,7 @@ do {									\
   30.43  	_vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()];	\
   30.44  	_vcpu->evtchn_upcall_mask = 0;					\
   30.45  	barrier(); /* unmask then check (avoid races) */		\
   30.46 -	if (unlikely(SWAP(_vcpu->evtchn_upcall_pending)))		\
   30.47 +	if (unlikely(_vcpu->evtchn_upcall_pending))			\
   30.48  		force_evtchn_callback();				\
   30.49  } while (0)
   30.50  
   30.51 @@ -244,7 +228,7 @@ do {									\
   30.52  do {									\
   30.53  	vcpu_info_t *_vcpu;						\
   30.54  	_vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()];	\
   30.55 -	(x) = SWAP(_vcpu->evtchn_upcall_mask);				\
   30.56 +	(x) = _vcpu->evtchn_upcall_mask;				\
   30.57  } while (0)
   30.58  
   30.59  #define __restore_flags(x)						\
   30.60 @@ -254,7 +238,7 @@ do {									\
   30.61  	_vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()];	\
   30.62  	if ((_vcpu->evtchn_upcall_mask = (x)) == 0) {			\
   30.63  		barrier(); /* unmask then check (avoid races) */	\
   30.64 -		if ( unlikely(SWAP(_vcpu->evtchn_upcall_pending)) )	\
   30.65 +		if ( unlikely(_vcpu->evtchn_upcall_pending) )		\
   30.66  			force_evtchn_callback();			\
   30.67  	}\
   30.68  } while (0)
   30.69 @@ -265,8 +249,8 @@ do {									\
   30.70  do {									\
   30.71  	vcpu_info_t *_vcpu;						\
   30.72  	_vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()];	\
   30.73 -	(x) = SWAP(_vcpu->evtchn_upcall_mask);				\
   30.74 -	_vcpu->evtchn_upcall_mask = SWAP(1);				\
   30.75 +	(x) = _vcpu->evtchn_upcall_mask;				\
   30.76 +	_vcpu->evtchn_upcall_mask = 1;					\
   30.77  	barrier();							\
   30.78  } while (0)
   30.79  
   30.80 @@ -277,7 +261,7 @@ do {									\
   30.81  #define local_irq_enable()	__sti()
   30.82  
   30.83  #define irqs_disabled()			\
   30.84 -	SWAP(HYPERVISOR_shared_info->vcpu_info[smp_processor_id()].evtchn_upcall_mask)
   30.85 +	(HYPERVISOR_shared_info->vcpu_info[smp_processor_id()].evtchn_upcall_mask)
   30.86  
   30.87  /* This is a barrier for the compiler only, NOT the processor! */
   30.88  #define barrier() __asm__ __volatile__("": : :"memory")
    31.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.2 +++ b/extras/mini-os/include/posix/net/if.h	Wed Feb 11 16:25:03 2009 -0800
    31.3 @@ -0,0 +1,85 @@
    31.4 +/*
    31.5 + * This code is mostly taken from NetBSD net/if.h 
    31.6 + * Changes: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
    31.7 + *
    31.8 + ******************************************************************************
    31.9 + *
   31.10 + * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
   31.11 + * All rights reserved.
   31.12 + *
   31.13 + * This code is derived from software contributed to The NetBSD Foundation
   31.14 + * by William Studenmund and Jason R. Thorpe.
   31.15 + *
   31.16 + * Redistribution and use in source and binary forms, with or without
   31.17 + * modification, are permitted provided that the following conditions
   31.18 + * are met:
   31.19 + * 1. Redistributions of source code must retain the above copyright
   31.20 + *    notice, this list of conditions and the following disclaimer.
   31.21 + * 2. Redistributions in binary form must reproduce the above copyright
   31.22 + *    notice, this list of conditions and the following disclaimer in the
   31.23 + *    documentation and/or other materials provided with the distribution.
   31.24 + *
   31.25 + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
   31.26 + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
   31.27 + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   31.28 + * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
   31.29 + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   31.30 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   31.31 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   31.32 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   31.33 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   31.34 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   31.35 + * POSSIBILITY OF SUCH DAMAGE.
   31.36 + */
   31.37 +
   31.38 +/*
   31.39 + * Copyright (c) 1982, 1986, 1989, 1993
   31.40 + *      The Regents of the University of California.  All rights reserved.
   31.41 + *
   31.42 + * Redistribution and use in source and binary forms, with or without
   31.43 + * modification, are permitted provided that the following conditions
   31.44 + * are met:
   31.45 + * 1. Redistributions of source code must retain the above copyright
   31.46 + *    notice, this list of conditions and the following disclaimer.
   31.47 + * 2. Redistributions in binary form must reproduce the above copyright
   31.48 + *    notice, this list of conditions and the following disclaimer in the
   31.49 + *    documentation and/or other materials provided with the distribution.
   31.50 + * 3. Neither the name of the University nor the names of its contributors
   31.51 + *    may be used to endorse or promote products derived from this software
   31.52 + *    without specific prior written permission.
   31.53 + *
   31.54 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   31.55 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   31.56 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   31.57 + * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   31.58 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   31.59 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   31.60 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   31.61 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   31.62 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   31.63 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   31.64 + * SUCH DAMAGE.
   31.65 + *
   31.66 + */
   31.67 +
   31.68 +#ifndef _NET_IF_H_
   31.69 +#define _NET_IF_H_
   31.70 +
   31.71 +/*
   31.72 + * Length of interface external name, including terminating '\0'.
   31.73 + * Note: this is the same size as a generic device's external name.
   31.74 + */
   31.75 +#define IF_NAMESIZE 16
   31.76 +
   31.77 +struct if_nameindex {
   31.78 +        unsigned int    if_index;       /* 1, 2, ... */
   31.79 +        char            *if_name;       /* null terminated name: "le0", ... */
   31.80 +};
   31.81 +
   31.82 +unsigned int if_nametoindex(const char *);
   31.83 +char *  if_indextoname(unsigned int, char *);
   31.84 +struct  if_nameindex * if_nameindex(void);
   31.85 +void    if_freenameindex(struct if_nameindex *);
   31.86 +
   31.87 +#endif /* !_NET_IF_H_ */
   31.88 +
    32.1 --- a/extras/mini-os/include/sched.h	Mon Nov 10 15:52:15 2008 -0800
    32.2 +++ b/extras/mini-os/include/sched.h	Wed Feb 11 16:25:03 2009 -0800
    32.3 @@ -48,8 +48,9 @@ struct thread* create_thread(char *name,
    32.4  void exit_thread(void) __attribute__((noreturn));
    32.5  void schedule(void);
    32.6  
    32.7 +#ifdef __INSIDE_MINIOS__
    32.8  #define current get_current()
    32.9 -
   32.10 +#endif
   32.11  
   32.12  void wake(struct thread *thread);
   32.13  void block(struct thread *thread);
    33.1 --- a/extras/mini-os/include/wait.h	Mon Nov 10 15:52:15 2008 -0800
    33.2 +++ b/extras/mini-os/include/wait.h	Wed Feb 11 16:25:03 2009 -0800
    33.3 @@ -7,7 +7,7 @@
    33.4  
    33.5  #define DEFINE_WAIT(name)                               \
    33.6  struct wait_queue name = {                              \
    33.7 -    .thread       = current,                            \
    33.8 +    .thread       = get_current(),                            \
    33.9      .thread_list  = MINIOS_LIST_HEAD_INIT((name).thread_list), \
   33.10  }
   33.11  
   33.12 @@ -53,7 +53,7 @@ static inline void wake_up(struct wait_q
   33.13      unsigned long flags;        \
   33.14      local_irq_save(flags);      \
   33.15      add_wait_queue(&wq, &w);    \
   33.16 -    block(current);             \
   33.17 +    block(get_current());       \
   33.18      local_irq_restore(flags);   \
   33.19  } while (0)
   33.20  
   33.21 @@ -74,8 +74,8 @@ static inline void wake_up(struct wait_q
   33.22          /* protect the list */                                  \
   33.23          local_irq_save(flags);                                  \
   33.24          add_wait_queue(&wq, &__wait);                           \
   33.25 -        current->wakeup_time = deadline;                        \
   33.26 -        clear_runnable(current);                                \
   33.27 +        get_current()->wakeup_time = deadline;                  \
   33.28 +        clear_runnable(get_current());                          \
   33.29          local_irq_restore(flags);                               \
   33.30          if((condition) || (deadline && NOW() >= deadline))      \
   33.31              break;                                              \
   33.32 @@ -83,7 +83,7 @@ static inline void wake_up(struct wait_q
   33.33      }                                                           \
   33.34      local_irq_save(flags);                                      \
   33.35      /* need to wake up */                                       \
   33.36 -    wake(current);                                              \
   33.37 +    wake(get_current());                                        \
   33.38      remove_wait_queue(&__wait);                                 \
   33.39      local_irq_restore(flags);                                   \
   33.40  } while(0) 
    34.1 --- a/extras/mini-os/include/xenbus.h	Mon Nov 10 15:52:15 2008 -0800
    34.2 +++ b/extras/mini-os/include/xenbus.h	Wed Feb 11 16:25:03 2009 -0800
    34.3 @@ -91,6 +91,9 @@ char* xenbus_printf(xenbus_transaction_t
    34.4                                    const char* fmt, ...)
    34.5                     __attribute__((__format__(printf, 4, 5)));
    34.6  
    34.7 +/* Utility function to figure out our domain id */
    34.8 +domid_t xenbus_get_self_id(void);
    34.9 +
   34.10  /* Reset the XenBus system. */
   34.11  void fini_xenbus(void);
   34.12  
    35.1 --- a/extras/mini-os/kernel.c	Mon Nov 10 15:52:15 2008 -0800
    35.2 +++ b/extras/mini-os/kernel.c	Wed Feb 11 16:25:03 2009 -0800
    35.3 @@ -434,25 +434,25 @@ static void kbdfront_thread(void *p)
    35.4  
    35.5  static struct pcifront_dev *pci_dev;
    35.6  
    35.7 +static void print_pcidev(unsigned int domain, unsigned int bus, unsigned int slot, unsigned int fun)
    35.8 +{
    35.9 +    unsigned int vendor, device, rev, class;
   35.10 +
   35.11 +    pcifront_conf_read(pci_dev, domain, bus, slot, fun, 0x00, 2, &vendor);
   35.12 +    pcifront_conf_read(pci_dev, domain, bus, slot, fun, 0x02, 2, &device);
   35.13 +    pcifront_conf_read(pci_dev, domain, bus, slot, fun, 0x08, 1, &rev);
   35.14 +    pcifront_conf_read(pci_dev, domain, bus, slot, fun, 0x0a, 2, &class);
   35.15 +
   35.16 +    printk("%04x:%02x:%02x.%02x %04x: %04x:%04x (rev %02x)\n", domain, bus, slot, fun, class, vendor, device, rev);
   35.17 +}
   35.18 +
   35.19  static void pcifront_thread(void *p)
   35.20  {
   35.21 -    void print(unsigned int domain, unsigned int bus, unsigned int slot, unsigned int fun)
   35.22 -    {
   35.23 -        unsigned int vendor, device, rev, class;
   35.24 -
   35.25 -        pcifront_conf_read(pci_dev, domain, bus, slot, fun, 0x00, 2, &vendor);
   35.26 -        pcifront_conf_read(pci_dev, domain, bus, slot, fun, 0x02, 2, &device);
   35.27 -        pcifront_conf_read(pci_dev, domain, bus, slot, fun, 0x08, 1, &rev);
   35.28 -        pcifront_conf_read(pci_dev, domain, bus, slot, fun, 0x0a, 2, &class);
   35.29 -
   35.30 -        printk("%04x:%02x:%02x.%02x %04x: %04x:%04x (rev %02x)\n", domain, bus, slot, fun, class, vendor, device, rev);
   35.31 -    }
   35.32 -
   35.33      pci_dev = init_pcifront(NULL);
   35.34      if (!pci_dev)
   35.35          return;
   35.36      printk("PCI devices:\n");
   35.37 -    pcifront_scan(pci_dev, print);
   35.38 +    pcifront_scan(pci_dev, print_pcidev);
   35.39  }
   35.40  
   35.41  static void fs_thread(void *p)
    36.1 --- a/extras/mini-os/lib/sys.c	Mon Nov 10 15:52:15 2008 -0800
    36.2 +++ b/extras/mini-os/lib/sys.c	Wed Feb 11 16:25:03 2009 -0800
    36.3 @@ -34,6 +34,7 @@
    36.4  #include <sys/unistd.h>
    36.5  #include <sys/stat.h>
    36.6  #include <sys/mman.h>
    36.7 +#include <net/if.h>
    36.8  #include <time.h>
    36.9  #include <errno.h>
   36.10  #include <fcntl.h>
   36.11 @@ -1324,6 +1325,12 @@ unsupported_function(int, tcsetattr, -1)
   36.12  unsupported_function(int, tcgetattr, 0);
   36.13  unsupported_function(int, poll, -1);
   36.14  
   36.15 +/* net/if.h */
   36.16 +unsupported_function_log(unsigned int, if_nametoindex, -1);
   36.17 +unsupported_function_log(char *, if_indextoname, (char *) NULL);
   36.18 +unsupported_function_log(struct  if_nameindex *, if_nameindex, (struct  if_nameindex *) NULL);
   36.19 +unsupported_function_crash(if_freenameindex);
   36.20 +
   36.21  /* Linuxish abi for the Caml runtime, don't support */
   36.22  unsupported_function_log(struct dirent *, readdir64, NULL);
   36.23  unsupported_function_log(int, getrusage, -1);
    37.1 --- a/extras/mini-os/minios.mk	Mon Nov 10 15:52:15 2008 -0800
    37.2 +++ b/extras/mini-os/minios.mk	Wed Feb 11 16:25:03 2009 -0800
    37.3 @@ -26,6 +26,9 @@ else
    37.4  DEF_CFLAGS += -O3
    37.5  endif
    37.6  
    37.7 +# Make the headers define our internal stuff
    37.8 +DEF_CFLAGS += -D__INSIDE_MINIOS__
    37.9 +
   37.10  # Build the CFLAGS and ASFLAGS for compiling and assembling.
   37.11  # DEF_... flags are the common mini-os flags,
   37.12  # ARCH_... flags may be defined in arch/$(TARGET_ARCH_FAM/rules.mk
    38.1 --- a/extras/mini-os/xenbus/xenbus.c	Mon Nov 10 15:52:15 2008 -0800
    38.2 +++ b/extras/mini-os/xenbus/xenbus.c	Wed Feb 11 16:25:03 2009 -0800
    38.3 @@ -666,6 +666,17 @@ char* xenbus_printf(xenbus_transaction_t
    38.4      return xenbus_write(xbt,fullpath,val);
    38.5  }
    38.6  
    38.7 +domid_t xenbus_get_self_id(void)
    38.8 +{
    38.9 +    char *dom_id;
   38.10 +    domid_t ret;
   38.11 +
   38.12 +    BUG_ON(xenbus_read(XBT_NIL, "domid", &dom_id));
   38.13 +    sscanf(dom_id, "%d", &ret);
   38.14 +
   38.15 +    return ret;
   38.16 +}
   38.17 +
   38.18  static void do_ls_test(const char *pre)
   38.19  {
   38.20      char **dirs, *msg;
    39.1 --- a/stubdom/Makefile	Mon Nov 10 15:52:15 2008 -0800
    39.2 +++ b/stubdom/Makefile	Wed Feb 11 16:25:03 2009 -0800
    39.3 @@ -8,15 +8,25 @@ export debug=y
    39.4  include $(XEN_ROOT)/Config.mk
    39.5  
    39.6  IOEMU_OPTIONS=--disable-sdl --disable-opengl --disable-vnc-tls --disable-brlapi --disable-kqemu
    39.7 -ZLIB_URL?=http://www.zlib.net
    39.8 +
    39.9 +#ZLIB_URL?=http://www.zlib.net
   39.10 +ZLIB_URL=$(XEN_EXTFILES_URL)
   39.11  ZLIB_VERSION=1.2.3
   39.12 -LIBPCI_URL?=http://www.kernel.org/pub/software/utils/pciutils
   39.13 +
   39.14 +#LIBPCI_URL?=http://www.kernel.org/pub/software/utils/pciutils
   39.15 +LIBPCI_URL?=$(XEN_EXTFILES_URL)
   39.16  LIBPCI_VERSION=2.2.9
   39.17 -NEWLIB_URL?=ftp://sources.redhat.com/pub/newlib
   39.18 +
   39.19 +#NEWLIB_URL?=ftp://sources.redhat.com/pub/newlib
   39.20 +NEWLIB_URL?=$(XEN_EXTFILES_URL)
   39.21  NEWLIB_VERSION=1.16.0
   39.22 -LWIP_URL?=http://download.savannah.gnu.org/releases/lwip
   39.23 +
   39.24 +#LWIP_URL?=http://download.savannah.gnu.org/releases/lwip
   39.25 +LWIP_URL?=$(XEN_EXTFILES_URL)
   39.26  LWIP_VERSION=1.3.0
   39.27 -GRUB_URL?=http://alpha.gnu.org/gnu/grub
   39.28 +
   39.29 +#GRUB_URL?=http://alpha.gnu.org/gnu/grub
   39.30 +GRUB_URL?=$(XEN_EXTFILES_URL)
   39.31  GRUB_VERSION=0.97
   39.32  
   39.33  WGET=wget -c
   39.34 @@ -184,6 +194,7 @@ mk-headers-$(XEN_TARGET_ARCH): ioemu/lin
   39.35            ln -sf $(addprefix ../../,$(wildcard $(XEN_ROOT)/xen/include/public/*.h)) include/xen && \
   39.36            ln -sf $(addprefix ../../$(XEN_ROOT)/xen/include/public/,arch-ia64 arch-x86 hvm io xsm) include/xen && \
   39.37            ( [ -h include/xen/sys ] || ln -sf ../../$(XEN_ROOT)/tools/include/xen-sys/MiniOS include/xen/sys ) && \
   39.38 +          ( [ -h include/xen/libelf ] || ln -sf ../../$(XEN_ROOT)/tools/include/xen/libelf include/xen/libelf ) && \
   39.39  	  mkdir -p include/xen-foreign && \
   39.40  	  ln -sf $(addprefix ../../,$(wildcard $(XEN_ROOT)/tools/include/xen-foreign/*)) include/xen-foreign/ && \
   39.41  	  $(MAKE) -C include/xen-foreign/ && \
    40.1 --- a/stubdom/README	Mon Nov 10 15:52:15 2008 -0800
    40.2 +++ b/stubdom/README	Wed Feb 11 16:25:03 2009 -0800
    40.3 @@ -56,6 +56,11 @@ sdl = 0
    40.4  
    40.5  vfb = [ 'type=sdl' ]
    40.6  
    40.7 +    by default qemu will use sdl together with opengl for rendering, if
    40.8 +    you do not want qemu to use opengl then also pass opengl=0:
    40.9 +
   40.10 +vfb = [ 'type=sdl, opengl=0' ]
   40.11 +
   40.12  * Using a VNC server in the stub domain
   40.13  
   40.14    - In hvmconfig, set vnclisten to "172.30.206.1" for instance.  Do not use a
    41.1 --- a/stubdom/grub/mini-os.c	Mon Nov 10 15:52:15 2008 -0800
    41.2 +++ b/stubdom/grub/mini-os.c	Wed Feb 11 16:25:03 2009 -0800
    41.3 @@ -649,7 +649,7 @@ int getrtsecs (void)
    41.4  {
    41.5      struct timeval tv;
    41.6      gettimeofday(&tv, NULL);
    41.7 -    return tv.tv_sec;
    41.8 +    return tv.tv_sec % 10 + ((tv.tv_sec / 10) % 6) * 0x10;
    41.9  }
   41.10  
   41.11  int currticks (void)
    42.1 --- a/stubdom/stubdom-dm	Mon Nov 10 15:52:15 2008 -0800
    42.2 +++ b/stubdom/stubdom-dm	Wed Feb 11 16:25:03 2009 -0800
    42.3 @@ -15,6 +15,7 @@ domname=
    42.4  vncviewer=0
    42.5  vncpid=
    42.6  extra=
    42.7 +videoram=4
    42.8  while [ "$#" -gt 0 ];
    42.9  do
   42.10      if [ "$#" -ge 2 ];
   42.11 @@ -38,6 +39,10 @@ do
   42.12                  extra="$extra -loadvm $2";
   42.13                  shift
   42.14                  ;;
   42.15 +	    -videoram)
   42.16 +	        videoram="$2"
   42.17 +		shift
   42.18 +		;;
   42.19  	esac
   42.20      fi
   42.21      case "$1" in
   42.22 @@ -72,7 +77,7 @@ do
   42.23  	sleep 1
   42.24  done
   42.25  
   42.26 -creation="xm create -c $domname-dm target=$domid memory=32 extra=\"$extra\""
   42.27 +creation="xm create -c $domname-dm target=$domid memory=32 videoram=$videoram extra=\"$extra\""
   42.28  
   42.29  (while true ; do sleep 60 ; done) | /bin/sh -c "$creation" &
   42.30  #xterm -geometry +0+0 -e /bin/sh -c "$creation ; echo ; echo press ENTER to shut down ; read" &
    43.1 --- a/tools/Makefile	Mon Nov 10 15:52:15 2008 -0800
    43.2 +++ b/tools/Makefile	Wed Feb 11 16:25:03 2009 -0800
    43.3 @@ -9,6 +9,7 @@ SUBDIRS-y += flask
    43.4  SUBDIRS-y += xenstore
    43.5  SUBDIRS-y += misc
    43.6  SUBDIRS-y += examples
    43.7 +SUBDIRS-y += hotplug
    43.8  SUBDIRS-y += xentrace
    43.9  SUBDIRS-$(CONFIG_XCUTILS) += xcutils
   43.10  SUBDIRS-$(CONFIG_X86) += firmware
    44.1 --- a/tools/Rules.mk	Mon Nov 10 15:52:15 2008 -0800
    44.2 +++ b/tools/Rules.mk	Wed Feb 11 16:25:03 2009 -0800
    44.3 @@ -29,6 +29,10 @@ X11_LDPATH = -L/usr/X11R6/$(LIBLEAFDIR)
    44.4  
    44.5  CFLAGS += -D__XEN_TOOLS__
    44.6  
    44.7 +# Get gcc to generate the dependencies for us.
    44.8 +CFLAGS += -MMD -MF .$(@F).d
    44.9 +DEPS = .*.d
   44.10 +
   44.11  # Enable implicit LFS support *and* explicit LFS names.
   44.12  CFLAGS  += $(shell getconf LFS_CFLAGS)
   44.13  CFLAGS  += -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
   44.14 @@ -59,4 +63,3 @@ subdirs-all subdirs-clean subdirs-instal
   44.15  
   44.16  subdir-all-% subdir-clean-% subdir-install-%: .phony
   44.17  	$(MAKE) -C $* $(patsubst subdir-%-$*,%,$@)
   44.18 -
    45.1 --- a/tools/blktap/drivers/Makefile	Mon Nov 10 15:52:15 2008 -0800
    45.2 +++ b/tools/blktap/drivers/Makefile	Wed Feb 11 16:25:03 2009 -0800
    45.3 @@ -13,16 +13,12 @@ CFLAGS   += $(CFLAGS_libxenstore)
    45.4  CFLAGS   += -I $(LIBAIO_DIR)
    45.5  CFLAGS   += -D_GNU_SOURCE
    45.6  
    45.7 -# Get gcc to generate the dependencies for us.
    45.8 -CFLAGS   += -Wp,-MD,.$(@F).d
    45.9 -DEPS      = .*.d
   45.10 -
   45.11 -ifeq ($(shell . ./check_gcrypt),"yes")
   45.12 +ifeq ($(shell . ./check_gcrypt $(CC)),yes)
   45.13  CFLAGS += -DUSE_GCRYPT
   45.14  CRYPT_LIB := -lgcrypt
   45.15  else
   45.16  CRYPT_LIB := -lcrypto
   45.17 -$(warning *** libgcrypt not installed: falling back to libcrypto ***)
   45.18 +$(warning === libgcrypt not installed: falling back to libcrypto ===)
   45.19  endif
   45.20  
   45.21  LDFLAGS_blktapctrl := $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenstore) -L../lib -lblktap
    46.1 --- a/tools/console/Makefile	Mon Nov 10 15:52:15 2008 -0800
    46.2 +++ b/tools/console/Makefile	Wed Feb 11 16:25:03 2009 -0800
    46.3 @@ -16,7 +16,7 @@ all: $(BIN)
    46.4  
    46.5  .PHONY: clean
    46.6  clean:
    46.7 -	$(RM) *.a *.so *.o *.rpm $(BIN)
    46.8 +	$(RM) *.a *.so *.o *.rpm $(BIN) $(DEPS)
    46.9  	$(RM) client/*.o daemon/*.o
   46.10  
   46.11  xenconsoled: $(patsubst %.c,%.o,$(wildcard daemon/*.c))
   46.12 @@ -33,3 +33,5 @@ install: $(BIN)
   46.13  	$(INSTALL_PROG) xenconsoled $(DESTDIR)/$(SBINDIR)
   46.14  	$(INSTALL_DIR) $(DESTDIR)$(PRIVATE_BINDIR)
   46.15  	$(INSTALL_PROG) xenconsole $(DESTDIR)$(PRIVATE_BINDIR)
   46.16 +
   46.17 +-include $(DEPS)
    47.1 --- a/tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/Makefile.in	Mon Nov 10 15:52:15 2008 -0800
    47.2 +++ b/tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/Makefile.in	Wed Feb 11 16:25:03 2009 -0800
    47.3 @@ -83,7 +83,7 @@ READLINE_DEP = $$(READLINE_DIR)
    47.4  # -I. for config files.
    47.5  # -I${srcdir} for our headers.
    47.6  # -I$(srcdir)/../regformats for regdef.h.
    47.7 -INCLUDE_CFLAGS = -I. -I${srcdir} -I$(srcdir)/../regformats -I$(INCLUDE_DIR)  -I../../../../../libxc/
    47.8 +INCLUDE_CFLAGS = -I. -I${srcdir} -I$(srcdir)/../regformats -I$(INCLUDE_DIR)  -I../../../../../libxc/ -I../../../../../include/
    47.9  
   47.10  # M{H,T}_CFLAGS, if defined, has host- and target-dependent CFLAGS
   47.11  # from the config/ directory.
    48.1 --- a/tools/examples/Makefile	Mon Nov 10 15:52:15 2008 -0800
    48.2 +++ b/tools/examples/Makefile	Wed Feb 11 16:25:03 2009 -0800
    48.3 @@ -24,41 +24,6 @@ XEN_CONFIGS += xmexample.vti
    48.4  XEN_CONFIGS += xend-pci-quirks.sxp
    48.5  XEN_CONFIGS += xend-pci-permissive.sxp
    48.6  
    48.7 -# Xen script dir and scripts to go there.
    48.8 -XEN_SCRIPT_DIR = /etc/xen/scripts
    48.9 -XEN_SCRIPTS = network-bridge vif-bridge
   48.10 -XEN_SCRIPTS += network-route vif-route
   48.11 -XEN_SCRIPTS += network-nat vif-nat
   48.12 -XEN_SCRIPTS += block
   48.13 -XEN_SCRIPTS += block-enbd block-nbd
   48.14 -XEN_SCRIPTS += blktap
   48.15 -XEN_SCRIPTS += vtpm vtpm-delete
   48.16 -XEN_SCRIPTS += xen-hotplug-cleanup
   48.17 -XEN_SCRIPTS += external-device-migrate
   48.18 -XEN_SCRIPTS += vscsi
   48.19 -XEN_SCRIPT_DATA = xen-script-common.sh locking.sh logging.sh
   48.20 -XEN_SCRIPT_DATA += xen-hotplug-common.sh xen-network-common.sh vif-common.sh
   48.21 -XEN_SCRIPT_DATA += block-common.sh vtpm-common.sh vtpm-hotplug-common.sh
   48.22 -XEN_SCRIPT_DATA += vtpm-migration.sh vtpm-impl
   48.23 -
   48.24 -XEN_HOTPLUG_DIR = /etc/hotplug
   48.25 -XEN_HOTPLUG_SCRIPTS = xen-backend.agent
   48.26 -
   48.27 -UDEV_RULES_DIR = /etc/udev
   48.28 -UDEV_RULES = xen-backend.rules
   48.29 -
   48.30 -DI = $(if $(DISTDIR),$(shell readlink -f $(DISTDIR)),)
   48.31 -DE = $(if $(DESTDIR),$(shell readlink -f $(DESTDIR)),)
   48.32 -ifeq ($(findstring $(DI),$(DE)),$(DI))
   48.33 -HOTPLUGS=install-hotplug install-udev
   48.34 -else
   48.35 -ifeq ($(shell [ -x /usr/bin/udevinfo ] && [ `/usr/bin/udevinfo -V | sed -e 's/^[^0-9]* \([0-9]\{1,\}\)[^0-9]\{0,\}/\1/'` -ge 059 ] && echo 1),1)
   48.36 -HOTPLUGS=install-udev
   48.37 -else
   48.38 -HOTPLUGS=install-hotplug
   48.39 -endif
   48.40 -endif
   48.41 -
   48.42  .PHONY: all
   48.43  all:
   48.44  
   48.45 @@ -66,7 +31,7 @@ all:
   48.46  build:
   48.47  
   48.48  .PHONY: install
   48.49 -install: all install-readmes install-initd install-configs install-scripts $(HOTPLUGS)
   48.50 +install: all install-readmes install-configs $(HOTPLUGS)
   48.51  
   48.52  .PHONY: install-readmes
   48.53  install-readmes:
   48.54 @@ -77,14 +42,6 @@ install-readmes:
   48.55  	    $(INSTALL_DATA) $$i $(DESTDIR)$(XEN_CONFIG_DIR); \
   48.56  	done
   48.57  
   48.58 -.PHONY: install-initd
   48.59 -install-initd:
   48.60 -	[ -d $(DESTDIR)/etc/init.d ] || $(INSTALL_DIR) $(DESTDIR)/etc/init.d
   48.61 -	[ -d $(DESTDIR)/etc/sysconfig ] || $(INSTALL_DIR) $(DESTDIR)/etc/sysconfig
   48.62 -	$(INSTALL_PROG) $(XEND_INITD) $(DESTDIR)/etc/init.d
   48.63 -	$(INSTALL_PROG) $(XENDOMAINS_INITD) $(DESTDIR)/etc/init.d
   48.64 -	$(INSTALL_PROG) $(XENDOMAINS_SYSCONFIG) $(DESTDIR)/etc/sysconfig/xendomains
   48.65 -
   48.66  .PHONY: install-configs
   48.67  install-configs: $(XEN_CONFIGS)
   48.68  	[ -d $(DESTDIR)$(XEN_CONFIG_DIR) ] || \
   48.69 @@ -96,19 +53,6 @@ install-configs: $(XEN_CONFIGS)
   48.70  	    $(INSTALL_DATA) $$i $(DESTDIR)$(XEN_CONFIG_DIR); \
   48.71  	done
   48.72  
   48.73 -.PHONY: install-scripts
   48.74 -install-scripts:
   48.75 -	[ -d $(DESTDIR)$(XEN_SCRIPT_DIR) ] || \
   48.76 -		$(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR)
   48.77 -	set -e; for i in $(XEN_SCRIPTS); \
   48.78 -	    do \
   48.79 -	    $(INSTALL_PROG) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \
   48.80 -	done
   48.81 -	set -e; for i in $(XEN_SCRIPT_DATA); \
   48.82 -	    do \
   48.83 -	    $(INSTALL_DATA) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \
   48.84 -	done
   48.85 -
   48.86  .PHONY: install-hotplug
   48.87  install-hotplug:
   48.88  	[ -d $(DESTDIR)$(XEN_HOTPLUG_DIR) ] || \
    49.1 --- a/tools/examples/blktap	Mon Nov 10 15:52:15 2008 -0800
    49.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    49.3 @@ -1,93 +0,0 @@
    49.4 -#!/bin/bash
    49.5 -
    49.6 -# Copyright (c) 2005, XenSource Ltd.
    49.7 -
    49.8 -dir=$(dirname "$0")
    49.9 -. "$dir/xen-hotplug-common.sh"
   49.10 -. "$dir/block-common.sh"
   49.11 -
   49.12 -findCommand "$@"
   49.13 -
   49.14 -##
   49.15 -# check_blktap_sharing file mode
   49.16 -#
   49.17 -# Perform the sharing check for the given blktap and mode.
   49.18 -#
   49.19 -check_blktap_sharing()
   49.20 -{
   49.21 -    local file="$1"
   49.22 -    local mode="$2"
   49.23 -
   49.24 -    local base_path="$XENBUS_BASE_PATH/$XENBUS_TYPE"
   49.25 -    for dom in $(xenstore-list "$base_path")
   49.26 -    do
   49.27 -        for dev in $(xenstore-list "$base_path/$dom")
   49.28 -        do
   49.29 -            params=$(xenstore_read "$base_path/$dom/$dev/params" | cut -d: -f2)
   49.30 -            if [ "$file" = "$params" ]
   49.31 -            then
   49.32 -
   49.33 -                if [ "$mode" = 'w' ]
   49.34 -                then
   49.35 -                    if ! same_vm "$dom" 
   49.36 -                    then
   49.37 -                        echo 'guest'
   49.38 -                        return
   49.39 -                    fi
   49.40 -                else 
   49.41 -                    local m=$(xenstore_read "$base_path/$dom/$dev/mode")
   49.42 -                    m=$(canonicalise_mode "$m")
   49.43 -
   49.44 -                    if [ "$m" = 'w' ] 
   49.45 -                    then
   49.46 -                        if ! same_vm "$dom"
   49.47 -                        then
   49.48 -                            echo 'guest'
   49.49 -                            return
   49.50 -                        fi
   49.51 -                    fi
   49.52 -                fi
   49.53 -            fi
   49.54 -        done
   49.55 -    done
   49.56 -
   49.57 -    echo 'ok'
   49.58 -}
   49.59 -
   49.60 -
   49.61 -t=$(xenstore_read_default "$XENBUS_PATH/type" 'MISSING')
   49.62 -if [ -n "$t" ]
   49.63 -then
   49.64 -    p=$(xenstore_read "$XENBUS_PATH/params")
   49.65 -    # if we have a ':', chew from head including :
   49.66 -    if echo $p | grep -q \:
   49.67 -    then
   49.68 -        p=${p#*:}
   49.69 -    fi
   49.70 -fi
   49.71 -# some versions of readlink cannot be passed a regular file
   49.72 -if [ -L "$p" ]; then
   49.73 -    file=$(readlink -f "$p") || fatal "$p link does not exist."
   49.74 -else
   49.75 -    file="$p"
   49.76 -fi
   49.77 -
   49.78 -if [ "$command" = 'add' ]
   49.79 -then
   49.80 -    [ -e "$file" ] || { fatal $file does not exist; }
   49.81 -
   49.82 -    FRONTEND_ID=$(xenstore_read "$XENBUS_PATH/frontend-id")
   49.83 -    FRONTEND_UUID=$(xenstore_read "/local/domain/$FRONTEND_ID/vm")
   49.84 -    mode=$(xenstore_read "$XENBUS_PATH/mode")
   49.85 -    mode=$(canonicalise_mode "$mode")
   49.86 -
   49.87 -    if [ "$mode" != '!' ] 
   49.88 -    then
   49.89 -        result=$(check_blktap_sharing "$file" "$mode")
   49.90 -        [ "$result" = 'ok' ] || ebusy "$file already in use by other domain"
   49.91 -    fi
   49.92 -
   49.93 -    success
   49.94 -fi
   49.95 -
   49.96 -exit 0
    50.1 --- a/tools/examples/block	Mon Nov 10 15:52:15 2008 -0800
    50.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.3 @@ -1,381 +0,0 @@
    50.4 -#!/bin/bash
    50.5 -
    50.6 -dir=$(dirname "$0")
    50.7 -. "$dir/block-common.sh"
    50.8 -
    50.9 -expand_dev() {
   50.10 -  local dev
   50.11 -  case $1 in
   50.12 -  /*)
   50.13 -    dev=$1
   50.14 -    ;;
   50.15 -  *)
   50.16 -    dev=/dev/$1
   50.17 -    ;;
   50.18 -  esac
   50.19 -  echo -n $dev
   50.20 -}
   50.21 -
   50.22 -
   50.23 -##
   50.24 -# check_sharing device mode
   50.25 -#
   50.26 -# Check whether the device requested is already in use.  To use the device in
   50.27 -# read-only mode, it may be in use in read-only mode, but may not be in use in
   50.28 -# read-write anywhere at all.  To use the device in read-write mode, it must
   50.29 -# not be in use anywhere at all.
   50.30 -#
   50.31 -# Prints one of
   50.32 -#
   50.33 -#    'local': the device may not be used because it is mounted in the current
   50.34 -#             (i.e. the privileged domain) in a way incompatible with the
   50.35 -#             requested mode;
   50.36 -#    'guest': the device may not be used because it already mounted by a guest
   50.37 -#             in a way incompatible with the requested mode; or
   50.38 -#    'ok':    the device may be used.
   50.39 -#
   50.40 -check_sharing()
   50.41 -{
   50.42 -  local dev="$1"
   50.43 -  local mode="$2"
   50.44 -
   50.45 -  local devmm=$(device_major_minor "$dev")
   50.46 -  local file
   50.47 -
   50.48 -  if [ "$mode" = 'w' ]
   50.49 -  then
   50.50 -    toskip="^$"
   50.51 -  else
   50.52 -    toskip="^[^ ]* [^ ]* [^ ]* ro[, ]"
   50.53 -  fi
   50.54 -
   50.55 -  for file in $(cat /proc/mounts | grep -v "$toskip" | cut -f 1 -d ' ')
   50.56 -  do
   50.57 -    if [ -e "$file" ]
   50.58 -    then
   50.59 -      local d=$(device_major_minor "$file")
   50.60 -
   50.61 -      if [ "$d" = "$devmm" ]
   50.62 -      then
   50.63 -        echo 'local'
   50.64 -        return
   50.65 -      fi
   50.66 -    fi
   50.67 -  done
   50.68 -
   50.69 -  local base_path="$XENBUS_BASE_PATH/$XENBUS_TYPE"
   50.70 -  for dom in $(xenstore-list "$base_path")
   50.71 -  do
   50.72 -    for dev in $(xenstore-list "$base_path/$dom")
   50.73 -    do
   50.74 -      d=$(xenstore_read_default "$base_path/$dom/$dev/physical-device" "")
   50.75 -
   50.76 -      if [ "$d" = "$devmm" ]
   50.77 -      then
   50.78 -        if [ "$mode" = 'w' ]
   50.79 -        then
   50.80 -          if ! same_vm $dom
   50.81 -          then
   50.82 -            echo 'guest'
   50.83 -            return
   50.84 -          fi
   50.85 -        else
   50.86 -          local m=$(xenstore_read "$base_path/$dom/$dev/mode")
   50.87 -          m=$(canonicalise_mode "$m")
   50.88 -
   50.89 -          if [ "$m" = 'w' ]
   50.90 -          then
   50.91 -            if ! same_vm $dom
   50.92 -            then
   50.93 -              echo 'guest'
   50.94 -              return
   50.95 -            fi
   50.96 -          fi
   50.97 -        fi
   50.98 -      fi
   50.99 -    done
  50.100 -  done
  50.101 -
  50.102 -  echo 'ok'
  50.103 -}
  50.104 -
  50.105 -
  50.106 -##
  50.107 -# check_device_sharing dev mode
  50.108 -#
  50.109 -# Perform the sharing check for the given physical device and mode.
  50.110 -#
  50.111 -check_device_sharing()
  50.112 -{
  50.113 -  local dev="$1"
  50.114 -  local mode=$(canonicalise_mode "$2")
  50.115 -  local result
  50.116 -
  50.117 -  if [ "x$mode" = 'x!' ]
  50.118 -  then
  50.119 -    return 0
  50.120 -  fi
  50.121 -
  50.122 -  result=$(check_sharing "$dev" "$mode")
  50.123 -
  50.124 -  if [ "$result" != 'ok' ]
  50.125 -  then
  50.126 -    do_ebusy "Device $dev is mounted " "$mode" "$result"
  50.127 -  fi
  50.128 -}
  50.129 -
  50.130 -
  50.131 -##
  50.132 -# check_device_sharing file dev mode
  50.133 -#
  50.134 -# Perform the sharing check for the given file mounted through the given
  50.135 -# loopback interface, in the given mode.
  50.136 -#
  50.137 -check_file_sharing()
  50.138 -{
  50.139 -  local file="$1"
  50.140 -  local dev="$2"
  50.141 -  local mode="$3"
  50.142 -
  50.143 -  result=$(check_sharing "$dev" "$mode")
  50.144 -
  50.145 -  if [ "$result" != 'ok' ]
  50.146 -  then
  50.147 -    do_ebusy "File $file is loopback-mounted through $dev,
  50.148 -which is mounted " "$mode" "$result"
  50.149 -  fi
  50.150 -}
  50.151 -
  50.152 -
  50.153 -##
  50.154 -# do_ebusy prefix mode result
  50.155 -#
  50.156 -# Helper function for check_device_sharing check_file_sharing, calling ebusy
  50.157 -# with an error message constructed from the given prefix, mode, and result
  50.158 -# from a call to check_sharing.
  50.159 -#
  50.160 -do_ebusy()
  50.161 -{
  50.162 -  local prefix="$1"
  50.163 -  local mode="$2"
  50.164 -  local result="$3"
  50.165 -
  50.166 -  if [ "$result" = 'guest' ]
  50.167 -  then
  50.168 -    dom='a guest '
  50.169 -    when='now'
  50.170 -  else
  50.171 -    dom='the privileged '
  50.172 -    when='by a guest'
  50.173 -  fi
  50.174 -
  50.175 -  if [ "$mode" = 'w' ]
  50.176 -  then
  50.177 -    m1=''
  50.178 -    m2=''
  50.179 -  else
  50.180 -    m1='read-write '
  50.181 -    m2='read-only '
  50.182 -  fi
  50.183 -
  50.184 -  release_lock "block"
  50.185 -  ebusy \
  50.186 -"${prefix}${m1}in ${dom}domain,
  50.187 -and so cannot be mounted ${m2}${when}."
  50.188 -}
  50.189 -
  50.190 -
  50.191 -t=$(xenstore_read_default "$XENBUS_PATH/type" 'MISSING')
  50.192 -
  50.193 -case "$command" in
  50.194 -  add)
  50.195 -    phys=$(xenstore_read_default "$XENBUS_PATH/physical-device" 'MISSING')
  50.196 -    if [ "$phys" != 'MISSING' ]
  50.197 -    then
  50.198 -      # Depending upon the hotplug configuration, it is possible for this
  50.199 -      # script to be called twice, so just bail.
  50.200 -      exit 0
  50.201 -    fi
  50.202 -
  50.203 -    if [ -n "$t" ]
  50.204 -    then
  50.205 -      p=$(xenstore_read "$XENBUS_PATH/params")
  50.206 -      mode=$(xenstore_read "$XENBUS_PATH/mode")
  50.207 -    fi
  50.208 -
  50.209 -    case $t in 
  50.210 -      phy)
  50.211 -        dev=$(expand_dev $p)
  50.212 -        FRONTEND_ID=$(xenstore_read "$XENBUS_PATH/frontend-id")
  50.213 -        FRONTEND_UUID=$(xenstore_read_default \
  50.214 -            "/local/domain/$FRONTEND_ID/vm" 'unknown')
  50.215 -
  50.216 -        if [ -L "$dev" ]
  50.217 -        then
  50.218 -          dev=$(readlink -f "$dev") || fatal "$dev link does not exist."
  50.219 -        fi
  50.220 -        test -e "$dev" || fatal "$dev does not exist."
  50.221 -        test -b "$dev" || fatal "$dev is not a block device."
  50.222 -
  50.223 -        claim_lock "block"
  50.224 -        check_device_sharing "$dev" "$mode"
  50.225 -	write_dev "$dev"
  50.226 -        release_lock "block"
  50.227 -	exit 0
  50.228 -	;;
  50.229 -
  50.230 -      file)
  50.231 -        # Canonicalise the file, for sharing check comparison, and the mode
  50.232 -        # for ease of use here.
  50.233 -        file=$(readlink -f "$p") || fatal "$p does not exist."
  50.234 -        test -f "$file" || fatal "$file does not exist."
  50.235 -        mode=$(canonicalise_mode "$mode")
  50.236 -
  50.237 -        claim_lock "block"
  50.238 -
  50.239 -        if [ "$mode" = 'w' ] && ! stat "$file" -c %A | grep -q w
  50.240 -        then
  50.241 -          release_lock "block"
  50.242 -          ebusy \
  50.243 -"File $file is read-only, and so I will not
  50.244 -mount it read-write in a guest domain."
  50.245 -        fi
  50.246 -
  50.247 -        loopdev=''
  50.248 -        for dev in /dev/loop*
  50.249 -        do
  50.250 -          if [ ! -b "$dev" ]
  50.251 -          then
  50.252 -            continue
  50.253 -          fi
  50.254 -
  50.255 -          f=$(losetup "$dev" 2>/dev/null) || f=''
  50.256 -
  50.257 -          if [ "$f" ]
  50.258 -          then
  50.259 -            # $dev is in use.  Check sharing.
  50.260 -            if [ "x$mode" = 'x!' ]
  50.261 -            then
  50.262 -              continue
  50.263 -            fi
  50.264 -
  50.265 -            f=$(echo "$f" | sed -e 's/.*(\(.*\)).*/\1/g')
  50.266 -
  50.267 -            # $f is the filename, as read from losetup, but the loopback
  50.268 -            # driver truncates filenames at 64 characters, so we need to go
  50.269 -            # trawling through the store if it's longer than that.  Truncation
  50.270 -            # is indicated by an asterisk at the end of the filename.
  50.271 -            if expr index "$f" '*' >/dev/null
  50.272 -            then
  50.273 -              found=""
  50.274 -              for dom in $(xenstore-list "$XENBUS_BASE_PATH")
  50.275 -              do
  50.276 -                for domdev in $(xenstore-list "$XENBUS_BASE_PATH/$dom")
  50.277 -                do
  50.278 -                  d=$(xenstore_read_default \
  50.279 -                        "$XENBUS_BASE_PATH/$dom/$domdev/node" "")
  50.280 -                  if [ "$d" = "$dev" ]
  50.281 -                  then
  50.282 -                    f=$(xenstore_read "$XENBUS_BASE_PATH/$dom/$domdev/params")
  50.283 -                    found=1
  50.284 -                    break 2
  50.285 -                  fi
  50.286 -                done
  50.287 -              done
  50.288 -
  50.289 -              if [ ! "$found" ]
  50.290 -              then
  50.291 -                # This loopback device is in use by someone else, so skip it.
  50.292 -                log debug "Loopback sharing check skips device $dev."
  50.293 -                continue
  50.294 -              fi
  50.295 -            fi
  50.296 -
  50.297 -            # Canonicalise the filename for the comparison.
  50.298 -
  50.299 -            # I have seen this readlink fails because the filename given by
  50.300 -            # losetup is only the basename.  This cannot happen when the loop
  50.301 -            # device is set up through this script, because file is
  50.302 -            # canonicalised above, but it may happen when loop devices are set
  50.303 -            # up some other way.  This readlink may also conceivably fail if
  50.304 -            # the file backing this loop device has been removed.
  50.305 -
  50.306 -            # For maximum safety, in the case that $f does not resolve, we
  50.307 -            # assume that $file and $f are in the same directory.
  50.308 -
  50.309 -            # If you create a loopback filesystem, remove it and continue to
  50.310 -            # run on it, and then create another file with the same name, then
  50.311 -            # this check will block that -- don't do that.
  50.312 -
  50.313 -            # If you create loop devices through some other mechanism, use
  50.314 -            # relative filenames, and then use the same filename through this
  50.315 -            # script, then this check will block that -- don't do that either.
  50.316 -
  50.317 -            f=$(readlink -f "$f" || echo $(dirname "$file")/$(basename "$f"))
  50.318 -
  50.319 -
  50.320 -            if [ "$f" = "$file" ]
  50.321 -            then
  50.322 -              check_file_sharing "$file" "$dev" "$mode"
  50.323 -            fi
  50.324 -          else
  50.325 -            # $dev is not in use, so we'll remember it for use later; we want
  50.326 -            # to finish the sharing check first.
  50.327 -
  50.328 -            if [ "$loopdev" = '' ]
  50.329 -            then
  50.330 -              loopdev="$dev"
  50.331 -            fi
  50.332 -          fi
  50.333 -        done
  50.334 -
  50.335 -        if [ "$loopdev" = '' ]
  50.336 -        then
  50.337 -          release_lock "block"
  50.338 -          fatal 'Failed to find an unused loop device'
  50.339 -        fi
  50.340 -
  50.341 -        if LANG=C losetup -h 2>&1 | grep read-only >/dev/null
  50.342 -        then
  50.343 -          roflag="-$mode"; roflag="${roflag#-w}"; roflag="${roflag#-!}"
  50.344 -        else
  50.345 -          roflag=''
  50.346 -        fi
  50.347 -        do_or_die losetup $roflag "$loopdev" "$file"
  50.348 -        xenstore_write "$XENBUS_PATH/node" "$loopdev"
  50.349 -        write_dev "$loopdev"
  50.350 -        release_lock "block"
  50.351 -        exit 0
  50.352 -	;;
  50.353 -
  50.354 -      "")
  50.355 -        claim_lock "block"
  50.356 -        success
  50.357 -        release_lock "block"
  50.358 -	;;
  50.359 -    esac
  50.360 -    ;;
  50.361 -
  50.362 -  remove)
  50.363 -    case $t in 
  50.364 -      phy)
  50.365 -	exit 0
  50.366 -	;;
  50.367 -
  50.368 -      file)
  50.369 -        node=$(xenstore_read "$XENBUS_PATH/node")
  50.370 -	losetup -d "$node"
  50.371 -	exit 0
  50.372 -	;;
  50.373 -
  50.374 -      "")
  50.375 -        exit 0
  50.376 -	;;
  50.377 -    esac
  50.378 -    ;;
  50.379 -
  50.380 -esac
  50.381 -
  50.382 -# If we've reached here, $t is neither phy nor file, so fire a helper script.
  50.383 -[ -x /etc/xen/scripts/block-"$t" ] && \
  50.384 -  /etc/xen/scripts/block-"$t" "$command" $node
    51.1 --- a/tools/examples/block-common.sh	Mon Nov 10 15:52:15 2008 -0800
    51.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    51.3 @@ -1,116 +0,0 @@
    51.4 -#
    51.5 -# Copyright (c) 2005 XenSource Ltd.
    51.6 -#
    51.7 -# This library is free software; you can redistribute it and/or
    51.8 -# modify it under the terms of version 2.1 of the GNU Lesser General Public
    51.9 -# License as published by the Free Software Foundation.
   51.10 -#
   51.11 -# This library is distributed in the hope that it will be useful,
   51.12 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
   51.13 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   51.14 -# Lesser General Public License for more details.
   51.15 -#
   51.16 -# You should have received a copy of the GNU Lesser General Public
   51.17 -# License along with this library; if not, write to the Free Software
   51.18 -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   51.19 -#
   51.20 -
   51.21 -
   51.22 -dir=$(dirname "$0")
   51.23 -. "$dir/xen-hotplug-common.sh"
   51.24 -
   51.25 -findCommand "$@"
   51.26 -
   51.27 -if [ "$command" != "add" ] &&
   51.28 -   [ "$command" != "remove" ]
   51.29 -then
   51.30 -  log err "Invalid command: $command"
   51.31 -  exit 1
   51.32 -fi
   51.33 -
   51.34 -
   51.35 -XENBUS_PATH="${XENBUS_PATH:?}"
   51.36 -
   51.37 -
   51.38 -ebusy()
   51.39 -{
   51.40 -  xenstore_write "$XENBUS_PATH/hotplug-error" "$*" \
   51.41 -                 "$XENBUS_PATH/hotplug-status" busy
   51.42 -  log err "$@"
   51.43 -  exit 1
   51.44 -}
   51.45 -
   51.46 -
   51.47 -##
   51.48 -# Print the given device's major and minor numbers, written in hex and
   51.49 -# separated by a colon.
   51.50 -device_major_minor()
   51.51 -{
   51.52 -  stat -L -c %t:%T "$1"
   51.53 -}
   51.54 -
   51.55 -
   51.56 -##
   51.57 -# Write physical-device = MM,mm to the store, where MM and mm are the major 
   51.58 -# and minor numbers of device respectively.
   51.59 -#
   51.60 -# @param device The device from which major and minor numbers are read, which
   51.61 -#               will be written into the store.
   51.62 -#
   51.63 -write_dev() {
   51.64 -  local mm
   51.65 -  
   51.66 -  mm=$(device_major_minor "$1")
   51.67 - 
   51.68 -  if [ -z $mm ]
   51.69 -  then
   51.70 -    fatal "Backend device does not exist"
   51.71 -  fi
   51.72 - 
   51.73 -  xenstore_write "$XENBUS_PATH/physical-device" "$mm"
   51.74 -
   51.75 -  success
   51.76 -}
   51.77 -
   51.78 -
   51.79 -##
   51.80 -# canonicalise_mode mode
   51.81 -#
   51.82 -# Takes the given mode, which may be r, w, ro, rw, w!, or rw!, or variations
   51.83 -# thereof, and canonicalises them to one of
   51.84 -#
   51.85 -#   'r': perform checks for a new read-only mount;
   51.86 -#   'w': perform checks for a read-write mount; or
   51.87 -#   '!': perform no checks at all.
   51.88 -#
   51.89 -canonicalise_mode()
   51.90 -{
   51.91 -  local mode="$1"
   51.92 -
   51.93 -  if ! expr index "$mode" 'w' >/dev/null
   51.94 -  then
   51.95 -    echo 'r'
   51.96 -  elif ! expr index "$mode" '!' >/dev/null
   51.97 -  then
   51.98 -    echo 'w'
   51.99 -  else
  51.100 -    echo '!'
  51.101 -  fi
  51.102 -}
  51.103 -
  51.104 -
  51.105 -same_vm()
  51.106 -{
  51.107 -  local otherdom="$1"
  51.108 -  # Note that othervm can be MISSING here, because Xend will be racing with
  51.109 -  # the hotplug scripts -- the entries in /local/domain can be removed by
  51.110 -  # Xend before the hotplug scripts have removed the entry in
  51.111 -  # /local/domain/0/backend/.  In this case, we want to pretend that the
  51.112 -  # VM is the same as FRONTEND_UUID, because that way the 'sharing' will be
  51.113 -  # allowed.
  51.114 -  local othervm=$(xenstore_read_default "/local/domain/$otherdom/vm"         \
  51.115 -                  "$FRONTEND_UUID")
  51.116 -
  51.117 -  [ "$FRONTEND_UUID" = "$othervm" ]
  51.118 -}
  51.119 -
    52.1 --- a/tools/examples/block-enbd	Mon Nov 10 15:52:15 2008 -0800
    52.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    52.3 @@ -1,27 +0,0 @@
    52.4 -#!/bin/bash
    52.5 -
    52.6 -# Usage: block-enbd [bind server ctl_port |unbind node]
    52.7 -#
    52.8 -# The node argument to unbind is the name of the device node we are to
    52.9 -# unbind.
   52.10 -#
   52.11 -# This assumes you're running a correctly configured server at the other end!
   52.12 -
   52.13 -dir=$(dirname "$0")
   52.14 -. "$dir/block-common.sh"
   52.15 -
   52.16 -case "$command" in
   52.17 -  add)
   52.18 -    for dev in /dev/nd*; do
   52.19 -      if nbd-client $2:$3 $dev; then
   52.20 -        write_dev $dev
   52.21 -        exit 0
   52.22 -      fi
   52.23 -    done
   52.24 -    exit 1
   52.25 -    ;;
   52.26 -  remove)
   52.27 -    nbd-client -d $2
   52.28 -    exit 0
   52.29 -    ;;
   52.30 -esac
    53.1 --- a/tools/examples/block-nbd	Mon Nov 10 15:52:15 2008 -0800
    53.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    53.3 @@ -1,27 +0,0 @@
    53.4 -#!/bin/bash
    53.5 -
    53.6 -# Usage: block-nbd [bind server ctl_port |unbind node]
    53.7 -#
    53.8 -# The node argument to unbind is the name of the device node we are to
    53.9 -# unbind.
   53.10 -#
   53.11 -# This assumes you're running a correctly configured server at the other end!
   53.12 -
   53.13 -dir=$(dirname "$0")
   53.14 -. "$dir/block-common.sh"
   53.15 -
   53.16 -case "$command" in
   53.17 -  add)
   53.18 -    for dev in /dev/nbd*; do
   53.19 -      if nbd-client $2 $3 $dev; then
   53.20 -        write_dev $dev
   53.21 -        exit 0
   53.22 -      fi
   53.23 -    done
   53.24 -    exit 1
   53.25 -    ;;
   53.26 -  remove)
   53.27 -    nbd-client -d $2
   53.28 -    exit 0
   53.29 -    ;;
   53.30 -esac
    54.1 --- a/tools/examples/external-device-migrate	Mon Nov 10 15:52:15 2008 -0800
    54.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    54.3 @@ -1,98 +0,0 @@
    54.4 -#!/bin/bash
    54.5 -
    54.6 -# Copyright (c) 2005 IBM Corporation
    54.7 -#
    54.8 -# This library is free software; you can redistribute it and/or
    54.9 -# modify it under the terms of version 2.1 of the GNU Lesser General Public
   54.10 -# License as published by the Free Software Foundation.
   54.11 -#
   54.12 -# This library is distributed in the hope that it will be useful,
   54.13 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
   54.14 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   54.15 -# Lesser General Public License for more details.
   54.16 -#
   54.17 -# You should have received a copy of the GNU Lesser General Public
   54.18 -# License along with this library; if not, write to the Free Software
   54.19 -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   54.20 -#
   54.21 -
   54.22 -set -x
   54.23 -
   54.24 -# This script is called by XenD for migration of external devices
   54.25 -# It does not handle the migration of those devices itself, but
   54.26 -# passes the requests on to further applications
   54.27 -# It handles the low-level command line parsing and some of the
   54.28 -# synchronization
   54.29 -
   54.30 -dir=$(dirname "$0")
   54.31 -. "$dir/logging.sh"
   54.32 -
   54.33 -
   54.34 -function ext_dev_migrate_usage() {
   54.35 -cat <<EOF
   54.36 -Pass the following command line parameters to the script:
   54.37 -
   54.38 --step <n>              : n-th migration step
   54.39 --host <host>           : the destination host
   54.40 --domname <domain name> : name of the domain that is migrating
   54.41 --type <device type>    : the type of device that is migrating
   54.42 --subtype <dev. subtype>: the subtype of the device
   54.43 --recover               : indicates recovery request; an error
   54.44 -                         occurred during migration
   54.45 --help                  : display this help screen
   54.46 -EOF
   54.47 -}
   54.48 -
   54.49 -# Parse the command line paramters. The following parameters must be
   54.50 -# passed as the first ones in the sequence:
   54.51 -#  -step       [required]
   54.52 -#  -host       [required]
   54.53 -#  -domname    [required]
   54.54 -#  -type       [required]
   54.55 -#  -subtype    [optional]
   54.56 -#  -recover    [optional]
   54.57 -# The remaining ones will be passed to the called function.
   54.58 -function evaluate_params()
   54.59 -{
   54.60 -	local step host domname typ recover filename func stype
   54.61 -	stype=""
   54.62 -	while [ $# -ge 1 ]; do
   54.63 -		case "$1" in
   54.64 -		-step)		step=$2; shift; shift;;
   54.65 -		-host)		host=$2; shift; shift;;
   54.66 -		-domname)	domname=$2; shift; shift;;
   54.67 -		-type)		typ=$2; shift; shift;;
   54.68 -		-subtype)	stype=$2; shift; shift;;
   54.69 -		-recover)	recover=1; shift;;
   54.70 -		-help)		ext_dev_migrate_usage; exit 0;;
   54.71 -		*)		break;;
   54.72 -		esac
   54.73 -	done
   54.74 -
   54.75 -	if [ "$step"    = "" -o \
   54.76 -	     "$host"    = "" -o \
   54.77 -	     "$typ"     = "" -o \
   54.78 -	     "$domname" = "" ]; then
   54.79 -	 	echo "Error: Parameter(s) missing (-step/-host/-type/-domname)" 1>&2
   54.80 -		echo "" 1>&2
   54.81 -		echo "$0 -help for usage." 1>&2
   54.82 -		exit 1
   54.83 -	fi
   54.84 -
   54.85 -	filename="$dir/$typ$stype-migration.sh"
   54.86 -	if [ ! -r $filename ]; then
   54.87 -		echo "Error: Could not find script '$filename'"
   54.88 -		return
   54.89 -	fi
   54.90 -	. "$filename"
   54.91 -
   54.92 -	if [ "$recover" = "1" ]; then
   54.93 -		func="$typ"_recover
   54.94 -		eval $func $host $domname $step $*
   54.95 -	else
   54.96 -		func="$typ"_migration_step
   54.97 -		eval $func $host $domname $step $*
   54.98 -	fi
   54.99 -}
  54.100 -
  54.101 -evaluate_params "$@"
    55.1 --- a/tools/examples/init.d/sysconfig.xendomains	Mon Nov 10 15:52:15 2008 -0800
    55.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    55.3 @@ -1,137 +0,0 @@
    55.4 -## Path: System/xen
    55.5 -## Description: xen domain start/stop on boot
    55.6 -## Type: string
    55.7 -## Default: 
    55.8 -#
    55.9 -# The xendomains script can send SysRq requests to domains on shutdown.
   55.10 -# If you don't want to MIGRATE, SAVE, or SHUTDOWN, this may be a possibility
   55.11 -# to do a quick and dirty shutdown ("s e i u o") or at least sync the disks
   55.12 -# of the domains ("s").
   55.13 -#
   55.14 -XENDOMAINS_SYSRQ=""
   55.15 -
   55.16 -## Type: integer 
   55.17 -## Default: 100000
   55.18 -#
   55.19 -# If XENDOMAINS_SYSRQ is set, this variable determines how long to wait
   55.20 -# (in microseconds) after each SysRq, so the domain has a chance to react.
   55.21 -# If you want to a quick'n'dirty shutdown via SysRq, you may want to set
   55.22 -# it to a relatively high value (1200000).
   55.23 -#
   55.24 -XENDOMAINS_USLEEP=100000
   55.25 -
   55.26 -## Type: integer
   55.27 -## Default: 5000000
   55.28 -#
   55.29 -# When creating a guest domain, it is sensible to allow a little time for it
   55.30 -# to get started before creating another domain or proceeding through the
   55.31 -# boot process.  Without this, the booting guests will thrash the disk as they
   55.32 -# start up.  This timeout (in microseconds) specifies the delay after guest
   55.33 -# domain creation.
   55.34 -#
   55.35 -XENDOMAINS_CREATE_USLEEP=5000000
   55.36 -
   55.37 -## Type: string
   55.38 -## Default: ""
   55.39 -#
   55.40 -# Set this to a non-empty string if you want to migrate virtual machines
   55.41 -# on shutdown. The string will be passed to the xm migrate DOMID command
   55.42 -# as is: It should contain the target IP address of the physical machine
   55.43 -# to migrate to and optionally parameters like --live. Leave empty if
   55.44 -# you don't want to try virtual machine relocation on shutdown.
   55.45 -# If migration succeeds, neither SAVE nor SHUTDOWN will be executed for
   55.46 -# that domain.
   55.47 -#
   55.48 -XENDOMAINS_MIGRATE=""
   55.49 -
   55.50 -## Type: string
   55.51 -## Default: /var/lib/xen/save
   55.52 -#
   55.53 -# Directory to save running domains to when the system (dom0) is
   55.54 -# shut down. Will also be used to restore domains from if # XENDOMAINS_RESTORE
   55.55 -# is set (see below). Leave empty to disable domain saving on shutdown 
   55.56 -# (e.g. because you rather shut domains down).
   55.57 -# If domain saving does succeed, SHUTDOWN will not be executed.
   55.58 -#
   55.59 -XENDOMAINS_SAVE=/var/lib/xen/save
   55.60 -
   55.61 -## Type: string
   55.62 -## Default: "--halt --wait"
   55.63 -#
   55.64 -# If neither MIGRATE nor SAVE were enabled or if they failed, you can
   55.65 -# try to shut down a domain by sending it a shutdown request. To do this,
   55.66 -# set this to "--halt --wait". Omit the "--wait" flag to avoid waiting
   55.67 -# for the domain to be really down. Leave empty to skip domain shutdown.
   55.68 -#
   55.69 -XENDOMAINS_SHUTDOWN="--halt --wait"
   55.70 -
   55.71 -## Type: string
   55.72 -## Default: "--all --halt --wait"
   55.73 -#
   55.74 -# After we have gone over all virtual machines (resp. all automatically
   55.75 -# started ones, see XENDOMAINS_AUTO_ONLY below) in a loop and sent SysRq,
   55.76 -# migrated, saved and/or shutdown according to the settings above, we
   55.77 -# might want to shutdown the virtual machines that are still running
   55.78 -# for some reason or another. To do this, set this variable to
   55.79 -# "--all --halt --wait", it will be passed to xm shutdown.
   55.80 -# Leave it empty not to do anything special here.
   55.81 -# (Note: This will hit all virtual machines, even if XENDOMAINS_AUTO_ONLY
   55.82 -# is set.)
   55.83 -# 
   55.84 -XENDOMAINS_SHUTDOWN_ALL="--all --halt --wait"
   55.85 -
   55.86 -## Type: boolean
   55.87 -## Default: true
   55.88 -#
   55.89 -# This variable determines whether saved domains from XENDOMAINS_SAVE
   55.90 -# will be restored on system startup. 
   55.91 -#
   55.92 -XENDOMAINS_RESTORE=true
   55.93 -
   55.94 -## Type: string
   55.95 -## Default: /etc/xen/auto
   55.96 -#
   55.97 -# This variable sets the directory where domains configurations
   55.98 -# are stored that should be started on system startup automatically.
   55.99 -# Leave empty if you don't want to start domains automatically
  55.100 -# (or just don't place any xen domain config files in that dir).
  55.101 -# Note that the script tries to be clever if both RESTORE and AUTO are 
  55.102 -# set: It will first restore saved domains and then only start domains
  55.103 -# in AUTO which are not running yet. 
  55.104 -# Note that the name matching is somewhat fuzzy.
  55.105 -#
  55.106 -XENDOMAINS_AUTO=/etc/xen/auto
  55.107 -
  55.108 -## Type: boolean
  55.109 -## Default: false
  55.110 -# 
  55.111 -# If this variable is set to "true", only the domains started via config 
  55.112 -# files in XENDOMAINS_AUTO will be treated according to XENDOMAINS_SYSRQ,
  55.113 -# XENDOMAINS_MIGRATE, XENDOMAINS_SAVE, XENDMAINS_SHUTDOWN; otherwise
  55.114 -# all running domains will be. 
  55.115 -# Note that the name matching is somewhat fuzzy.
  55.116 -# 
  55.117 -XENDOMAINS_AUTO_ONLY=false
  55.118 -
  55.119 -## Type: integer
  55.120 -## Default: 300
  55.121 -#
  55.122 -# On xendomains stop, a number of xm commands (xm migrate, save, shutdown,
  55.123 -# shutdown --all) may be executed. In the worst case, these commands may
  55.124 -# stall forever, which will prevent a successful shutdown of the machine.
  55.125 -# If this variable is non-zero, the script will set up a watchdog timer
  55.126 -# for every of these xm commands and time it out after the number of seconds
  55.127 -# specified by this variable.
  55.128 -# Note that SHUTDOWN_ALL will not be called if no virtual machines or only
  55.129 -# zombies are still running, so you don't need to enable this timeout just
  55.130 -# for the zombie case.
  55.131 -# The setting should be large enough to make sure that migrate/save/shutdown
  55.132 -# can succeed. If you do live migrations, keep in mind that live migration
  55.133 -# of a 1GB machine over Gigabit ethernet may actually take something like
  55.134 -# 100s (assuming that live migration uses 10% of the network # bandwidth).
  55.135 -# Depending on the virtual machine, a shutdown may also require a significant
  55.136 -# amount of time. So better setup this variable to a huge number and hope the
  55.137 -# watchdog never fires.
  55.138 -#
  55.139 -XENDOMAINS_STOP_MAXWAIT=300
  55.140 -
    56.1 --- a/tools/examples/init.d/xend	Mon Nov 10 15:52:15 2008 -0800
    56.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    56.3 @@ -1,66 +0,0 @@
    56.4 -#!/bin/bash
    56.5 -#
    56.6 -# xend		Script to start and stop the Xen control daemon.
    56.7 -#
    56.8 -# Author:       Keir Fraser <keir.fraser@cl.cam.ac.uk>
    56.9 -#
   56.10 -# chkconfig: 2345 98 01
   56.11 -# description: Starts and stops the Xen control daemon.
   56.12 -### BEGIN INIT INFO
   56.13 -# Provides:          xend
   56.14 -# Required-Start:    $syslog $remote_fs
   56.15 -# Should-Start:
   56.16 -# Required-Stop:     $syslog $remote_fs
   56.17 -# Should-Stop:
   56.18 -# Default-Start:     3 4 5
   56.19 -# Default-Stop:      0 1 2 6
   56.20 -# Default-Enabled:   yes
   56.21 -# Short-Description: Start/stop xend
   56.22 -# Description:       Starts and stops the Xen control daemon.
   56.23 -### END INIT INFO
   56.24 -
   56.25 -if ! grep -q "control_d" /proc/xen/capabilities ; then
   56.26 -	exit 0
   56.27 -fi
   56.28 -
   56.29 -# Wait for Xend to be up
   56.30 -function await_daemons_up
   56.31 -{
   56.32 -	i=1
   56.33 -	rets=10
   56.34 -	xend status
   56.35 -	while [ $? -ne 0 -a $i -lt $rets ]; do
   56.36 -	    sleep 1
   56.37 -	    echo -n .
   56.38 -	    i=$(($i + 1))
   56.39 -	    xend status
   56.40 -	done
   56.41 -}
   56.42 -
   56.43 -case "$1" in
   56.44 -  start)
   56.45 -	xend start
   56.46 -	await_daemons_up
   56.47 -	;;
   56.48 -  stop)
   56.49 -	xend stop
   56.50 -	;;
   56.51 -  status)
   56.52 -	xend status
   56.53 -	;;
   56.54 -  reload)
   56.55 -        xend reload
   56.56 -        ;;
   56.57 -  restart|force-reload)
   56.58 -	xend restart
   56.59 -	await_daemons_up
   56.60 -	;;
   56.61 -  *)
   56.62 -	# do not advertise unreasonable commands that there is no reason
   56.63 -	# to use with this device
   56.64 -	echo $"Usage: $0 {start|stop|status|restart|reload|force-reload}"
   56.65 -	exit 1
   56.66 -esac
   56.67 -
   56.68 -exit $?
   56.69 -
    57.1 --- a/tools/examples/init.d/xendomains	Mon Nov 10 15:52:15 2008 -0800
    57.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    57.3 @@ -1,531 +0,0 @@
    57.4 -#!/bin/bash
    57.5 -#
    57.6 -# /etc/init.d/xendomains
    57.7 -# Start / stop domains automatically when domain 0 boots / shuts down.
    57.8 -#
    57.9 -# chkconfig: 345 99 00
   57.10 -# description: Start / stop Xen domains.
   57.11 -#
   57.12 -# This script offers fairly basic functionality.  It should work on Redhat
   57.13 -# but also on LSB-compliant SuSE releases and on Debian with the LSB package
   57.14 -# installed.  (LSB is the Linux Standard Base)
   57.15 -#
   57.16 -# Based on the example in the "Designing High Quality Integrated Linux
   57.17 -# Applications HOWTO" by Avi Alkalay
   57.18 -# <http://www.tldp.org/HOWTO/HighQuality-Apps-HOWTO/>
   57.19 -#
   57.20 -### BEGIN INIT INFO
   57.21 -# Provides:          xendomains
   57.22 -# Required-Start:    $syslog $remote_fs xend
   57.23 -# Should-Start:
   57.24 -# Required-Stop:     $syslog $remote_fs xend
   57.25 -# Should-Stop:
   57.26 -# Default-Start:     3 4 5
   57.27 -# Default-Stop:      0 1 2 6
   57.28 -# Default-Enabled:   yes
   57.29 -# Short-Description: Start/stop secondary xen domains
   57.30 -# Description:       Start / stop domains automatically when domain 0 
   57.31 -#                    boots / shuts down.
   57.32 -### END INIT INFO
   57.33 -
   57.34 -# Correct exit code would probably be 5, but it's enough 
   57.35 -# if xend complains if we're not running as privileged domain
   57.36 -if ! [ -e /proc/xen/privcmd ]; then
   57.37 -	exit 0
   57.38 -fi
   57.39 -
   57.40 -LOCKFILE=/var/lock/subsys/xendomains
   57.41 -XENDOM_CONFIG=/etc/sysconfig/xendomains
   57.42 -
   57.43 -test -r $XENDOM_CONFIG || { echo "$XENDOM_CONFIG not existing";
   57.44 -	if [ "$1" = "stop" ]; then exit 0;
   57.45 -	else exit 6; fi; }
   57.46 -
   57.47 -. $XENDOM_CONFIG
   57.48 -
   57.49 -# Use the SUSE rc_ init script functions;
   57.50 -# emulate them on LSB, RH and other systems
   57.51 -if test -e /etc/rc.status; then
   57.52 -    # SUSE rc script library
   57.53 -    . /etc/rc.status
   57.54 -else    
   57.55 -    _cmd=$1
   57.56 -    declare -a _SMSG
   57.57 -    if test "${_cmd}" = "status"; then
   57.58 -	_SMSG=(running dead dead unused unknown)
   57.59 -	_RC_UNUSED=3
   57.60 -    else
   57.61 -	_SMSG=(done failed failed missed failed skipped unused failed failed)
   57.62 -	_RC_UNUSED=6
   57.63 -    fi
   57.64 -    if test -e /etc/init.d/functions; then
   57.65 -	# REDHAT
   57.66 -	. /etc/init.d/functions
   57.67 -	echo_rc()
   57.68 -	{
   57.69 -	    #echo -n "  [${_SMSG[${_RC_RV}]}] "
   57.70 -	    if test ${_RC_RV} = 0; then
   57.71 -		success "  [${_SMSG[${_RC_RV}]}] "
   57.72 -	    else
   57.73 -		failure "  [${_SMSG[${_RC_RV}]}] "
   57.74 -	    fi
   57.75 -	}
   57.76 -    elif test -e /lib/lsb/init-functions; then
   57.77 -	# LSB    
   57.78 -    	. /lib/lsb/init-functions
   57.79 -        if alias log_success_msg >/dev/null 2>/dev/null; then
   57.80 -	  echo_rc()
   57.81 -	  {
   57.82 -	       echo "  [${_SMSG[${_RC_RV}]}] "
   57.83 -	  }
   57.84 -        else
   57.85 -	  echo_rc()
   57.86 -	  {
   57.87 -	    if test ${_RC_RV} = 0; then
   57.88 -		log_success_msg "  [${_SMSG[${_RC_RV}]}] "
   57.89 -	    else
   57.90 -		log_failure_msg "  [${_SMSG[${_RC_RV}]}] "
   57.91 -	    fi
   57.92 -	  }
   57.93 -        fi
   57.94 -    else    
   57.95 -	# emulate it
   57.96 -	echo_rc()
   57.97 -	{
   57.98 -	    echo "  [${_SMSG[${_RC_RV}]}] "
   57.99 -	}
  57.100 -    fi
  57.101 -    rc_reset() { _RC_RV=0; }
  57.102 -    rc_failed()
  57.103 -    {
  57.104 -	if test -z "$1"; then 
  57.105 -	    _RC_RV=1;
  57.106 -	elif test "$1" != "0"; then 
  57.107 -	    _RC_RV=$1; 
  57.108 -    	fi
  57.109 -	return ${_RC_RV}
  57.110 -    }
  57.111 -    rc_check()
  57.112 -    {
  57.113 -	return rc_failed $?
  57.114 -    }	
  57.115 -    rc_status()
  57.116 -    {
  57.117 -	rc_failed $?
  57.118 -	if test "$1" = "-r"; then _RC_RV=0; shift; fi
  57.119 -	if test "$1" = "-s"; then rc_failed 5; echo_rc; rc_failed 3; shift; fi
  57.120 -	if test "$1" = "-u"; then rc_failed ${_RC_UNUSED}; echo_rc; rc_failed 3; shift; fi
  57.121 -	if test "$1" = "-v"; then echo_rc; shift; fi
  57.122 -	if test "$1" = "-r"; then _RC_RV=0; shift; fi
  57.123 -	return ${_RC_RV}
  57.124 -    }
  57.125 -    rc_exit() { exit ${_RC_RV}; }
  57.126 -    rc_active() 
  57.127 -    {
  57.128 -	if test -z "$RUNLEVEL"; then read RUNLEVEL REST < <(/sbin/runlevel); fi
  57.129 -	if test -e /etc/init.d/S[0-9][0-9]${1}; then return 0; fi
  57.130 -	return 1
  57.131 -    }
  57.132 -fi
  57.133 -
  57.134 -if ! which usleep >&/dev/null
  57.135 -then
  57.136 -  usleep()
  57.137 -  {
  57.138 -    if [ -n "$1" ]
  57.139 -    then
  57.140 -      sleep $(( $1 / 1000000 ))
  57.141 -    fi
  57.142 -  }
  57.143 -fi
  57.144 -
  57.145 -# Reset status of this service
  57.146 -rc_reset
  57.147 -
  57.148 -##
  57.149 -# Returns 0 (success) if the given parameter names a directory, and that
  57.150 -# directory is not empty.
  57.151 -#
  57.152 -contains_something()
  57.153 -{
  57.154 -  if [ -d "$1" ] && [ `/bin/ls $1 | wc -l` -gt 0 ]
  57.155 -  then
  57.156 -    return 0
  57.157 -  else
  57.158 -    return 1
  57.159 -  fi
  57.160 -}
  57.161 -
  57.162 -# read name from xen config file
  57.163 -rdname()
  57.164 -{
  57.165 -    NM=$(xm create --quiet --dryrun --defconfig "$1" |
  57.166 -         sed -n 's/^.*(name \(.*\))$/\1/p')
  57.167 -}
  57.168 -
  57.169 -rdnames()
  57.170 -{
  57.171 -    NAMES=
  57.172 -    if ! contains_something "$XENDOMAINS_AUTO"
  57.173 -    then 
  57.174 -	return
  57.175 -    fi
  57.176 -    for dom in $XENDOMAINS_AUTO/*; do
  57.177 -	rdname $dom
  57.178 -	if test -z $NAMES; then 
  57.179 -	    NAMES=$NM; 
  57.180 -	else
  57.181 -	    NAMES="$NAMES|$NM"
  57.182 -	fi
  57.183 -    done
  57.184 -}
  57.185 -
  57.186 -parseln()
  57.187 -{
  57.188 -    if [[ "$1" =~ "\(domain" ]]; then
  57.189 -        name=;id=
  57.190 -    else if [[ "$1" =~ "\(name" ]]; then
  57.191 -        name=$(echo $1 | sed -e 's/^.*(name \(.*\))$/\1/')
  57.192 -    else if [[ "$1" =~ "\(domid" ]]; then
  57.193 -        id=$(echo $1 | sed -e 's/^.*(domid \(.*\))$/\1/')
  57.194 -    fi; fi; fi
  57.195 -
  57.196 -    [ -n "$name" -a -n "$id" ] && return 0 || return 1
  57.197 -}
  57.198 -
  57.199 -is_running()
  57.200 -{
  57.201 -    rdname $1
  57.202 -    RC=1
  57.203 -    name=;id=
  57.204 -    while read LN; do
  57.205 -	parseln "$LN" || continue
  57.206 -	if test $id = 0; then continue; fi
  57.207 -	case $name in 
  57.208 -	    ($NM)
  57.209 -		RC=0
  57.210 -		;;
  57.211 -	esac
  57.212 -    done < <(xm list -l | grep '(\(domain\|domid\|name\)')
  57.213 -    return $RC
  57.214 -}
  57.215 -
  57.216 -start() 
  57.217 -{
  57.218 -    if [ -f $LOCKFILE ]; then 
  57.219 -	echo -n "xendomains already running (lockfile exists)"
  57.220 -	return; 
  57.221 -    fi
  57.222 -
  57.223 -    saved_domains=" "
  57.224 -    if [ "$XENDOMAINS_RESTORE" = "true" ] &&
  57.225 -       contains_something "$XENDOMAINS_SAVE"
  57.226 -    then
  57.227 -	mkdir -p $(dirname "$LOCKFILE")
  57.228 -	touch $LOCKFILE
  57.229 -	echo -n "Restoring Xen domains:"
  57.230 -	saved_domains=`ls $XENDOMAINS_SAVE`
  57.231 -        for dom in $XENDOMAINS_SAVE/*; do
  57.232 -            if [ -f $dom ] ; then
  57.233 -                HEADER=`head -c 16 $dom | head -n 1 2> /dev/null`
  57.234 -                if [ $HEADER = "LinuxGuestRecord" ]; then
  57.235 -                    echo -n " ${dom##*/}"
  57.236 -                    xm restore $dom
  57.237 -                    if [ $? -ne 0 ]; then
  57.238 -                        rc_failed $?
  57.239 -                        echo -n '!'
  57.240 -                    else
  57.241 -                        # mv $dom ${dom%/*}/.${dom##*/}
  57.242 -                        rm $dom
  57.243 -                    fi
  57.244 -                fi
  57.245 -            fi
  57.246 -        done
  57.247 -	echo .
  57.248 -    fi
  57.249 -
  57.250 -    if contains_something "$XENDOMAINS_AUTO"
  57.251 -    then
  57.252 -	touch $LOCKFILE
  57.253 -	echo -n "Starting auto Xen domains:"
  57.254 -	# We expect config scripts for auto starting domains to be in
  57.255 -	# XENDOMAINS_AUTO - they could just be symlinks to files elsewhere
  57.256 -
  57.257 -	# Create all domains with config files in XENDOMAINS_AUTO.
  57.258 -	# TODO: We should record which domain name belongs 
  57.259 -	# so we have the option to selectively shut down / migrate later
  57.260 -	# If a domain statefile from $XENDOMAINS_SAVE matches a domain name
  57.261 -	# in $XENDOMAINS_AUTO, do not try to start that domain; if it didn't 
  57.262 -	# restore correctly it requires administrative attention.
  57.263 -	for dom in $XENDOMAINS_AUTO/*; do
  57.264 -	    echo -n " ${dom##*/}"
  57.265 -	    shortdom=$(echo $dom | sed -n 's/^.*\/\(.*\)$/\1/p')
  57.266 -	    echo $saved_domains | grep -w $shortdom > /dev/null
  57.267 -	    if [ $? -eq 0 ] || is_running $dom; then
  57.268 -		echo -n "(skip)"
  57.269 -	    else
  57.270 -		xm create --quiet --defconfig $dom
  57.271 -		if [ $? -ne 0 ]; then
  57.272 -		    rc_failed $?
  57.273 -		    echo -n '!'
  57.274 -		else
  57.275 -		    usleep $XENDOMAINS_CREATE_USLEEP
  57.276 -		fi
  57.277 -	    fi
  57.278 -	done
  57.279 -    fi	
  57.280 -}
  57.281 -
  57.282 -all_zombies()
  57.283 -{
  57.284 -    name=;id=
  57.285 -    while read LN; do
  57.286 -	parseln "$LN" || continue
  57.287 -	if test $id = 0; then continue; fi
  57.288 -	if test "$state" != "-b---d" -a "$state" != "-----d"; then
  57.289 -	    return 1;
  57.290 -	fi
  57.291 -    done < <(xm list -l | grep '(\(domain\|domid\|name\)')
  57.292 -    return 0
  57.293 -}
  57.294 -
  57.295 -# Wait for max $XENDOMAINS_STOP_MAXWAIT for xm $1 to finish;
  57.296 -# if it has not exited by that time kill it, so the init script will
  57.297 -# succeed within a finite amount of time; if $2 is nonnull, it will
  57.298 -# kill the command as well as soon as no domain (except for zombies)
  57.299 -# are left (used for shutdown --all).
  57.300 -watchdog_xm()
  57.301 -{
  57.302 -    if test -z "$XENDOMAINS_STOP_MAXWAIT" -o "$XENDOMAINS_STOP_MAXWAIT" = "0"; then
  57.303 -	exit
  57.304 -    fi
  57.305 -    usleep 20000
  57.306 -    for no in `seq 0 $XENDOMAINS_STOP_MAXWAIT`; do
  57.307 -	# exit if xm save/migrate/shutdown is finished
  57.308 -	PSAX=`ps axlw | grep "xm $1" | grep -v grep`
  57.309 -	if test -z "$PSAX"; then exit; fi
  57.310 -	echo -n "."; sleep 1
  57.311 -	# go to kill immediately if there's only zombies left
  57.312 -	if all_zombies && test -n "$2"; then break; fi
  57.313 -    done
  57.314 -    sleep 1
  57.315 -    read PSF PSUID PSPID PSPPID < <(echo "$PSAX")
  57.316 -    # kill xm $1
  57.317 -    kill $PSPID >/dev/null 2>&1
  57.318 -}
  57.319 -
  57.320 -stop()
  57.321 -{
  57.322 -    # Collect list of domains to shut down
  57.323 -    if test "$XENDOMAINS_AUTO_ONLY" = "true"; then
  57.324 -	rdnames
  57.325 -    fi
  57.326 -    echo -n "Shutting down Xen domains:"
  57.327 -    name=;id=
  57.328 -    while read LN; do
  57.329 -	parseln "$LN" || continue
  57.330 -	if test $id = 0; then continue; fi
  57.331 -	echo -n " $name"
  57.332 -	if test "$XENDOMAINS_AUTO_ONLY" = "true"; then
  57.333 -	    eval "
  57.334 -	    case \"\$name\" in
  57.335 -		($NAMES)
  57.336 -		    # nothing
  57.337 -		    ;;
  57.338 -		(*)
  57.339 -		    echo -n '(skip)'
  57.340 -		    continue
  57.341 -		    ;;
  57.342 -	    esac
  57.343 -	    "
  57.344 -	fi
  57.345 -	# XENDOMAINS_SYSRQ chould be something like just "s" 
  57.346 -	# or "s e i u" or even "s e s i u o"
  57.347 -	# for the latter, you should set XENDOMAINS_USLEEP to 1200000 or so
  57.348 -	if test -n "$XENDOMAINS_SYSRQ"; then
  57.349 -	    for sysrq in $XENDOMAINS_SYSRQ; do
  57.350 -		echo -n "(SR-$sysrq)"
  57.351 -		xm sysrq $id $sysrq
  57.352 -		if test $? -ne 0; then
  57.353 -		    rc_failed $?
  57.354 -		    echo -n '!'
  57.355 -		fi
  57.356 -		# usleep just ignores empty arg
  57.357 -		usleep $XENDOMAINS_USLEEP
  57.358 -	    done
  57.359 -	fi
  57.360 -	if test "$state" = "-b---d" -o "$state" = "-----d"; then
  57.361 -	    echo -n "(zomb)"
  57.362 -	    continue
  57.363 -	fi
  57.364 -	if test -n "$XENDOMAINS_MIGRATE"; then
  57.365 -	    echo -n "(migr)"
  57.366 -	    watchdog_xm migrate &
  57.367 -	    WDOG_PID=$!
  57.368 -	    xm migrate $id $XENDOMAINS_MIGRATE
  57.369 -	    if test $? -ne 0; then
  57.370 -		rc_failed $?
  57.371 -		echo -n '!'
  57.372 -		kill $WDOG_PID >/dev/null 2>&1
  57.373 -	    else
  57.374 -		kill $WDOG_PID >/dev/null 2>&1
  57.375 -		continue
  57.376 -	    fi
  57.377 -	fi
  57.378 -	if test -n "$XENDOMAINS_SAVE"; then
  57.379 -	    echo -n "(save)"
  57.380 -	    watchdog_xm save &
  57.381 -	    WDOG_PID=$!
  57.382 -	    mkdir -p "$XENDOMAINS_SAVE"
  57.383 -	    xm save $id $XENDOMAINS_SAVE/$name
  57.384 -	    if test $? -ne 0; then
  57.385 -		rc_failed $?
  57.386 -		echo -n '!'
  57.387 -		kill $WDOG_PID >/dev/null 2>&1
  57.388 -	    else
  57.389 -		kill $WDOG_PID >/dev/null 2>&1
  57.390 -		continue
  57.391 -	    fi
  57.392 -	fi
  57.393 -	if test -n "$XENDOMAINS_SHUTDOWN"; then
  57.394 -	    # XENDOMAINS_SHUTDOWN should be "--halt --wait"
  57.395 -	    echo -n "(shut)"
  57.396 -	    watchdog_xm shutdown &
  57.397 -	    WDOG_PID=$!
  57.398 -	    xm shutdown $id $XENDOMAINS_SHUTDOWN
  57.399 -	    if test $? -ne 0; then
  57.400 -		rc_failed $?
  57.401 -		echo -n '!'
  57.402 -	    fi
  57.403 -	    kill $WDOG_PID >/dev/null 2>&1
  57.404 -	fi
  57.405 -    done < <(xm list -l | grep '(\(domain\|domid\|name\)')
  57.406 -
  57.407 -    # NB. this shuts down ALL Xen domains (politely), not just the ones in
  57.408 -    # AUTODIR/*
  57.409 -    # This is because it's easier to do ;-) but arguably if this script is run
  57.410 -    # on system shutdown then it's also the right thing to do.
  57.411 -    if ! all_zombies && test -n "$XENDOMAINS_SHUTDOWN_ALL"; then
  57.412 -	# XENDOMAINS_SHUTDOWN_ALL should be "--all --halt --wait"
  57.413 -	echo -n " SHUTDOWN_ALL "
  57.414 -	watchdog_xm shutdown 1 &
  57.415 -	WDOG_PID=$!
  57.416 -	xm shutdown $XENDOMAINS_SHUTDOWN_ALL
  57.417 -	if test $? -ne 0; then
  57.418 -	    rc_failed $?
  57.419 -	    echo -n '!'
  57.420 -	fi
  57.421 -	kill $WDOG_PID >/dev/null 2>&1
  57.422 -    fi
  57.423 -
  57.424 -    # Unconditionally delete lock file
  57.425 -    rm -f $LOCKFILE
  57.426 -}
  57.427 -
  57.428 -check_domain_up()
  57.429 -{
  57.430 -    name=;id=
  57.431 -    while read LN; do
  57.432 -	parseln "$LN" || continue
  57.433 -	if test $id = 0; then continue; fi
  57.434 -	case $name in 
  57.435 -	    ($1)
  57.436 -		return 0
  57.437 -		;;
  57.438 -	esac
  57.439 -    done < <(xm list -l | grep '(\(domain\|domid\|name\)')
  57.440 -    return 1
  57.441 -}
  57.442 -
  57.443 -check_all_auto_domains_up()
  57.444 -{
  57.445 -    if ! contains_something "$XENDOMAINS_AUTO"
  57.446 -    then
  57.447 -      return 0
  57.448 -    fi
  57.449 -    missing=
  57.450 -    for nm in $XENDOMAINS_AUTO/*; do
  57.451 -	rdname $nm
  57.452 -	found=0
  57.453 -	if check_domain_up "$NM"; then 
  57.454 -	    echo -n " $name"
  57.455 -	else 
  57.456 -	    missing="$missing $NM"
  57.457 -	fi
  57.458 -    done
  57.459 -    if test -n "$missing"; then
  57.460 -	echo -n " MISS AUTO:$missing"
  57.461 -	return 1
  57.462 -    fi
  57.463 -    return 0
  57.464 -}
  57.465 -
  57.466 -check_all_saved_domains_up()
  57.467 -{
  57.468 -    if ! contains_something "$XENDOMAINS_SAVE" 
  57.469 -    then
  57.470 -      return 0
  57.471 -    fi
  57.472 -    missing=`/bin/ls $XENDOMAINS_SAVE`
  57.473 -    echo -n " MISS SAVED: " $missing
  57.474 -    return 1
  57.475 -}
  57.476 -
  57.477 -# This does NOT necessarily restart all running domains: instead it
  57.478 -# stops all running domains and then boots all the domains specified in
  57.479 -# AUTODIR.  If other domains have been started manually then they will
  57.480 -# not get restarted.
  57.481 -# Commented out to avoid confusion!
  57.482 -
  57.483 -restart()
  57.484 -{
  57.485 -    stop
  57.486 -    start
  57.487 -}
  57.488 -
  57.489 -reload()
  57.490 -{
  57.491 -    restart
  57.492 -}
  57.493 -
  57.494 -
  57.495 -case "$1" in
  57.496 -    start)
  57.497 -	start
  57.498 -	rc_status
  57.499 -	if test -f $LOCKFILE; then rc_status -v; fi
  57.500 -	;;
  57.501 -
  57.502 -    stop)
  57.503 -	stop
  57.504 -	rc_status -v
  57.505 -	;;
  57.506 -
  57.507 -    restart)
  57.508 -	restart
  57.509 -	;;
  57.510 -    reload)
  57.511 -	reload
  57.512 -	;;
  57.513 -
  57.514 -    status)
  57.515 -	echo -n "Checking for xendomains:" 
  57.516 -	if test ! -f $LOCKFILE; then 
  57.517 -	    rc_failed 3
  57.518 -	else
  57.519 -	    check_all_auto_domains_up
  57.520 -	    rc_status
  57.521 -	    check_all_saved_domains_up
  57.522 -	    rc_status
  57.523 -	fi
  57.524 -	rc_status -v
  57.525 -	;;
  57.526 -
  57.527 -    *)
  57.528 -	echo "Usage: $0 {start|stop|restart|reload|status}"
  57.529 -	rc_failed 3
  57.530 -	rc_status -v
  57.531 -	;;
  57.532 -esac
  57.533 -
  57.534 -rc_exit
    58.1 --- a/tools/examples/locking.sh	Mon Nov 10 15:52:15 2008 -0800
    58.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    58.3 @@ -1,98 +0,0 @@
    58.4 -#
    58.5 -# Copyright (c) 2005 XenSource Ltd.
    58.6 -#
    58.7 -# This library is free software; you can redistribute it and/or
    58.8 -# modify it under the terms of version 2.1 of the GNU Lesser General Public
    58.9 -# License as published by the Free Software Foundation.
   58.10 -#
   58.11 -# This library is distributed in the hope that it will be useful,
   58.12 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
   58.13 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   58.14 -# Lesser General Public License for more details.
   58.15 -#
   58.16 -# You should have received a copy of the GNU Lesser General Public
   58.17 -# License along with this library; if not, write to the Free Software
   58.18 -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   58.19 -#
   58.20 -
   58.21 -#
   58.22 -# Serialisation
   58.23 -#
   58.24 -
   58.25 -LOCK_SLEEPTIME=1
   58.26 -LOCK_SPINNING_RETRIES=5
   58.27 -LOCK_RETRIES=100
   58.28 -LOCK_BASEDIR=/var/run/xen-hotplug
   58.29 -
   58.30 -
   58.31 -claim_lock()
   58.32 -{
   58.33 -  local lockdir="$LOCK_BASEDIR/$1"
   58.34 -  mkdir -p "$LOCK_BASEDIR"
   58.35 -  _claim_lock "$lockdir"
   58.36 -}
   58.37 -
   58.38 -
   58.39 -release_lock()
   58.40 -{
   58.41 -  _release_lock "$LOCK_BASEDIR/$1"
   58.42 -}
   58.43 -
   58.44 -
   58.45 -_claim_lock()
   58.46 -{
   58.47 -  local lockdir="$1"
   58.48 -  local owner=$(_lock_owner "$lockdir")
   58.49 -  local retries=0
   58.50 -
   58.51 -  while [ $retries -lt $LOCK_RETRIES ]
   58.52 -  do
   58.53 -    mkdir "$lockdir" 2>/dev/null && trap "release_lock $1; sigerr" ERR &&
   58.54 -      _update_lock_info "$lockdir" && return
   58.55 -
   58.56 -    local new_owner=$(_lock_owner "$lockdir")
   58.57 -    if [ "$new_owner" != "$owner" ]
   58.58 -    then
   58.59 -      owner="$new_owner"
   58.60 -      retries=0
   58.61 -    fi
   58.62 -
   58.63 -    if [ $retries -gt $LOCK_SPINNING_RETRIES ]
   58.64 -    then
   58.65 -      sleep $LOCK_SLEEPTIME
   58.66 -    else
   58.67 -      sleep 0
   58.68 -    fi
   58.69 -    retries=$(($retries + 1))
   58.70 -  done
   58.71 -  _steal_lock "$lockdir"
   58.72 -}
   58.73 -
   58.74 -
   58.75 -_release_lock()
   58.76 -{
   58.77 -  trap sigerr ERR
   58.78 -  rm -rf "$1" 2>/dev/null || true
   58.79 -}
   58.80 -
   58.81 -
   58.82 -_steal_lock()
   58.83 -{
   58.84 -  local lockdir="$1"
   58.85 -  local owner=$(cat "$lockdir/owner" 2>/dev/null || echo "unknown")
   58.86 -  log err "Forced to steal lock on $lockdir from $owner!"
   58.87 -  _release_lock "$lockdir"
   58.88 -  _claim_lock "$lockdir"
   58.89 -}
   58.90 -
   58.91 -
   58.92 -_lock_owner()
   58.93 -{
   58.94 -  cat "$1/owner" 2>/dev/null || echo "unknown"
   58.95 -}
   58.96 -
   58.97 -
   58.98 -_update_lock_info()
   58.99 -{
  58.100 -  echo "$$: $0" >"$1/owner"
  58.101 -}
    59.1 --- a/tools/examples/logging.sh	Mon Nov 10 15:52:15 2008 -0800
    59.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    59.3 @@ -1,22 +0,0 @@
    59.4 -#
    59.5 -# Copyright (c) 2005 XenSource Ltd.
    59.6 -#
    59.7 -# This library is free software; you can redistribute it and/or
    59.8 -# modify it under the terms of version 2.1 of the GNU Lesser General Public
    59.9 -# License as published by the Free Software Foundation.
   59.10 -#
   59.11 -# This library is distributed in the hope that it will be useful,
   59.12 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
   59.13 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   59.14 -# Lesser General Public License for more details.
   59.15 -#
   59.16 -# You should have received a copy of the GNU Lesser General Public
   59.17 -# License along with this library; if not, write to the Free Software
   59.18 -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   59.19 -#
   59.20 -
   59.21 -log() {
   59.22 -  local level="$1"
   59.23 -  shift
   59.24 -  logger -p "daemon.$level" -- "$0:" "$@" || echo "$0 $@" >&2
   59.25 -}
    60.1 --- a/tools/examples/network-bridge	Mon Nov 10 15:52:15 2008 -0800
    60.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    60.3 @@ -1,310 +0,0 @@
    60.4 -#!/bin/bash
    60.5 -#============================================================================
    60.6 -# Default Xen network start/stop script.
    60.7 -# Xend calls a network script when it starts.
    60.8 -# The script name to use is defined in /etc/xen/xend-config.sxp
    60.9 -# in the network-script field.
   60.10 -#
   60.11 -# This script creates a bridge (default ${netdev}), adds a device
   60.12 -# (defaults to the device on the default gateway route) to it, copies
   60.13 -# the IP addresses from the device to the bridge and adjusts the routes
   60.14 -# accordingly.
   60.15 -#
   60.16 -# If all goes well, this should ensure that networking stays up.
   60.17 -# However, some configurations are upset by this, especially
   60.18 -# NFS roots. If the bridged setup does not meet your needs,
   60.19 -# configure a different script, for example using routing instead.
   60.20 -#
   60.21 -# Usage:
   60.22 -#
   60.23 -# network-bridge (start|stop|status) {VAR=VAL}*
   60.24 -#
   60.25 -# Vars:
   60.26 -#
   60.27 -# bridge     The bridge to use (default ${netdev}).
   60.28 -# netdev     The interface to add to the bridge (default gateway device).
   60.29 -# antispoof  Whether to use iptables to prevent spoofing (default no).
   60.30 -#
   60.31 -# Internal Vars:
   60.32 -# pdev="p${netdev}"
   60.33 -# tdev=tmpbridge
   60.34 -#
   60.35 -# start:
   60.36 -# Creates the bridge as tdev
   60.37 -# Copies the IP and MAC addresses from pdev to bridge
   60.38 -# Renames netdev to be pdev 
   60.39 -# Renames tdev to bridge
   60.40 -# Enslaves pdev to bridge
   60.41 -#
   60.42 -# stop:
   60.43 -# Removes pdev from the bridge
   60.44 -# Transfers addresses, routes from bridge to pdev
   60.45 -# Renames bridge to tdev
   60.46 -# Renames pdev to netdev 
   60.47 -# Deletes tdev
   60.48 -#
   60.49 -# status:
   60.50 -# Print addresses, interfaces, routes
   60.51 -#
   60.52 -#============================================================================
   60.53 -
   60.54 -
   60.55 -dir=$(dirname "$0")
   60.56 -. "$dir/xen-script-common.sh"
   60.57 -. "$dir/xen-network-common.sh"
   60.58 -
   60.59 -findCommand "$@"
   60.60 -evalVariables "$@"
   60.61 -
   60.62 -is_network_root () {
   60.63 -    local rootfs=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $3; }}' /etc/mtab)
   60.64 -    local rootopts=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $4; }}' /etc/mtab)
   60.65 -
   60.66 -    [[ "$rootfs" =~ "^nfs" ]] || [[ "$rootopts" =~ "_netdev" ]] && has_nfsroot=1 || has_nfsroot=0
   60.67 -    if [ $has_nfsroot -eq 1 ]; then
   60.68 -        local bparms=$(cat /proc/cmdline)
   60.69 -        for p in $bparms; do
   60.70 -            local ipaddr=$(echo $p | awk /nfsroot=/'{ print substr($1,9,index($1,":")-9) }')
   60.71 -            if [ "$ipaddr" != "" ]; then
   60.72 -                local nfsdev=$(ip route get $ipaddr | awk /$ipaddr/'{ print $3 }')
   60.73 -                [[ "$nfsdev" == "$netdev" ]] && return 0 || return 1
   60.74 -            fi
   60.75 -        done
   60.76 -    fi
   60.77 -    return 1
   60.78 -}
   60.79 -
   60.80 -find_alt_device () {
   60.81 -    local interf=$1
   60.82 -    local prefix=${interf%[[:digit:]]}
   60.83 -    local ifs=$(ip link show | grep " $prefix" |\
   60.84 -                gawk '{ printf ("%s",substr($2,1,length($2)-1)) }' |\
   60.85 -                sed s/$interf//)
   60.86 -    echo "$ifs"
   60.87 -}
   60.88 -
   60.89 -netdev=${netdev:-$(ip route list 0.0.0.0/0  | \
   60.90 -                   sed 's/.*dev \([a-z]\+[0-9]\+\).*$/\1/')}
   60.91 -if is_network_root ; then
   60.92 -    altdevs=$(find_alt_device $netdev)
   60.93 -    for netdev in $altdevs; do break; done
   60.94 -    if [ -z "$netdev" ]; then
   60.95 -        [ -x /usr/bin/logger ] && /usr/bin/logger "network-bridge: bridging not supported on network root; not starting"
   60.96 -        exit
   60.97 -    fi
   60.98 -fi
   60.99 -netdev=${netdev:-eth0}
  60.100 -bridge=${bridge:-${netdev}}
  60.101 -antispoof=${antispoof:-no}
  60.102 -
  60.103 -pdev="p${netdev}"
  60.104 -tdev=tmpbridge
  60.105 -
  60.106 -get_ip_info() {
  60.107 -    addr_pfx=`ip addr show dev $1 | egrep '^ *inet' | sed -e 's/ *inet //' -e 's/ .*//'`
  60.108 -    gateway=`ip route show dev $1 | fgrep default | sed 's/default via //'`
  60.109 -}
  60.110 -    
  60.111 -do_ifup() {
  60.112 -    if ! ifup $1 ; then
  60.113 -        if [ -n "$addr_pfx" ] ; then
  60.114 -            # use the info from get_ip_info()
  60.115 -            ip addr flush $1
  60.116 -            ip addr add ${addr_pfx} dev $1
  60.117 -            ip link set dev $1 up
  60.118 -            [ -n "$gateway" ] && ip route add default via ${gateway}
  60.119 -        fi
  60.120 -    fi
  60.121 -}
  60.122 -
  60.123 -# Usage: transfer_addrs src dst
  60.124 -# Copy all IP addresses (including aliases) from device $src to device $dst.
  60.125 -transfer_addrs () {
  60.126 -    local src=$1
  60.127 -    local dst=$2
  60.128 -    # Don't bother if $dst already has IP addresses.
  60.129 -    if ip addr show dev ${dst} | egrep -q '^ *inet ' ; then
  60.130 -        return
  60.131 -    fi
  60.132 -    # Address lines start with 'inet' and have the device in them.
  60.133 -    # Replace 'inet' with 'ip addr add' and change the device name $src
  60.134 -    # to 'dev $src'.
  60.135 -    ip addr show dev ${src} | egrep '^ *inet ' | sed -e "
  60.136 -s/inet/ip addr add/
  60.137 -s@\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+/[0-9]\+\)@\1@
  60.138 -s/${src}/dev ${dst} label ${dst}/
  60.139 -s/secondary//
  60.140 -" | sh -e
  60.141 -    # Remove automatic routes on destination device
  60.142 -    ip route list | sed -ne "
  60.143 -/dev ${dst}\( \|$\)/ {
  60.144 -  s/^/ip route del /
  60.145 -  p
  60.146 -}" | sh -e
  60.147 -}
  60.148 -
  60.149 -# Usage: transfer_routes src dst
  60.150 -# Get all IP routes to device $src, delete them, and
  60.151 -# add the same routes to device $dst.
  60.152 -# The original routes have to be deleted, otherwise adding them
  60.153 -# for $dst fails (duplicate routes).
  60.154 -transfer_routes () {
  60.155 -    local src=$1
  60.156 -    local dst=$2
  60.157 -    # List all routes and grep the ones with $src in.
  60.158 -    # Stick 'ip route del' on the front to delete.
  60.159 -    # Change $src to $dst and use 'ip route add' to add.
  60.160 -    ip route list | sed -ne "
  60.161 -/dev ${src}\( \|$\)/ {
  60.162 -  h
  60.163 -  s/^/ip route del /
  60.164 -  P
  60.165 -  g
  60.166 -  s/${src}/${dst}/
  60.167 -  s/^/ip route add /
  60.168 -  P
  60.169 -  d
  60.170 -}" | sh -e
  60.171 -}
  60.172 -
  60.173 -
  60.174 -##
  60.175 -# link_exists interface
  60.176 -#
  60.177 -# Returns 0 if the interface named exists (whether up or down), 1 otherwise.
  60.178 -#
  60.179 -link_exists()
  60.180 -{
  60.181 -    if ip link show "$1" >/dev/null 2>/dev/null
  60.182 -    then
  60.183 -        return 0
  60.184 -    else
  60.185 -        return 1
  60.186 -    fi
  60.187 -}
  60.188 -
  60.189 -# Set the default forwarding policy for $dev to drop.
  60.190 -# Allow forwarding to the bridge.
  60.191 -antispoofing () {
  60.192 -    iptables -P FORWARD DROP
  60.193 -    iptables -F FORWARD
  60.194 -    iptables -A FORWARD -m physdev --physdev-in ${pdev} -j ACCEPT
  60.195 -}
  60.196 -
  60.197 -# Usage: show_status dev bridge
  60.198 -# Print ifconfig and routes.
  60.199 -show_status () {
  60.200 -    local dev=$1
  60.201 -    local bridge=$2
  60.202 -    
  60.203 -    echo '============================================================'
  60.204 -    ip addr show ${dev}
  60.205 -    ip addr show ${bridge}
  60.206 -    echo ' '
  60.207 -    brctl show ${bridge}
  60.208 -    echo ' '
  60.209 -    ip route list
  60.210 -    echo ' '
  60.211 -    route -n
  60.212 -    echo '============================================================'
  60.213 -}
  60.214 -
  60.215 -op_start () {
  60.216 -    if [ "${bridge}" = "null" ] ; then
  60.217 -	return
  60.218 -    fi
  60.219 -
  60.220 -    if link_exists "$pdev"; then
  60.221 -        # The device is already up.
  60.222 -        return
  60.223 -    fi
  60.224 -
  60.225 -    create_bridge ${tdev}
  60.226 -
  60.227 -    preiftransfer ${netdev}
  60.228 -    transfer_addrs ${netdev} ${tdev}
  60.229 -    if ! ifdown ${netdev}; then
  60.230 -	# If ifdown fails, remember the IP details.
  60.231 -	get_ip_info ${netdev}
  60.232 -	ip link set ${netdev} down
  60.233 -	ip addr flush ${netdev}
  60.234 -    fi
  60.235 -    ip link set ${netdev} name ${pdev}
  60.236 -    ip link set ${tdev} name ${bridge}
  60.237 -
  60.238 -    setup_bridge_port ${pdev}
  60.239 -
  60.240 -    add_to_bridge2 ${bridge} ${pdev}
  60.241 -    do_ifup ${bridge}
  60.242 -
  60.243 -    if [ ${antispoof} = 'yes' ] ; then
  60.244 -	antispoofing
  60.245 -    fi
  60.246 -}
  60.247 -
  60.248 -op_stop () {
  60.249 -    if [ "${bridge}" = "null" ]; then
  60.250 -	return
  60.251 -    fi
  60.252 -    if ! link_exists "$bridge"; then
  60.253 -	return
  60.254 -    fi
  60.255 -
  60.256 -    transfer_addrs ${bridge} ${pdev}
  60.257 -    if ! ifdown ${bridge}; then
  60.258 -	get_ip_info ${bridge}
  60.259 -    fi
  60.260 -    ip link set ${pdev} down
  60.261 -    ip addr flush ${bridge}
  60.262 -
  60.263 -    brctl delif ${bridge} ${pdev}
  60.264 -    ip link set ${bridge} down
  60.265 -
  60.266 -    ip link set ${bridge} name ${tdev}
  60.267 -    ip link set ${pdev} name ${netdev}
  60.268 -    do_ifup ${netdev}
  60.269 -
  60.270 -    brctl delbr ${tdev}
  60.271 -}
  60.272 -
  60.273 -# adds $dev to $bridge but waits for $dev to be in running state first
  60.274 -add_to_bridge2() {
  60.275 -    local bridge=$1
  60.276 -    local dev=$2
  60.277 -    local maxtries=10
  60.278 -
  60.279 -    echo -n "Waiting for ${dev} to negotiate link."
  60.280 -    ip link set ${dev} up
  60.281 -    for i in `seq ${maxtries}` ; do
  60.282 -	if ifconfig ${dev} | grep -q RUNNING ; then
  60.283 -	    break
  60.284 -	else
  60.285 -	    echo -n '.'
  60.286 -	    sleep 1
  60.287 -	fi
  60.288 -    done
  60.289 -
  60.290 -    if [ ${i} -eq ${maxtries} ] ; then echo -n '(link isnt in running state)' ; fi
  60.291 -    echo
  60.292 -
  60.293 -    add_to_bridge ${bridge} ${dev}
  60.294 -}
  60.295 -
  60.296 -case "$command" in
  60.297 -    start)
  60.298 -	op_start
  60.299 -	;;
  60.300 -    
  60.301 -    stop)
  60.302 -	op_stop
  60.303 -	;;
  60.304 -
  60.305 -    status)
  60.306 -	show_status ${netdev} ${bridge}
  60.307 -	;;
  60.308 -
  60.309 -    *)
  60.310 -	echo "Unknown command: $command" >&2
  60.311 -	echo 'Valid commands are: start, stop, status' >&2
  60.312 -	exit 1
  60.313 -esac
    61.1 --- a/tools/examples/network-nat	Mon Nov 10 15:52:15 2008 -0800
    61.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    61.3 @@ -1,119 +0,0 @@
    61.4 -#!/bin/bash -x
    61.5 -#============================================================================
    61.6 -# Default Xen network start/stop script when using NAT.
    61.7 -# Xend calls a network script when it starts.
    61.8 -# The script name to use is defined in /etc/xen/xend-config.sxp
    61.9 -# in the network-script field.
   61.10 -#
   61.11 -# Usage:
   61.12 -#
   61.13 -# network-nat (start|stop|status) {VAR=VAL}*
   61.14 -#
   61.15 -# Vars:
   61.16 -#
   61.17 -# netdev     The gateway interface (default eth0).
   61.18 -# antispoof  Whether to use iptables to prevent spoofing (default no).
   61.19 -# dhcp       Whether to alter the local DHCP configuration (default no).
   61.20 -#
   61.21 -#============================================================================
   61.22 -
   61.23 -dir=$(dirname "$0")
   61.24 -. "$dir/xen-script-common.sh"
   61.25 -. "$dir/xen-network-common.sh"
   61.26 -
   61.27 -findCommand "$@"
   61.28 -evalVariables "$@"
   61.29 -
   61.30 -netdev=${netdev:-eth0}
   61.31 -# antispoofing not yet implemented
   61.32 -antispoof=${antispoof:-no}
   61.33 -
   61.34 -# turn on dhcp feature by default if dhcpd is installed
   61.35 -if [ -f /etc/dhcpd.conf ]
   61.36 -then
   61.37 -	dhcp=${dhcp:-yes}
   61.38 -else
   61.39 -	dhcp=${dhcp:-no}
   61.40 -fi
   61.41 -
   61.42 -
   61.43 -if [ "$dhcp" != 'no' ]
   61.44 -then
   61.45 -  dhcpd_conf_file=$(find_dhcpd_conf_file)
   61.46 -  dhcpd_init_file=$(find_dhcpd_init_file)
   61.47 -  if [ -z "$dhcpd_conf_file" ] || [ -z "$dhcpd_init_file" ]
   61.48 -  then
   61.49 -    echo 'Failed to find dhcpd configuration or init file.' >&2
   61.50 -    exit 1
   61.51 -  fi
   61.52 -fi
   61.53 -
   61.54 -
   61.55 -function dhcp_start()
   61.56 -{
   61.57 -  if ! grep -q "subnet 10.0.0.0" "$dhcpd_conf_file"
   61.58 -  then
   61.59 -    echo >>"$dhcpd_conf_file" "subnet 10.0.0.0 netmask 255.255.0.0 {}"
   61.60 -  fi
   61.61 -
   61.62 -  "$dhcpd_init_file" restart
   61.63 -}
   61.64 -
   61.65 -
   61.66 -function dhcp_stop()
   61.67 -{
   61.68 -  local tmpfile=$(mktemp)
   61.69 -  grep -v "subnet 10.0.0.0" "$dhcpd_conf_file" >"$tmpfile"
   61.70 -  if diff "$tmpfile" "$dhcpd_conf_file" >&/dev/null
   61.71 -  then
   61.72 -    rm "$tmpfile"
   61.73 -  else
   61.74 -    mv "$tmpfile" "$dhcpd_conf_file"
   61.75 -  fi
   61.76 -
   61.77 -  "$dhcpd_init_file" restart
   61.78 -}
   61.79 -
   61.80 -
   61.81 -op_start() {
   61.82 -	echo 1 >/proc/sys/net/ipv4/ip_forward
   61.83 -	iptables -t nat -A POSTROUTING -o ${netdev} -j MASQUERADE
   61.84 -        [ "$dhcp" != 'no' ] && dhcp_start
   61.85 -}
   61.86 -
   61.87 -
   61.88 -op_stop() {
   61.89 -        [ "$dhcp" != 'no' ] && dhcp_stop
   61.90 -	iptables -t nat -D POSTROUTING -o ${netdev} -j MASQUERADE
   61.91 -}
   61.92 -
   61.93 -
   61.94 -show_status() {
   61.95 -    echo '============================================================'
   61.96 -    ifconfig
   61.97 -    echo ' '
   61.98 -    ip route list
   61.99 -    echo ' '
  61.100 -    route -n
  61.101 -    echo '============================================================'
  61.102 -
  61.103 -}
  61.104 -
  61.105 -case "$command" in
  61.106 -    start)
  61.107 -        op_start
  61.108 -        ;;
  61.109 -    
  61.110 -    stop)
  61.111 -        op_stop
  61.112 -        ;;
  61.113 -
  61.114 -    status)
  61.115 -        show_status
  61.116 -       ;;
  61.117 -
  61.118 -    *)
  61.119 -       echo "Unknown command: $command" >&2
  61.120 -       echo 'Valid commands are: start, stop, status' >&2
  61.121 -       exit 1
  61.122 -esac
    62.1 --- a/tools/examples/network-route	Mon Nov 10 15:52:15 2008 -0800
    62.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    62.3 @@ -1,27 +0,0 @@
    62.4 -#!/bin/bash
    62.5 -#============================================================================
    62.6 -# Default Xen network start/stop script.
    62.7 -# Xend calls a network script when it starts.
    62.8 -# The script name to use is defined in /etc/xen/xend-config.sxp
    62.9 -# in the network-script field.
   62.10 -#
   62.11 -# Usage:
   62.12 -#
   62.13 -# network-route (start|stop|status) {VAR=VAL}*
   62.14 -#
   62.15 -# Vars:
   62.16 -#
   62.17 -# netdev     The gateway interface (default eth0).
   62.18 -# antispoof  Whether to use iptables to prevent spoofing (default yes).
   62.19 -#
   62.20 -#============================================================================
   62.21 -
   62.22 -dir=$(dirname "$0")
   62.23 -. "$dir/xen-script-common.sh"
   62.24 -
   62.25 -evalVariables "$@"
   62.26 -
   62.27 -netdev=${netdev:-eth${vifnum}}
   62.28 -
   62.29 -echo 1 >/proc/sys/net/ipv4/ip_forward
   62.30 -echo 1 >/proc/sys/net/ipv4/conf/${netdev}/proxy_arp
    63.1 --- a/tools/examples/vif-bridge	Mon Nov 10 15:52:15 2008 -0800
    63.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    63.3 @@ -1,100 +0,0 @@
    63.4 -#!/bin/bash
    63.5 -#============================================================================
    63.6 -# /etc/xen/vif-bridge
    63.7 -#
    63.8 -# Script for configuring a vif in bridged mode.
    63.9 -# The hotplugging system will call this script if it is specified either in
   63.10 -# the device configuration given to Xend, or the default Xend configuration
   63.11 -# in /etc/xen/xend-config.sxp.  If the script is specified in neither of those
   63.12 -# places, then this script is the default.
   63.13 -#
   63.14 -# Usage:
   63.15 -# vif-bridge (add|remove|online|offline)
   63.16 -#
   63.17 -# Environment vars:
   63.18 -# vif         vif interface name (required).
   63.19 -# XENBUS_PATH path to this device's details in the XenStore (required).
   63.20 -#
   63.21 -# Read from the store:
   63.22 -# bridge  bridge to add the vif to (optional).  Defaults to searching for the
   63.23 -#         bridge itself.
   63.24 -# ip      list of IP networks for the vif, space-separated (optional).
   63.25 -#
   63.26 -# up:
   63.27 -# Enslaves the vif interface to the bridge and adds iptables rules
   63.28 -# for its ip addresses (if any).
   63.29 -#
   63.30 -# down:
   63.31 -# Removes the vif interface from the bridge and removes the iptables
   63.32 -# rules for its ip addresses (if any).
   63.33 -#============================================================================
   63.34 -
   63.35 -dir=$(dirname "$0")
   63.36 -. "$dir/vif-common.sh"
   63.37 -
   63.38 -bridge=${bridge:-}
   63.39 -bridge=$(xenstore_read_default "$XENBUS_PATH/bridge" "$bridge")
   63.40 -
   63.41 -if [ -z "$bridge" ]
   63.42 -then
   63.43 -  bridge=$(brctl show | cut -d "
   63.44 -" -f 2 | cut -f 1)
   63.45 -
   63.46 -  if [ -z "$bridge" ]
   63.47 -  then
   63.48 -     fatal "Could not find bridge, and none was specified"
   63.49 -  fi
   63.50 -else
   63.51 -  #
   63.52 -  # Old style bridge setup with netloop, used to have a bridge name
   63.53 -  # of xenbrX, enslaving pethX and vif0.X, and then configuring
   63.54 -  # eth0.
   63.55 -  #
   63.56 -  # New style bridge setup does not use netloop, so the bridge name
   63.57 -  # is ethX and the physical device is enslaved pethX
   63.58 -  #
   63.59 -  # So if...
   63.60 -  #
   63.61 -  #   - User asks for xenbrX
   63.62 -  #   - AND xenbrX doesn't exist
   63.63 -  #   - AND there is a ethX device which is a bridge
   63.64 -  #
   63.65 -  # ..then we translate xenbrX to ethX
   63.66 -  #
   63.67 -  # This lets old config files work without modification
   63.68 -  #
   63.69 -  if [ ! -e "/sys/class/net/$bridge" ] && [ -z "${bridge##xenbr*}" ]
   63.70 -  then
   63.71 -     if [ -e "/sys/class/net/eth${bridge#xenbr}/bridge" ]
   63.72 -     then
   63.73 -        bridge="eth${bridge#xenbr}"
   63.74 -     fi
   63.75 -  fi
   63.76 -fi
   63.77 -
   63.78 -RET=0
   63.79 -ip link show $bridge 1>/dev/null 2>&1 || RET=1
   63.80 -if [ "$RET" -eq 1 ]
   63.81 -then
   63.82 -    fatal "Could not find bridge device $bridge"
   63.83 -fi
   63.84 -
   63.85 -case "$command" in
   63.86 -    online)
   63.87 -	setup_bridge_port "$vif"
   63.88 -	add_to_bridge "$bridge" "$vif"
   63.89 -        ;;
   63.90 -
   63.91 -    offline)
   63.92 -        do_without_error brctl delif "$bridge" "$vif"
   63.93 -        do_without_error ifconfig "$vif" down
   63.94 -        ;;
   63.95 -esac
   63.96 -
   63.97 -handle_iptable
   63.98 -
   63.99 -log debug "Successful vif-bridge $command for $vif, bridge $bridge."
  63.100 -if [ "$command" == "online" ]
  63.101 -then
  63.102 -  success
  63.103 -fi
    64.1 --- a/tools/examples/vif-common.sh	Mon Nov 10 15:52:15 2008 -0800
    64.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    64.3 @@ -1,151 +0,0 @@
    64.4 -#
    64.5 -# Copyright (c) 2005 XenSource Ltd.
    64.6 -#
    64.7 -# This library is free software; you can redistribute it and/or
    64.8 -# modify it under the terms of version 2.1 of the GNU Lesser General Public
    64.9 -# License as published by the Free Software Foundation.
   64.10 -#
   64.11 -# This library is distributed in the hope that it will be useful,
   64.12 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
   64.13 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   64.14 -# Lesser General Public License for more details.
   64.15 -#
   64.16 -# You should have received a copy of the GNU Lesser General Public
   64.17 -# License along with this library; if not, write to the Free Software
   64.18 -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   64.19 -#
   64.20 -
   64.21 -
   64.22 -dir=$(dirname "$0")
   64.23 -. "$dir/xen-hotplug-common.sh"
   64.24 -. "$dir/xen-network-common.sh"
   64.25 -
   64.26 -findCommand "$@"
   64.27 -
   64.28 -if [ "$command" != "online" ]  &&
   64.29 -   [ "$command" != "offline" ] &&
   64.30 -   [ "$command" != "add" ]     &&
   64.31 -   [ "$command" != "remove" ]
   64.32 -then
   64.33 -  log err "Invalid command: $command"
   64.34 -  exit 1
   64.35 -fi
   64.36 -
   64.37 -case "$command" in
   64.38 -    add | remove)
   64.39 -        exit 0
   64.40 -        ;;
   64.41 -esac
   64.42 -
   64.43 -
   64.44 -# Parameters may be read from the environment, the command line arguments, and
   64.45 -# the store, with overriding in that order.  The environment is given by the
   64.46 -# driver, the command line is given by the Xend global configuration, and
   64.47 -# store details are given by the per-domain or per-device configuration.
   64.48 -
   64.49 -evalVariables "$@"
   64.50 -
   64.51 -ip=${ip:-}
   64.52 -ip=$(xenstore_read_default "$XENBUS_PATH/ip" "$ip")
   64.53 -
   64.54 -# Check presence of compulsory args.
   64.55 -XENBUS_PATH="${XENBUS_PATH:?}"
   64.56 -vif="${vif:?}"
   64.57 -
   64.58 -
   64.59 -vifname=$(xenstore_read_default "$XENBUS_PATH/vifname" "")
   64.60 -if [ "$vifname" ]
   64.61 -then
   64.62 -  if [ "$command" == "online" ] && ! ip link show "$vifname" >&/dev/null
   64.63 -  then
   64.64 -    do_or_die ip link set "$vif" name "$vifname"
   64.65 -  fi
   64.66 -  vif="$vifname"
   64.67 -fi
   64.68 -
   64.69 -
   64.70 -frob_iptable()
   64.71 -{
   64.72 -  if [ "$command" == "online" ]
   64.73 -  then
   64.74 -    local c="-A"
   64.75 -  else
   64.76 -    local c="-D"
   64.77 -  fi
   64.78 -
   64.79 -  iptables "$c" FORWARD -m physdev --physdev-in "$vif" "$@" -j ACCEPT \
   64.80 -    2>/dev/null ||
   64.81 -    [ "$c" == "-D" ] ||
   64.82 -    log err \
   64.83 -     "iptables $c FORWARD -m physdev --physdev-in $vif $@ -j ACCEPT failed.
   64.84 -If you are using iptables, this may affect networking for guest domains."
   64.85 -}
   64.86 -
   64.87 -
   64.88 -##
   64.89 -# Add or remove the appropriate entries in the iptables.  With antispoofing
   64.90 -# turned on, we have to explicitly allow packets to the interface, regardless
   64.91 -# of the ip setting.  If ip is set, then we additionally restrict the packets
   64.92 -# to those coming from the specified networks, though we allow DHCP requests
   64.93 -# as well.
   64.94 -#
   64.95 -handle_iptable()
   64.96 -{
   64.97 -  # Check for a working iptables installation.  Checking for the iptables
   64.98 -  # binary is not sufficient, because the user may not have the appropriate
   64.99 -  # modules installed.  If iptables is not working, then there's no need to do
  64.100 -  # anything with it, so we can just return.
  64.101 -  if ! iptables -L -n >&/dev/null
  64.102 -  then
  64.103 -    return
  64.104 -  fi
  64.105 -
  64.106 -  if [ "$ip" != "" ]
  64.107 -  then
  64.108 -      local addr
  64.109 -      for addr in $ip
  64.110 -      do
  64.111 -        frob_iptable -s "$addr"
  64.112 -      done
  64.113 -
  64.114 -      # Always allow the domain to talk to a DHCP server.
  64.115 -      frob_iptable -p udp --sport 68 --dport 67
  64.116 -  else
  64.117 -      # No IP addresses have been specified, so allow anything.
  64.118 -      frob_iptable
  64.119 -  fi
  64.120 -}
  64.121 -
  64.122 -
  64.123 -##
  64.124 -# ip_of interface
  64.125 -#
  64.126 -# Print the IP address currently in use at the given interface, or nothing if
  64.127 -# the interface is not up.
  64.128 -#
  64.129 -ip_of()
  64.130 -{
  64.131 -  ip addr show "$1" | awk "/^.*inet.*$1\$/{print \$2}" | sed -n '1 s,/.*,,p'
  64.132 -}
  64.133 -
  64.134 -
  64.135 -##
  64.136 -# dom0_ip
  64.137 -#
  64.138 -# Print the IP address of the interface in dom0 through which we are routing.
  64.139 -# This is the IP address on the interface specified as "netdev" as a parameter
  64.140 -# to these scripts, or eth0 by default.  This function will call fatal if no
  64.141 -# such interface could be found.
  64.142 -#
  64.143 -dom0_ip()
  64.144 -{
  64.145 -  local nd=${netdev:-eth0}
  64.146 -  local result=$(ip_of "$nd")
  64.147 -  if [ -z "$result" ]
  64.148 -  then
  64.149 -      fatal
  64.150 -"$netdev is not up.  Bring it up or specify another interface with " \
  64.151 -"netdev=<if> as a parameter to $0."
  64.152 -  fi
  64.153 -  echo "$result"
  64.154 -}
    65.1 --- a/tools/examples/vif-nat	Mon Nov 10 15:52:15 2008 -0800
    65.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    65.3 @@ -1,192 +0,0 @@
    65.4 -#!/bin/bash
    65.5 -#============================================================================
    65.6 -# /etc/xen/vif-nat
    65.7 -#
    65.8 -# Script for configuring a vif in routed-nat mode.
    65.9 -# The hotplugging system will call this script if it is specified either in
   65.10 -# the device configuration given to Xend, or the default Xend configuration
   65.11 -# in /etc/xen/xend-config.sxp.  If the script is specified in neither of those
   65.12 -# places, then vif-bridge is the default.
   65.13 -#
   65.14 -# Usage:
   65.15 -# vif-nat (add|remove|online|offline)
   65.16 -#
   65.17 -# Environment vars:
   65.18 -# vif         vif interface name (required).
   65.19 -# XENBUS_PATH path to this device's details in the XenStore (required).
   65.20 -#
   65.21 -# Parameters:
   65.22 -# dhcp        Whether to alter the local DHCP configuration to include this
   65.23 -#             new host (default no).
   65.24 -#
   65.25 -# Read from the store:
   65.26 -# ip      list of IP networks for the vif, space-separated (default given in
   65.27 -#         this script).
   65.28 -#============================================================================
   65.29 -
   65.30 -
   65.31 -dir=$(dirname "$0")
   65.32 -. "$dir/vif-common.sh"
   65.33 -
   65.34 -# turn on dhcp feature by default if dhcpd is installed
   65.35 -if [ -f /etc/dhcpd.conf ]
   65.36 -then
   65.37 -	dhcp=${dhcp:-yes}
   65.38 -else
   65.39 -	dhcp=${dhcp:-no}
   65.40 -fi
   65.41 -
   65.42 -if [ "$dhcp" != 'no' ]
   65.43 -then
   65.44 -  dhcpd_conf_file=$(find_dhcpd_conf_file)
   65.45 -  dhcpd_init_file=$(find_dhcpd_init_file)
   65.46 -  dhcpd_arg_file=$(find_dhcpd_arg_file)
   65.47 -  if [ -z "$dhcpd_conf_file" ] || [ -z "$dhcpd_init_file" ] || [ -z "$dhcpd_arg_file" ]
   65.48 -  then
   65.49 -    echo 'Failed to find dhcpd configuration or init or args file.' >&2
   65.50 -    exit 1
   65.51 -  fi
   65.52 -fi
   65.53 -
   65.54 -
   65.55 -domid=$(xenstore_read "$XENBUS_PATH/frontend-id")
   65.56 -vifid=$(xenstore_read "$XENBUS_PATH/handle")
   65.57 -vifid=$(( $vifid + 1 ))
   65.58 -
   65.59 -
   65.60 -ip_from_dom()
   65.61 -{
   65.62 -  local domid1=$(( $domid / 256 ))
   65.63 -  local domid2=$(( $domid % 256 ))
   65.64 -
   65.65 -  echo "10.$domid1.$domid2.$vifid/16"
   65.66 -}
   65.67 -
   65.68 -
   65.69 -routing_ip()
   65.70 -{
   65.71 -  echo $(echo $1 | awk -F. '{print $1"."$2"."$3"."$4 + 127}')
   65.72 -}
   65.73 -
   65.74 -
   65.75 -dotted_quad()
   65.76 -{
   65.77 - echo\
   65.78 - $(( ($1 & 0xFF000000) >> 24))\
   65.79 -.$(( ($1 & 0x00FF0000) >> 16))\
   65.80 -.$(( ($1 & 0x0000FF00) >> 8 ))\
   65.81 -.$((  $1 & 0x000000FF       ))
   65.82 -}
   65.83 -
   65.84 -
   65.85 -if [ "$ip" = "" ]
   65.86 -then
   65.87 -  ip=$(ip_from_dom)
   65.88 -fi
   65.89 -
   65.90 -router_ip=$(routing_ip "$ip")
   65.91 -
   65.92 -# Split the given IP/bits pair.
   65.93 -vif_ip=`echo ${ip} | awk -F/ '{print $1}'`
   65.94 -
   65.95 -hostname=$(xenstore_read "$XENBUS_PATH/domain" | tr -- '_.:/+' '-----')
   65.96 -if [ "$vifid" != "1" ]
   65.97 -then
   65.98 -  hostname="$hostname-$vifid"
   65.99 -fi
  65.100 -
  65.101 -dhcparg_remove_entry()
  65.102 -{
  65.103 -  local tmpfile=$(mktemp)
  65.104 -  sed -e "s/$vif //" "$dhcpd_arg_file" >"$tmpfile"
  65.105 -  if diff "$tmpfile" "$dhcpd_arg_file" >/dev/null
  65.106 -  then
  65.107 -    rm "$tmpfile"
  65.108 -  else
  65.109 -    mv "$tmpfile" "$dhcpd_arg_file"
  65.110 -  fi
  65.111 -}
  65.112 -
  65.113 -dhcparg_add_entry()
  65.114 -{
  65.115 -  dhcparg_remove_entry
  65.116 -  local tmpfile=$(mktemp)
  65.117 -  # handle Red Hat, SUSE, and Debian styles, with or without quotes
  65.118 -  sed -e 's/^DHCPDARGS="*\([^"]*\)"*/DHCPDARGS="\1'"$vif "'"/' \
  65.119 -     "$dhcpd_arg_file" >"$tmpfile" && mv "$tmpfile" "$dhcpd_arg_file"
  65.120 -  sed -e 's/^DHCPD_INTERFACE="*\([^"]*\)"*/DHCPD_INTERFACE="\1'"$vif "'"/' \
  65.121 -     "$dhcpd_arg_file" >"$tmpfile" && mv "$tmpfile" "$dhcpd_arg_file"
  65.122 -  sed -e 's/^INTERFACES="*\([^"]*\)"*/INTERFACES="\1'"$vif "'"/' \
  65.123 -     "$dhcpd_arg_file" >"$tmpfile" && mv "$tmpfile" "$dhcpd_arg_file"
  65.124 -  rm -f "$tmpfile"
  65.125 -}
  65.126 -
  65.127 -dhcp_remove_entry()
  65.128 -{
  65.129 -  local tmpfile=$(mktemp)
  65.130 -  grep -v "host $hostname" "$dhcpd_conf_file" >"$tmpfile"
  65.131 -  if diff "$tmpfile" "$dhcpd_conf_file" >/dev/null
  65.132 -  then
  65.133 -    rm "$tmpfile"
  65.134 -  else
  65.135 -    mv "$tmpfile" "$dhcpd_conf_file"
  65.136 -  fi
  65.137 -  dhcparg_remove_entry
  65.138 -}
  65.139 -
  65.140 -
  65.141 -dhcp_up()
  65.142 -{
  65.143 -  claim_lock "vif-nat-dhcp"
  65.144 -  dhcp_remove_entry
  65.145 -  mac=$(xenstore_read "$XENBUS_PATH/mac")
  65.146 -  echo >>"$dhcpd_conf_file" \
  65.147 -"host $hostname { hardware ethernet $mac; fixed-address $vif_ip; option routers $router_ip; option host-name \"$hostname\"; }"
  65.148 -  dhcparg_add_entry
  65.149 -  release_lock "vif-nat-dhcp"
  65.150 -  "$dhcpd_init_file" restart || true
  65.151 -}
  65.152 -
  65.153 -
  65.154 -dhcp_down()
  65.155 -{
  65.156 -  claim_lock "vif-nat-dhcp"
  65.157 -  dhcp_remove_entry
  65.158 -  release_lock "vif-nat-dhcp"
  65.159 -  "$dhcpd_init_file" restart || true # We need to ignore failure because
  65.160 -                                     # ISC dhcpd 3 borks if there is nothing
  65.161 -                                     # for it to do, which is the case if
  65.162 -                                     # the outgoing interface is not
  65.163 -                                     # configured to offer leases and there
  65.164 -                                     # are no vifs.
  65.165 -}
  65.166 -
  65.167 -
  65.168 -case "$command" in
  65.169 -    online)
  65.170 -        if ip route | grep -q "dev $vif"
  65.171 -        then
  65.172 -          log debug "$vif already up"
  65.173 -          exit 0
  65.174 -        fi
  65.175 -
  65.176 -        do_or_die ip link set "$vif" up arp on
  65.177 -        do_or_die ip addr add "$router_ip" dev "$vif"
  65.178 -        do_or_die ip route add "$vif_ip" dev "$vif" src "$router_ip"
  65.179 -        echo 1 >/proc/sys/net/ipv4/conf/${vif}/proxy_arp
  65.180 -        [ "$dhcp" != 'no' ] && dhcp_up
  65.181 -        ;;
  65.182 -    offline)
  65.183 -        [ "$dhcp" != 'no' ] && dhcp_down
  65.184 -        do_without_error ifconfig "$vif" down
  65.185 -        ;;
  65.186 -esac
  65.187 -
  65.188 -
  65.189 -handle_iptable
  65.190 -
  65.191 -log debug "Successful vif-nat $command for $vif."
  65.192 -if [ "$command" = "online" ]
  65.193 -then
  65.194 -  success
  65.195 -fi
    66.1 --- a/tools/examples/vif-route	Mon Nov 10 15:52:15 2008 -0800
    66.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    66.3 @@ -1,56 +0,0 @@
    66.4 -#!/bin/bash
    66.5 -#============================================================================
    66.6 -# /etc/xen/vif-route
    66.7 -#
    66.8 -# Script for configuring a vif in routed mode.
    66.9 -# The hotplugging system will call this script if it is specified either in
   66.10 -# the device configuration given to Xend, or the default Xend configuration
   66.11 -# in /etc/xen/xend-config.sxp.  If the script is specified in neither of those
   66.12 -# places, then vif-bridge is the default.
   66.13 -#
   66.14 -# Usage:
   66.15 -# vif-route (add|remove|online|offline)
   66.16 -#
   66.17 -# Environment vars:
   66.18 -# vif         vif interface name (required).
   66.19 -# XENBUS_PATH path to this device's details in the XenStore (required).
   66.20 -#
   66.21 -# Read from the store:
   66.22 -# ip      list of IP networks for the vif, space-separated (default given in
   66.23 -#         this script).
   66.24 -#============================================================================
   66.25 -
   66.26 -dir=$(dirname "$0")
   66.27 -. "$dir/vif-common.sh"
   66.28 -
   66.29 -main_ip=$(dom0_ip)
   66.30 -
   66.31 -case "$command" in
   66.32 -    online)
   66.33 -        ifconfig ${vif} ${main_ip} netmask 255.255.255.255 up
   66.34 -        echo 1 >/proc/sys/net/ipv4/conf/${vif}/proxy_arp
   66.35 -        ipcmd='add'
   66.36 -        cmdprefix=''
   66.37 -        ;;
   66.38 -    offline)
   66.39 -        do_without_error ifdown ${vif}
   66.40 -        ipcmd='del'
   66.41 -        cmdprefix='do_without_error'
   66.42 -        ;;
   66.43 -esac
   66.44 -
   66.45 -if [ "${ip}" ] ; then
   66.46 -    # If we've been given a list of IP addresses, then add routes from dom0 to
   66.47 -    # the guest using those addresses.
   66.48 -    for addr in ${ip} ; do
   66.49 -      ${cmdprefix} ip route ${ipcmd} ${addr} dev ${vif} src ${main_ip}
   66.50 -    done 
   66.51 -fi
   66.52 -
   66.53 -handle_iptable
   66.54 -
   66.55 -log debug "Successful vif-route $command for $vif."
   66.56 -if [ "$command" = "online" ]
   66.57 -then
   66.58 -  success
   66.59 -fi
    67.1 --- a/tools/examples/vscsi	Mon Nov 10 15:52:15 2008 -0800
    67.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    67.3 @@ -1,22 +0,0 @@
    67.4 -#!/bin/sh
    67.5 -#
    67.6 -# Copyright (c) 2007, FUJITSU Limited
    67.7 -# Based on the block scripts code.
    67.8 -#
    67.9 -
   67.10 -dir=$(dirname "$0")
   67.11 -. "$dir/xen-hotplug-common.sh"
   67.12 -
   67.13 -findCommand "$@"
   67.14 -
   67.15 -case "$command" in
   67.16 -	add)
   67.17 -		success
   67.18 -		;;
   67.19 -	remove)
   67.20 -		# TODO
   67.21 -		exit 0
   67.22 -		;;
   67.23 -esac
   67.24 -
   67.25 -exit 0
    68.1 --- a/tools/examples/vtpm	Mon Nov 10 15:52:15 2008 -0800
    68.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    68.3 @@ -1,22 +0,0 @@
    68.4 -#!/bin/bash
    68.5 -
    68.6 -dir=$(dirname "$0")
    68.7 -. "$dir/vtpm-hotplug-common.sh"
    68.8 -
    68.9 -vtpm_fatal_error=0
   68.10 -
   68.11 -case "$command" in
   68.12 -  add)
   68.13 -    vtpm_create_instance
   68.14 -  ;;
   68.15 -  remove)
   68.16 -    vtpm_remove_instance
   68.17 -  ;;
   68.18 -esac
   68.19 -
   68.20 -if [ $vtpm_fatal_error -eq 0 ]; then
   68.21 -	log debug "Successful vTPM operation '$command'."
   68.22 -	success
   68.23 -else
   68.24 -	fatal "Error while executing vTPM operation '$command'."
   68.25 -fi
    69.1 --- a/tools/examples/vtpm-common.sh	Mon Nov 10 15:52:15 2008 -0800
    69.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    69.3 @@ -1,448 +0,0 @@
    69.4 -#
    69.5 -# Copyright (c) 2005 IBM Corporation
    69.6 -# Copyright (c) 2005 XenSource Ltd.
    69.7 -#
    69.8 -# This library is free software; you can redistribute it and/or
    69.9 -# modify it under the terms of version 2.1 of the GNU Lesser General Public
   69.10 -# License as published by the Free Software Foundation.
   69.11 -#
   69.12 -# This library is distributed in the hope that it will be useful,
   69.13 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
   69.14 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   69.15 -# Lesser General Public License for more details.
   69.16 -#
   69.17 -# You should have received a copy of the GNU Lesser General Public
   69.18 -# License along with this library; if not, write to the Free Software
   69.19 -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   69.20 -#
   69.21 -
   69.22 -dir=$(dirname "$0")
   69.23 -. "$dir/logging.sh"
   69.24 -. "$dir/locking.sh"
   69.25 -
   69.26 -VTPMDB="/var/vtpm/vtpm.db"
   69.27 -
   69.28 -#In the vtpm-impl file some commands should be defined:
   69.29 -#      vtpm_create, vtpm_setup, vtpm_start, etc. (see below)
   69.30 -if [ -r "$dir/vtpm-impl.alt" ]; then
   69.31 -	. "$dir/vtpm-impl.alt"
   69.32 -elif [ -r "$dir/vtpm-impl" ]; then
   69.33 -	. "$dir/vtpm-impl"
   69.34 -else
   69.35 -	function vtpm_create () {
   69.36 -		true
   69.37 -	}
   69.38 -	function vtpm_setup() {
   69.39 -		true
   69.40 -	}
   69.41 -	function vtpm_start() {
   69.42 -		true
   69.43 -	}
   69.44 -	function vtpm_suspend() {
   69.45 -		true
   69.46 -	}
   69.47 -	function vtpm_resume() {
   69.48 -		true
   69.49 -	}
   69.50 -	function vtpm_delete() {
   69.51 -		true
   69.52 -	}
   69.53 -	function vtpm_migrate() {
   69.54 -		echo "Error: vTPM migration accross machines not implemented."
   69.55 -	}
   69.56 -	function vtpm_migrate_local() {
   69.57 -		echo "Error: local vTPM migration not supported"
   69.58 -	}
   69.59 -	function vtpm_migrate_recover() {
   69.60 -		true
   69.61 -	}
   69.62 -fi
   69.63 -
   69.64 -
   69.65 -#Find the instance number for the vtpm given the name of the domain
   69.66 -# Parameters
   69.67 -# - vmname : the name of the vm
   69.68 -# Return value
   69.69 -#  Returns '0' if instance number could not be found, otherwise
   69.70 -#  it returns the instance number in the variable 'instance'
   69.71 -function vtpmdb_find_instance () {
   69.72 -	local vmname ret instance
   69.73 -	vmname=$1
   69.74 -	ret=0
   69.75 -
   69.76 -	instance=$(cat $VTPMDB |                   \
   69.77 -	          awk -vvmname=$vmname             \
   69.78 -	          '{                               \
   69.79 -	             if ( 1 != index($1,"#")) {    \
   69.80 -	               if ( $1 == vmname ) {       \
   69.81 -	                 print $2;                 \
   69.82 -	                 exit;                     \
   69.83 -	               }                           \
   69.84 -	             }                             \
   69.85 -	           }')
   69.86 -	if [ "$instance" != "" ]; then
   69.87 -		ret=$instance
   69.88 -	fi
   69.89 -	echo "$ret"
   69.90 -}
   69.91 -
   69.92 -
   69.93 -# Check whether a particular instance number is still available
   69.94 -# returns "0" if it is not available, "1" otherwise.
   69.95 -function vtpmdb_is_free_instancenum () {
   69.96 -	local instance instances avail i
   69.97 -	instance=$1
   69.98 -	avail=1
   69.99 -	#Allowed instance number range: 1-255
  69.100 -	if [ $instance -eq 0 -o $instance -gt 255 ]; then
  69.101 -		avail=0
  69.102 -	else
  69.103 -		instances=$(cat $VTPMDB |                \
  69.104 -		           gawk                          \
  69.105 -		           '{                            \
  69.106 -		               if (1 != index($1,"#")) { \
  69.107 -		                 printf("%s ",$2);       \
  69.108 -		               }                         \
  69.109 -		            }')
  69.110 -		for i in $instances; do
  69.111 -			if [ $i -eq $instance ]; then
  69.112 -				avail=0
  69.113 -				break
  69.114 -			fi
  69.115 -		done
  69.116 -	fi
  69.117 -	echo "$avail"
  69.118 -}
  69.119 -
  69.120 -
  69.121 -# Get an available instance number given the database
  69.122 -# Returns an unused instance number
  69.123 -function vtpmdb_get_free_instancenum () {
  69.124 -	local ctr instances don found
  69.125 -	instances=$(cat $VTPMDB |                \
  69.126 -	           gawk                          \
  69.127 -	           '{                            \
  69.128 -	               if (1 != index($1,"#")) { \
  69.129 -	                 printf("%s ",$2);       \
  69.130 -	               }                         \
  69.131 -	            }')
  69.132 -	ctr=1
  69.133 -	don=0
  69.134 -	while [ $don -eq 0 ]; do
  69.135 -		found=0
  69.136 -		for i in $instances; do
  69.137 -			if [ $i -eq $ctr ]; then
  69.138 -				found=1;
  69.139 -				break;
  69.140 -			fi
  69.141 -		done
  69.142 -
  69.143 -		if [ $found -eq 0 ]; then
  69.144 -			don=1
  69.145 -			break
  69.146 -		fi
  69.147 -		let ctr=ctr+1
  69.148 -	done
  69.149 -	echo "$ctr"
  69.150 -}
  69.151 -
  69.152 -
  69.153 -# Add a domain name and instance number to the DB file
  69.154 -function vtpmdb_add_instance () {
  69.155 -	local res vmname inst
  69.156 -	vmname=$1
  69.157 -	inst=$2
  69.158 -
  69.159 -	if [ ! -f $VTPMDB ]; then
  69.160 -		echo "#Database for VM to vTPM association" > $VTPMDB
  69.161 -		echo "#1st column: domain name" >> $VTPMDB
  69.162 -		echo "#2nd column: TPM instance number" >> $VTPMDB
  69.163 -	fi
  69.164 -	res=$(vtpmdb_validate_entry $vmname $inst)
  69.165 -	if [ $res -eq 0 ]; then
  69.166 -		echo "$vmname $inst" >> $VTPMDB
  69.167 -	fi
  69.168 -}
  69.169 -
  69.170 -
  69.171 -#Validate whether an entry is the same as passed to this
  69.172 -#function
  69.173 -function vtpmdb_validate_entry () {
  69.174 -	local res rc vmname inst
  69.175 -	rc=0
  69.176 -	vmname=$1
  69.177 -	inst=$2
  69.178 -
  69.179 -	res=$(cat $VTPMDB |            \
  69.180 -	     gawk -vvmname=$vmname     \
  69.181 -	          -vinst=$inst         \
  69.182 -	     '{                        \
  69.183 -	         if ( 1 == index($1,"#")) {\
  69.184 -	         } else                \
  69.185 -	         if ( $1 == vmname &&  \
  69.186 -	              $2 == inst) {    \
  69.187 -	            printf("1");       \
  69.188 -	            exit;              \
  69.189 -	         } else                \
  69.190 -	         if ( $1 == vmname ||  \
  69.191 -	              $2 == inst) {    \
  69.192 -	            printf("2");       \
  69.193 -	            exit;              \
  69.194 -	         }                     \
  69.195 -	     }')
  69.196 -
  69.197 -	if [ "$res" == "1" ]; then
  69.198 -		rc=1
  69.199 -	elif [ "$res" == "2" ]; then
  69.200 -		rc=2
  69.201 -	fi
  69.202 -	echo "$rc"
  69.203 -}
  69.204 -
  69.205 -
  69.206 -#Remove an entry from the vTPM database given its domain name
  69.207 -#and instance number
  69.208 -function vtpmdb_remove_entry () {
  69.209 -	local vmname instance VTPMDB_TMP
  69.210 -	vmname=$1
  69.211 -	instance=$2
  69.212 -	VTPMDB_TMP="$VTPMDB".tmp
  69.213 -
  69.214 -	$(cat $VTPMDB |            \
  69.215 -	 gawk -vvmname=$vmname     \
  69.216 -	 '{                        \
  69.217 -	    if ( $1 != vmname ) {  \
  69.218 -	      print $0;            \
  69.219 -	    }                      \
  69.220 -	 '} > $VTPMDB_TMP)
  69.221 -	if [ -e $VTPMDB_TMP ]; then
  69.222 -		mv -f $VTPMDB_TMP $VTPMDB
  69.223 -		vtpm_delete $instance
  69.224 -	else
  69.225 -		log err "Error creating temporary file '$VTPMDB_TMP'."
  69.226 -	fi
  69.227 -}
  69.228 -
  69.229 -
  69.230 -# Find the reason for the creation of this device:
  69.231 -# Returns 'resume' or 'create'
  69.232 -function vtpm_get_create_reason () {
  69.233 -	local resume
  69.234 -	resume=$(xenstore_read $XENBUS_PATH/resume)
  69.235 -	if [ "$resume" == "True" ]; then
  69.236 -		echo "resume"
  69.237 -	else
  69.238 -		echo "create"
  69.239 -	fi
  69.240 -}
  69.241 -
  69.242 -
  69.243 -#Create a vTPM instance
  69.244 -# If no entry in the TPM database is found, the instance is
  69.245 -# created and an entry added to the database.
  69.246 -function vtpm_create_instance () {
  69.247 -	local res instance domname reason uuid
  69.248 -	uuid=$(xenstore_read "$XENBUS_PATH"/uuid)
  69.249 -	reason=$(vtpm_get_create_reason)
  69.250 -
  69.251 -	claim_lock vtpmdb
  69.252 -
  69.253 -	instance="0"
  69.254 -
  69.255 -	if [ "$uuid" != "" ]; then
  69.256 -		instance=$(vtpmdb_find_instance $uuid)
  69.257 -	fi
  69.258 -	if [ "$instance" == "0" ]; then
  69.259 -		domname=$(xenstore_read "$XENBUS_PATH"/domain)
  69.260 -		instance=$(vtpmdb_find_instance $domname)
  69.261 -	fi
  69.262 -
  69.263 -	if [ "$instance" == "0" -a "$reason" != "create" ]; then
  69.264 -		release_lock vtpmdb
  69.265 -		return
  69.266 -	fi
  69.267 -
  69.268 -	if [ "$instance" == "0" ]; then
  69.269 -		#Try to give the preferred instance to the domain
  69.270 -		instance=$(xenstore_read "$XENBUS_PATH"/pref_instance)
  69.271 -		if [ "$instance" != "" ]; then
  69.272 -			res=$(vtpmdb_is_free_instancenum $instance)
  69.273 -			if [ $res -eq 0 ]; then
  69.274 -				instance=$(vtpmdb_get_free_instancenum)
  69.275 -			fi
  69.276 -		else
  69.277 -			instance=$(vtpmdb_get_free_instancenum)
  69.278 -		fi
  69.279 -
  69.280 -		vtpm_create $instance
  69.281 -
  69.282 -		if [ $vtpm_fatal_error -eq 0 ]; then
  69.283 -			if [ "$uuid" != "" ]; then
  69.284 -				vtpmdb_add_instance $uuid $instance
  69.285 -			else
  69.286 -				vtpmdb_add_instance $domname $instance
  69.287 -			fi
  69.288 -		fi
  69.289 -	else
  69.290 -		if [ "$reason" == "resume" ]; then
  69.291 -			vtpm_resume $instance
  69.292 -		else
  69.293 -			vtpm_start $instance
  69.294 -		fi
  69.295 -	fi
  69.296 -
  69.297 -	release_lock vtpmdb
  69.298 -
  69.299 -	xenstore_write $XENBUS_PATH/instance $instance
  69.300 -}
  69.301 -
  69.302 -
  69.303 -#Remove an instance when a VM is terminating or suspending.
  69.304 -#Since it is assumed that the VM will appear again, the
  69.305 -#entry is kept in the VTPMDB file.
  69.306 -function vtpm_remove_instance () {
  69.307 -	local instance reason domname uuid
  69.308 -	#Stop script execution quietly if path does not exist (anymore)
  69.309 -	xenstore-exists "$XENBUS_PATH"/domain
  69.310 -	uuid=$(xenstore_read "$XENBUS_PATH"/uuid)
  69.311 -
  69.312 -	claim_lock vtpmdb
  69.313 -
  69.314 -	instance="0"
  69.315 -
  69.316 -	if [ "$uuid" != "" ]; then
  69.317 -		instance=$(vtpmdb_find_instance $uuid)
  69.318 -	fi
  69.319 -
  69.320 -	if [ "$instance" == "0" ]; then
  69.321 -		domname=$(xenstore_read "$XENBUS_PATH"/domain)
  69.322 -		instance=$(vtpmdb_find_instance $domname)
  69.323 -	fi
  69.324 -
  69.325 -	if [ "$instance" != "0" ]; then
  69.326 -		vtpm_suspend $instance
  69.327 -	fi
  69.328 -
  69.329 -	release_lock vtpmdb
  69.330 -}
  69.331 -
  69.332 -
  69.333 -#Remove an entry in the VTPMDB file given the domain's name
  69.334 -#1st parameter: The name of the domain
  69.335 -function vtpm_delete_instance () {
  69.336 -	local instance
  69.337 -
  69.338 -	claim_lock vtpmdb
  69.339 -
  69.340 -	instance=$(vtpmdb_find_instance $1)
  69.341 -	if [ "$instance" != "0" ]; then
  69.342 -		vtpmdb_remove_entry $1 $instance
  69.343 -	fi
  69.344 -
  69.345 -	release_lock vtpmdb
  69.346 -}
  69.347 -
  69.348 -# Determine whether the given address is local to this machine
  69.349 -# Return values:
  69.350 -#  "-1" : the given machine name is invalid
  69.351 -#  "0"  : this is not an address of this machine
  69.352 -#  "1"  : this is an address local to this machine
  69.353 -function vtpm_isLocalAddress() {
  69.354 -	local addr res
  69.355 -	addr=$(ping $1 -c 1 |  \
  69.356 -	       gawk '{ print substr($3,2,length($3)-2); exit }')
  69.357 -	if [ "$addr" == "" ]; then
  69.358 -		echo "-1"
  69.359 -		return
  69.360 -	fi
  69.361 -	res=$(ifconfig | grep "inet addr" |  \
  69.362 -	     gawk -vaddr=$addr               \
  69.363 -	     '{                              \
  69.364 -	        if ( addr == substr($2, 6)) {\
  69.365 -	          print "1";                 \
  69.366 -	        }                            \
  69.367 -	     }'                              \
  69.368 -	    )
  69.369 -	if [ "$res" == "" ]; then
  69.370 -		echo "0"
  69.371 -		return
  69.372 -	fi
  69.373 -	echo "1"
  69.374 -}
  69.375 -
  69.376 -# Perform a migration step. This function differentiates between migration
  69.377 -# to the local host or to a remote machine.
  69.378 -# Parameters:
  69.379 -# 1st: destination host to migrate to
  69.380 -# 2nd: name of the domain to migrate
  69.381 -# 3rd: the migration step to perform
  69.382 -function vtpm_migration_step() {
  69.383 -	local res=$(vtpm_isLocalAddress $1)
  69.384 -	if [ "$res" == "0" ]; then
  69.385 -		vtpm_migrate $1 $2 $3
  69.386 -	else
  69.387 -		vtpm_migrate_local
  69.388 -	fi
  69.389 -}
  69.390 -
  69.391 -# Recover from migration due to an error. This function differentiates
  69.392 -# between migration to the local host or to a remote machine.
  69.393 -# Parameters:
  69.394 -# 1st: destination host the migration was going to
  69.395 -# 2nd: name of the domain that was to be migrated
  69.396 -# 3rd: the last successful migration step that was done
  69.397 -function vtpm_recover() {
  69.398 -	local res
  69.399 -	res=$(vtpm_isLocalAddress $1)
  69.400 -	if [ "$res" == "0" ]; then
  69.401 -		vtpm_migrate_recover $1 $2 $3
  69.402 -	fi
  69.403 -}
  69.404 -
  69.405 -
  69.406 -#Determine the domain id given a domain's name.
  69.407 -#1st parameter: name of the domain
  69.408 -#return value: domain id  or -1 if domain id could not be determined
  69.409 -function vtpm_domid_from_name () {
  69.410 -	local id name ids
  69.411 -	ids=$(xenstore-list /local/domain)
  69.412 -	for id in $ids; do
  69.413 -		name=$(xenstore-read /local/domain/$id/name)
  69.414 -		if [ "$name" == "$1" ]; then
  69.415 -			echo "$id"
  69.416 -			return
  69.417 -		fi
  69.418 -	done
  69.419 -	echo "-1"
  69.420 -}
  69.421 -
  69.422 -#Determine the virtual TPM's instance number using the domain ID.
  69.423 -#1st parm: domain ID
  69.424 -function vtpm_uuid_by_domid() {
  69.425 -	echo $(xenstore-read /local/domain/0/backend/vtpm/$1/0/uuid)
  69.426 -}
  69.427 -
  69.428 -
  69.429 -# Determine the vTPM's UUID by the name of the VM
  69.430 -function vtpm_uuid_from_vmname() {
  69.431 -	local domid=$(vtpm_domid_from_name $1)
  69.432 -	if [ "$domid" != "-1" ]; then
  69.433 -		echo $(vtpm_uuid_by_domid $domid)
  69.434 -		return
  69.435 -	fi
  69.436 -	echo ""
  69.437 -}
  69.438 -
  69.439 -#Add a virtual TPM instance number and its associated domain name
  69.440 -#to the VTPMDB file and activate usage of this virtual TPM instance
  69.441 -#by writing the instance number into the xenstore
  69.442 -#1st parm: name of virtual machine
  69.443 -#2nd parm: instance of associated virtual TPM
  69.444 -function vtpm_add_and_activate() {
  69.445 -	local domid=$(vtpm_domid_from_name $1)
  69.446 -	local vtpm_uuid=$(vtpm_uuid_from_vmname $1)
  69.447 -	if [ "$vtpm_uuid" != "" -a "$domid" != "-1" ]; then
  69.448 -		vtpmdb_add_instance $vtpm_uuid $2
  69.449 -		xenstore-write backend/vtpm/$domid/0/instance $2
  69.450 -	fi
  69.451 -}
    70.1 --- a/tools/examples/vtpm-delete	Mon Nov 10 15:52:15 2008 -0800
    70.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    70.3 @@ -1,18 +0,0 @@
    70.4 -#!/bin/bash
    70.5 -
    70.6 -# This scripts must be called the following way:
    70.7 -# vtpm-delete <vtpm uuid>
    70.8 -# or
    70.9 -# vtpm-delete --vmname <vm name>
   70.10 -
   70.11 -dir=$(dirname "$0")
   70.12 -. "$dir/vtpm-common.sh"
   70.13 -
   70.14 -if [ "$1" == "--vmname" ]; then
   70.15 -	vtpm_uuid=$(vtpm_uuid_from_vmname $2)
   70.16 -	if [ "$vtpm_uuid" != "" ];then
   70.17 -		vtpm_delete_instance $vtpm_uuid
   70.18 -	fi
   70.19 -else
   70.20 -	vtpm_delete_instance $1
   70.21 -fi
    71.1 --- a/tools/examples/vtpm-hotplug-common.sh	Mon Nov 10 15:52:15 2008 -0800
    71.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    71.3 @@ -1,35 +0,0 @@
    71.4 -#
    71.5 -# Copyright (c) 2005 IBM Corporation
    71.6 -# Copyright (c) 2005 XenSource Ltd.
    71.7 -#
    71.8 -# This library is free software; you can redistribute it and/or
    71.9 -# modify it under the terms of version 2.1 of the GNU Lesser General Public
   71.10 -# License as published by the Free Software Foundation.
   71.11 -#
   71.12 -# This library is distributed in the hope that it will be useful,
   71.13 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
   71.14 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   71.15 -# Lesser General Public License for more details.
   71.16 -#
   71.17 -# You should have received a copy of the GNU Lesser General Public
   71.18 -# License along with this library; if not, write to the Free Software
   71.19 -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   71.20 -#
   71.21 -
   71.22 -dir=$(dirname "$0")
   71.23 -. "$dir/xen-hotplug-common.sh"
   71.24 -
   71.25 -findCommand "$@"
   71.26 -if [ "$command" != "online" ]  &&
   71.27 -   [ "$command" != "offline" ] &&
   71.28 -   [ "$command" != "add" ]     &&
   71.29 -   [ "$command" != "remove" ]
   71.30 -then
   71.31 -	log err "Invalid command: $command"
   71.32 -	exit 1
   71.33 -fi
   71.34 -
   71.35 -
   71.36 -XENBUS_PATH="${XENBUS_PATH:?}"
   71.37 -
   71.38 -. "$dir/vtpm-common.sh"
    72.1 --- a/tools/examples/vtpm-impl	Mon Nov 10 15:52:15 2008 -0800
    72.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    72.3 @@ -1,208 +0,0 @@
    72.4 -#!/bin/bash
    72.5 -# ===================================================================
    72.6 -# 
    72.7 -# Copyright (c) 2005, Intel Corp.
    72.8 -# All rights reserved.
    72.9 -#
   72.10 -# Redistribution and use in source and binary forms, with or without 
   72.11 -# modification, are permitted provided that the following conditions 
   72.12 -# are met:
   72.13 -#
   72.14 -#   * Redistributions of source code must retain the above copyright 
   72.15 -#     notice, this list of conditions and the following disclaimer.
   72.16 -#   * Redistributions in binary form must reproduce the above 
   72.17 -#     copyright notice, this list of conditions and the following 
   72.18 -#     disclaimer in the documentation and/or other materials provided 
   72.19 -#     with the distribution.
   72.20 -#   * Neither the name of Intel Corporation nor the names of its 
   72.21 -#     contributors may be used to endorse or promote products derived
   72.22 -#     from this software without specific prior written permission.
   72.23 -#
   72.24 -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
   72.25 -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
   72.26 -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
   72.27 -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
   72.28 -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
   72.29 -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
   72.30 -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
   72.31 -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   72.32 -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
   72.33 -# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
   72.34 -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
   72.35 -# OF THE POSSIBILITY OF SUCH DAMAGE.
   72.36 -# ===================================================================
   72.37 -
   72.38 -#            |        SRC        |    TAG  |      CMD SIZE     |        ORD       |mtype|strt
   72.39 -TPM_CMD_OPEN=\\x00\\x00\\x00\\x00\\x01\\xc1\\x00\\x00\\x00\\x11\\x01\\x00\\x00\\x01\\x01\\x01
   72.40 -TPM_CMD_RESM=\\x00\\x00\\x00\\x00\\x01\\xc1\\x00\\x00\\x00\\x11\\x01\\x00\\x00\\x01\\x01\\x02
   72.41 -TPM_CMD_CLOS=\\x00\\x00\\x00\\x00\\x01\\xc1\\x00\\x00\\x00\\x0e\\x01\\x00\\x00\\x02
   72.42 -TPM_CMD_DELE=\\x00\\x00\\x00\\x00\\x01\\xc1\\x00\\x00\\x00\\x0e\\x01\\x00\\x00\\x03
   72.43 -
   72.44 -TPM_TYPE_PVM=\\x01
   72.45 -TPM_TYPE_HVM=\\x02
   72.46 -
   72.47 -TPM_SUCCESS=00000000
   72.48 -
   72.49 -TX_VTPM_MANAGER=/var/vtpm/fifos/from_console.fifo
   72.50 -RX_VTPM_MANAGER=/var/vtpm/fifos/to_console.fifo
   72.51 -
   72.52 -VTPM_MIG=/usr/bin/vtpm_migrator
   72.53 -
   72.54 -# -------------------- Helpers for binary streams -----------
   72.55 -
   72.56 -function str_to_hex32() {
   72.57 - printf "%0.8x" $1
   72.58 -}
   72.59 -
   72.60 -function hex32_to_bin() {
   72.61 - local inst=$(str_to_hex32 $1);
   72.62 - 
   72.63 - local n1=`echo $inst | sed 's/\(..\)....../\\\\x\1/'`
   72.64 - local n2=`echo $inst | sed 's/..\(..\)..../\\\\x\1/'`
   72.65 - local n3=`echo $inst | sed 's/....\(..\)../\\\\x\1/'`
   72.66 - local n4=`echo $inst | sed 's/......\(..\)/\\\\x\1/'`
   72.67 -
   72.68 - echo "$n1$n2$n3$n4"
   72.69 -}
   72.70 -
   72.71 -function vtpm_manager_cmd() {
   72.72 - local cmd=$1;
   72.73 - local inst=$2;
   72.74 - local inst_bin=$(hex32_to_bin $inst);
   72.75 -
   72.76 - claim_lock vtpm_mgr
   72.77 -
   72.78 - #send cmd to vtpm_manager
   72.79 - printf "$cmd$inst_bin" > $TX_VTPM_MANAGER
   72.80 -
   72.81 - #recv response
   72.82 - set +e
   72.83 - local resp_hex=`dd skip=10 bs=1 count=4 if=$RX_VTPM_MANAGER 2> /dev/null | xxd -ps`
   72.84 - set -e
   72.85 -
   72.86 - release_lock vtpm_mgr
   72.87 -
   72.88 - #return whether the command was successful
   72.89 - if [ $resp_hex -ne $TPM_SUCCESS ]; then
   72.90 -   vtpm_fatal_error=1
   72.91 -   false
   72.92 -  else
   72.93 -   true
   72.94 - fi
   72.95 -}
   72.96 -
   72.97 -# Helper to get vm type to pass to vtpm_manager open/resume
   72.98 -function vtpm_get_type() {
   72.99 - local inst=$(xenstore_read $XENBUS_PATH/frontend-id)
  72.100 - local vm=$(xenstore_read /local/domain/$inst/vm)
  72.101 - if [ "$vm" != "" ]; then
  72.102 -  local ostype=$(xenstore-read $vm/image/ostype)
  72.103 -  if [ "$ostype" == "hvm" ]; then
  72.104 -   echo $TPM_TYPE_HVM;
  72.105 -  else
  72.106 -   echo $TPM_TYPE_PVM;
  72.107 -  fi
  72.108 - fi
  72.109 -}
  72.110 -
  72.111 -# ------------------ Command handlers -----------------
  72.112 -
  72.113 -# Create new vtpm instance & set it up for use
  72.114 -function vtpm_create () {
  72.115 - # Creation is handled implicitly by the manager on first setup
  72.116 - # so just set it up for use
  72.117 - $(vtpm_start $1)
  72.118 -}
  72.119 -
  72.120 -# Setup vtpm instance for use.
  72.121 -function vtpm_start() {
  72.122 - local vmtype=$(vtpm_get_type);
  72.123 - $(vtpm_manager_cmd $TPM_CMD_OPEN$vmtype $1)
  72.124 -}
  72.125 -
  72.126 -function vtpm_resume() {
  72.127 - local vmtype=$(vtpm_get_type);
  72.128 - $(vtpm_manager_cmd $TPM_CMD_RESM$vmtype $1)
  72.129 -}
  72.130 -
  72.131 -# Reset the vtpm AKA clear PCRs
  72.132 -function vtpm_reset() {
  72.133 - #not used by current implemenation
  72.134 - true
  72.135 -}
  72.136 -
  72.137 -# Shutdown the vtpm while the vm is down
  72.138 -# This could be a suspend of shutdown
  72.139 -# we cannot distinquish, so save the state
  72.140 -# and decide on startup if we should keep is
  72.141 -function vtpm_suspend() {
  72.142 - $(vtpm_manager_cmd $TPM_CMD_CLOS $1)
  72.143 -}
  72.144 -
  72.145 -
  72.146 -function vtpm_delete() {
  72.147 - local inst=$1
  72.148 - if $(vtpm_manager_cmd $TPM_CMD_DELE $inst); then
  72.149 -   rm -f /var/vtpm/vtpm_dm_$1.data
  72.150 -   true
  72.151 - else 
  72.152 -   vtpm_fatal_error=1
  72.153 -   false
  72.154 - fi
  72.155 -}
  72.156 -
  72.157 -# Perform a migration step. This function differentiates between migration
  72.158 -# to the local host or to a remote machine.
  72.159 -# Parameters:
  72.160 -# 1st: destination host to migrate to
  72.161 -# 2nd: name of the domain to migrate
  72.162 -# 3rd: the migration step to perform
  72.163 -function vtpm_migrate() {
  72.164 - local instance res
  72.165 -
  72.166 - instance=$(vtpmdb_find_instance $2)
  72.167 - if [ "$instance" == "" ]; then
  72.168 -  log err "VTPM Migratoin failed. Unable to translation of domain name"
  72.169 -  echo "Error: VTPM Migration failed while looking up instance number"
  72.170 - fi
  72.171 -
  72.172 - case "$3" in
  72.173 -  0)
  72.174 -   #Incicate migration supported
  72.175 -   echo "0" 
  72.176 -  ;;
  72.177 -
  72.178 -  1)
  72.179 -   # Get Public Key from Destination
  72.180 -   # Call vtpm_manager's migration part 1
  72.181 -   claim_lock vtpm_mgr
  72.182 -   $VTPM_MIG $1 $2 $instance $3
  72.183 -   release_lock vtpm_mgr
  72.184 -  ;;
  72.185 -
  72.186 -  2)
  72.187 -   # Call manager's migration step 2 and send result to destination
  72.188 -   # If successful remove from db
  72.189 -   claim_lock vtpm_mgr
  72.190 -   $VTPM_MIG $1 $2 $instance $3
  72.191 -   release_lock vtpm_mgr
  72.192 -  ;;
  72.193 -
  72.194 -  3)
  72.195 -   if `ps x | grep "$VTPM_MIG $1"`; then
  72.196 -    log err "VTPM Migration failed to complete."
  72.197 -    echo "Error: VTPM Migration failed to complete."
  72.198 -   fi
  72.199 -  ;;
  72.200 - esac
  72.201 - 
  72.202 -}
  72.203 -
  72.204 -
  72.205 -function vtpm_migrate_recover() {
  72.206 - echo "Error: Recovery not supported yet" 
  72.207 -}
  72.208 -
  72.209 -function vtpm_migrate_local() {
  72.210 - echo "Error: local vTPM migration not supported"
  72.211 -}
    73.1 --- a/tools/examples/vtpm-migration.sh	Mon Nov 10 15:52:15 2008 -0800
    73.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    73.3 @@ -1,19 +0,0 @@
    73.4 -#
    73.5 -# Copyright (c) 2005 IBM Corporation
    73.6 -#
    73.7 -# This library is free software; you can redistribute it and/or
    73.8 -# modify it under the terms of version 2.1 of the GNU Lesser General Public
    73.9 -# License as published by the Free Software Foundation.
   73.10 -#
   73.11 -# This library is distributed in the hope that it will be useful,
   73.12 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
   73.13 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   73.14 -# Lesser General Public License for more details.
   73.15 -#
   73.16 -# You should have received a copy of the GNU Lesser General Public
   73.17 -# License along with this library; if not, write to the Free Software
   73.18 -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   73.19 -#
   73.20 -
   73.21 -dir=$(dirname "$0")
   73.22 -. "$dir/vtpm-common.sh"
    74.1 --- a/tools/examples/xen-backend.agent	Mon Nov 10 15:52:15 2008 -0800
    74.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    74.3 @@ -1,39 +0,0 @@
    74.4 -#! /bin/bash
    74.5 -
    74.6 -PATH=/etc/xen/scripts:$PATH
    74.7 -
    74.8 -. /etc/xen/scripts/locking.sh
    74.9 -
   74.10 -claim_lock xenbus_hotplug_global
   74.11 -
   74.12 -case "$XENBUS_TYPE" in
   74.13 -  tap)
   74.14 -    /etc/xen/scripts/blktap "$ACTION"
   74.15 -    ;;
   74.16 -  vbd)
   74.17 -    /etc/xen/scripts/block "$ACTION"
   74.18 -    ;;
   74.19 -  vtpm)
   74.20 -    /etc/xen/scripts/vtpm "$ACTION"
   74.21 -    ;;
   74.22 -  vif)
   74.23 -    [ -n "$script" ] && $script "$ACTION"
   74.24 -    ;;
   74.25 -  vscsi)
   74.26 -    /etc/xen/scripts/vscsi "$ACTION"
   74.27 -    ;;
   74.28 -esac
   74.29 -
   74.30 -case "$ACTION" in
   74.31 -  add)
   74.32 -    ;;
   74.33 -  remove)
   74.34 -    /etc/xen/scripts/xen-hotplug-cleanup
   74.35 -    ;;
   74.36 -  online)
   74.37 -    ;;
   74.38 -  offline)
   74.39 -    ;;
   74.40 -esac
   74.41 -
   74.42 -release_lock xenbus_hotplug_global
    75.1 --- a/tools/examples/xen-backend.rules	Mon Nov 10 15:52:15 2008 -0800
    75.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    75.3 @@ -1,9 +0,0 @@
    75.4 -SUBSYSTEM=="xen-backend", KERNEL=="tap*", RUN+="/etc/xen/scripts/blktap $env{ACTION}"
    75.5 -SUBSYSTEM=="xen-backend", KERNEL=="vbd*", RUN+="/etc/xen/scripts/block $env{ACTION}"
    75.6 -SUBSYSTEM=="xen-backend", KERNEL=="vtpm*", RUN+="/etc/xen/scripts/vtpm $env{ACTION}"
    75.7 -SUBSYSTEM=="xen-backend", KERNEL=="vif*", ACTION=="online", RUN+="$env{script} online"
    75.8 -SUBSYSTEM=="xen-backend", KERNEL=="vif*", ACTION=="offline", RUN+="$env{script} offline"
    75.9 -SUBSYSTEM=="xen-backend", KERNEL=="vscsi*", RUN+="/etc/xen/scripts/vscsi $env{ACTION}"
   75.10 -SUBSYSTEM=="xen-backend", ACTION=="remove", RUN+="/etc/xen/scripts/xen-hotplug-cleanup"
   75.11 -KERNEL=="evtchn", NAME="xen/%k"
   75.12 -KERNEL=="blktap[0-9]*", NAME="xen/%k"
    76.1 --- a/tools/examples/xen-hotplug-cleanup	Mon Nov 10 15:52:15 2008 -0800
    76.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    76.3 @@ -1,22 +0,0 @@
    76.4 -#! /bin/bash
    76.5 -
    76.6 -dir=$(dirname "$0")
    76.7 -. "$dir/xen-hotplug-common.sh"
    76.8 -
    76.9 -# Claim the lock protecting /etc/xen/scripts/block.  This stops a race whereby
   76.10 -# paths in the store would disappear underneath that script as it attempted to
   76.11 -# read from the store checking for device sharing.
   76.12 -# Any other scripts that do similar things will have to have their lock
   76.13 -# claimed too.
   76.14 -# This is pretty horrible, but there's not really a nicer way of solving this.
   76.15 -claim_lock "block"
   76.16 -
   76.17 -# remove device frontend store entries
   76.18 -xenstore-rm -t \
   76.19 -  $(xenstore-read "$XENBUS_PATH/frontend" 2>/dev/null) 2>/dev/null || true
   76.20 -
   76.21 -# remove device backend store entries
   76.22 -xenstore-rm -t "$XENBUS_PATH"        2>/dev/null || true
   76.23 -xenstore-rm -t "error/$XENBUS_PATH"  2>/dev/null || true
   76.24 -
   76.25 -release_lock "block"
    77.1 --- a/tools/examples/xen-hotplug-common.sh	Mon Nov 10 15:52:15 2008 -0800
    77.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    77.3 @@ -1,93 +0,0 @@
    77.4 -#
    77.5 -# Copyright (c) 2005 XenSource Ltd.
    77.6 -#
    77.7 -# This library is free software; you can redistribute it and/or
    77.8 -# modify it under the terms of version 2.1 of the GNU Lesser General Public
    77.9 -# License as published by the Free Software Foundation.
   77.10 -#
   77.11 -# This library is distributed in the hope that it will be useful,
   77.12 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
   77.13 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   77.14 -# Lesser General Public License for more details.
   77.15 -#
   77.16 -# You should have received a copy of the GNU Lesser General Public
   77.17 -# License along with this library; if not, write to the Free Software
   77.18 -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   77.19 -#
   77.20 -
   77.21 -
   77.22 -dir=$(dirname "$0")
   77.23 -. "$dir/logging.sh"
   77.24 -. "$dir/xen-script-common.sh"
   77.25 -. "$dir/locking.sh"
   77.26 -
   77.27 -exec 2>>/var/log/xen/xen-hotplug.log
   77.28 -
   77.29 -export PATH="/sbin:/bin:/usr/bin:/usr/sbin:$PATH"
   77.30 -export LANG="POSIX"
   77.31 -unset $(set | grep ^LC_ | cut -d= -f1)
   77.32 -
   77.33 -fatal() {
   77.34 -  xenstore_write "$XENBUS_PATH/hotplug-error" "$*" \
   77.35 -                 "$XENBUS_PATH/hotplug-status" error
   77.36 -  log err "$@"
   77.37 -  exit 1
   77.38 -}
   77.39 -
   77.40 -success() {
   77.41 -  # Tell DevController that backend is "connected"
   77.42 -  xenstore_write "$XENBUS_PATH/hotplug-status" connected
   77.43 -}
   77.44 -
   77.45 -do_or_die() {
   77.46 -  "$@" || fatal "$@ failed"
   77.47 -}
   77.48 -
   77.49 -do_without_error() {
   77.50 -  "$@" 2>/dev/null || log debug "$@ failed"
   77.51 -}
   77.52 -
   77.53 -sigerr() {
   77.54 -  fatal "$0 failed; error detected."
   77.55 -}
   77.56 -
   77.57 -trap sigerr ERR
   77.58 -
   77.59 -
   77.60 -##
   77.61 -# xenstore_read <path>+
   77.62 -#
   77.63 -# Read each of the given paths, returning each result on a separate line, or
   77.64 -# exit this script if any of the paths is missing.
   77.65 -#
   77.66 -xenstore_read() {
   77.67 -  local v=$(xenstore-read "$@" || true)
   77.68 -  [ "$v" != "" ] || fatal "xenstore-read $@ failed."
   77.69 -  echo "$v"
   77.70 -}
   77.71 -
   77.72 -
   77.73 -##
   77.74 -# xenstore_read_default <path> <default>
   77.75 -#
   77.76 -# Read the given path, returning the value there or the given default if the
   77.77 -# path is not present.
   77.78 -#
   77.79 -xenstore_read_default() {
   77.80 -  xenstore-read "$1" 2>/dev/null || echo "$2"
   77.81 -}
   77.82 -
   77.83 -
   77.84 -##
   77.85 -# xenstore_write (<path> <value>)+
   77.86 -#
   77.87 -# Write each of the key/value pairs to the store, and exit this script if any
   77.88 -# such writing fails.
   77.89 -#
   77.90 -xenstore_write() {
   77.91 -  log debug "Writing $@ to xenstore."
   77.92 -  xenstore-write "$@" || fatal "Writing $@ to xenstore failed."
   77.93 -}
   77.94 -
   77.95 -
   77.96 -log debug "$@" "XENBUS_PATH=$XENBUS_PATH"
    78.1 --- a/tools/examples/xen-network-common.sh	Mon Nov 10 15:52:15 2008 -0800
    78.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    78.3 @@ -1,118 +0,0 @@
    78.4 -#
    78.5 -# Copyright (c) 2005 XenSource Ltd.
    78.6 -#
    78.7 -# This library is free software; you can redistribute it and/or
    78.8 -# modify it under the terms of version 2.1 of the GNU Lesser General Public
    78.9 -# License as published by the Free Software Foundation.
   78.10 -#
   78.11 -# This library is distributed in the hope that it will be useful,
   78.12 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
   78.13 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   78.14 -# Lesser General Public License for more details.
   78.15 -#
   78.16 -# You should have received a copy of the GNU Lesser General Public
   78.17 -# License along with this library; if not, write to the Free Software
   78.18 -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   78.19 -#
   78.20 -
   78.21 -
   78.22 -# Gentoo doesn't have ifup/ifdown, so we define appropriate alternatives.
   78.23 -
   78.24 -# Other platforms just use ifup / ifdown directly.
   78.25 -
   78.26 -##
   78.27 -# preiftransfer
   78.28 -#
   78.29 -# @param $1 The current name for the physical device, which is also the name
   78.30 -#           that the virtual device will take once the physical device has
   78.31 -#           been renamed.
   78.32 -
   78.33 -if ! which ifup >/dev/null 2>/dev/null
   78.34 -then
   78.35 -  preiftransfer()
   78.36 -  {
   78.37 -    true
   78.38 -  }
   78.39 -  ifup()
   78.40 -  {
   78.41 -    false
   78.42 -  }
   78.43 -  ifdown()
   78.44 -  {
   78.45 -    false
   78.46 -  }
   78.47 -else
   78.48 -  preiftransfer()
   78.49 -  {
   78.50 -    true
   78.51 -  }
   78.52 -fi
   78.53 -
   78.54 -
   78.55 -first_file()
   78.56 -{
   78.57 -  t="$1"
   78.58 -  shift
   78.59 -  for file in $@
   78.60 -  do
   78.61 -    if [ "$t" "$file" ]
   78.62 -    then
   78.63 -      echo "$file"
   78.64 -      return
   78.65 -    fi
   78.66 -  done
   78.67 -}
   78.68 -
   78.69 -find_dhcpd_conf_file()
   78.70 -{
   78.71 -  first_file -f /etc/dhcp3/dhcpd.conf /etc/dhcpd.conf
   78.72 -}
   78.73 -
   78.74 -
   78.75 -find_dhcpd_init_file()
   78.76 -{
   78.77 -  first_file -x /etc/init.d/{dhcp3-server,dhcp,dhcpd}
   78.78 -}
   78.79 -
   78.80 -find_dhcpd_arg_file()
   78.81 -{
   78.82 -  first_file -f /etc/sysconfig/dhcpd /etc/defaults/dhcp /etc/default/dhcp3-server
   78.83 -}
   78.84 -
   78.85 -# configure interfaces which act as pure bridge ports:
   78.86 -setup_bridge_port() {
   78.87 -    local dev="$1"
   78.88 -
   78.89 -    # take interface down ...
   78.90 -    ip link set ${dev} down
   78.91 -
   78.92 -    # ... and configure it
   78.93 -    ip addr flush ${dev}
   78.94 -}
   78.95 -
   78.96 -# Usage: create_bridge bridge
   78.97 -create_bridge () {
   78.98 -    local bridge=$1
   78.99 -
  78.100 -    # Don't create the bridge if it already exists.
  78.101 -    if [ ! -e "/sys/class/net/${bridge}/bridge" ]; then
  78.102 -	brctl addbr ${bridge}
  78.103 -	brctl stp ${bridge} off
  78.104 -	brctl setfd ${bridge} 0
  78.105 -    fi
  78.106 -}
  78.107 -
  78.108 -# Usage: add_to_bridge bridge dev
  78.109 -add_to_bridge () {
  78.110 -    local bridge=$1
  78.111 -    local dev=$2
  78.112 -
  78.113 -    # Don't add $dev to $bridge if it's already on a bridge.
  78.114 -    if [ -e "/sys/class/net/${bridge}/brif/${dev}" ]; then
  78.115 -	ip link set ${dev} up || true
  78.116 -	return
  78.117 -    fi
  78.118 -    brctl addif ${bridge} ${dev}
  78.119 -    ip link set ${dev} up
  78.120 -}
  78.121 -
    79.1 --- a/tools/examples/xen-script-common.sh	Mon Nov 10 15:52:15 2008 -0800
    79.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    79.3 @@ -1,44 +0,0 @@
    79.4 -#
    79.5 -# Copyright (c) 2005 XenSource Ltd.
    79.6 -#
    79.7 -# This library is free software; you can redistribute it and/or
    79.8 -# modify it under the terms of version 2.1 of the GNU Lesser General Public
    79.9 -# License as published by the Free Software Foundation.
   79.10 -#
   79.11 -# This library is distributed in the hope that it will be useful,
   79.12 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
   79.13 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   79.14 -# Lesser General Public License for more details.
   79.15 -#
   79.16 -# You should have received a copy of the GNU Lesser General Public
   79.17 -# License along with this library; if not, write to the Free Software
   79.18 -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   79.19 -#
   79.20 -
   79.21 -
   79.22 -set -e
   79.23 -
   79.24 -
   79.25 -evalVariables()
   79.26 -{
   79.27 -  for arg in "$@"
   79.28 -  do
   79.29 -    if expr 'index' "$arg" '=' '>' '1' >/dev/null
   79.30 -    then
   79.31 -      eval "$arg"
   79.32 -    fi
   79.33 -  done
   79.34 -}
   79.35 -
   79.36 -
   79.37 -findCommand()
   79.38 -{
   79.39 -  for arg in "$@"
   79.40 -  do
   79.41 -    if ! expr 'index' "$arg" '=' >/dev/null
   79.42 -    then
   79.43 -      command="$arg"
   79.44 -      return
   79.45 -    fi
   79.46 -  done
   79.47 -}
    80.1 --- a/tools/examples/xmexample.hvm	Mon Nov 10 15:52:15 2008 -0800
    80.2 +++ b/tools/examples/xmexample.hvm	Wed Feb 11 16:25:03 2009 -0800
    80.3 @@ -288,6 +288,39 @@ serial='pty'
    80.4  #  'x' -> we don't care (do not check)
    80.5  #  's' -> the bit must be the same as on the host that started this VM
    80.6  
    80.7 +#-----------------------------------------------------------------------------
    80.8 +#   Configure passthrough PCI{,-X,e} devices:
    80.9 +#
   80.10 +#   pci=[ '[SSSS:]BB:DD.F[,option1[,option2[...]]]', ... ]
   80.11 +#
   80.12 +#   [SSSS]:BB:DD.F  "bus segment:bus:device.function"(1) of the device to
   80.13 +#                   be assigned, bus segment is optional. All fields are
   80.14 +#                   in hexadecimal and no field should be longer than that
   80.15 +#                   as shown in the pattern. Successful assignment may need
   80.16 +#                   certain hardware support and additional configurations
   80.17 +#                   (e.g. VT-d, see docs/misc/vtd.txt for more details).
   80.18 +#
   80.19 +#       (1) bus segment is sometimes also referred to as the PCI "domain",
   80.20 +#           not to be confused with Xen domain.
   80.21 +#
   80.22 +#
   80.23 +#   optionN         per-device options in "key=val" format. Current
   80.24 +#                   available options are:
   80.25 +#                   - msitranslate=0|1
   80.26 +#                      per-device overriden of pci_msitranslate, see below
   80.27 +#
   80.28 +#pci=[ '07:00.0', '07:00.1' ]
   80.29 +
   80.30 +#   MSI-INTx translation for MSI capable devices:
   80.31 +#
   80.32 +#   If it's set, Xen will enable MSI for the device that supports it even
   80.33 +# if the guest don't use MSI. In the case, an IO-APIC type interrupt will
   80.34 +# be injected to the guest every time a corresponding MSI message is
   80.35 +# received.
   80.36 +#   If the guest enables MSI or MSI-X, the translation is automatically
   80.37 +# turned off.
   80.38 +# 
   80.39 +#pci_msitranslate=1
   80.40  
   80.41  #-----------------------------------------------------------------------------
   80.42  #   Configure PVSCSI devices:
    81.1 --- a/tools/firmware/Makefile	Mon Nov 10 15:52:15 2008 -0800
    81.2 +++ b/tools/firmware/Makefile	Wed Feb 11 16:25:03 2009 -0800
    81.3 @@ -15,10 +15,10 @@ SUBDIRS += hvmloader
    81.4  .PHONY: all
    81.5  all:
    81.6  	@set -e; if [ $$((`( bcc -v 2>&1 | grep version || echo 0.0.0 ) | cut -d' ' -f 3 | awk -F. '{ printf "0x%02x%02x%02x", $$1, $$2, $$3}'`)) -lt $$((0x00100e)) ] ; then \
    81.7 -	echo "***********************************************************"; \
    81.8 +	echo "==========================================================="; \
    81.9  	echo "Require dev86 package version >= 0.16.14 to build firmware!"; \
   81.10  	echo "(visit http://www.cix.co.uk/~mayday for more information)"; \
   81.11 -	echo "***********************************************************"; \
   81.12 +	echo "==========================================================="; \
   81.13  	else \
   81.14  	$(MAKE) subdirs-$@; \
   81.15  	fi
    82.1 --- a/tools/firmware/Rules.mk	Mon Nov 10 15:52:15 2008 -0800
    82.2 +++ b/tools/firmware/Rules.mk	Wed Feb 11 16:25:03 2009 -0800
    82.3 @@ -2,7 +2,7 @@
    82.4  override XEN_TARGET_ARCH = x86_32
    82.5  
    82.6  # User-supplied CFLAGS are not useful here.
    82.7 -CFLAGS :=
    82.8 +CFLAGS =
    82.9  
   82.10  include $(XEN_ROOT)/tools/Rules.mk
   82.11  
   82.12 @@ -13,9 +13,9 @@ endif
   82.13  CFLAGS += -Werror
   82.14  
   82.15  # Disable PIE/SSP if GCC supports them. They can break us.
   82.16 -CFLAGS += $(call cc-option,$(CC),-nopie,)
   82.17 -CFLAGS += $(call cc-option,$(CC),-fno-stack-protector,)
   82.18 -CFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,)
   82.19 +$(call cc-option-add,CFLAGS,CC,-nopie)
   82.20 +$(call cc-option-add,CFLAGS,CC,-fno-stack-protector)
   82.21 +$(call cc-option-add,CFLAGS,CC,-fno-stack-protector-all)
   82.22  
   82.23  # Extra CFLAGS suitable for an embedded type of environment.
   82.24  CFLAGS += -fno-builtin -msoft-float
    83.1 --- a/tools/firmware/hvmloader/32bitbios_support.c	Mon Nov 10 15:52:15 2008 -0800
    83.2 +++ b/tools/firmware/hvmloader/32bitbios_support.c	Wed Feb 11 16:25:03 2009 -0800
    83.3 @@ -32,15 +32,13 @@
    83.4  
    83.5  #include "../rombios/32bit/32bitbios_flat.h"
    83.6  
    83.7 -static void relocate_32bitbios(char *elfarray, uint32_t elfarraysize)
    83.8 +static uint32_t relocate_32bitbios(char *elfarray, uint32_t elfarraysize)
    83.9  {
   83.10      Elf32_Ehdr *ehdr = (Elf32_Ehdr *)elfarray;
   83.11      Elf32_Shdr *shdr = (Elf32_Shdr *)&elfarray[ehdr->e_shoff];
   83.12 -    char *secstrings = &elfarray[shdr[ehdr->e_shstrndx].sh_offset];
   83.13 -    char *jump_table;
   83.14      uint32_t reloc_off, reloc_size;
   83.15      char *highbiosarea;
   83.16 -    int i, jump_sec_idx = 0;
   83.17 +    int i;
   83.18  
   83.19      /*
   83.20       * Step 1. General elf cleanup, and compute total relocation size.
   83.21 @@ -51,13 +49,6 @@ static void relocate_32bitbios(char *elf
   83.22          /* By default all section data points into elf image data array. */
   83.23          shdr[i].sh_addr = (Elf32_Addr)&elfarray[shdr[i].sh_offset];
   83.24  
   83.25 -        if ( !strcmp(".biosjumptable", secstrings + shdr[i].sh_name) )
   83.26 -        {
   83.27 -            /* We do not relocate the BIOS jump table to high memory. */
   83.28 -            shdr[i].sh_flags &= ~SHF_ALLOC;
   83.29 -            jump_sec_idx = i;
   83.30 -        }
   83.31 -
   83.32          /* Fix up a corner case of address alignment. */
   83.33          if ( shdr[i].sh_addralign == 0 )
   83.34              shdr[i].sh_addralign = 1;
   83.35 @@ -76,7 +67,7 @@ static void relocate_32bitbios(char *elf
   83.36       */
   83.37      reloc_size = reloc_off;
   83.38      printf("%d bytes of ROMBIOS high-memory extensions:\n", reloc_size);
   83.39 -    highbiosarea = (char *)(long)e820_malloc(reloc_size, 0);
   83.40 +    highbiosarea = mem_alloc(reloc_size, 0);
   83.41      BUG_ON(highbiosarea == NULL);
   83.42      printf("  Relocating to 0x%x-0x%x ... ",
   83.43             (uint32_t)&highbiosarea[0],
   83.44 @@ -148,21 +139,12 @@ static void relocate_32bitbios(char *elf
   83.45          }
   83.46      }
   83.47  
   83.48 -    /* Step 5. Find the ROMBIOS jump-table stub and copy in the real table. */
   83.49 -    for ( jump_table = (char *)ROMBIOS_BEGIN;
   83.50 -          jump_table != (char *)ROMBIOS_END;
   83.51 -          jump_table++ )
   83.52 -        if ( !strncmp(jump_table, "___JMPT", 7) )
   83.53 -            break;
   83.54 -    BUG_ON(jump_table == NULL);
   83.55 -    BUG_ON(jump_sec_idx == 0);
   83.56 -    memcpy(jump_table, (char *)shdr[jump_sec_idx].sh_addr,
   83.57 -           shdr[jump_sec_idx].sh_size);
   83.58 +    printf("done\n");
   83.59  
   83.60 -    printf("done\n");
   83.61 +    return (uint32_t)highbiosarea;
   83.62  }
   83.63  
   83.64 -void highbios_setup(void)
   83.65 +uint32_t highbios_setup(void)
   83.66  {
   83.67 -    relocate_32bitbios((char *)highbios_array, sizeof(highbios_array));
   83.68 +    return relocate_32bitbios((char *)highbios_array, sizeof(highbios_array));
   83.69  }
    84.1 --- a/tools/firmware/hvmloader/Makefile	Mon Nov 10 15:52:15 2008 -0800
    84.2 +++ b/tools/firmware/hvmloader/Makefile	Wed Feb 11 16:25:03 2009 -0800
    84.3 @@ -58,4 +58,6 @@ roms.h: ../rombios/BIOS-bochs-latest ../
    84.4  .PHONY: clean
    84.5  clean: subdirs-clean
    84.6  	rm -f roms.h acpi.h
    84.7 -	rm -f hvmloader hvmloader.tmp *.o
    84.8 +	rm -f hvmloader hvmloader.tmp *.o $(DEPS)
    84.9 +
   84.10 +-include $(DEPS)
    85.1 --- a/tools/firmware/hvmloader/acpi/Makefile	Mon Nov 10 15:52:15 2008 -0800
    85.2 +++ b/tools/firmware/hvmloader/acpi/Makefile	Wed Feb 11 16:25:03 2009 -0800
    85.3 @@ -22,9 +22,6 @@ C_SRC = build.c dsdt.c static_tables.c
    85.4  H_SRC = $(wildcard *.h)
    85.5  OBJS  = $(patsubst %.c,%.o,$(C_SRC))
    85.6  
    85.7 -IASL_VER = acpica-unix-20080729
    85.8 -IASL_URL = http://acpica.org/download/$(IASL_VER).tar.gz
    85.9 -
   85.10  CFLAGS += -I. -I.. $(CFLAGS_include)
   85.11  
   85.12  vpath iasl $(PATH)
   85.13 @@ -45,15 +42,11 @@ dsdt.c: dsdt.asl
   85.14  
   85.15  iasl:
   85.16  	@echo
   85.17 -	@echo "ACPI ASL compiler(iasl) is needed"
   85.18 -	@echo "Download Intel ACPI CA"
   85.19 -	@echo "If wget failed, please download and compile manually from"
   85.20 +	@echo "ACPI ASL compiler (iasl) is needed"
   85.21 +	@echo "Download and install Intel ACPI CA from"
   85.22  	@echo "http://acpica.org/downloads/"
   85.23  	@echo 
   85.24 -	wget $(IASL_URL)
   85.25 -	tar xzf $(IASL_VER).tar.gz
   85.26 -	make -C $(IASL_VER)/compiler
   85.27 -	$(INSTALL_PROG) $(IASL_VER)/compiler/iasl $(DESTDIR)$(BINDIR)/iasl
   85.28 +	@exit 1
   85.29  
   85.30  acpi.a: $(OBJS)
   85.31  	$(AR) rc $@ $(OBJS)
   85.32 @@ -62,6 +55,8 @@ acpi.a: $(OBJS)
   85.33  	$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
   85.34  
   85.35  clean:
   85.36 -	rm -rf *.a *.o $(IASL_VER) $(IASL_VER).tar.gz
   85.37 +	rm -rf *.a *.o $(IASL_VER) $(IASL_VER).tar.gz $(DEPS)
   85.38  
   85.39  install: all
   85.40 +
   85.41 +-include $(DEPS)
    86.1 --- a/tools/firmware/hvmloader/acpi/build.c	Mon Nov 10 15:52:15 2008 -0800
    86.2 +++ b/tools/firmware/hvmloader/acpi/build.c	Wed Feb 11 16:25:03 2009 -0800
    86.3 @@ -48,50 +48,11 @@ static void set_checksum(
    86.4      p[checksum_offset] = -sum;
    86.5  }
    86.6  
    86.7 -static int uart_exists(uint16_t uart_base)
    86.8 -{
    86.9 -    uint16_t ier = uart_base + 1;
   86.10 -    uint8_t a, b, c;
   86.11 -
   86.12 -    a = inb(ier);
   86.13 -    outb(ier, 0);
   86.14 -    b = inb(ier);
   86.15 -    outb(ier, 0xf);
   86.16 -    c = inb(ier);
   86.17 -    outb(ier, a);
   86.18 -
   86.19 -    return ((b == 0) && (c == 0xf));
   86.20 -}
   86.21 -
   86.22 -static int hpet_exists(unsigned long hpet_base)
   86.23 -{
   86.24 -    uint32_t hpet_id = *(uint32_t *)hpet_base;
   86.25 -    return ((hpet_id >> 16) == 0x8086);
   86.26 -}
   86.27 -
   86.28  static uint8_t battery_port_exists(void)
   86.29  {
   86.30      return (inb(0x88) == 0x1F);
   86.31  }
   86.32  
   86.33 -static int construct_bios_info_table(uint8_t *buf)
   86.34 -{
   86.35 -    struct bios_info *bios_info = (struct bios_info *)buf;
   86.36 -
   86.37 -    memset(bios_info, 0, sizeof(*bios_info));
   86.38 -
   86.39 -    bios_info->com1_present = uart_exists(0x3f8);
   86.40 -    bios_info->com2_present = uart_exists(0x2f8);
   86.41 -
   86.42 -    bios_info->hpet_present = hpet_exists(ACPI_HPET_ADDRESS);
   86.43 -
   86.44 -    bios_info->pci_min = PCI_MEMBASE;
   86.45 -    bios_info->pci_len = PCI_MEMSIZE;
   86.46 -    bios_info->xen_pfiob = 0xdead;
   86.47 -
   86.48 -    return align16(sizeof(*bios_info));
   86.49 -}
   86.50 -
   86.51  static int construct_madt(struct acpi_20_madt *madt)
   86.52  {
   86.53      struct acpi_20_madt_intsrcovr *intsrcovr;
   86.54 @@ -150,7 +111,7 @@ static int construct_madt(struct acpi_20
   86.55      offset += sizeof(*io_apic);
   86.56  
   86.57      lapic = (struct acpi_20_madt_lapic *)(io_apic + 1);
   86.58 -    for ( i = 0; i < get_vcpu_nr(); i++ )
   86.59 +    for ( i = 0; i < hvm_info->nr_vcpus; i++ )
   86.60      {
   86.61          memset(lapic, 0, sizeof(*lapic));
   86.62          lapic->type    = ACPI_PROCESSOR_LOCAL_APIC;
   86.63 @@ -199,9 +160,10 @@ static int construct_secondary_tables(ui
   86.64      struct acpi_20_tcpa *tcpa;
   86.65      static const uint16_t tis_signature[] = {0x0001, 0x0001, 0x0001};
   86.66      uint16_t *tis_hdr;
   86.67 +    void *lasa;
   86.68  
   86.69      /* MADT. */
   86.70 -    if ( (get_vcpu_nr() > 1) || get_apic_mode() )
   86.71 +    if ( (hvm_info->nr_vcpus > 1) || hvm_info->apic_mode )
   86.72      {
   86.73          madt = (struct acpi_20_madt *)&buf[offset];
   86.74          offset += construct_madt(madt);
   86.75 @@ -246,11 +208,11 @@ static int construct_secondary_tables(ui
   86.76          tcpa->header.oem_revision = ACPI_OEM_REVISION;
   86.77          tcpa->header.creator_id   = ACPI_CREATOR_ID;
   86.78          tcpa->header.creator_revision = ACPI_CREATOR_REVISION;
   86.79 -        tcpa->lasa = e820_malloc(ACPI_2_0_TCPA_LAML_SIZE, 0);
   86.80 -        if ( tcpa->lasa )
   86.81 +        if ( (lasa = mem_alloc(ACPI_2_0_TCPA_LAML_SIZE, 0)) != NULL )
   86.82          {
   86.83 +            tcpa->lasa = virt_to_phys(lasa);
   86.84              tcpa->laml = ACPI_2_0_TCPA_LAML_SIZE;
   86.85 -            memset((char *)(unsigned long)tcpa->lasa, 0, tcpa->laml);
   86.86 +            memset(lasa, 0, tcpa->laml);
   86.87              set_checksum(tcpa,
   86.88                           offsetof(struct acpi_header, checksum),
   86.89                           tcpa->header.length);
   86.90 @@ -348,9 +310,7 @@ static void __acpi_build_tables(uint8_t 
   86.91      buf = (uint8_t *)ACPI_PHYSICAL_ADDRESS;
   86.92      offset = 0;
   86.93  
   86.94 -    offset += construct_bios_info_table(&buf[offset]);
   86.95      rsdp = (struct acpi_20_rsdp *)&buf[offset];
   86.96 -
   86.97      memcpy(rsdp, &Rsdp, sizeof(struct acpi_20_rsdp));
   86.98      offset += align16(sizeof(struct acpi_20_rsdp));
   86.99      rsdp->rsdt_address = (unsigned long)rsdt;
  86.100 @@ -376,7 +336,7 @@ void acpi_build_tables(void)
  86.101      memset(buf, 0, high_sz);
  86.102  
  86.103      /* Allocate data area and set up ACPI tables there. */
  86.104 -    buf = (uint8_t *)e820_malloc(high_sz, 0);
  86.105 +    buf = mem_alloc(high_sz, 0);
  86.106      __acpi_build_tables(buf, &low_sz, &high_sz);
  86.107  
  86.108      printf(" - Lo data: %08lx-%08lx\n"
    87.1 --- a/tools/firmware/hvmloader/acpi/dsdt.asl	Mon Nov 10 15:52:15 2008 -0800
    87.2 +++ b/tools/firmware/hvmloader/acpi/dsdt.asl	Wed Feb 11 16:25:03 2009 -0800
    87.3 @@ -86,7 +86,7 @@ DefinitionBlock ("DSDT.aml", "DSDT", 2, 
    87.4  
    87.5      Scope (\_SB)
    87.6      {
    87.7 -       /* ACPI_PHYSICAL_ADDRESS == 0xEA000 */
    87.8 +       /* BIOS_INFO_PHYSICAL_ADDRESS == 0xEA000 */
    87.9         OperationRegion(BIOS, SystemMemory, 0xEA000, 16)
   87.10         Field(BIOS, ByteAcc, NoLock, Preserve) {
   87.11             UAR1, 1,
   87.12 @@ -122,6 +122,20 @@ DefinitionBlock ("DSDT.aml", "DSDT", 2, 
   87.13             Name (_ADR, 0x00)
   87.14             Name (_BBN, 0x00)
   87.15  
   87.16 +           /*
   87.17 +            * Reserve the IO port ranges [0x10c0, 0x10c2] and [0xb044, 0xb047].
   87.18 +            * Or else, for a hotplugged-in device, the port IO BAR assigned
   87.19 +            * by guest OS may conflict with the ranges here.
   87.20 +            */
   87.21 +           Device(HP0)
   87.22 +           {
   87.23 +               Name(_HID, EISAID("PNP0C02"))
   87.24 +               Name(_CRS, ResourceTemplate() {
   87.25 +                   IO (Decode16, 0x10c0, 0x10c0, 0x00, 0x03)
   87.26 +                   IO (Decode16, 0xb044, 0xb044, 0x00, 0x04)
   87.27 +               })
   87.28 +           }
   87.29 +
   87.30             Method (_CRS, 0, NotSerialized)
   87.31             {
   87.32                 Name (PRT0, ResourceTemplate ()
    88.1 --- a/tools/firmware/hvmloader/acpi/dsdt.c	Mon Nov 10 15:52:15 2008 -0800
    88.2 +++ b/tools/firmware/hvmloader/acpi/dsdt.c	Wed Feb 11 16:25:03 2009 -0800
    88.3 @@ -1,22 +1,22 @@
    88.4  /*
    88.5   * 
    88.6   * Intel ACPI Component Architecture
    88.7 - * ASL Optimizing Compiler version 20060707 [Feb 16 2007]
    88.8 - * Copyright (C) 2000 - 2006 Intel Corporation
    88.9 + * ASL Optimizing Compiler version 20081204 [Jan 23 2009]
   88.10 + * Copyright (C) 2000 - 2008 Intel Corporation
   88.11   * Supports ACPI Specification Revision 3.0a
   88.12   * 
   88.13 - * Compilation of "dsdt.asl" - Tue May 20 14:34:40 2008
   88.14 + * Compilation of "dsdt.asl" - Fri Jan 23 14:30:29 2009
   88.15   * 
   88.16   * C source code output
   88.17   *
   88.18   */
   88.19  unsigned char AmlCode[] =
   88.20  {
   88.21 -    0x44,0x53,0x44,0x54,0x32,0x11,0x00,0x00,  /* 00000000    "DSDT2..." */
   88.22 -    0x02,0xEC,0x58,0x65,0x6E,0x00,0x00,0x00,  /* 00000008    "..Xen..." */
   88.23 +    0x44,0x53,0x44,0x54,0x5E,0x11,0x00,0x00,  /* 00000000    "DSDT^..." */
   88.24 +    0x02,0xEB,0x58,0x65,0x6E,0x00,0x00,0x00,  /* 00000008    "..Xen..." */
   88.25      0x48,0x56,0x4D,0x00,0x00,0x00,0x00,0x00,  /* 00000010    "HVM....." */
   88.26      0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C,  /* 00000018    "....INTL" */
   88.27 -    0x07,0x07,0x06,0x20,0x08,0x50,0x4D,0x42,  /* 00000020    "... .PMB" */
   88.28 +    0x04,0x12,0x08,0x20,0x08,0x50,0x4D,0x42,  /* 00000020    "... .PMB" */
   88.29      0x53,0x0B,0x00,0x0C,0x08,0x50,0x4D,0x4C,  /* 00000028    "S....PML" */
   88.30      0x4E,0x0A,0x08,0x08,0x49,0x4F,0x42,0x31,  /* 00000030    "N...IOB1" */
   88.31      0x00,0x08,0x49,0x4F,0x4C,0x31,0x00,0x08,  /* 00000038    "..IOL1.." */
   88.32 @@ -56,7 +56,7 @@ unsigned char AmlCode[] =
   88.33      0x07,0x0A,0x07,0x00,0x00,0x08,0x50,0x49,  /* 00000148    "......PI" */
   88.34      0x43,0x44,0x00,0x14,0x0C,0x5F,0x50,0x49,  /* 00000150    "CD..._PI" */
   88.35      0x43,0x01,0x70,0x68,0x50,0x49,0x43,0x44,  /* 00000158    "C.phPICD" */
   88.36 -    0x10,0x42,0xF1,0x5F,0x53,0x42,0x5F,0x5B,  /* 00000160    ".B._SB_[" */
   88.37 +    0x10,0x4E,0xF3,0x5F,0x53,0x42,0x5F,0x5B,  /* 00000160    ".N._SB_[" */
   88.38      0x80,0x42,0x49,0x4F,0x53,0x00,0x0C,0x00,  /* 00000168    ".BIOS..." */
   88.39      0xA0,0x0E,0x00,0x0A,0x10,0x5B,0x81,0x21,  /* 00000170    ".....[.!" */
   88.40      0x42,0x49,0x4F,0x53,0x01,0x55,0x41,0x52,  /* 00000178    "BIOS.UAR" */
   88.41 @@ -72,496 +72,501 @@ unsigned char AmlCode[] =
   88.42      0x00,0xFF,0xFF,0x09,0x00,0x00,0x00,0x00,  /* 000001C8    "........" */
   88.43      0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 000001D0    "........" */
   88.44      0x00,0x00,0x00,0x0A,0x00,0x00,0x00,0x00,  /* 000001D8    "........" */
   88.45 -    0x00,0x79,0x00,0x5B,0x82,0x4E,0xE8,0x50,  /* 000001E0    ".y.[.N.P" */
   88.46 +    0x00,0x79,0x00,0x5B,0x82,0x4A,0xEB,0x50,  /* 000001E0    ".y.[.J.P" */
   88.47      0x43,0x49,0x30,0x08,0x5F,0x48,0x49,0x44,  /* 000001E8    "CI0._HID" */
   88.48      0x0C,0x41,0xD0,0x0A,0x03,0x08,0x5F,0x55,  /* 000001F0    ".A...._U" */
   88.49      0x49,0x44,0x00,0x08,0x5F,0x41,0x44,0x52,  /* 000001F8    "ID.._ADR" */
   88.50 -    0x00,0x08,0x5F,0x42,0x42,0x4E,0x00,0x14,  /* 00000200    ".._BBN.." */
   88.51 -    0x4E,0x0C,0x5F,0x43,0x52,0x53,0x00,0x08,  /* 00000208    "N._CRS.." */
   88.52 -    0x50,0x52,0x54,0x30,0x11,0x42,0x07,0x0A,  /* 00000210    "PRT0.B.." */
   88.53 -    0x6E,0x88,0x0D,0x00,0x02,0x0E,0x00,0x00,  /* 00000218    "n......." */
   88.54 -    0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,  /* 00000220    "........" */
   88.55 -    0x01,0x47,0x01,0xF8,0x0C,0xF8,0x0C,0x01,  /* 00000228    ".G......" */
   88.56 -    0x08,0x88,0x0D,0x00,0x01,0x0C,0x03,0x00,  /* 00000230    "........" */
   88.57 -    0x00,0x00,0x00,0xF7,0x0C,0x00,0x00,0xF8,  /* 00000238    "........" */
   88.58 -    0x0C,0x88,0x0D,0x00,0x01,0x0C,0x03,0x00,  /* 00000240    "........" */
   88.59 -    0x00,0x00,0x0D,0xFF,0xFF,0x00,0x00,0x00,  /* 00000248    "........" */
   88.60 -    0xF3,0x87,0x17,0x00,0x00,0x0C,0x03,0x00,  /* 00000250    "........" */
   88.61 -    0x00,0x00,0x00,0x00,0x00,0x0A,0x00,0xFF,  /* 00000258    "........" */
   88.62 -    0xFF,0x0B,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000260    "........" */
   88.63 -    0x00,0x02,0x00,0x87,0x17,0x00,0x00,0x0C,  /* 00000268    "........" */
   88.64 -    0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000270    "........" */
   88.65 -    0xF0,0xFF,0xFF,0xFF,0xF4,0x00,0x00,0x00,  /* 00000278    "........" */
   88.66 -    0x00,0x00,0x00,0x00,0x05,0x79,0x00,0x8A,  /* 00000280    ".....y.." */
   88.67 -    0x50,0x52,0x54,0x30,0x0A,0x5C,0x4D,0x4D,  /* 00000288    "PRT0.\MM" */
   88.68 -    0x49,0x4E,0x8A,0x50,0x52,0x54,0x30,0x0A,  /* 00000290    "IN.PRT0." */
   88.69 -    0x60,0x4D,0x4D,0x41,0x58,0x8A,0x50,0x52,  /* 00000298    "`MMAX.PR" */
   88.70 -    0x54,0x30,0x0A,0x68,0x4D,0x4C,0x45,0x4E,  /* 000002A0    "T0.hMLEN" */
   88.71 -    0x70,0x50,0x4D,0x49,0x4E,0x4D,0x4D,0x49,  /* 000002A8    "pPMINMMI" */
   88.72 -    0x4E,0x70,0x50,0x4C,0x45,0x4E,0x4D,0x4C,  /* 000002B0    "NpPLENML" */
   88.73 -    0x45,0x4E,0x72,0x4D,0x4D,0x49,0x4E,0x4D,  /* 000002B8    "ENrMMINM" */
   88.74 -    0x4C,0x45,0x4E,0x4D,0x4D,0x41,0x58,0x74,  /* 000002C0    "LENMMAXt" */
   88.75 -    0x4D,0x4D,0x41,0x58,0x01,0x4D,0x4D,0x41,  /* 000002C8    "MMAX.MMA" */
   88.76 -    0x58,0xA4,0x50,0x52,0x54,0x30,0x08,0x42,  /* 000002D0    "X.PRT0.B" */
   88.77 -    0x55,0x46,0x41,0x11,0x09,0x0A,0x06,0x23,  /* 000002D8    "UFA....#" */
   88.78 -    0x20,0x0C,0x18,0x79,0x00,0x08,0x42,0x55,  /* 000002E0    " ..y..BU" */
   88.79 -    0x46,0x42,0x11,0x09,0x0A,0x06,0x23,0x00,  /* 000002E8    "FB....#." */
   88.80 -    0x00,0x18,0x79,0x00,0x8B,0x42,0x55,0x46,  /* 000002F0    "..y..BUF" */
   88.81 -    0x42,0x01,0x49,0x52,0x51,0x56,0x5B,0x82,  /* 000002F8    "B.IRQV[." */
   88.82 -    0x48,0x08,0x4C,0x4E,0x4B,0x41,0x08,0x5F,  /* 00000300    "H.LNKA._" */
   88.83 -    0x48,0x49,0x44,0x0C,0x41,0xD0,0x0C,0x0F,  /* 00000308    "HID.A..." */
   88.84 -    0x08,0x5F,0x55,0x49,0x44,0x01,0x14,0x1C,  /* 00000310    "._UID..." */
   88.85 -    0x5F,0x53,0x54,0x41,0x00,0x7B,0x50,0x49,  /* 00000318    "_STA.{PI" */
   88.86 -    0x52,0x41,0x0A,0x80,0x60,0xA0,0x08,0x93,  /* 00000320    "RA..`..." */
   88.87 -    0x60,0x0A,0x80,0xA4,0x0A,0x09,0xA1,0x04,  /* 00000328    "`......." */
   88.88 -    0xA4,0x0A,0x0B,0x14,0x0B,0x5F,0x50,0x52,  /* 00000330    "....._PR" */
   88.89 -    0x53,0x00,0xA4,0x42,0x55,0x46,0x41,0x14,  /* 00000338    "S..BUFA." */
   88.90 -    0x11,0x5F,0x44,0x49,0x53,0x00,0x7D,0x50,  /* 00000340    "._DIS.}P" */
   88.91 -    0x49,0x52,0x41,0x0A,0x80,0x50,0x49,0x52,  /* 00000348    "IRA..PIR" */
   88.92 -    0x41,0x14,0x1A,0x5F,0x43,0x52,0x53,0x00,  /* 00000350    "A.._CRS." */
   88.93 -    0x7B,0x50,0x49,0x52,0x41,0x0A,0x0F,0x60,  /* 00000358    "{PIRA..`" */
   88.94 -    0x79,0x01,0x60,0x49,0x52,0x51,0x56,0xA4,  /* 00000360    "y.`IRQV." */
   88.95 -    0x42,0x55,0x46,0x42,0x14,0x1B,0x5F,0x53,  /* 00000368    "BUFB.._S" */
   88.96 -    0x52,0x53,0x01,0x8B,0x68,0x01,0x49,0x52,  /* 00000370    "RS..h.IR" */
   88.97 -    0x51,0x31,0x82,0x49,0x52,0x51,0x31,0x60,  /* 00000378    "Q1.IRQ1`" */
   88.98 -    0x76,0x60,0x70,0x60,0x50,0x49,0x52,0x41,  /* 00000380    "v`p`PIRA" */
   88.99 -    0x5B,0x82,0x49,0x08,0x4C,0x4E,0x4B,0x42,  /* 00000388    "[.I.LNKB" */
  88.100 -    0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,  /* 00000390    "._HID.A." */
  88.101 -    0x0C,0x0F,0x08,0x5F,0x55,0x49,0x44,0x0A,  /* 00000398    "..._UID." */
  88.102 -    0x02,0x14,0x1C,0x5F,0x53,0x54,0x41,0x00,  /* 000003A0    "..._STA." */
  88.103 -    0x7B,0x50,0x49,0x52,0x42,0x0A,0x80,0x60,  /* 000003A8    "{PIRB..`" */
  88.104 -    0xA0,0x08,0x93,0x60,0x0A,0x80,0xA4,0x0A,  /* 000003B0    "...`...." */
  88.105 -    0x09,0xA1,0x04,0xA4,0x0A,0x0B,0x14,0x0B,  /* 000003B8    "........" */
  88.106 -    0x5F,0x50,0x52,0x53,0x00,0xA4,0x42,0x55,  /* 000003C0    "_PRS..BU" */
  88.107 -    0x46,0x41,0x14,0x11,0x5F,0x44,0x49,0x53,  /* 000003C8    "FA.._DIS" */
  88.108 -    0x00,0x7D,0x50,0x49,0x52,0x42,0x0A,0x80,  /* 000003D0    ".}PIRB.." */
  88.109 -    0x50,0x49,0x52,0x42,0x14,0x1A,0x5F,0x43,  /* 000003D8    "PIRB.._C" */
  88.110 -    0x52,0x53,0x00,0x7B,0x50,0x49,0x52,0x42,  /* 000003E0    "RS.{PIRB" */
  88.111 -    0x0A,0x0F,0x60,0x79,0x01,0x60,0x49,0x52,  /* 000003E8    "..`y.`IR" */
  88.112 -    0x51,0x56,0xA4,0x42,0x55,0x46,0x42,0x14,  /* 000003F0    "QV.BUFB." */
  88.113 -    0x1B,0x5F,0x53,0x52,0x53,0x01,0x8B,0x68,  /* 000003F8    "._SRS..h" */
  88.114 -    0x01,0x49,0x52,0x51,0x31,0x82,0x49,0x52,  /* 00000400    ".IRQ1.IR" */
  88.115 -    0x51,0x31,0x60,0x76,0x60,0x70,0x60,0x50,  /* 00000408    "Q1`v`p`P" */
  88.116 -    0x49,0x52,0x42,0x5B,0x82,0x49,0x08,0x4C,  /* 00000410    "IRB[.I.L" */
  88.117 -    0x4E,0x4B,0x43,0x08,0x5F,0x48,0x49,0x44,  /* 00000418    "NKC._HID" */
  88.118 -    0x0C,0x41,0xD0,0x0C,0x0F,0x08,0x5F,0x55,  /* 00000420    ".A...._U" */
  88.119 -    0x49,0x44,0x0A,0x03,0x14,0x1C,0x5F,0x53,  /* 00000428    "ID...._S" */
  88.120 -    0x54,0x41,0x00,0x7B,0x50,0x49,0x52,0x43,  /* 00000430    "TA.{PIRC" */
  88.121 -    0x0A,0x80,0x60,0xA0,0x08,0x93,0x60,0x0A,  /* 00000438    "..`...`." */
  88.122 -    0x80,0xA4,0x0A,0x09,0xA1,0x04,0xA4,0x0A,  /* 00000440    "........" */
  88.123 -    0x0B,0x14,0x0B,0x5F,0x50,0x52,0x53,0x00,  /* 00000448    "..._PRS." */
  88.124 -    0xA4,0x42,0x55,0x46,0x41,0x14,0x11,0x5F,  /* 00000450    ".BUFA.._" */
  88.125 -    0x44,0x49,0x53,0x00,0x7D,0x50,0x49,0x52,  /* 00000458    "DIS.}PIR" */
  88.126 -    0x43,0x0A,0x80,0x50,0x49,0x52,0x43,0x14,  /* 00000460    "C..PIRC." */
  88.127 -    0x1A,0x5F,0x43,0x52,0x53,0x00,0x7B,0x50,  /* 00000468    "._CRS.{P" */
  88.128 -    0x49,0x52,0x43,0x0A,0x0F,0x60,0x79,0x01,  /* 00000470    "IRC..`y." */
  88.129 -    0x60,0x49,0x52,0x51,0x56,0xA4,0x42,0x55,  /* 00000478    "`IRQV.BU" */
  88.130 -    0x46,0x42,0x14,0x1B,0x5F,0x53,0x52,0x53,  /* 00000480    "FB.._SRS" */
  88.131 -    0x01,0x8B,0x68,0x01,0x49,0x52,0x51,0x31,  /* 00000488    "..h.IRQ1" */
  88.132 -    0x82,0x49,0x52,0x51,0x31,0x60,0x76,0x60,  /* 00000490    ".IRQ1`v`" */
  88.133 -    0x70,0x60,0x50,0x49,0x52,0x43,0x5B,0x82,  /* 00000498    "p`PIRC[." */
  88.134 -    0x49,0x08,0x4C,0x4E,0x4B,0x44,0x08,0x5F,  /* 000004A0    "I.LNKD._" */
  88.135 -    0x48,0x49,0x44,0x0C,0x41,0xD0,0x0C,0x0F,  /* 000004A8    "HID.A..." */
  88.136 -    0x08,0x5F,0x55,0x49,0x44,0x0A,0x04,0x14,  /* 000004B0    "._UID..." */
  88.137 -    0x1C,0x5F,0x53,0x54,0x41,0x00,0x7B,0x50,  /* 000004B8    "._STA.{P" */
  88.138 -    0x49,0x52,0x44,0x0A,0x80,0x60,0xA0,0x08,  /* 000004C0    "IRD..`.." */
  88.139 -    0x93,0x60,0x0A,0x80,0xA4,0x0A,0x09,0xA1,  /* 000004C8    ".`......" */
  88.140 -    0x04,0xA4,0x0A,0x0B,0x14,0x0B,0x5F,0x50,  /* 000004D0    "......_P" */
  88.141 -    0x52,0x53,0x00,0xA4,0x42,0x55,0x46,0x41,  /* 000004D8    "RS..BUFA" */
  88.142 -    0x14,0x11,0x5F,0x44,0x49,0x53,0x00,0x7D,  /* 000004E0    ".._DIS.}" */
  88.143 -    0x50,0x49,0x52,0x44,0x0A,0x80,0x50,0x49,  /* 000004E8    "PIRD..PI" */
  88.144 -    0x52,0x44,0x14,0x1A,0x5F,0x43,0x52,0x53,  /* 000004F0    "RD.._CRS" */
  88.145 -    0x00,0x7B,0x50,0x49,0x52,0x44,0x0A,0x0F,  /* 000004F8    ".{PIRD.." */
  88.146 -    0x60,0x79,0x01,0x60,0x49,0x52,0x51,0x56,  /* 00000500    "`y.`IRQV" */
  88.147 -    0xA4,0x42,0x55,0x46,0x42,0x14,0x1B,0x5F,  /* 00000508    ".BUFB.._" */
  88.148 -    0x53,0x52,0x53,0x01,0x8B,0x68,0x01,0x49,  /* 00000510    "SRS..h.I" */
  88.149 -    0x52,0x51,0x31,0x82,0x49,0x52,0x51,0x31,  /* 00000518    "RQ1.IRQ1" */
  88.150 -    0x60,0x76,0x60,0x70,0x60,0x50,0x49,0x52,  /* 00000520    "`v`p`PIR" */
  88.151 -    0x44,0x5B,0x82,0x44,0x05,0x48,0x50,0x45,  /* 00000528    "D[.D.HPE" */
  88.152 -    0x54,0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,  /* 00000530    "T._HID.A" */
  88.153 -    0xD0,0x01,0x03,0x08,0x5F,0x55,0x49,0x44,  /* 00000538    "...._UID" */
  88.154 -    0x00,0x14,0x18,0x5F,0x53,0x54,0x41,0x00,  /* 00000540    "..._STA." */
  88.155 -    0xA0,0x0C,0x93,0x5E,0x5E,0x5E,0x48,0x50,  /* 00000548    "...^^^HP" */
  88.156 -    0x45,0x54,0x00,0xA4,0x00,0xA1,0x04,0xA4,  /* 00000550    "ET......" */
  88.157 -    0x0A,0x0F,0x08,0x5F,0x43,0x52,0x53,0x11,  /* 00000558    "..._CRS." */
  88.158 -    0x1F,0x0A,0x1C,0x87,0x17,0x00,0x00,0x0D,  /* 00000560    "........" */
  88.159 -    0x01,0x00,0x00,0x00,0x00,0x00,0x00,0xD0,  /* 00000568    "........" */
  88.160 -    0xFE,0xFF,0x03,0xD0,0xFE,0x00,0x00,0x00,  /* 00000570    "........" */
  88.161 -    0x00,0x00,0x04,0x00,0x00,0x79,0x00,0x14,  /* 00000578    ".....y.." */
  88.162 -    0x16,0x5F,0x50,0x52,0x54,0x00,0xA0,0x0A,  /* 00000580    "._PRT..." */
  88.163 -    0x50,0x49,0x43,0x44,0xA4,0x50,0x52,0x54,  /* 00000588    "PICD.PRT" */
  88.164 -    0x41,0xA4,0x50,0x52,0x54,0x50,0x08,0x50,  /* 00000590    "A.PRTP.P" */
  88.165 -    0x52,0x54,0x50,0x12,0x49,0x36,0x3C,0x12,  /* 00000598    "RTP.I6<." */
  88.166 -    0x0D,0x04,0x0C,0xFF,0xFF,0x01,0x00,0x00,  /* 000005A0    "........" */
  88.167 -    0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0D,0x04,  /* 000005A8    "LNKB...." */
  88.168 -    0x0C,0xFF,0xFF,0x01,0x00,0x01,0x4C,0x4E,  /* 000005B0    "......LN" */
  88.169 -    0x4B,0x43,0x00,0x12,0x0E,0x04,0x0C,0xFF,  /* 000005B8    "KC......" */
  88.170 -    0xFF,0x01,0x00,0x0A,0x02,0x4C,0x4E,0x4B,  /* 000005C0    ".....LNK" */
  88.171 -    0x44,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,  /* 000005C8    "D......." */
  88.172 -    0x01,0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x41,  /* 000005D0    "....LNKA" */
  88.173 -    0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x02,  /* 000005D8    "........" */
  88.174 -    0x00,0x00,0x4C,0x4E,0x4B,0x43,0x00,0x12,  /* 000005E0    "..LNKC.." */
  88.175 -    0x0D,0x04,0x0C,0xFF,0xFF,0x02,0x00,0x01,  /* 000005E8    "........" */
  88.176 -    0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0E,0x04,  /* 000005F0    "LNKD...." */
  88.177 -    0x0C,0xFF,0xFF,0x02,0x00,0x0A,0x02,0x4C,  /* 000005F8    ".......L" */
  88.178 -    0x4E,0x4B,0x41,0x00,0x12,0x0E,0x04,0x0C,  /* 00000600    "NKA....." */
  88.179 -    0xFF,0xFF,0x02,0x00,0x0A,0x03,0x4C,0x4E,  /* 00000608    "......LN" */
  88.180 -    0x4B,0x42,0x00,0x12,0x0D,0x04,0x0C,0xFF,  /* 00000610    "KB......" */
  88.181 -    0xFF,0x03,0x00,0x00,0x4C,0x4E,0x4B,0x44,  /* 00000618    "....LNKD" */
  88.182 -    0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x03,  /* 00000620    "........" */
  88.183 -    0x00,0x01,0x4C,0x4E,0x4B,0x41,0x00,0x12,  /* 00000628    "..LNKA.." */
  88.184 -    0x0E,0x04,0x0C,0xFF,0xFF,0x03,0x00,0x0A,  /* 00000630    "........" */
  88.185 -    0x02,0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0E,  /* 00000638    ".LNKB..." */
  88.186 -    0x04,0x0C,0xFF,0xFF,0x03,0x00,0x0A,0x03,  /* 00000640    "........" */
  88.187 -    0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0D,0x04,  /* 00000648    "LNKC...." */
  88.188 -    0x0C,0xFF,0xFF,0x04,0x00,0x00,0x4C,0x4E,  /* 00000650    "......LN" */
  88.189 -    0x4B,0x41,0x00,0x12,0x0D,0x04,0x0C,0xFF,  /* 00000658    "KA......" */
  88.190 -    0xFF,0x04,0x00,0x01,0x4C,0x4E,0x4B,0x42,  /* 00000660    "....LNKB" */
  88.191 -    0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x04,  /* 00000668    "........" */
  88.192 -    0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x43,0x00,  /* 00000670    "...LNKC." */
  88.193 -    0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x04,0x00,  /* 00000678    "........" */
  88.194 -    0x0A,0x03,0x4C,0x4E,0x4B,0x44,0x00,0x12,  /* 00000680    "..LNKD.." */
  88.195 -    0x0D,0x04,0x0C,0xFF,0xFF,0x05,0x00,0x00,  /* 00000688    "........" */
  88.196 -    0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0D,0x04,  /* 00000690    "LNKB...." */
  88.197 -    0x0C,0xFF,0xFF,0x05,0x00,0x01,0x4C,0x4E,  /* 00000698    "......LN" */
  88.198 -    0x4B,0x43,0x00,0x12,0x0E,0x04,0x0C,0xFF,  /* 000006A0    "KC......" */
  88.199 -    0xFF,0x05,0x00,0x0A,0x02,0x4C,0x4E,0x4B,  /* 000006A8    ".....LNK" */
  88.200 -    0x44,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,  /* 000006B0    "D......." */
  88.201 -    0x05,0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x41,  /* 000006B8    "....LNKA" */
  88.202 -    0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x06,  /* 000006C0    "........" */
  88.203 -    0x00,0x00,0x4C,0x4E,0x4B,0x43,0x00,0x12,  /* 000006C8    "..LNKC.." */
  88.204 -    0x0D,0x04,0x0C,0xFF,0xFF,0x06,0x00,0x01,  /* 000006D0    "........" */
  88.205 -    0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0E,0x04,  /* 000006D8    "LNKD...." */
  88.206 -    0x0C,0xFF,0xFF,0x06,0x00,0x0A,0x02,0x4C,  /* 000006E0    ".......L" */
  88.207 -    0x4E,0x4B,0x41,0x00,0x12,0x0E,0x04,0x0C,  /* 000006E8    "NKA....." */
  88.208 -    0xFF,0xFF,0x06,0x00,0x0A,0x03,0x4C,0x4E,  /* 000006F0    "......LN" */
  88.209 -    0x4B,0x42,0x00,0x12,0x0D,0x04,0x0C,0xFF,  /* 000006F8    "KB......" */
  88.210 -    0xFF,0x07,0x00,0x00,0x4C,0x4E,0x4B,0x44,  /* 00000700    "....LNKD" */
  88.211 -    0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x07,  /* 00000708    "........" */
  88.212 -    0x00,0x01,0x4C,0x4E,0x4B,0x41,0x00,0x12,  /* 00000710    "..LNKA.." */
  88.213 -    0x0E,0x04,0x0C,0xFF,0xFF,0x07,0x00,0x0A,  /* 00000718    "........" */
  88.214 -    0x02,0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0E,  /* 00000720    ".LNKB..." */
  88.215 -    0x04,0x0C,0xFF,0xFF,0x07,0x00,0x0A,0x03,  /* 00000728    "........" */
  88.216 -    0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0D,0x04,  /* 00000730    "LNKC...." */
  88.217 -    0x0C,0xFF,0xFF,0x08,0x00,0x00,0x4C,0x4E,  /* 00000738    "......LN" */
  88.218 -    0x4B,0x41,0x00,0x12,0x0D,0x04,0x0C,0xFF,  /* 00000740    "KA......" */
  88.219 -    0xFF,0x08,0x00,0x01,0x4C,0x4E,0x4B,0x42,  /* 00000748    "....LNKB" */
  88.220 -    0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x08,  /* 00000750    "........" */
  88.221 -    0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x43,0x00,  /* 00000758    "...LNKC." */
  88.222 -    0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x08,0x00,  /* 00000760    "........" */
  88.223 -    0x0A,0x03,0x4C,0x4E,0x4B,0x44,0x00,0x12,  /* 00000768    "..LNKD.." */
  88.224 -    0x0D,0x04,0x0C,0xFF,0xFF,0x09,0x00,0x00,  /* 00000770    "........" */
  88.225 -    0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0D,0x04,  /* 00000778    "LNKB...." */
  88.226 -    0x0C,0xFF,0xFF,0x09,0x00,0x01,0x4C,0x4E,  /* 00000780    "......LN" */
  88.227 -    0x4B,0x43,0x00,0x12,0x0E,0x04,0x0C,0xFF,  /* 00000788    "KC......" */
  88.228 -    0xFF,0x09,0x00,0x0A,0x02,0x4C,0x4E,0x4B,  /* 00000790    ".....LNK" */
  88.229 -    0x44,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,  /* 00000798    "D......." */
  88.230 -    0x09,0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x41,  /* 000007A0    "....LNKA" */
  88.231 -    0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x0A,  /* 000007A8    "........" */
  88.232 -    0x00,0x00,0x4C,0x4E,0x4B,0x43,0x00,0x12,  /* 000007B0    "..LNKC.." */
  88.233 -    0x0D,0x04,0x0C,0xFF,0xFF,0x0A,0x00,0x01,  /* 000007B8    "........" */
  88.234 -    0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0E,0x04,  /* 000007C0    "LNKD...." */
  88.235 -    0x0C,0xFF,0xFF,0x0A,0x00,0x0A,0x02,0x4C,  /* 000007C8    ".......L" */
  88.236 -    0x4E,0x4B,0x41,0x00,0x12,0x0E,0x04,0x0C,  /* 000007D0    "NKA....." */
  88.237 -    0xFF,0xFF,0x0A,0x00,0x0A,0x03,0x4C,0x4E,  /* 000007D8    "......LN" */
  88.238 -    0x4B,0x42,0x00,0x12,0x0D,0x04,0x0C,0xFF,  /* 000007E0    "KB......" */
  88.239 -    0xFF,0x0B,0x00,0x00,0x4C,0x4E,0x4B,0x44,  /* 000007E8    "....LNKD" */
  88.240 -    0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x0B,  /* 000007F0    "........" */
  88.241 -    0x00,0x01,0x4C,0x4E,0x4B,0x41,0x00,0x12,  /* 000007F8    "..LNKA.." */
  88.242 -    0x0E,0x04,0x0C,0xFF,0xFF,0x0B,0x00,0x0A,  /* 00000800    "........" */
  88.243 -    0x02,0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0E,  /* 00000808    ".LNKB..." */
  88.244 -    0x04,0x0C,0xFF,0xFF,0x0B,0x00,0x0A,0x03,  /* 00000810    "........" */
  88.245 -    0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0D,0x04,  /* 00000818    "LNKC...." */
  88.246 -    0x0C,0xFF,0xFF,0x0C,0x00,0x00,0x4C,0x4E,  /* 00000820    "......LN" */
  88.247 -    0x4B,0x41,0x00,0x12,0x0D,0x04,0x0C,0xFF,  /* 00000828    "KA......" */
  88.248 -    0xFF,0x0C,0x00,0x01,0x4C,0x4E,0x4B,0x42,  /* 00000830    "....LNKB" */
  88.249 -    0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x0C,  /* 00000838    "........" */
  88.250 -    0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x43,0x00,  /* 00000840    "...LNKC." */
  88.251 -    0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x0C,0x00,  /* 00000848    "........" */
  88.252 -    0x0A,0x03,0x4C,0x4E,0x4B,0x44,0x00,0x12,  /* 00000850    "..LNKD.." */
  88.253 -    0x0D,0x04,0x0C,0xFF,0xFF,0x0D,0x00,0x00,  /* 00000858    "........" */
  88.254 -    0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0D,0x04,  /* 00000860    "LNKB...." */
  88.255 -    0x0C,0xFF,0xFF,0x0D,0x00,0x01,0x4C,0x4E,  /* 00000868    "......LN" */
  88.256 -    0x4B,0x43,0x00,0x12,0x0E,0x04,0x0C,0xFF,  /* 00000870    "KC......" */
  88.257 -    0xFF,0x0D,0x00,0x0A,0x02,0x4C,0x4E,0x4B,  /* 00000878    ".....LNK" */
  88.258 -    0x44,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,  /* 00000880    "D......." */
  88.259 -    0x0D,0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x41,  /* 00000888    "....LNKA" */
  88.260 -    0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x0E,  /* 00000890    "........" */
  88.261 -    0x00,0x00,0x4C,0x4E,0x4B,0x43,0x00,0x12,  /* 00000898    "..LNKC.." */
  88.262 -    0x0D,0x04,0x0C,0xFF,0xFF,0x0E,0x00,0x01,  /* 000008A0    "........" */
  88.263 -    0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0E,0x04,  /* 000008A8    "LNKD...." */
  88.264 -    0x0C,0xFF,0xFF,0x0E,0x00,0x0A,0x02,0x4C,  /* 000008B0    ".......L" */
  88.265 -    0x4E,0x4B,0x41,0x00,0x12,0x0E,0x04,0x0C,  /* 000008B8    "NKA....." */
  88.266 -    0xFF,0xFF,0x0E,0x00,0x0A,0x03,0x4C,0x4E,  /* 000008C0    "......LN" */
  88.267 -    0x4B,0x42,0x00,0x12,0x0D,0x04,0x0C,0xFF,  /* 000008C8    "KB......" */
  88.268 -    0xFF,0x0F,0x00,0x00,0x4C,0x4E,0x4B,0x44,  /* 000008D0    "....LNKD" */
  88.269 -    0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x0F,  /* 000008D8    "........" */
  88.270 -    0x00,0x01,0x4C,0x4E,0x4B,0x41,0x00,0x12,  /* 000008E0    "..LNKA.." */
  88.271 -    0x0E,0x04,0x0C,0xFF,0xFF,0x0F,0x00,0x0A,  /* 000008E8    "........" */
  88.272 -    0x02,0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0E,  /* 000008F0    ".LNKB..." */
  88.273 -    0x04,0x0C,0xFF,0xFF,0x0F,0x00,0x0A,0x03,  /* 000008F8    "........" */
  88.274 -    0x4C,0x4E,0x4B,0x43,0x00,0x08,0x50,0x52,  /* 00000900    "LNKC..PR" */
  88.275 -    0x54,0x41,0x12,0x41,0x2F,0x3C,0x12,0x0B,  /* 00000908    "TA.A/<.." */
  88.276 -    0x04,0x0C,0xFF,0xFF,0x01,0x00,0x00,0x00,  /* 00000910    "........" */
  88.277 -    0x0A,0x14,0x12,0x0B,0x04,0x0C,0xFF,0xFF,  /* 00000918    "........" */
  88.278 -    0x01,0x00,0x01,0x00,0x0A,0x15,0x12,0x0C,  /* 00000920    "........" */
  88.279 -    0x04,0x0C,0xFF,0xFF,0x01,0x00,0x0A,0x02,  /* 00000928    "........" */
  88.280 -    0x00,0x0A,0x16,0x12,0x0C,0x04,0x0C,0xFF,  /* 00000930    "........" */
  88.281 -    0xFF,0x01,0x00,0x0A,0x03,0x00,0x0A,0x17,  /* 00000938    "........" */
  88.282 -    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x02,0x00,  /* 00000940    "........" */
  88.283 -    0x00,0x00,0x0A,0x18,0x12,0x0B,0x04,0x0C,  /* 00000948    "........" */
  88.284 -    0xFF,0xFF,0x02,0x00,0x01,0x00,0x0A,0x19,  /* 00000950    "........" */
  88.285 -    0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x02,0x00,  /* 00000958    "........" */
  88.286 -    0x0A,0x02,0x00,0x0A,0x1A,0x12,0x0C,0x04,  /* 00000960    "........" */
  88.287 -    0x0C,0xFF,0xFF,0x02,0x00,0x0A,0x03,0x00,  /* 00000968    "........" */
  88.288 -    0x0A,0x1B,0x12,0x0B,0x04,0x0C,0xFF,0xFF,  /* 00000970    "........" */
  88.289 -    0x03,0x00,0x00,0x00,0x0A,0x1C,0x12,0x0B,  /* 00000978    "........" */
  88.290 -    0x04,0x0C,0xFF,0xFF,0x03,0x00,0x01,0x00,  /* 00000980    "........" */
  88.291 -    0x0A,0x1D,0x12,0x0C,0x04,0x0C,0xFF,0xFF,  /* 00000988    "........" */
  88.292 -    0x03,0x00,0x0A,0x02,0x00,0x0A,0x1E,0x12,  /* 00000990    "........" */
  88.293 -    0x0C,0x04,0x0C,0xFF,0xFF,0x03,0x00,0x0A,  /* 00000998    "........" */
  88.294 -    0x03,0x00,0x0A,0x1F,0x12,0x0B,0x04,0x0C,  /* 000009A0    "........" */
  88.295 -    0xFF,0xFF,0x04,0x00,0x00,0x00,0x0A,0x20,  /* 000009A8    "....... " */
  88.296 -    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x04,0x00,  /* 000009B0    "........" */
  88.297 -    0x01,0x00,0x0A,0x21,0x12,0x0C,0x04,0x0C,  /* 000009B8    "...!...." */
  88.298 -    0xFF,0xFF,0x04,0x00,0x0A,0x02,0x00,0x0A,  /* 000009C0    "........" */
  88.299 -    0x22,0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x04,  /* 000009C8    ""......." */
  88.300 -    0x00,0x0A,0x03,0x00,0x0A,0x23,0x12,0x0B,  /* 000009D0    ".....#.." */
  88.301 -    0x04,0x0C,0xFF,0xFF,0x05,0x00,0x00,0x00,  /* 000009D8    "........" */
  88.302 -    0x0A,0x24,0x12,0x0B,0x04,0x0C,0xFF,0xFF,  /* 000009E0    ".$......" */
  88.303 -    0x05,0x00,0x01,0x00,0x0A,0x25,0x12,0x0C,  /* 000009E8    ".....%.." */
  88.304 -    0x04,0x0C,0xFF,0xFF,0x05,0x00,0x0A,0x02,  /* 000009F0    "........" */
  88.305 -    0x00,0x0A,0x26,0x12,0x0C,0x04,0x0C,0xFF,  /* 000009F8    "..&....." */
  88.306 -    0xFF,0x05,0x00,0x0A,0x03,0x00,0x0A,0x27,  /* 00000A00    ".......'" */
  88.307 -    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x06,0x00,  /* 00000A08    "........" */
  88.308 -    0x00,0x00,0x0A,0x28,0x12,0x0B,0x04,0x0C,  /* 00000A10    "...(...." */
  88.309 -    0xFF,0xFF,0x06,0x00,0x01,0x00,0x0A,0x29,  /* 00000A18    ".......)" */
  88.310 -    0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x06,0x00,  /* 00000A20    "........" */
  88.311 -    0x0A,0x02,0x00,0x0A,0x2A,0x12,0x0C,0x04,  /* 00000A28    "....*..." */
  88.312 -    0x0C,0xFF,0xFF,0x06,0x00,0x0A,0x03,0x00,  /* 00000A30    "........" */
  88.313 -    0x0A,0x2B,0x12,0x0B,0x04,0x0C,0xFF,0xFF,  /* 00000A38    ".+......" */
  88.314 -    0x07,0x00,0x00,0x00,0x0A,0x2C,0x12,0x0B,  /* 00000A40    ".....,.." */
  88.315 -    0x04,0x0C,0xFF,0xFF,0x07,0x00,0x01,0x00,  /* 00000A48    "........" */
  88.316 -    0x0A,0x2D,0x12,0x0C,0x04,0x0C,0xFF,0xFF,  /* 00000A50    ".-......" */
  88.317 -    0x07,0x00,0x0A,0x02,0x00,0x0A,0x2E,0x12,  /* 00000A58    "........" */
  88.318 -    0x0C,0x04,0x0C,0xFF,0xFF,0x07,0x00,0x0A,  /* 00000A60    "........" */
  88.319 -    0x03,0x00,0x0A,0x2F,0x12,0x0B,0x04,0x0C,  /* 00000A68    ".../...." */
  88.320 -    0xFF,0xFF,0x08,0x00,0x00,0x00,0x0A,0x11,  /* 00000A70    "........" */
  88.321 -    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x08,0x00,  /* 00000A78    "........" */
  88.322 -    0x01,0x00,0x0A,0x12,0x12,0x0C,0x04,0x0C,  /* 00000A80    "........" */
  88.323 -    0xFF,0xFF,0x08,0x00,0x0A,0x02,0x00,0x0A,  /* 00000A88    "........" */
  88.324 -    0x13,0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x08,  /* 00000A90    "........" */
  88.325 -    0x00,0x0A,0x03,0x00,0x0A,0x14,0x12,0x0B,  /* 00000A98    "........" */
  88.326 -    0x04,0x0C,0xFF,0xFF,0x09,0x00,0x00,0x00,  /* 00000AA0    "........" */
  88.327 -    0x0A,0x15,0x12,0x0B,0x04,0x0C,0xFF,0xFF,  /* 00000AA8    "........" */
  88.328 -    0x09,0x00,0x01,0x00,0x0A,0x16,0x12,0x0C,  /* 00000AB0    "........" */
  88.329 -    0x04,0x0C,0xFF,0xFF,0x09,0x00,0x0A,0x02,  /* 00000AB8    "........" */
  88.330 -    0x00,0x0A,0x17,0x12,0x0C,0x04,0x0C,0xFF,  /* 00000AC0    "........" */
  88.331 -    0xFF,0x09,0x00,0x0A,0x03,0x00,0x0A,0x18,  /* 00000AC8    "........" */
  88.332 -    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x0A,0x00,  /* 00000AD0    "........" */
  88.333 -    0x00,0x00,0x0A,0x19,0x12,0x0B,0x04,0x0C,  /* 00000AD8    "........" */
  88.334 -    0xFF,0xFF,0x0A,0x00,0x01,0x00,0x0A,0x1A,  /* 00000AE0    "........" */
  88.335 -    0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x0A,0x00,  /* 00000AE8    "........" */
  88.336 -    0x0A,0x02,0x00,0x0A,0x1B,0x12,0x0C,0x04,  /* 00000AF0    "........" */
  88.337 -    0x0C,0xFF,0xFF,0x0A,0x00,0x0A,0x03,0x00,  /* 00000AF8    "........" */
  88.338 -    0x0A,0x1C,0x12,0x0B,0x04,0x0C,0xFF,0xFF,  /* 00000B00    "........" */
  88.339 -    0x0B,0x00,0x00,0x00,0x0A,0x1D,0x12,0x0B,  /* 00000B08    "........" */
  88.340 -    0x04,0x0C,0xFF,0xFF,0x0B,0x00,0x01,0x00,  /* 00000B10    "........" */
  88.341 -    0x0A,0x1E,0x12,0x0C,0x04,0x0C,0xFF,0xFF,  /* 00000B18    "........" */
  88.342 -    0x0B,0x00,0x0A,0x02,0x00,0x0A,0x1F,0x12,  /* 00000B20    "........" */
  88.343 -    0x0C,0x04,0x0C,0xFF,0xFF,0x0B,0x00,0x0A,  /* 00000B28    "........" */
  88.344 -    0x03,0x00,0x0A,0x20,0x12,0x0B,0x04,0x0C,  /* 00000B30    "... ...." */
  88.345 -    0xFF,0xFF,0x0C,0x00,0x00,0x00,0x0A,0x21,  /* 00000B38    ".......!" */
  88.346 -    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x0C,0x00,  /* 00000B40    "........" */
  88.347 -    0x01,0x00,0x0A,0x22,0x12,0x0C,0x04,0x0C,  /* 00000B48    "..."...." */
  88.348 -    0xFF,0xFF,0x0C,0x00,0x0A,0x02,0x00,0x0A,  /* 00000B50    "........" */
  88.349 -    0x23,0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x0C,  /* 00000B58    "#......." */
  88.350 -    0x00,0x0A,0x03,0x00,0x0A,0x24,0x12,0x0B,  /* 00000B60    ".....$.." */
  88.351 -    0x04,0x0C,0xFF,0xFF,0x0D,0x00,0x00,0x00,  /* 00000B68    "........" */
  88.352 -    0x0A,0x25,0x12,0x0B,0x04,0x0C,0xFF,0xFF,  /* 00000B70    ".%......" */
  88.353 -    0x0D,0x00,0x01,0x00,0x0A,0x26,0x12,0x0C,  /* 00000B78    ".....&.." */
  88.354 -    0x04,0x0C,0xFF,0xFF,0x0D,0x00,0x0A,0x02,  /* 00000B80    "........" */
  88.355 -    0x00,0x0A,0x27,0x12,0x0C,0x04,0x0C,0xFF,  /* 00000B88    "..'....." */
  88.356 -    0xFF,0x0D,0x00,0x0A,0x03,0x00,0x0A,0x28,  /* 00000B90    ".......(" */
  88.357 -    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x0E,0x00,  /* 00000B98    "........" */
  88.358 -    0x00,0x00,0x0A,0x29,0x12,0x0B,0x04,0x0C,  /* 00000BA0    "...)...." */
  88.359 -    0xFF,0xFF,0x0E,0x00,0x01,0x00,0x0A,0x2A,  /* 00000BA8    ".......*" */
  88.360 -    0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x0E,0x00,  /* 00000BB0    "........" */
  88.361 -    0x0A,0x02,0x00,0x0A,0x2B,0x12,0x0C,0x04,  /* 00000BB8    "....+..." */
  88.362 -    0x0C,0xFF,0xFF,0x0E,0x00,0x0A,0x03,0x00,  /* 00000BC0    "........" */
  88.363 -    0x0A,0x2C,0x12,0x0B,0x04,0x0C,0xFF,0xFF,  /* 00000BC8    ".,......" */
  88.364 -    0x0F,0x00,0x00,0x00,0x0A,0x2D,0x12,0x0B,  /* 00000BD0    ".....-.." */
  88.365 -    0x04,0x0C,0xFF,0xFF,0x0F,0x00,0x01,0x00,  /* 00000BD8    "........" */
  88.366 -    0x0A,0x2E,0x12,0x0C,0x04,0x0C,0xFF,0xFF,  /* 00000BE0    "........" */
  88.367 -    0x0F,0x00,0x0A,0x02,0x00,0x0A,0x2F,0x12,  /* 00000BE8    "....../." */
  88.368 -    0x0C,0x04,0x0C,0xFF,0xFF,0x0F,0x00,0x0A,  /* 00000BF0    "........" */
  88.369 -    0x03,0x00,0x0A,0x10,0x5B,0x82,0x46,0x37,  /* 00000BF8    "....[.F7" */
  88.370 -    0x49,0x53,0x41,0x5F,0x08,0x5F,0x41,0x44,  /* 00000C00    "ISA_._AD" */
  88.371 -    0x52,0x0C,0x00,0x00,0x01,0x00,0x5B,0x80,  /* 00000C08    "R.....[." */
  88.372 -    0x50,0x49,0x52,0x51,0x02,0x0A,0x60,0x0A,  /* 00000C10    "PIRQ..`." */
  88.373 -    0x04,0x10,0x2E,0x5C,0x00,0x5B,0x81,0x29,  /* 00000C18    "...\.[.)" */
  88.374 -    0x5C,0x2F,0x04,0x5F,0x53,0x42,0x5F,0x50,  /* 00000C20    "\/._SB_P" */
  88.375 -    0x43,0x49,0x30,0x49,0x53,0x41,0x5F,0x50,  /* 00000C28    "CI0ISA_P" */
  88.376 -    0x49,0x52,0x51,0x01,0x50,0x49,0x52,0x41,  /* 00000C30    "IRQ.PIRA" */
  88.377 -    0x08,0x50,0x49,0x52,0x42,0x08,0x50,0x49,  /* 00000C38    ".PIRB.PI" */
  88.378 -    0x52,0x43,0x08,0x50,0x49,0x52,0x44,0x08,  /* 00000C40    "RC.PIRD." */
  88.379 -    0x5B,0x82,0x46,0x0B,0x53,0x59,0x53,0x52,  /* 00000C48    "[.F.SYSR" */
  88.380 -    0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,  /* 00000C50    "._HID.A." */
  88.381 -    0x0C,0x02,0x08,0x5F,0x55,0x49,0x44,0x01,  /* 00000C58    "..._UID." */
  88.382 -    0x08,0x43,0x52,0x53,0x5F,0x11,0x4E,0x08,  /* 00000C60    ".CRS_.N." */
  88.383 -    0x0A,0x8A,0x47,0x01,0x10,0x00,0x10,0x00,  /* 00000C68    "..G....." */
  88.384 -    0x00,0x10,0x47,0x01,0x22,0x00,0x22,0x00,  /* 00000C70    "..G."."." */
  88.385 -    0x00,0x0C,0x47,0x01,0x30,0x00,0x30,0x00,  /* 00000C78    "..G.0.0." */
  88.386 -    0x00,0x10,0x47,0x01,0x44,0x00,0x44,0x00,  /* 00000C80    "..G.D.D." */
  88.387 -    0x00,0x1C,0x47,0x01,0x62,0x00,0x62,0x00,  /* 00000C88    "..G.b.b." */
  88.388 -    0x00,0x02,0x47,0x01,0x65,0x00,0x65,0x00,  /* 00000C90    "..G.e.e." */
  88.389 -    0x00,0x0B,0x47,0x01,0x72,0x00,0x72,0x00,  /* 00000C98    "..G.r.r." */
  88.390 -    0x00,0x0E,0x47,0x01,0x80,0x00,0x80,0x00,  /* 00000CA0    "..G....." */
  88.391 -    0x00,0x01,0x47,0x01,0x84,0x00,0x84,0x00,  /* 00000CA8    "..G....." */
  88.392 -    0x00,0x03,0x47,0x01,0x88,0x00,0x88,0x00,  /* 00000CB0    "..G....." */
  88.393 -    0x00,0x01,0x47,0x01,0x8C,0x00,0x8C,0x00,  /* 00000CB8    "..G....." */
  88.394 -    0x00,0x03,0x47,0x01,0x90,0x00,0x90,0x00,  /* 00000CC0    "..G....." */
  88.395 -    0x00,0x10,0x47,0x01,0xA2,0x00,0xA2,0x00,  /* 00000CC8    "..G....." */
  88.396 -    0x00,0x1C,0x47,0x01,0xE0,0x00,0xE0,0x00,  /* 00000CD0    "..G....." */
  88.397 -    0x00,0x10,0x47,0x01,0xA0,0x08,0xA0,0x08,  /* 00000CD8    "..G....." */
  88.398 -    0x00,0x04,0x47,0x01,0xC0,0x0C,0xC0,0x0C,  /* 00000CE0    "..G....." */
  88.399 -    0x00,0x10,0x47,0x01,0xD0,0x04,0xD0,0x04,  /* 00000CE8    "..G....." */
  88.400 -    0x00,0x02,0x79,0x00,0x14,0x0B,0x5F,0x43,  /* 00000CF0    "..y..._C" */
  88.401 -    0x52,0x53,0x00,0xA4,0x43,0x52,0x53,0x5F,  /* 00000CF8    "RS..CRS_" */
  88.402 -    0x5B,0x82,0x2B,0x50,0x49,0x43,0x5F,0x08,  /* 00000D00    "[.+PIC_." */
  88.403 -    0x5F,0x48,0x49,0x44,0x0B,0x41,0xD0,0x08,  /* 00000D08    "_HID.A.." */
  88.404 -    0x5F,0x43,0x52,0x53,0x11,0x18,0x0A,0x15,  /* 00000D10    "_CRS...." */
  88.405 -    0x47,0x01,0x20,0x00,0x20,0x00,0x01,0x02,  /* 00000D18    "G. . ..." */
  88.406 -    0x47,0x01,0xA0,0x00,0xA0,0x00,0x01,0x02,  /* 00000D20    "G......." */
  88.407 -    0x22,0x04,0x00,0x79,0x00,0x5B,0x82,0x47,  /* 00000D28    ""..y.[.G" */
  88.408 -    0x05,0x44,0x4D,0x41,0x30,0x08,0x5F,0x48,  /* 00000D30    ".DMA0._H" */
  88.409 -    0x49,0x44,0x0C,0x41,0xD0,0x02,0x00,0x08,  /* 00000D38    "ID.A...." */
  88.410 -    0x5F,0x43,0x52,0x53,0x11,0x41,0x04,0x0A,  /* 00000D40    "_CRS.A.." */
  88.411 -    0x3D,0x2A,0x10,0x04,0x47,0x01,0x00,0x00,  /* 00000D48    "=*..G..." */
  88.412 -    0x00,0x00,0x00,0x10,0x47,0x01,0x81,0x00,  /* 00000D50    "....G..." */
  88.413 -    0x81,0x00,0x00,0x03,0x47,0x01,0x87,0x00,  /* 00000D58    "....G..." */
  88.414 -    0x87,0x00,0x00,0x01,0x47,0x01,0x89,0x00,  /* 00000D60    "....G..." */
  88.415 -    0x89,0x00,0x00,0x03,0x47,0x01,0x8F,0x00,  /* 00000D68    "....G..." */
  88.416 -    0x8F,0x00,0x00,0x01,0x47,0x01,0xC0,0x00,  /* 00000D70    "....G..." */
  88.417 -    0xC0,0x00,0x00,0x20,0x47,0x01,0x80,0x04,  /* 00000D78    "... G..." */
  88.418 -    0x80,0x04,0x00,0x10,0x79,0x00,0x5B,0x82,  /* 00000D80    "....y.[." */
  88.419 -    0x25,0x54,0x4D,0x52,0x5F,0x08,0x5F,0x48,  /* 00000D88    "%TMR_._H" */
  88.420 -    0x49,0x44,0x0C,0x41,0xD0,0x01,0x00,0x08,  /* 00000D90    "ID.A...." */
  88.421 -    0x5F,0x43,0x52,0x53,0x11,0x10,0x0A,0x0D,  /* 00000D98    "_CRS...." */
  88.422 -    0x47,0x01,0x40,0x00,0x40,0x00,0x00,0x04,  /* 00000DA0    "G.@.@..." */
  88.423 -    0x22,0x01,0x00,0x79,0x00,0x5B,0x82,0x25,  /* 00000DA8    ""..y.[.%" */
  88.424 -    0x52,0x54,0x43,0x5F,0x08,0x5F,0x48,0x49,  /* 00000DB0    "RTC_._HI" */
  88.425 -    0x44,0x0C,0x41,0xD0,0x0B,0x00,0x08,0x5F,  /* 00000DB8    "D.A...._" */
  88.426 -    0x43,0x52,0x53,0x11,0x10,0x0A,0x0D,0x47,  /* 00000DC0    "CRS....G" */
  88.427 -    0x01,0x70,0x00,0x70,0x00,0x00,0x02,0x22,  /* 00000DC8    ".p.p..."" */
  88.428 -    0x00,0x01,0x79,0x00,0x5B,0x82,0x22,0x53,  /* 00000DD0    "..y.[."S" */
  88.429 -    0x50,0x4B,0x52,0x08,0x5F,0x48,0x49,0x44,  /* 00000DD8    "PKR._HID" */
  88.430 -    0x0C,0x41,0xD0,0x08,0x00,0x08,0x5F,0x43,  /* 00000DE0    ".A...._C" */
  88.431 -    0x52,0x53,0x11,0x0D,0x0A,0x0A,0x47,0x01,  /* 00000DE8    "RS....G." */
  88.432 -    0x61,0x00,0x61,0x00,0x00,0x01,0x79,0x00,  /* 00000DF0    "a.a...y." */
  88.433 -    0x5B,0x82,0x31,0x50,0x53,0x32,0x4D,0x08,  /* 00000DF8    "[.1PS2M." */
  88.434 -    0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x0F,  /* 00000E00    "_HID.A.." */
  88.435 -    0x13,0x08,0x5F,0x43,0x49,0x44,0x0C,0x41,  /* 00000E08    ".._CID.A" */
  88.436 -    0xD0,0x0F,0x13,0x14,0x09,0x5F,0x53,0x54,  /* 00000E10    "....._ST" */
  88.437 -    0x41,0x00,0xA4,0x0A,0x0F,0x08,0x5F,0x43,  /* 00000E18    "A....._C" */
  88.438 -    0x52,0x53,0x11,0x08,0x0A,0x05,0x22,0x00,  /* 00000E20    "RS...."." */
  88.439 -    0x10,0x79,0x00,0x5B,0x82,0x42,0x04,0x50,  /* 00000E28    ".y.[.B.P" */
  88.440 -    0x53,0x32,0x4B,0x08,0x5F,0x48,0x49,0x44,  /* 00000E30    "S2K._HID" */
  88.441 -    0x0C,0x41,0xD0,0x03,0x03,0x08,0x5F,0x43,  /* 00000E38    ".A...._C" */
  88.442 -    0x49,0x44,0x0C,0x41,0xD0,0x03,0x0B,0x14,  /* 00000E40    "ID.A...." */
  88.443 -    0x09,0x5F,0x53,0x54,0x41,0x00,0xA4,0x0A,  /* 00000E48    "._STA..." */
  88.444 -    0x0F,0x08,0x5F,0x43,0x52,0x53,0x11,0x18,  /* 00000E50    ".._CRS.." */
  88.445 -    0x0A,0x15,0x47,0x01,0x60,0x00,0x60,0x00,  /* 00000E58    "..G.`.`." */
  88.446 -    0x00,0x01,0x47,0x01,0x64,0x00,0x64,0x00,  /* 00000E60    "..G.d.d." */
  88.447 -    0x00,0x01,0x22,0x02,0x00,0x79,0x00,0x5B,  /* 00000E68    ".."..y.[" */
  88.448 -    0x82,0x3A,0x46,0x44,0x43,0x30,0x08,0x5F,  /* 00000E70    ".:FDC0._" */
  88.449 -    0x48,0x49,0x44,0x0C,0x41,0xD0,0x07,0x00,  /* 00000E78    "HID.A..." */
  88.450 -    0x14,0x09,0x5F,0x53,0x54,0x41,0x00,0xA4,  /* 00000E80    ".._STA.." */
  88.451 -    0x0A,0x0F,0x08,0x5F,0x43,0x52,0x53,0x11,  /* 00000E88    "..._CRS." */
  88.452 -    0x1B,0x0A,0x18,0x47,0x01,0xF0,0x03,0xF0,  /* 00000E90    "...G...." */
  88.453 -    0x03,0x01,0x06,0x47,0x01,0xF7,0x03,0xF7,  /* 00000E98    "...G...." */
  88.454 -    0x03,0x01,0x01,0x22,0x40,0x00,0x2A,0x04,  /* 00000EA0    "..."@.*." */
  88.455 -    0x00,0x79,0x00,0x5B,0x82,0x46,0x04,0x55,  /* 00000EA8    ".y.[.F.U" */
  88.456 -    0x41,0x52,0x31,0x08,0x5F,0x48,0x49,0x44,  /* 00000EB0    "AR1._HID" */
  88.457 -    0x0C,0x41,0xD0,0x05,0x01,0x08,0x5F,0x55,  /* 00000EB8    ".A...._U" */
  88.458 -    0x49,0x44,0x01,0x14,0x19,0x5F,0x53,0x54,  /* 00000EC0    "ID..._ST" */
  88.459 -    0x41,0x00,0xA0,0x0D,0x93,0x5E,0x5E,0x5E,  /* 00000EC8    "A....^^^" */
  88.460 -    0x5E,0x55,0x41,0x52,0x31,0x00,0xA4,0x00,  /* 00000ED0    "^UAR1..." */
  88.461 -    0xA1,0x04,0xA4,0x0A,0x0F,0x08,0x5F,0x43,  /* 00000ED8    "......_C" */
  88.462 -    0x52,0x53,0x11,0x10,0x0A,0x0D,0x47,0x01,  /* 00000EE0    "RS....G." */
  88.463 -    0xF8,0x03,0xF8,0x03,0x08,0x08,0x22,0x10,  /* 00000EE8    "......"." */
  88.464 -    0x00,0x79,0x00,0x5B,0x82,0x47,0x04,0x55,  /* 00000EF0    ".y.[.G.U" */
  88.465 -    0x41,0x52,0x32,0x08,0x5F,0x48,0x49,0x44,  /* 00000EF8    "AR2._HID" */
  88.466 -    0x0C,0x41,0xD0,0x05,0x01,0x08,0x5F,0x55,  /* 00000F00    ".A...._U" */
  88.467 -    0x49,0x44,0x0A,0x02,0x14,0x19,0x5F,0x53,  /* 00000F08    "ID...._S" */
  88.468 -    0x54,0x41,0x00,0xA0,0x0D,0x93,0x5E,0x5E,  /* 00000F10    "TA....^^" */
  88.469 -    0x5E,0x5E,0x55,0x41,0x52,0x32,0x00,0xA4,  /* 00000F18    "^^UAR2.." */
  88.470 -    0x00,0xA1,0x04,0xA4,0x0A,0x0F,0x08,0x5F,  /* 00000F20    "......._" */
  88.471 -    0x43,0x52,0x53,0x11,0x10,0x0A,0x0D,0x47,  /* 00000F28    "CRS....G" */
  88.472 -    0x01,0xF8,0x02,0xF8,0x02,0x08,0x08,0x22,  /* 00000F30    "......."" */
  88.473 -    0x08,0x00,0x79,0x00,0x5B,0x82,0x36,0x4C,  /* 00000F38    "..y.[.6L" */
  88.474 -    0x54,0x50,0x31,0x08,0x5F,0x48,0x49,0x44,  /* 00000F40    "TP1._HID" */
  88.475 -    0x0C,0x41,0xD0,0x04,0x00,0x08,0x5F,0x55,  /* 00000F48    ".A...._U" */
  88.476 -    0x49,0x44,0x0A,0x02,0x14,0x09,0x5F,0x53,  /* 00000F50    "ID...._S" */
  88.477 -    0x54,0x41,0x00,0xA4,0x0A,0x0F,0x08,0x5F,  /* 00000F58    "TA....._" */
  88.478 -    0x43,0x52,0x53,0x11,0x10,0x0A,0x0D,0x47,  /* 00000F60    "CRS....G" */
  88.479 -    0x01,0x78,0x03,0x78,0x03,0x08,0x08,0x22,  /* 00000F68    ".x.x..."" */
  88.480 -    0x80,0x00,0x79,0x00,0x5B,0x82,0x4D,0x07,  /* 00000F70    "..y.[.M." */
  88.481 -    0x53,0x31,0x46,0x30,0x08,0x5F,0x41,0x44,  /* 00000F78    "S1F0._AD" */
  88.482 -    0x52,0x0C,0x00,0x00,0x06,0x00,0x08,0x5F,  /* 00000F80    "R......_" */
  88.483 -    0x53,0x55,0x4E,0x01,0x14,0x13,0x5F,0x50,  /* 00000F88    "SUN..._P" */
  88.484 -    0x53,0x30,0x00,0x70,0x0A,0x80,0x5C,0x2E,  /* 00000F90    "S0.p..\." */
  88.485 -    0x5F,0x47,0x50,0x45,0x44,0x50,0x54,0x32,  /* 00000F98    "_GPEDPT2" */
  88.486 -    0x14,0x13,0x5F,0x50,0x53,0x33,0x00,0x70,  /* 00000FA0    ".._PS3.p" */
  88.487 -    0x0A,0x83,0x5C,0x2E,0x5F,0x47,0x50,0x45,  /* 00000FA8    "..\._GPE" */
  88.488 -    0x44,0x50,0x54,0x32,0x14,0x1F,0x5F,0x45,  /* 00000FB0    "DPT2.._E" */
  88.489 -    0x4A,0x30,0x01,0x70,0x0A,0x88,0x5C,0x2E,  /* 00000FB8    "J0.p..\." */
  88.490 -    0x5F,0x47,0x50,0x45,0x44,0x50,0x54,0x32,  /* 00000FC0    "_GPEDPT2" */
  88.491 -    0x70,0x01,0x5C,0x2E,0x5F,0x47,0x50,0x45,  /* 00000FC8    "p.\._GPE" */
  88.492 -    0x50,0x48,0x50,0x31,0x14,0x1E,0x5F,0x53,  /* 00000FD0    "PHP1.._S" */
  88.493 -    0x54,0x41,0x00,0x70,0x0A,0x89,0x5C,0x2E,  /* 00000FD8    "TA.p..\." */
  88.494 -    0x5F,0x47,0x50,0x45,0x44,0x50,0x54,0x32,  /* 00000FE0    "_GPEDPT2" */
  88.495 -    0xA4,0x5C,0x2E,0x5F,0x47,0x50,0x45,0x50,  /* 00000FE8    ".\._GPEP" */
  88.496 -    0x48,0x50,0x31,0x5B,0x82,0x4E,0x07,0x53,  /* 00000FF0    "HP1[.N.S" */
  88.497 -    0x32,0x46,0x30,0x08,0x5F,0x41,0x44,0x52,  /* 00000FF8    "2F0._ADR" */
  88.498 -    0x0C,0x00,0x00,0x07,0x00,0x08,0x5F,0x53,  /* 00001000    "......_S" */
  88.499 -    0x55,0x4E,0x0A,0x02,0x14,0x13,0x5F,0x50,  /* 00001008    "UN...._P" */
  88.500 -    0x53,0x30,0x00,0x70,0x0A,0x90,0x5C,0x2E,  /* 00001010    "S0.p..\." */
  88.501 -    0x5F,0x47,0x50,0x45,0x44,0x50,0x54,0x32,  /* 00001018    "_GPEDPT2" */
  88.502 -    0x14,0x13,0x5F,0x50,0x53,0x33,0x00,0x70,  /* 00001020    ".._PS3.p" */
  88.503 -    0x0A,0x93,0x5C,0x2E,0x5F,0x47,0x50,0x45,  /* 00001028    "..\._GPE" */
  88.504 -    0x44,0x50,0x54,0x32,0x14,0x1F,0x5F,0x45,  /* 00001030    "DPT2.._E" */
  88.505 -    0x4A,0x30,0x01,0x70,0x0A,0x98,0x5C,0x2E,  /* 00001038    "J0.p..\." */
  88.506 -    0x5F,0x47,0x50,0x45,0x44,0x50,0x54,0x32,  /* 00001040    "_GPEDPT2" */
  88.507 -    0x70,0x01,0x5C,0x2E,0x5F,0x47,0x50,0x45,  /* 00001048    "p.\._GPE" */
  88.508 -    0x50,0x48,0x50,0x32,0x14,0x1E,0x5F,0x53,  /* 00001050    "PHP2.._S" */
  88.509 -    0x54,0x41,0x00,0x70,0x0A,0x99,0x5C,0x2E,  /* 00001058    "TA.p..\." */
  88.510 -    0x5F,0x47,0x50,0x45,0x44,0x50,0x54,0x32,  /* 00001060    "_GPEDPT2" */
  88.511 -    0xA4,0x5C,0x2E,0x5F,0x47,0x50,0x45,0x50,  /* 00001068    ".\._GPEP" */
  88.512 -    0x48,0x50,0x32,0x10,0x4E,0x0B,0x5F,0x47,  /* 00001070    "HP2.N._G" */
  88.513 -    0x50,0x45,0x5B,0x80,0x50,0x48,0x50,0x5F,  /* 00001078    "PE[.PHP_" */
  88.514 -    0x01,0x0B,0xC0,0x10,0x0A,0x03,0x5B,0x81,  /* 00001080    "......[." */
  88.515 -    0x15,0x50,0x48,0x50,0x5F,0x01,0x50,0x53,  /* 00001088    ".PHP_.PS" */
  88.516 -    0x54,0x41,0x08,0x50,0x48,0x50,0x31,0x08,  /* 00001090    "TA.PHP1." */
  88.517 -    0x50,0x48,0x50,0x32,0x08,0x5B,0x80,0x44,  /* 00001098    "PHP2.[.D" */
  88.518 -    0x47,0x31,0x5F,0x01,0x0B,0x44,0xB0,0x0A,  /* 000010A0    "G1_..D.." */
  88.519 -    0x04,0x5B,0x81,0x10,0x44,0x47,0x31,0x5F,  /* 000010A8    ".[..DG1_" */
  88.520 -    0x01,0x44,0x50,0x54,0x31,0x08,0x44,0x50,  /* 000010B0    ".DPT1.DP" */
  88.521 -    0x54,0x32,0x08,0x14,0x46,0x07,0x5F,0x4C,  /* 000010B8    "T2..F._L" */
  88.522 -    0x30,0x33,0x00,0x08,0x53,0x4C,0x54,0x5F,  /* 000010C0    "03..SLT_" */
  88.523 -    0x00,0x08,0x45,0x56,0x54,0x5F,0x00,0x70,  /* 000010C8    "..EVT_.p" */
  88.524 -    0x50,0x53,0x54,0x41,0x61,0x7A,0x61,0x0A,  /* 000010D0    "PSTAaza." */
  88.525 -    0x04,0x53,0x4C,0x54,0x5F,0x7B,0x61,0x0A,  /* 000010D8    ".SLT_{a." */
  88.526 -    0x0F,0x45,0x56,0x54,0x5F,0x70,0x53,0x4C,  /* 000010E0    ".EVT_pSL" */
  88.527 -    0x54,0x5F,0x44,0x50,0x54,0x31,0x70,0x45,  /* 000010E8    "T_DPT1pE" */
  88.528 -    0x56,0x54,0x5F,0x44,0x50,0x54,0x32,0xA0,  /* 000010F0    "VT_DPT2." */
  88.529 -    0x1B,0x93,0x53,0x4C,0x54,0x5F,0x01,0x86,  /* 000010F8    "..SLT_.." */
  88.530 -    0x5C,0x2F,0x03,0x5F,0x53,0x42,0x5F,0x50,  /* 00001100    "\/._SB_P" */
  88.531 -    0x43,0x49,0x30,0x53,0x31,0x46,0x30,0x45,  /* 00001108    "CI0S1F0E" */
  88.532 -    0x56,0x54,0x5F,0xA1,0x1E,0xA0,0x1C,0x93,  /* 00001110    "VT_....." */
  88.533 -    0x53,0x4C,0x54,0x5F,0x0A,0x02,0x86,0x5C,  /* 00001118    "SLT_...\" */
  88.534 -    0x2F,0x03,0x5F,0x53,0x42,0x5F,0x50,0x43,  /* 00001120    "/._SB_PC" */
  88.535 -    0x49,0x30,0x53,0x32,0x46,0x30,0x45,0x56,  /* 00001128    "I0S2F0EV" */
  88.536 -    0x54,0x5F,
  88.537 +    0x00,0x08,0x5F,0x42,0x42,0x4E,0x00,0x5B,  /* 00000200    ".._BBN.[" */
  88.538 +    0x82,0x2A,0x48,0x50,0x30,0x5F,0x08,0x5F,  /* 00000208    ".*HP0_._" */
  88.539 +    0x48,0x49,0x44,0x0C,0x41,0xD0,0x0C,0x02,  /* 00000210    "HID.A..." */
  88.540 +    0x08,0x5F,0x43,0x52,0x53,0x11,0x15,0x0A,  /* 00000218    "._CRS..." */
  88.541 +    0x12,0x47,0x01,0xC0,0x10,0xC0,0x10,0x00,  /* 00000220    ".G......" */
  88.542 +    0x03,0x47,0x01,0x44,0xB0,0x44,0xB0,0x00,  /* 00000228    ".G.D.D.." */
  88.543 +    0x04,0x79,0x00,0x14,0x4E,0x0C,0x5F,0x43,  /* 00000230    ".y..N._C" */
  88.544 +    0x52,0x53,0x00,0x08,0x50,0x52,0x54,0x30,  /* 00000238    "RS..PRT0" */
  88.545 +    0x11,0x42,0x07,0x0A,0x6E,0x88,0x0D,0x00,  /* 00000240    ".B..n..." */
  88.546 +    0x02,0x0E,0x00,0x00,0x00,0x00,0x00,0xFF,  /* 00000248    "........" */
  88.547 +    0x00,0x00,0x00,0x00,0x01,0x47,0x01,0xF8,  /* 00000250    ".....G.." */
  88.548 +    0x0C,0xF8,0x0C,0x01,0x08,0x88,0x0D,0x00,  /* 00000258    "........" */
  88.549 +    0x01,0x0C,0x03,0x00,0x00,0x00,0x00,0xF7,  /* 00000260    "........" */
  88.550 +    0x0C,0x00,0x00,0xF8,0x0C,0x88,0x0D,0x00,  /* 00000268    "........" */
  88.551 +    0x01,0x0C,0x03,0x00,0x00,0x00,0x0D,0xFF,  /* 00000270    "........" */
  88.552 +    0xFF,0x00,0x00,0x00,0xF3,0x87,0x17,0x00,  /* 00000278    "........" */
  88.553 +    0x00,0x0C,0x03,0x00,0x00,0x00,0x00,0x00,  /* 00000280    "........" */
  88.554 +    0x00,0x0A,0x00,0xFF,0xFF,0x0B,0x00,0x00,  /* 00000288    "........" */
  88.555 +    0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x87,  /* 00000290    "........" */
  88.556 +    0x17,0x00,0x00,0x0C,0x03,0x00,0x00,0x00,  /* 00000298    "........" */
  88.557 +    0x00,0x00,0x00,0x00,0xF0,0xFF,0xFF,0xFF,  /* 000002A0    "........" */
  88.558 +    0xF4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 000002A8    "........" */
  88.559 +    0x05,0x79,0x00,0x8A,0x50,0x52,0x54,0x30,  /* 000002B0    ".y..PRT0" */
  88.560 +    0x0A,0x5C,0x4D,0x4D,0x49,0x4E,0x8A,0x50,  /* 000002B8    ".\MMIN.P" */
  88.561 +    0x52,0x54,0x30,0x0A,0x60,0x4D,0x4D,0x41,  /* 000002C0    "RT0.`MMA" */
  88.562 +    0x58,0x8A,0x50,0x52,0x54,0x30,0x0A,0x68,  /* 000002C8    "X.PRT0.h" */
  88.563 +    0x4D,0x4C,0x45,0x4E,0x70,0x50,0x4D,0x49,  /* 000002D0    "MLENpPMI" */
  88.564 +    0x4E,0x4D,0x4D,0x49,0x4E,0x70,0x50,0x4C,  /* 000002D8    "NMMINpPL" */
  88.565 +    0x45,0x4E,0x4D,0x4C,0x45,0x4E,0x72,0x4D,  /* 000002E0    "ENMLENrM" */
  88.566 +    0x4D,0x49,0x4E,0x4D,0x4C,0x45,0x4E,0x4D,  /* 000002E8    "MINMLENM" */
  88.567 +    0x4D,0x41,0x58,0x74,0x4D,0x4D,0x41,0x58,  /* 000002F0    "MAXtMMAX" */
  88.568 +    0x01,0x4D,0x4D,0x41,0x58,0xA4,0x50,0x52,  /* 000002F8    ".MMAX.PR" */
  88.569 +    0x54,0x30,0x08,0x42,0x55,0x46,0x41,0x11,  /* 00000300    "T0.BUFA." */
  88.570 +    0x09,0x0A,0x06,0x23,0x20,0x0C,0x18,0x79,  /* 00000308    "...# ..y" */
  88.571 +    0x00,0x08,0x42,0x55,0x46,0x42,0x11,0x09,  /* 00000310    "..BUFB.." */
  88.572 +    0x0A,0x06,0x23,0x00,0x00,0x18,0x79,0x00,  /* 00000318    "..#...y." */
  88.573 +    0x8B,0x42,0x55,0x46,0x42,0x01,0x49,0x52,  /* 00000320    ".BUFB.IR" */
  88.574 +    0x51,0x56,0x5B,0x82,0x48,0x08,0x4C,0x4E,  /* 00000328    "QV[.H.LN" */
  88.575 +    0x4B,0x41,0x08,0x5F,0x48,0x49,0x44,0x0C,  /* 00000330    "KA._HID." */
  88.576 +    0x41,0xD0,0x0C,0x0F,0x08,0x5F,0x55,0x49,  /* 00000338    "A...._UI" */
  88.577 +    0x44,0x01,0x14,0x1C,0x5F,0x53,0x54,0x41,  /* 00000340    "D..._STA" */
  88.578 +    0x00,0x7B,0x50,0x49,0x52,0x41,0x0A,0x80,  /* 00000348    ".{PIRA.." */
  88.579 +    0x60,0xA0,0x08,0x93,0x60,0x0A,0x80,0xA4,  /* 00000350    "`...`..." */
  88.580 +    0x0A,0x09,0xA1,0x04,0xA4,0x0A,0x0B,0x14,  /* 00000358    "........" */
  88.581 +    0x0B,0x5F,0x50,0x52,0x53,0x00,0xA4,0x42,  /* 00000360    "._PRS..B" */
  88.582 +    0x55,0x46,0x41,0x14,0x11,0x5F,0x44,0x49,  /* 00000368    "UFA.._DI" */
  88.583 +    0x53,0x00,0x7D,0x50,0x49,0x52,0x41,0x0A,  /* 00000370    "S.}PIRA." */
  88.584 +    0x80,0x50,0x49,0x52,0x41,0x14,0x1A,0x5F,  /* 00000378    ".PIRA.._" */
  88.585 +    0x43,0x52,0x53,0x00,0x7B,0x50,0x49,0x52,  /* 00000380    "CRS.{PIR" */
  88.586 +    0x41,0x0A,0x0F,0x60,0x79,0x01,0x60,0x49,  /* 00000388    "A..`y.`I" */
  88.587 +    0x52,0x51,0x56,0xA4,0x42,0x55,0x46,0x42,  /* 00000390    "RQV.BUFB" */
  88.588 +    0x14,0x1B,0x5F,0x53,0x52,0x53,0x01,0x8B,  /* 00000398    ".._SRS.." */
  88.589 +    0x68,0x01,0x49,0x52,0x51,0x31,0x82,0x49,  /* 000003A0    "h.IRQ1.I" */
  88.590 +    0x52,0x51,0x31,0x60,0x76,0x60,0x70,0x60,  /* 000003A8    "RQ1`v`p`" */
  88.591 +    0x50,0x49,0x52,0x41,0x5B,0x82,0x49,0x08,  /* 000003B0    "PIRA[.I." */
  88.592 +    0x4C,0x4E,0x4B,0x42,0x08,0x5F,0x48,0x49,  /* 000003B8    "LNKB._HI" */
  88.593 +    0x44,0x0C,0x41,0xD0,0x0C,0x0F,0x08,0x5F,  /* 000003C0    "D.A...._" */
  88.594 +    0x55,0x49,0x44,0x0A,0x02,0x14,0x1C,0x5F,  /* 000003C8    "UID...._" */
  88.595 +    0x53,0x54,0x41,0x00,0x7B,0x50,0x49,0x52,  /* 000003D0    "STA.{PIR" */
  88.596 +    0x42,0x0A,0x80,0x60,0xA0,0x08,0x93,0x60,  /* 000003D8    "B..`...`" */
  88.597 +    0x0A,0x80,0xA4,0x0A,0x09,0xA1,0x04,0xA4,  /* 000003E0    "........" */
  88.598 +    0x0A,0x0B,0x14,0x0B,0x5F,0x50,0x52,0x53,  /* 000003E8    "...._PRS" */
  88.599 +    0x00,0xA4,0x42,0x55,0x46,0x41,0x14,0x11,  /* 000003F0    "..BUFA.." */
  88.600 +    0x5F,0x44,0x49,0x53,0x00,0x7D,0x50,0x49,  /* 000003F8    "_DIS.}PI" */
  88.601 +    0x52,0x42,0x0A,0x80,0x50,0x49,0x52,0x42,  /* 00000400    "RB..PIRB" */
  88.602 +    0x14,0x1A,0x5F,0x43,0x52,0x53,0x00,0x7B,  /* 00000408    ".._CRS.{" */
  88.603 +    0x50,0x49,0x52,0x42,0x0A,0x0F,0x60,0x79,  /* 00000410    "PIRB..`y" */
  88.604 +    0x01,0x60,0x49,0x52,0x51,0x56,0xA4,0x42,  /* 00000418    ".`IRQV.B" */
  88.605 +    0x55,0x46,0x42,0x14,0x1B,0x5F,0x53,0x52,  /* 00000420    "UFB.._SR" */
  88.606 +    0x53,0x01,0x8B,0x68,0x01,0x49,0x52,0x51,  /* 00000428    "S..h.IRQ" */
  88.607 +    0x31,0x82,0x49,0x52,0x51,0x31,0x60,0x76,  /* 00000430    "1.IRQ1`v" */
  88.608 +    0x60,0x70,0x60,0x50,0x49,0x52,0x42,0x5B,  /* 00000438    "`p`PIRB[" */
  88.609 +    0x82,0x49,0x08,0x4C,0x4E,0x4B,0x43,0x08,  /* 00000440    ".I.LNKC." */
  88.610 +    0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x0C,  /* 00000448    "_HID.A.." */
  88.611 +    0x0F,0x08,0x5F,0x55,0x49,0x44,0x0A,0x03,  /* 00000450    ".._UID.." */
  88.612 +    0x14,0x1C,0x5F,0x53,0x54,0x41,0x00,0x7B,  /* 00000458    ".._STA.{" */
  88.613 +    0x50,0x49,0x52,0x43,0x0A,0x80,0x60,0xA0,  /* 00000460    "PIRC..`." */
  88.614 +    0x08,0x93,0x60,0x0A,0x80,0xA4,0x0A,0x09,  /* 00000468    "..`....." */
  88.615 +    0xA1,0x04,0xA4,0x0A,0x0B,0x14,0x0B,0x5F,  /* 00000470    "......._" */
  88.616 +    0x50,0x52,0x53,0x00,0xA4,0x42,0x55,0x46,  /* 00000478    "PRS..BUF" */
  88.617 +    0x41,0x14,0x11,0x5F,0x44,0x49,0x53,0x00,  /* 00000480    "A.._DIS." */
  88.618 +    0x7D,0x50,0x49,0x52,0x43,0x0A,0x80,0x50,  /* 00000488    "}PIRC..P" */
  88.619 +    0x49,0x52,0x43,0x14,0x1A,0x5F,0x43,0x52,  /* 00000490    "IRC.._CR" */
  88.620 +    0x53,0x00,0x7B,0x50,0x49,0x52,0x43,0x0A,  /* 00000498    "S.{PIRC." */
  88.621 +    0x0F,0x60,0x79,0x01,0x60,0x49,0x52,0x51,  /* 000004A0    ".`y.`IRQ" */
  88.622 +    0x56,0xA4,0x42,0x55,0x46,0x42,0x14,0x1B,  /* 000004A8    "V.BUFB.." */
  88.623 +    0x5F,0x53,0x52,0x53,0x01,0x8B,0x68,0x01,  /* 000004B0    "_SRS..h." */
  88.624 +    0x49,0x52,0x51,0x31,0x82,0x49,0x52,0x51,  /* 000004B8    "IRQ1.IRQ" */
  88.625 +    0x31,0x60,0x76,0x60,0x70,0x60,0x50,0x49,  /* 000004C0    "1`v`p`PI" */
  88.626 +    0x52,0x43,0x5B,0x82,0x49,0x08,0x4C,0x4E,  /* 000004C8    "RC[.I.LN" */
  88.627 +    0x4B,0x44,0x08,0x5F,0x48,0x49,0x44,0x0C,  /* 000004D0    "KD._HID." */
  88.628 +    0x41,0xD0,0x0C,0x0F,0x08,0x5F,0x55,0x49,  /* 000004D8    "A...._UI" */
  88.629 +    0x44,0x0A,0x04,0x14,0x1C,0x5F,0x53,0x54,  /* 000004E0    "D...._ST" */
  88.630 +    0x41,0x00,0x7B,0x50,0x49,0x52,0x44,0x0A,  /* 000004E8    "A.{PIRD." */
  88.631 +    0x80,0x60,0xA0,0x08,0x93,0x60,0x0A,0x80,  /* 000004F0    ".`...`.." */
  88.632 +    0xA4,0x0A,0x09,0xA1,0x04,0xA4,0x0A,0x0B,  /* 000004F8    "........" */
  88.633 +    0x14,0x0B,0x5F,0x50,0x52,0x53,0x00,0xA4,  /* 00000500    ".._PRS.." */
  88.634 +    0x42,0x55,0x46,0x41,0x14,0x11,0x5F,0x44,  /* 00000508    "BUFA.._D" */
  88.635 +    0x49,0x53,0x00,0x7D,0x50,0x49,0x52,0x44,  /* 00000510    "IS.}PIRD" */
  88.636 +    0x0A,0x80,0x50,0x49,0x52,0x44,0x14,0x1A,  /* 00000518    "..PIRD.." */
  88.637 +    0x5F,0x43,0x52,0x53,0x00,0x7B,0x50,0x49,  /* 00000520    "_CRS.{PI" */
  88.638 +    0x52,0x44,0x0A,0x0F,0x60,0x79,0x01,0x60,  /* 00000528    "RD..`y.`" */
  88.639 +    0x49,0x52,0x51,0x56,0xA4,0x42,0x55,0x46,  /* 00000530    "IRQV.BUF" */
  88.640 +    0x42,0x14,0x1B,0x5F,0x53,0x52,0x53,0x01,  /* 00000538    "B.._SRS." */
  88.641 +    0x8B,0x68,0x01,0x49,0x52,0x51,0x31,0x82,  /* 00000540    ".h.IRQ1." */
  88.642 +    0x49,0x52,0x51,0x31,0x60,0x76,0x60,0x70,  /* 00000548    "IRQ1`v`p" */
  88.643 +    0x60,0x50,0x49,0x52,0x44,0x5B,0x82,0x44,  /* 00000550    "`PIRD[.D" */
  88.644 +    0x05,0x48,0x50,0x45,0x54,0x08,0x5F,0x48,  /* 00000558    ".HPET._H" */
  88.645 +    0x49,0x44,0x0C,0x41,0xD0,0x01,0x03,0x08,  /* 00000560    "ID.A...." */
  88.646 +    0x5F,0x55,0x49,0x44,0x00,0x14,0x18,0x5F,  /* 00000568    "_UID..._" */
  88.647 +    0x53,0x54,0x41,0x00,0xA0,0x0C,0x93,0x5E,  /* 00000570    "STA....^" */
  88.648 +    0x5E,0x5E,0x48,0x50,0x45,0x54,0x00,0xA4,  /* 00000578    "^^HPET.." */
  88.649 +    0x00,0xA1,0x04,0xA4,0x0A,0x0F,0x08,0x5F,  /* 00000580    "......._" */
  88.650 +    0x43,0x52,0x53,0x11,0x1F,0x0A,0x1C,0x87,  /* 00000588    "CRS....." */
  88.651 +    0x17,0x00,0x00,0x0D,0x01,0x00,0x00,0x00,  /* 00000590    "........" */
  88.652 +    0x00,0x00,0x00,0xD0,0xFE,0xFF,0x03,0xD0,  /* 00000598    "........" */
  88.653 +    0xFE,0x00,0x00,0x00,0x00,0x00,0x04,0x00,  /* 000005A0    "........" */
  88.654 +    0x00,0x79,0x00,0x14,0x16,0x5F,0x50,0x52,  /* 000005A8    ".y..._PR" */
  88.655 +    0x54,0x00,0xA0,0x0A,0x50,0x49,0x43,0x44,  /* 000005B0    "T...PICD" */
  88.656 +    0xA4,0x50,0x52,0x54,0x41,0xA4,0x50,0x52,  /* 000005B8    ".PRTA.PR" */
  88.657 +    0x54,0x50,0x08,0x50,0x52,0x54,0x50,0x12,  /* 000005C0    "TP.PRTP." */
  88.658 +    0x49,0x36,0x3C,0x12,0x0D,0x04,0x0C,0xFF,  /* 000005C8    "I6<....." */
  88.659 +    0xFF,0x01,0x00,0x00,0x4C,0x4E,0x4B,0x42,  /* 000005D0    "....LNKB" */
  88.660 +    0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x01,  /* 000005D8    "........" */
  88.661 +    0x00,0x01,0x4C,0x4E,0x4B,0x43,0x00,0x12,  /* 000005E0    "..LNKC.." */
  88.662 +    0x0E,0x04,0x0C,0xFF,0xFF,0x01,0x00,0x0A,  /* 000005E8    "........" */
  88.663 +    0x02,0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0E,  /* 000005F0    ".LNKD..." */
  88.664 +    0x04,0x0C,0xFF,0xFF,0x01,0x00,0x0A,0x03,  /* 000005F8    "........" */
  88.665 +    0x4C,0x4E,0x4B,0x41,0x00,0x12,0x0D,0x04,  /* 00000600    "LNKA...." */
  88.666 +    0x0C,0xFF,0xFF,0x02,0x00,0x00,0x4C,0x4E,  /* 00000608    "......LN" */
  88.667 +    0x4B,0x43,0x00,0x12,0x0D,0x04,0x0C,0xFF,  /* 00000610    "KC......" */
  88.668 +    0xFF,0x02,0x00,0x01,0x4C,0x4E,0x4B,0x44,  /* 00000618    "....LNKD" */
  88.669 +    0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x02,  /* 00000620    "........" */
  88.670 +    0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x41,0x00,  /* 00000628    "...LNKA." */
  88.671 +    0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x02,0x00,  /* 00000630    "........" */
  88.672 +    0x0A,0x03,0x4C,0x4E,0x4B,0x42,0x00,0x12,  /* 00000638    "..LNKB.." */
  88.673 +    0x0D,0x04,0x0C,0xFF,0xFF,0x03,0x00,0x00,  /* 00000640    "........" */
  88.674 +    0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0D,0x04,  /* 00000648    "LNKD...." */
  88.675 +    0x0C,0xFF,0xFF,0x03,0x00,0x01,0x4C,0x4E,  /* 00000650    "......LN" */
  88.676 +    0x4B,0x41,0x00,0x12,0x0E,0x04,0x0C,0xFF,  /* 00000658    "KA......" */
  88.677 +    0xFF,0x03,0x00,0x0A,0x02,0x4C,0x4E,0x4B,  /* 00000660    ".....LNK" */
  88.678 +    0x42,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,  /* 00000668    "B......." */
  88.679 +    0x03,0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x43,  /* 00000670    "....LNKC" */
  88.680 +    0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x04,  /* 00000678    "........" */
  88.681 +    0x00,0x00,0x4C,0x4E,0x4B,0x41,0x00,0x12,  /* 00000680    "..LNKA.." */
  88.682 +    0x0D,0x04,0x0C,0xFF,0xFF,0x04,0x00,0x01,  /* 00000688    "........" */
  88.683 +    0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0E,0x04,  /* 00000690    "LNKB...." */
  88.684 +    0x0C,0xFF,0xFF,0x04,0x00,0x0A,0x02,0x4C,  /* 00000698    ".......L" */
  88.685 +    0x4E,0x4B,0x43,0x00,0x12,0x0E,0x04,0x0C,  /* 000006A0    "NKC....." */
  88.686 +    0xFF,0xFF,0x04,0x00,0x0A,0x03,0x4C,0x4E,  /* 000006A8    "......LN" */
  88.687 +    0x4B,0x44,0x00,0x12,0x0D,0x04,0x0C,0xFF,  /* 000006B0    "KD......" */
  88.688 +    0xFF,0x05,0x00,0x00,0x4C,0x4E,0x4B,0x42,  /* 000006B8    "....LNKB" */
  88.689 +    0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x05,  /* 000006C0    "........" */
  88.690 +    0x00,0x01,0x4C,0x4E,0x4B,0x43,0x00,0x12,  /* 000006C8    "..LNKC.." */
  88.691 +    0x0E,0x04,0x0C,0xFF,0xFF,0x05,0x00,0x0A,  /* 000006D0    "........" */
  88.692 +    0x02,0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0E,  /* 000006D8    ".LNKD..." */
  88.693 +    0x04,0x0C,0xFF,0xFF,0x05,0x00,0x0A,0x03,  /* 000006E0    "........" */
  88.694 +    0x4C,0x4E,0x4B,0x41,0x00,0x12,0x0D,0x04,  /* 000006E8    "LNKA...." */
  88.695 +    0x0C,0xFF,0xFF,0x06,0x00,0x00,0x4C,0x4E,  /* 000006F0    "......LN" */
  88.696 +    0x4B,0x43,0x00,0x12,0x0D,0x04,0x0C,0xFF,  /* 000006F8    "KC......" */
  88.697 +    0xFF,0x06,0x00,0x01,0x4C,0x4E,0x4B,0x44,  /* 00000700    "....LNKD" */
  88.698 +    0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x06,  /* 00000708    "........" */
  88.699 +    0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x41,0x00,  /* 00000710    "...LNKA." */
  88.700 +    0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x06,0x00,  /* 00000718    "........" */
  88.701 +    0x0A,0x03,0x4C,0x4E,0x4B,0x42,0x00,0x12,  /* 00000720    "..LNKB.." */
  88.702 +    0x0D,0x04,0x0C,0xFF,0xFF,0x07,0x00,0x00,  /* 00000728    "........" */
  88.703 +    0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0D,0x04,  /* 00000730    "LNKD...." */
  88.704 +    0x0C,0xFF,0xFF,0x07,0x00,0x01,0x4C,0x4E,  /* 00000738    "......LN" */
  88.705 +    0x4B,0x41,0x00,0x12,0x0E,0x04,0x0C,0xFF,  /* 00000740    "KA......" */
  88.706 +    0xFF,0x07,0x00,0x0A,0x02,0x4C,0x4E,0x4B,  /* 00000748    ".....LNK" */
  88.707 +    0x42,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,  /* 00000750    "B......." */
  88.708 +    0x07,0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x43,  /* 00000758    "....LNKC" */
  88.709 +    0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x08,  /* 00000760    "........" */
  88.710 +    0x00,0x00,0x4C,0x4E,0x4B,0x41,0x00,0x12,  /* 00000768    "..LNKA.." */
  88.711 +    0x0D,0x04,0x0C,0xFF,0xFF,0x08,0x00,0x01,  /* 00000770    "........" */
  88.712 +    0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0E,0x04,  /* 00000778    "LNKB...." */
  88.713 +    0x0C,0xFF,0xFF,0x08,0x00,0x0A,0x02,0x4C,  /* 00000780    ".......L" */
  88.714 +    0x4E,0x4B,0x43,0x00,0x12,0x0E,0x04,0x0C,  /* 00000788    "NKC....." */
  88.715 +    0xFF,0xFF,0x08,0x00,0x0A,0x03,0x4C,0x4E,  /* 00000790    "......LN" */
  88.716 +    0x4B,0x44,0x00,0x12,0x0D,0x04,0x0C,0xFF,  /* 00000798    "KD......" */
  88.717 +    0xFF,0x09,0x00,0x00,0x4C,0x4E,0x4B,0x42,  /* 000007A0    "....LNKB" */
  88.718 +    0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x09,  /* 000007A8    "........" */
  88.719 +    0x00,0x01,0x4C,0x4E,0x4B,0x43,0x00,0x12,  /* 000007B0    "..LNKC.." */
  88.720 +    0x0E,0x04,0x0C,0xFF,0xFF,0x09,0x00,0x0A,  /* 000007B8    "........" */
  88.721 +    0x02,0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0E,  /* 000007C0    ".LNKD..." */
  88.722 +    0x04,0x0C,0xFF,0xFF,0x09,0x00,0x0A,0x03,  /* 000007C8    "........" */
  88.723 +    0x4C,0x4E,0x4B,0x41,0x00,0x12,0x0D,0x04,  /* 000007D0    "LNKA...." */
  88.724 +    0x0C,0xFF,0xFF,0x0A,0x00,0x00,0x4C,0x4E,  /* 000007D8    "......LN" */
  88.725 +    0x4B,0x43,0x00,0x12,0x0D,0x04,0x0C,0xFF,  /* 000007E0    "KC......" */
  88.726 +    0xFF,0x0A,0x00,0x01,0x4C,0x4E,0x4B,0x44,  /* 000007E8    "....LNKD" */
  88.727 +    0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x0A,  /* 000007F0    "........" */
  88.728 +    0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x41,0x00,  /* 000007F8    "...LNKA." */
  88.729 +    0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x0A,0x00,  /* 00000800    "........" */
  88.730 +    0x0A,0x03,0x4C,0x4E,0x4B,0x42,0x00,0x12,  /* 00000808    "..LNKB.." */
  88.731 +    0x0D,0x04,0x0C,0xFF,0xFF,0x0B,0x00,0x00,  /* 00000810    "........" */
  88.732 +    0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0D,0x04,  /* 00000818    "LNKD...." */
  88.733 +    0x0C,0xFF,0xFF,0x0B,0x00,0x01,0x4C,0x4E,  /* 00000820    "......LN" */
  88.734 +    0x4B,0x41,0x00,0x12,0x0E,0x04,0x0C,0xFF,  /* 00000828    "KA......" */
  88.735 +    0xFF,0x0B,0x00,0x0A,0x02,0x4C,0x4E,0x4B,  /* 00000830    ".....LNK" */
  88.736 +    0x42,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,  /* 00000838    "B......." */
  88.737 +    0x0B,0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x43,  /* 00000840    "....LNKC" */
  88.738 +    0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x0C,  /* 00000848    "........" */
  88.739 +    0x00,0x00,0x4C,0x4E,0x4B,0x41,0x00,0x12,  /* 00000850    "..LNKA.." */
  88.740 +    0x0D,0x04,0x0C,0xFF,0xFF,0x0C,0x00,0x01,  /* 00000858    "........" */
  88.741 +    0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0E,0x04,  /* 00000860    "LNKB...." */
  88.742 +    0x0C,0xFF,0xFF,0x0C,0x00,0x0A,0x02,0x4C,  /* 00000868    ".......L" */
  88.743 +    0x4E,0x4B,0x43,0x00,0x12,0x0E,0x04,0x0C,  /* 00000870    "NKC....." */
  88.744 +    0xFF,0xFF,0x0C,0x00,0x0A,0x03,0x4C,0x4E,  /* 00000878    "......LN" */
  88.745 +    0x4B,0x44,0x00,0x12,0x0D,0x04,0x0C,0xFF,  /* 00000880    "KD......" */
  88.746 +    0xFF,0x0D,0x00,0x00,0x4C,0x4E,0x4B,0x42,  /* 00000888    "....LNKB" */
  88.747 +    0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x0D,  /* 00000890    "........" */
  88.748 +    0x00,0x01,0x4C,0x4E,0x4B,0x43,0x00,0x12,  /* 00000898    "..LNKC.." */
  88.749 +    0x0E,0x04,0x0C,0xFF,0xFF,0x0D,0x00,0x0A,  /* 000008A0    "........" */
  88.750 +    0x02,0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0E,  /* 000008A8    ".LNKD..." */
  88.751 +    0x04,0x0C,0xFF,0xFF,0x0D,0x00,0x0A,0x03,  /* 000008B0    "........" */
  88.752 +    0x4C,0x4E,0x4B,0x41,0x00,0x12,0x0D,0x04,  /* 000008B8    "LNKA...." */
  88.753 +    0x0C,0xFF,0xFF,0x0E,0x00,0x00,0x4C,0x4E,  /* 000008C0    "......LN" */
  88.754 +    0x4B,0x43,0x00,0x12,0x0D,0x04,0x0C,0xFF,  /* 000008C8    "KC......" */
  88.755 +    0xFF,0x0E,0x00,0x01,0x4C,0x4E,0x4B,0x44,  /* 000008D0    "....LNKD" */
  88.756 +    0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x0E,  /* 000008D8    "........" */
  88.757 +    0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x41,0x00,  /* 000008E0    "...LNKA." */
  88.758 +    0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x0E,0x00,  /* 000008E8    "........" */
  88.759 +    0x0A,0x03,0x4C,0x4E,0x4B,0x42,0x00,0x12,  /* 000008F0    "..LNKB.." */
  88.760 +    0x0D,0x04,0x0C,0xFF,0xFF,0x0F,0x00,0x00,  /* 000008F8    "........" */
  88.761 +    0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0D,0x04,  /* 00000900    "LNKD...." */
  88.762 +    0x0C,0xFF,0xFF,0x0F,0x00,0x01,0x4C,0x4E,  /* 00000908    "......LN" */
  88.763 +    0x4B,0x41,0x00,0x12,0x0E,0x04,0x0C,0xFF,  /* 00000910    "KA......" */
  88.764 +    0xFF,0x0F,0x00,0x0A,0x02,0x4C,0x4E,0x4B,  /* 00000918    ".....LNK" */
  88.765 +    0x42,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,  /* 00000920    "B......." */
  88.766 +    0x0F,0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x43,  /* 00000928    "....LNKC" */
  88.767 +    0x00,0x08,0x50,0x52,0x54,0x41,0x12,0x41,  /* 00000930    "..PRTA.A" */
  88.768 +    0x2F,0x3C,0x12,0x0B,0x04,0x0C,0xFF,0xFF,  /* 00000938    "/<......" */
  88.769 +    0x01,0x00,0x00,0x00,0x0A,0x14,0x12,0x0B,  /* 00000940    "........" */
  88.770 +    0x04,0x0C,0xFF,0xFF,0x01,0x00,0x01,0x00,  /* 00000948    "........" */
  88.771 +    0x0A,0x15,0x12,0x0C,0x04,0x0C,0xFF,0xFF,  /* 00000950    "........" */
  88.772 +    0x01,0x00,0x0A,0x02,0x00,0x0A,0x16,0x12,  /* 00000958    "........" */
  88.773 +    0x0C,0x04,0x0C,0xFF,0xFF,0x01,0x00,0x0A,  /* 00000960    "........" */
  88.774 +    0x03,0x00,0x0A,0x17,0x12,0x0B,0x04,0x0C,  /* 00000968    "........" */
  88.775 +    0xFF,0xFF,0x02,0x00,0x00,0x00,0x0A,0x18,  /* 00000970    "........" */
  88.776 +    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x02,0x00,  /* 00000978    "........" */
  88.777 +    0x01,0x00,0x0A,0x19,0x12,0x0C,0x04,0x0C,  /* 00000980    "........" */
  88.778 +    0xFF,0xFF,0x02,0x00,0x0A,0x02,0x00,0x0A,  /* 00000988    "........" */
  88.779 +    0x1A,0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x02,  /* 00000990    "........" */
  88.780 +    0x00,0x0A,0x03,0x00,0x0A,0x1B,0x12,0x0B,  /* 00000998    "........" */
  88.781 +    0x04,0x0C,0xFF,0xFF,0x03,0x00,0x00,0x00,  /* 000009A0    "........" */
  88.782 +    0x0A,0x1C,0x12,0x0B,0x04,0x0C,0xFF,0xFF,  /* 000009A8    "........" */
  88.783 +    0x03,0x00,0x01,0x00,0x0A,0x1D,0x12,0x0C,  /* 000009B0    "........" */
  88.784 +    0x04,0x0C,0xFF,0xFF,0x03,0x00,0x0A,0x02,  /* 000009B8    "........" */
  88.785 +    0x00,0x0A,0x1E,0x12,0x0C,0x04,0x0C,0xFF,  /* 000009C0    "........" */
  88.786 +    0xFF,0x03,0x00,0x0A,0x03,0x00,0x0A,0x1F,  /* 000009C8    "........" */
  88.787 +    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x04,0x00,  /* 000009D0    "........" */
  88.788 +    0x00,0x00,0x0A,0x20,0x12,0x0B,0x04,0x0C,  /* 000009D8    "... ...." */
  88.789 +    0xFF,0xFF,0x04,0x00,0x01,0x00,0x0A,0x21,  /* 000009E0    ".......!" */
  88.790 +    0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x04,0x00,  /* 000009E8    "........" */
  88.791 +    0x0A,0x02,0x00,0x0A,0x22,0x12,0x0C,0x04,  /* 000009F0    "...."..." */
  88.792 +    0x0C,0xFF,0xFF,0x04,0x00,0x0A,0x03,0x00,  /* 000009F8    "........" */
  88.793 +    0x0A,0x23,0x12,0x0B,0x04,0x0C,0xFF,0xFF,  /* 00000A00    ".#......" */
  88.794 +    0x05,0x00,0x00,0x00,0x0A,0x24,0x12,0x0B,  /* 00000A08    ".....$.." */
  88.795 +    0x04,0x0C,0xFF,0xFF,0x05,0x00,0x01,0x00,  /* 00000A10    "........" */
  88.796 +    0x0A,0x25,0x12,0x0C,0x04,0x0C,0xFF,0xFF,  /* 00000A18    ".%......" */
  88.797 +    0x05,0x00,0x0A,0x02,0x00,0x0A,0x26,0x12,  /* 00000A20    "......&." */
  88.798 +    0x0C,0x04,0x0C,0xFF,0xFF,0x05,0x00,0x0A,  /* 00000A28    "........" */
  88.799 +    0x03,0x00,0x0A,0x27,0x12,0x0B,0x04,0x0C,  /* 00000A30    "...'...." */
  88.800 +    0xFF,0xFF,0x06,0x00,0x00,0x00,0x0A,0x28,  /* 00000A38    ".......(" */
  88.801 +    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x06,0x00,  /* 00000A40    "........" */
  88.802 +    0x01,0x00,0x0A,0x29,0x12,0x0C,0x04,0x0C,  /* 00000A48    "...)...." */
  88.803 +    0xFF,0xFF,0x06,0x00,0x0A,0x02,0x00,0x0A,  /* 00000A50    "........" */
  88.804 +    0x2A,0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x06,  /* 00000A58    "*......." */
  88.805 +    0x00,0x0A,0x03,0x00,0x0A,0x2B,0x12,0x0B,  /* 00000A60    ".....+.." */
  88.806 +    0x04,0x0C,0xFF,0xFF,0x07,0x00,0x00,0x00,  /* 00000A68    "........" */
  88.807 +    0x0A,0x2C,0x12,0x0B,0x04,0x0C,0xFF,0xFF,  /* 00000A70    ".,......" */
  88.808 +    0x07,0x00,0x01,0x00,0x0A,0x2D,0x12,0x0C,  /* 00000A78    ".....-.." */
  88.809 +    0x04,0x0C,0xFF,0xFF,0x07,0x00,0x0A,0x02,  /* 00000A80    "........" */
  88.810 +    0x00,0x0A,0x2E,0x12,0x0C,0x04,0x0C,0xFF,  /* 00000A88    "........" */
  88.811 +    0xFF,0x07,0x00,0x0A,0x03,0x00,0x0A,0x2F,  /* 00000A90    "......./" */
  88.812 +    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x08,0x00,  /* 00000A98    "........" */
  88.813 +    0x00,0x00,0x0A,0x11,0x12,0x0B,0x04,0x0C,  /* 00000AA0    "........" */
  88.814 +    0xFF,0xFF,0x08,0x00,0x01,0x00,0x0A,0x12,  /* 00000AA8    "........" */
  88.815 +    0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x08,0x00,  /* 00000AB0    "........" */
  88.816 +    0x0A,0x02,0x00,0x0A,0x13,0x12,0x0C,0x04,  /* 00000AB8    "........" */
  88.817 +    0x0C,0xFF,0xFF,0x08,0x00,0x0A,0x03,0x00,  /* 00000AC0    "........" */
  88.818 +    0x0A,0x14,0x12,0x0B,0x04,0x0C,0xFF,0xFF,  /* 00000AC8    "........" */
  88.819 +    0x09,0x00,0x00,0x00,0x0A,0x15,0x12,0x0B,  /* 00000AD0    "........" */
  88.820 +    0x04,0x0C,0xFF,0xFF,0x09,0x00,0x01,0x00,  /* 00000AD8    "........" */
  88.821 +    0x0A,0x16,0x12,0x0C,0x04,0x0C,0xFF,0xFF,  /* 00000AE0    "........" */
  88.822 +    0x09,0x00,0x0A,0x02,0x00,0x0A,0x17,0x12,  /* 00000AE8    "........" */
  88.823 +    0x0C,0x04,0x0C,0xFF,0xFF,0x09,0x00,0x0A,  /* 00000AF0    "........" */
  88.824 +    0x03,0x00,0x0A,0x18,0x12,0x0B,0x04,0x0C,  /* 00000AF8    "........" */
  88.825 +    0xFF,0xFF,0x0A,0x00,0x00,0x00,0x0A,0x19,  /* 00000B00    "........" */
  88.826 +    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x0A,0x00,  /* 00000B08    "........" */
  88.827 +    0x01,0x00,0x0A,0x1A,0x12,0x0C,0x04,0x0C,  /* 00000B10    "........" */
  88.828 +    0xFF,0xFF,0x0A,0x00,0x0A,0x02,0x00,0x0A,  /* 00000B18    "........" */
  88.829 +    0x1B,0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x0A,  /* 00000B20    "........" */
  88.830 +    0x00,0x0A,0x03,0x00,0x0A,0x1C,0x12,0x0B,  /* 00000B28    "........" */
  88.831 +    0x04,0x0C,0xFF,0xFF,0x0B,0x00,0x00,0x00,  /* 00000B30    "........" */
  88.832 +    0x0A,0x1D,0x12,0x0B,0x04,0x0C,0xFF,0xFF,  /* 00000B38    "........" */
  88.833 +    0x0B,0x00,0x01,0x00,0x0A,0x1E,0x12,0x0C,  /* 00000B40    "........" */
  88.834 +    0x04,0x0C,0xFF,0xFF,0x0B,0x00,0x0A,0x02,  /* 00000B48    "........" */
  88.835 +    0x00,0x0A,0x1F,0x12,0x0C,0x04,0x0C,0xFF,  /* 00000B50    "........" */
  88.836 +    0xFF,0x0B,0x00,0x0A,0x03,0x00,0x0A,0x20,  /* 00000B58    "....... " */
  88.837 +    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x0C,0x00,  /* 00000B60    "........" */
  88.838 +    0x00,0x00,0x0A,0x21,0x12,0x0B,0x04,0x0C,  /* 00000B68    "...!...." */
  88.839 +    0xFF,0xFF,0x0C,0x00,0x01,0x00,0x0A,0x22,  /* 00000B70    "......."" */
  88.840 +    0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x0C,0x00,  /* 00000B78    "........" */
  88.841 +    0x0A,0x02,0x00,0x0A,0x23,0x12,0x0C,0x04,  /* 00000B80    "....#..." */
  88.842 +    0x0C,0xFF,0xFF,0x0C,0x00,0x0A,0x03,0x00,  /* 00000B88    "........" */
  88.843 +    0x0A,0x24,0x12,0x0B,0x04,0x0C,0xFF,0xFF,  /* 00000B90    ".$......" */
  88.844 +    0x0D,0x00,0x00,0x00,0x0A,0x25,0x12,0x0B,  /* 00000B98    ".....%.." */
  88.845 +    0x04,0x0C,0xFF,0xFF,0x0D,0x00,0x01,0x00,  /* 00000BA0    "........" */
  88.846 +    0x0A,0x26,0x12,0x0C,0x04,0x0C,0xFF,0xFF,  /* 00000BA8    ".&......" */
  88.847 +    0x0D,0x00,0x0A,0x02,0x00,0x0A,0x27,0x12,  /* 00000BB0    "......'." */
  88.848 +    0x0C,0x04,0x0C,0xFF,0xFF,0x0D,0x00,0x0A,  /* 00000BB8    "........" */
  88.849 +    0x03,0x00,0x0A,0x28,0x12,0x0B,0x04,0x0C,  /* 00000BC0    "...(...." */
  88.850 +    0xFF,0xFF,0x0E,0x00,0x00,0x00,0x0A,0x29,  /* 00000BC8    ".......)" */
  88.851 +    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x0E,0x00,  /* 00000BD0    "........" */
  88.852 +    0x01,0x00,0x0A,0x2A,0x12,0x0C,0x04,0x0C,  /* 00000BD8    "...*...." */
  88.853 +    0xFF,0xFF,0x0E,0x00,0x0A,0x02,0x00,0x0A,  /* 00000BE0    "........" */
  88.854 +    0x2B,0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x0E,  /* 00000BE8    "+......." */
  88.855 +    0x00,0x0A,0x03,0x00,0x0A,0x2C,0x12,0x0B,  /* 00000BF0    ".....,.." */
  88.856 +    0x04,0x0C,0xFF,0xFF,0x0F,0x00,0x00,0x00,  /* 00000BF8    "........" */
  88.857 +    0x0A,0x2D,0x12,0x0B,0x04,0x0C,0xFF,0xFF,  /* 00000C00    ".-......" */
  88.858 +    0x0F,0x00,0x01,0x00,0x0A,0x2E,0x12,0x0C,  /* 00000C08    "........" */
  88.859 +    0x04,0x0C,0xFF,0xFF,0x0F,0x00,0x0A,0x02,  /* 00000C10    "........" */
  88.860 +    0x00,0x0A,0x2F,0x12,0x0C,0x04,0x0C,0xFF,  /* 00000C18    "../....." */
  88.861 +    0xFF,0x0F,0x00,0x0A,0x03,0x00,0x0A,0x10,  /* 00000C20    "........" */
  88.862 +    0x5B,0x82,0x46,0x37,0x49,0x53,0x41,0x5F,  /* 00000C28    "[.F7ISA_" */
  88.863 +    0x08,0x5F,0x41,0x44,0x52,0x0C,0x00,0x00,  /* 00000C30    "._ADR..." */
  88.864 +    0x01,0x00,0x5B,0x80,0x50,0x49,0x52,0x51,  /* 00000C38    "..[.PIRQ" */
  88.865 +    0x02,0x0A,0x60,0x0A,0x04,0x10,0x2E,0x5C,  /* 00000C40    "..`....\" */
  88.866 +    0x00,0x5B,0x81,0x29,0x5C,0x2F,0x04,0x5F,  /* 00000C48    ".[.)\/._" */
  88.867 +    0x53,0x42,0x5F,0x50,0x43,0x49,0x30,0x49,  /* 00000C50    "SB_PCI0I" */
  88.868 +    0x53,0x41,0x5F,0x50,0x49,0x52,0x51,0x01,  /* 00000C58    "SA_PIRQ." */
  88.869 +    0x50,0x49,0x52,0x41,0x08,0x50,0x49,0x52,  /* 00000C60    "PIRA.PIR" */
  88.870 +    0x42,0x08,0x50,0x49,0x52,0x43,0x08,0x50,  /* 00000C68    "B.PIRC.P" */
  88.871 +    0x49,0x52,0x44,0x08,0x5B,0x82,0x46,0x0B,  /* 00000C70    "IRD.[.F." */
  88.872 +    0x53,0x59,0x53,0x52,0x08,0x5F,0x48,0x49,  /* 00000C78    "SYSR._HI" */
  88.873 +    0x44,0x0C,0x41,0xD0,0x0C,0x02,0x08,0x5F,  /* 00000C80    "D.A...._" */
  88.874 +    0x55,0x49,0x44,0x01,0x08,0x43,0x52,0x53,  /* 00000C88    "UID..CRS" */
  88.875 +    0x5F,0x11,0x4E,0x08,0x0A,0x8A,0x47,0x01,  /* 00000C90    "_.N...G." */
  88.876 +    0x10,0x00,0x10,0x00,0x00,0x10,0x47,0x01,  /* 00000C98    "......G." */
  88.877 +    0x22,0x00,0x22,0x00,0x00,0x0C,0x47,0x01,  /* 00000CA0    ""."...G." */
  88.878 +    0x30,0x00,0x30,0x00,0x00,0x10,0x47,0x01,  /* 00000CA8    "0.0...G." */
  88.879 +    0x44,0x00,0x44,0x00,0x00,0x1C,0x47,0x01,  /* 00000CB0    "D.D...G." */
  88.880 +    0x62,0x00,0x62,0x00,0x00,0x02,0x47,0x01,  /* 00000CB8    "b.b...G." */
  88.881 +    0x65,0x00,0x65,0x00,0x00,0x0B,0x47,0x01,  /* 00000CC0    "e.e...G." */
  88.882 +    0x72,0x00,0x72,0x00,0x00,0x0E,0x47,0x01,  /* 00000CC8    "r.r...G." */
  88.883 +    0x80,0x00,0x80,0x00,0x00,0x01,0x47,0x01,  /* 00000CD0    "......G." */
  88.884 +    0x84,0x00,0x84,0x00,0x00,0x03,0x47,0x01,  /* 00000CD8    "......G." */
  88.885 +    0x88,0x00,0x88,0x00,0x00,0x01,0x47,0x01,  /* 00000CE0    "......G." */
  88.886 +    0x8C,0x00,0x8C,0x00,0x00,0x03,0x47,0x01,  /* 00000CE8    "......G." */
  88.887 +    0x90,0x00,0x90,0x00,0x00,0x10,0x47,0x01,  /* 00000CF0    "......G." */
  88.888 +    0xA2,0x00,0xA2,0x00,0x00,0x1C,0x47,0x01,  /* 00000CF8    "......G." */
  88.889 +    0xE0,0x00,0xE0,0x00,0x00,0x10,0x47,0x01,  /* 00000D00    "......G." */
  88.890 +    0xA0,0x08,0xA0,0x08,0x00,0x04,0x47,0x01,  /* 00000D08    "......G." */
  88.891 +    0xC0,0x0C,0xC0,0x0C,0x00,0x10,0x47,0x01,  /* 00000D10    "......G." */
  88.892 +    0xD0,0x04,0xD0,0x04,0x00,0x02,0x79,0x00,  /* 00000D18    "......y." */
  88.893 +    0x14,0x0B,0x5F,0x43,0x52,0x53,0x00,0xA4,  /* 00000D20    ".._CRS.." */
  88.894 +    0x43,0x52,0x53,0x5F,0x5B,0x82,0x2B,0x50,  /* 00000D28    "CRS_[.+P" */
  88.895 +    0x49,0x43,0x5F,0x08,0x5F,0x48,0x49,0x44,  /* 00000D30    "IC_._HID" */
  88.896 +    0x0B,0x41,0xD0,0x08,0x5F,0x43,0x52,0x53,  /* 00000D38    ".A.._CRS" */
  88.897 +    0x11,0x18,0x0A,0x15,0x47,0x01,0x20,0x00,  /* 00000D40    "....G. ." */
  88.898 +    0x20,0x00,0x01,0x02,0x47,0x01,0xA0,0x00,  /* 00000D48    " ...G..." */
  88.899 +    0xA0,0x00,0x01,0x02,0x22,0x04,0x00,0x79,  /* 00000D50    "...."..y" */
  88.900 +    0x00,0x5B,0x82,0x47,0x05,0x44,0x4D,0x41,  /* 00000D58    ".[.G.DMA" */
  88.901 +    0x30,0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,  /* 00000D60    "0._HID.A" */
  88.902 +    0xD0,0x02,0x00,0x08,0x5F,0x43,0x52,0x53,  /* 00000D68    "...._CRS" */
  88.903 +    0x11,0x41,0x04,0x0A,0x3D,0x2A,0x10,0x04,  /* 00000D70    ".A..=*.." */
  88.904 +    0x47,0x01,0x00,0x00,0x00,0x00,0x00,0x10,  /* 00000D78    "G......." */
  88.905 +    0x47,0x01,0x81,0x00,0x81,0x00,0x00,0x03,  /* 00000D80    "G......." */
  88.906 +    0x47,0x01,0x87,0x00,0x87,0x00,0x00,0x01,  /* 00000D88    "G......." */
  88.907 +    0x47,0x01,0x89,0x00,0x89,0x00,0x00,0x03,  /* 00000D90    "G......." */
  88.908 +    0x47,0x01,0x8F,0x00,0x8F,0x00,0x00,0x01,  /* 00000D98    "G......." */
  88.909 +    0x47,0x01,0xC0,0x00,0xC0,0x00,0x00,0x20,  /* 00000DA0    "G...... " */
  88.910 +    0x47,0x01,0x80,0x04,0x80,0x04,0x00,0x10,  /* 00000DA8    "G......." */
  88.911 +    0x79,0x00,0x5B,0x82,0x25,0x54,0x4D,0x52,  /* 00000DB0    "y.[.%TMR" */
  88.912 +    0x5F,0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,  /* 00000DB8    "_._HID.A" */
  88.913 +    0xD0,0x01,0x00,0x08,0x5F,0x43,0x52,0x53,  /* 00000DC0    "...._CRS" */
  88.914 +    0x11,0x10,0x0A,0x0D,0x47,0x01,0x40,0x00,  /* 00000DC8    "....G.@." */
  88.915 +    0x40,0x00,0x00,0x04,0x22,0x01,0x00,0x79,  /* 00000DD0    "@..."..y" */
  88.916 +    0x00,0x5B,0x82,0x25,0x52,0x54,0x43,0x5F,  /* 00000DD8    ".[.%RTC_" */
  88.917 +    0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,  /* 00000DE0    "._HID.A." */
  88.918 +    0x0B,0x00,0x08,0x5F,0x43,0x52,0x53,0x11,  /* 00000DE8    "..._CRS." */
  88.919 +    0x10,0x0A,0x0D,0x47,0x01,0x70,0x00,0x70,  /* 00000DF0    "...G.p.p" */
  88.920 +    0x00,0x00,0x02,0x22,0x00,0x01,0x79,0x00,  /* 00000DF8    "..."..y." */
  88.921 +    0x5B,0x82,0x22,0x53,0x50,0x4B,0x52,0x08,  /* 00000E00    "[."SPKR." */
  88.922 +    0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x08,  /* 00000E08    "_HID.A.." */
  88.923 +    0x00,0x08,0x5F,0x43,0x52,0x53,0x11,0x0D,  /* 00000E10    ".._CRS.." */
  88.924 +    0x0A,0x0A,0x47,0x01,0x61,0x00,0x61,0x00,  /* 00000E18    "..G.a.a." */
  88.925 +    0x00,0x01,0x79,0x00,0x5B,0x82,0x31,0x50,  /* 00000E20    "..y.[.1P" */
  88.926 +    0x53,0x32,0x4D,0x08,0x5F,0x48,0x49,0x44,  /* 00000E28    "S2M._HID" */
  88.927 +    0x0C,0x41,0xD0,0x0F,0x13,0x08,0x5F,0x43,  /* 00000E30    ".A...._C" */
  88.928 +    0x49,0x44,0x0C,0x41,0xD0,0x0F,0x13,0x14,  /* 00000E38    "ID.A...." */
  88.929 +    0x09,0x5F,0x53,0x54,0x41,0x00,0xA4,0x0A,  /* 00000E40    "._STA..." */
  88.930 +    0x0F,0x08,0x5F,0x43,0x52,0x53,0x11,0x08,  /* 00000E48    ".._CRS.." */
  88.931 +    0x0A,0x05,0x22,0x00,0x10,0x79,0x00,0x5B,  /* 00000E50    ".."..y.[" */
  88.932 +    0x82,0x42,0x04,0x50,0x53,0x32,0x4B,0x08,  /* 00000E58    ".B.PS2K." */
  88.933 +    0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x03,  /* 00000E60    "_HID.A.." */
  88.934 +    0x03,0x08,0x5F,0x43,0x49,0x44,0x0C,0x41,  /* 00000E68    ".._CID.A" */
  88.935 +    0xD0,0x03,0x0B,0x14,0x09,0x5F,0x53,0x54,  /* 00000E70    "....._ST" */
  88.936 +    0x41,0x00,0xA4,0x0A,0x0F,0x08,0x5F,0x43,  /* 00000E78    "A....._C" */
  88.937 +    0x52,0x53,0x11,0x18,0x0A,0x15,0x47,0x01,  /* 00000E80    "RS....G." */
  88.938 +    0x60,0x00,0x60,0x00,0x00,0x01,0x47,0x01,  /* 00000E88    "`.`...G." */
  88.939 +    0x64,0x00,0x64,0x00,0x00,0x01,0x22,0x02,  /* 00000E90    "d.d..."." */
  88.940 +    0x00,0x79,0x00,0x5B,0x82,0x3A,0x46,0x44,  /* 00000E98    ".y.[.:FD" */
  88.941 +    0x43,0x30,0x08,0x5F,0x48,0x49,0x44,0x0C,  /* 00000EA0    "C0._HID." */
  88.942 +    0x41,0xD0,0x07,0x00,0x14,0x09,0x5F,0x53,  /* 00000EA8    "A....._S" */
  88.943 +    0x54,0x41,0x00,0xA4,0x0A,0x0F,0x08,0x5F,  /* 00000EB0    "TA....._" */
  88.944 +    0x43,0x52,0x53,0x11,0x1B,0x0A,0x18,0x47,  /* 00000EB8    "CRS....G" */
  88.945 +    0x01,0xF0,0x03,0xF0,0x03,0x01,0x06,0x47,  /* 00000EC0    ".......G" */
  88.946 +    0x01,0xF7,0x03,0xF7,0x03,0x01,0x01,0x22,  /* 00000EC8    "......."" */
  88.947 +    0x40,0x00,0x2A,0x04,0x00,0x79,0x00,0x5B,  /* 00000ED0    "@.*..y.[" */
  88.948 +    0x82,0x46,0x04,0x55,0x41,0x52,0x31,0x08,  /* 00000ED8    ".F.UAR1." */
  88.949 +    0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x05,  /* 00000EE0    "_HID.A.." */
  88.950 +    0x01,0x08,0x5F,0x55,0x49,0x44,0x01,0x14,  /* 00000EE8    ".._UID.." */
  88.951 +    0x19,0x5F,0x53,0x54,0x41,0x00,0xA0,0x0D,  /* 00000EF0    "._STA..." */
  88.952 +    0x93,0x5E,0x5E,0x5E,0x5E,0x55,0x41,0x52,  /* 00000EF8    ".^^^^UAR" */
  88.953 +    0x31,0x00,0xA4,0x00,0xA1,0x04,0xA4,0x0A,  /* 00000F00    "1......." */
  88.954 +    0x0F,0x08,0x5F,0x43,0x52,0x53,0x11,0x10,  /* 00000F08    ".._CRS.." */
  88.955 +    0x0A,0x0D,0x47,0x01,0xF8,0x03,0xF8,0x03,  /* 00000F10    "..G....." */
  88.956 +    0x08,0x08,0x22,0x10,0x00,0x79,0x00,0x5B,  /* 00000F18    ".."..y.[" */
  88.957 +    0x82,0x47,0x04,0x55,0x41,0x52,0x32,0x08,  /* 00000F20    ".G.UAR2." */
  88.958 +    0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x05,  /* 00000F28    "_HID.A.." */
  88.959 +    0x01,0x08,0x5F,0x55,0x49,0x44,0x0A,0x02,  /* 00000F30    ".._UID.." */
  88.960 +    0x14,0x19,0x5F,0x53,0x54,0x41,0x00,0xA0,  /* 00000F38    ".._STA.." */
  88.961 +    0x0D,0x93,0x5E,0x5E,0x5E,0x5E,0x55,0x41,  /* 00000F40    "..^^^^UA" */
  88.962 +    0x52,0x32,0x00,0xA4,0x00,0xA1,0x04,0xA4,  /* 00000F48    "R2......" */
  88.963 +    0x0A,0x0F,0x08,0x5F,0x43,0x52,0x53,0x11,  /* 00000F50    "..._CRS." */
  88.964 +    0x10,0x0A,0x0D,0x47,0x01,0xF8,0x02,0xF8,  /* 00000F58    "...G...." */
  88.965 +    0x02,0x08,0x08,0x22,0x08,0x00,0x79,0x00,  /* 00000F60    "..."..y." */
  88.966 +    0x5B,0x82,0x36,0x4C,0x54,0x50,0x31,0x08,  /* 00000F68    "[.6LTP1." */
  88.967 +    0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x04,  /* 00000F70    "_HID.A.." */
  88.968 +    0x00,0x08,0x5F,0x55,0x49,0x44,0x0A,0x02,  /* 00000F78    ".._UID.." */
  88.969 +    0x14,0x09,0x5F,0x53,0x54,0x41,0x00,0xA4,  /* 00000F80    ".._STA.." */
  88.970 +    0x0A,0x0F,0x08,0x5F,0x43,0x52,0x53,0x11,  /* 00000F88    "..._CRS." */
  88.971 +    0x10,0x0A,0x0D,0x47,0x01,0x78,0x03,0x78,  /* 00000F90    "...G.x.x" */
  88.972 +    0x03,0x08,0x08,0x22,0x80,0x00,0x79,0x00,  /* 00000F98    "..."..y." */
  88.973 +    0x5B,0x82,0x4D,0x07,0x53,0x31,0x46,0x30,  /* 00000FA0    "[.M.S1F0" */
  88.974 +    0x08,0x5F,0x41,0x44,0x52,0x0C,0x00,0x00,  /* 00000FA8    "._ADR..." */
  88.975 +    0x06,0x00,0x08,0x5F,0x53,0x55,0x4E,0x01,  /* 00000FB0    "..._SUN." */
  88.976 +    0x14,0x13,0x5F,0x50,0x53,0x30,0x00,0x70,  /* 00000FB8    ".._PS0.p" */
  88.977 +    0x0A,0x80,0x5C,0x2E,0x5F,0x47,0x50,0x45,  /* 00000FC0    "..\._GPE" */
  88.978 +    0x44,0x50,0x54,0x32,0x14,0x13,0x5F,0x50,  /* 00000FC8    "DPT2.._P" */
  88.979 +    0x53,0x33,0x00,0x70,0x0A,0x83,0x5C,0x2E,  /* 00000FD0    "S3.p..\." */
  88.980 +    0x5F,0x47,0x50,0x45,0x44,0x50,0x54,0x32,  /* 00000FD8    "_GPEDPT2" */
  88.981 +    0x14,0x1F,0x5F,0x45,0x4A,0x30,0x01,0x70,  /* 00000FE0    ".._EJ0.p" */
  88.982 +    0x0A,0x88,0x5C,0x2E,0x5F,0x47,0x50,0x45,  /* 00000FE8    "..\._GPE" */
  88.983 +    0x44,0x50,0x54,0x32,0x70,0x01,0x5C,0x2E,  /* 00000FF0    "DPT2p.\." */
  88.984 +    0x5F,0x47,0x50,0x45,0x50,0x48,0x50,0x31,  /* 00000FF8    "_GPEPHP1" */
  88.985 +    0x14,0x1E,0x5F,0x53,0x54,0x41,0x00,0x70,  /* 00001000    ".._STA.p" */
  88.986 +    0x0A,0x89,0x5C,0x2E,0x5F,0x47,0x50,0x45,  /* 00001008    "..\._GPE" */
  88.987 +    0x44,0x50,0x54,0x32,0xA4,0x5C,0x2E,0x5F,  /* 00001010    "DPT2.\._" */
  88.988 +    0x47,0x50,0x45,0x50,0x48,0x50,0x31,0x5B,  /* 00001018    "GPEPHP1[" */
  88.989 +    0x82,0x4E,0x07,0x53,0x32,0x46,0x30,0x08,  /* 00001020    ".N.S2F0." */
  88.990 +    0x5F,0x41,0x44,0x52,0x0C,0x00,0x00,0x07,  /* 00001028    "_ADR...." */
  88.991 +    0x00,0x08,0x5F,0x53,0x55,0x4E,0x0A,0x02,  /* 00001030    ".._SUN.." */
  88.992 +    0x14,0x13,0x5F,0x50,0x53,0x30,0x00,0x70,  /* 00001038    ".._PS0.p" */
  88.993 +    0x0A,0x90,0x5C,0x2E,0x5F,0x47,0x50,0x45,  /* 00001040    "..\._GPE" */
  88.994 +    0x44,0x50,0x54,0x32,0x14,0x13,0x5F,0x50,  /* 00001048    "DPT2.._P" */
  88.995 +    0x53,0x33,0x00,0x70,0x0A,0x93,0x5C,0x2E,  /* 00001050    "S3.p..\." */
  88.996 +    0x5F,0x47,0x50,0x45,0x44,0x50,0x54,0x32,  /* 00001058    "_GPEDPT2" */
  88.997 +    0x14,0x1F,0x5F,0x45,0x4A,0x30,0x01,0x70,  /* 00001060    ".._EJ0.p" */
  88.998 +    0x0A,0x98,0x5C,0x2E,0x5F,0x47,0x50,0x45,  /* 00001068    "..\._GPE" */
  88.999 +    0x44,0x50,0x54,0x32,0x70,0x01,0x5C,0x2E,  /* 00001070    "DPT2p.\." */
 88.1000 +    0x5F,0x47,0x50,0x45,0x50,0x48,0x50,0x32,  /* 00001078    "_GPEPHP2" */
 88.1001 +    0x14,0x1E,0x5F,0x53,0x54,0x41,0x00,0x70,  /* 00001080    ".._STA.p" */
 88.1002 +    0x0A,0x99,0x5C,0x2E,0x5F,0x47,0x50,0x45,  /* 00001088    "..\._GPE" */
 88.1003 +    0x44,0x50,0x54,0x32,0xA4,0x5C,0x2E,0x5F,  /* 00001090    "DPT2.\._" */
 88.1004 +    0x47,0x50,0x45,0x50,0x48,0x50,0x32,0x10,  /* 00001098    "GPEPHP2." */
 88.1005 +    0x4E,0x0B,0x5F,0x47,0x50,0x45,0x5B,0x80,  /* 000010A0    "N._GPE[." */
 88.1006 +    0x50,0x48,0x50,0x5F,0x01,0x0B,0xC0,0x10,  /* 000010A8    "PHP_...." */
 88.1007 +    0x0A,0x03,0x5B,0x81,0x15,0x50,0x48,0x50,  /* 000010B0    "..[..PHP" */
 88.1008 +    0x5F,0x01,0x50,0x53,0x54,0x41,0x08,0x50,  /* 000010B8    "_.PSTA.P" */
 88.1009 +    0x48,0x50,0x31,0x08,0x50,0x48,0x50,0x32,  /* 000010C0    "HP1.PHP2" */
 88.1010 +    0x08,0x5B,0x80,0x44,0x47,0x31,0x5F,0x01,  /* 000010C8    ".[.DG1_." */
 88.1011 +    0x0B,0x44,0xB0,0x0A,0x04,0x5B,0x81,0x10,  /* 000010D0    ".D...[.." */
 88.1012 +    0x44,0x47,0x31,0x5F,0x01,0x44,0x50,0x54,  /* 000010D8    "DG1_.DPT" */
 88.1013 +    0x31,0x08,0x44,0x50,0x54,0x32,0x08,0x14,  /* 000010E0    "1.DPT2.." */
 88.1014 +    0x46,0x07,0x5F,0x4C,0x30,0x33,0x00,0x08,  /* 000010E8    "F._L03.." */
 88.1015 +    0x53,0x4C,0x54,0x5F,0x00,0x08,0x45,0x56,  /* 000010F0    "SLT_..EV" */
 88.1016 +    0x54,0x5F,0x00,0x70,0x50,0x53,0x54,0x41,  /* 000010F8    "T_.pPSTA" */
 88.1017 +    0x61,0x7A,0x61,0x0A,0x04,0x53,0x4C,0x54,  /* 00001100    "aza..SLT" */
 88.1018 +    0x5F,0x7B,0x61,0x0A,0x0F,0x45,0x56,0x54,  /* 00001108    "_{a..EVT" */
 88.1019 +    0x5F,0x70,0x53,0x4C,0x54,0x5F,0x44,0x50,  /* 00001110    "_pSLT_DP" */
 88.1020 +    0x54,0x31,0x70,0x45,0x56,0x54,0x5F,0x44,  /* 00001118    "T1pEVT_D" */
 88.1021 +    0x50,0x54,0x32,0xA0,0x1B,0x93,0x53,0x4C,  /* 00001120    "PT2...SL" */
 88.1022 +    0x54,0x5F,0x01,0x86,0x5C,0x2F,0x03,0x5F,  /* 00001128    "T_..\/._" */
 88.1023 +    0x53,0x42,0x5F,0x50,0x43,0x49,0x30,0x53,  /* 00001130    "SB_PCI0S" */
 88.1024 +    0x31,0x46,0x30,0x45,0x56,0x54,0x5F,0xA1,  /* 00001138    "1F0EVT_." */
 88.1025 +    0x1E,0xA0,0x1C,0x93,0x53,0x4C,0x54,0x5F,  /* 00001140    "....SLT_" */
 88.1026 +    0x0A,0x02,0x86,0x5C,0x2F,0x03,0x5F,0x53,  /* 00001148    "...\/._S" */
 88.1027 +    0x42,0x5F,0x50,0x43,0x49,0x30,0x53,0x32,  /* 00001150    "B_PCI0S2" */
 88.1028 +    0x46,0x30,0x45,0x56,0x54,0x5F,
 88.1029  };
 88.1030  int DsdtLen=sizeof(AmlCode);
    89.1 --- a/tools/firmware/hvmloader/cacheattr.c	Mon Nov 10 15:52:15 2008 -0800
    89.2 +++ b/tools/firmware/hvmloader/cacheattr.c	Wed Feb 11 16:25:03 2009 -0800
    89.3 @@ -88,11 +88,25 @@ void cacheattr_init(void)
    89.4      nr_var_ranges = (uint8_t)mtrr_cap;
    89.5      if ( nr_var_ranges != 0 )
    89.6      {
    89.7 -        /* A single UC range covering PCI space. */
    89.8 -        wrmsr(MSR_MTRRphysBase(0), PCI_MEMBASE);
    89.9 -        wrmsr(MSR_MTRRphysMask(0),
   89.10 -              ((uint64_t)(int32_t)PCI_MEMBASE & addr_mask) | (1u << 11));
   89.11 -        printf("var MTRRs ... ");
   89.12 +        unsigned long base = pci_mem_start, size;
   89.13 +        int i;
   89.14 +
   89.15 +        for ( i = 0; (base != pci_mem_end) && (i < nr_var_ranges); i++ )
   89.16 +        {
   89.17 +            size = PAGE_SIZE;
   89.18 +            while ( !(base & size) )
   89.19 +                size <<= 1;
   89.20 +            while ( ((base + size) < base) || ((base + size) > pci_mem_end) )
   89.21 +                size >>= 1;
   89.22 +
   89.23 +            wrmsr(MSR_MTRRphysBase(i), base);
   89.24 +            wrmsr(MSR_MTRRphysMask(i),
   89.25 +                  (~(uint64_t)(size-1) & addr_mask) | (1u << 11));
   89.26 +
   89.27 +            base += size;
   89.28 +        }
   89.29 +
   89.30 +        printf("var MTRRs [%d/%d] ... ", i, nr_var_ranges);
   89.31      }
   89.32  
   89.33      wrmsr(MSR_MTRRdefType, mtrr_def);
    90.1 --- a/tools/firmware/hvmloader/config.h	Mon Nov 10 15:52:15 2008 -0800
    90.2 +++ b/tools/firmware/hvmloader/config.h	Wed Feb 11 16:25:03 2009 -0800
    90.3 @@ -1,6 +1,9 @@
    90.4  #ifndef __HVMLOADER_CONFIG_H__
    90.5  #define __HVMLOADER_CONFIG_H__
    90.6  
    90.7 +#define PAGE_SHIFT 12
    90.8 +#define PAGE_SIZE  (1ul << PAGE_SHIFT)
    90.9 +
   90.10  #define IOAPIC_BASE_ADDRESS 0xfec00000
   90.11  #define IOAPIC_ID           0x01
   90.12  #define IOAPIC_VERSION      0x11
   90.13 @@ -11,8 +14,14 @@
   90.14  #define PCI_ISA_DEVFN       0x08    /* dev 1, fn 0 */
   90.15  #define PCI_ISA_IRQ_MASK    0x0c20U /* ISA IRQs 5,10,11 are PCI connected */
   90.16  
   90.17 -#define PCI_MEMBASE         0xf0000000
   90.18 -#define PCI_MEMSIZE         0x0c000000
   90.19 +/* MMIO hole: Hardcoded defaults, which can be dynamically expanded. */
   90.20 +#define PCI_MEM_START       0xf0000000
   90.21 +#define PCI_MEM_END         0xfc000000
   90.22 +extern unsigned long pci_mem_start, pci_mem_end;
   90.23 +
   90.24 +/* We reserve 16MB for special BIOS mappings, etc. */
   90.25 +#define RESERVED_MEMBASE    0xfc000000
   90.26 +#define RESERVED_MEMSIZE    0x01000000
   90.27  
   90.28  #define ROMBIOS_SEG            0xF000
   90.29  #define ROMBIOS_BEGIN          0x000F0000
   90.30 @@ -21,24 +30,35 @@
   90.31  #define ROMBIOS_END            (ROMBIOS_BEGIN + ROMBIOS_SIZE)
   90.32  
   90.33  /* Memory map. */
   90.34 +#define SCRATCH_PHYSICAL_ADDRESS      0x00010000
   90.35  #define HYPERCALL_PHYSICAL_ADDRESS    0x00080000
   90.36  #define VGABIOS_PHYSICAL_ADDRESS      0x000C0000
   90.37 -#define ETHERBOOT_PHYSICAL_ADDRESS    0x000D0000
   90.38 -#define SMBIOS_PHYSICAL_ADDRESS       0x000E9000
   90.39 -#define SMBIOS_MAXIMUM_SIZE           0x00001000
   90.40 -#define ACPI_PHYSICAL_ADDRESS         0x000EA000
   90.41 +#define OPTIONROM_PHYSICAL_ADDRESS    0x000C8000
   90.42 +#define OPTIONROM_PHYSICAL_END        0x000EA000
   90.43 +#define BIOS_INFO_PHYSICAL_ADDRESS    0x000EA000
   90.44 +#define ACPI_PHYSICAL_ADDRESS         0x000EA020
   90.45 +#define E820_PHYSICAL_ADDRESS         0x000EA100
   90.46 +#define SMBIOS_PHYSICAL_ADDRESS       0x000EB000
   90.47 +#define SMBIOS_MAXIMUM_SIZE           0x00005000
   90.48  #define ROMBIOS_PHYSICAL_ADDRESS      0x000F0000
   90.49 -#define SCRATCH_PHYSICAL_ADDRESS      0x00010000
   90.50 +
   90.51 +/* Offsets from E820_PHYSICAL_ADDRESS. */
   90.52 +#define E820_NR_OFFSET                0x0
   90.53 +#define E820_OFFSET                   0x8
   90.54  
   90.55  /* Xen Platform Device */
   90.56  #define PFFLAG_ROM_LOCK 1 /* Sets whether ROM memory area is RW or RO */
   90.57  
   90.58 +/* Located at BIOS_INFO_PHYSICAL_ADDRESS. */
   90.59  struct bios_info {
   90.60 -    uint8_t  com1_present:1;
   90.61 -    uint8_t  com2_present:1;
   90.62 -    uint8_t  hpet_present:1;
   90.63 -    uint32_t pci_min, pci_len;
   90.64 -    uint16_t xen_pfiob;
   90.65 +    uint8_t  com1_present:1;    /* 0[0] - System has COM1? */
   90.66 +    uint8_t  com2_present:1;    /* 0[1] - System has COM2? */
   90.67 +    uint8_t  hpet_present:1;    /* 0[2] - System has HPET? */
   90.68 +    uint32_t pci_min, pci_len;  /* 4, 8 - PCI I/O hole boundaries */
   90.69 +    uint32_t bios32_entry;      /* 12   - Entry point for 32-bit BIOS */
   90.70 +    uint16_t xen_pfiob;         /* 16   - Xen platform device I/O ports */
   90.71  };
   90.72 +#define BIOSINFO_OFF_bios32_entry 12
   90.73 +#define BIOSINFO_OFF_xen_pfiob    16
   90.74  
   90.75  #endif /* __HVMLOADER_CONFIG_H__ */
    91.1 --- a/tools/firmware/hvmloader/e820.h	Mon Nov 10 15:52:15 2008 -0800
    91.2 +++ b/tools/firmware/hvmloader/e820.h	Wed Feb 11 16:25:03 2009 -0800
    91.3 @@ -17,7 +17,7 @@ struct e820entry {
    91.4      uint32_t type;
    91.5  } __attribute__((packed));
    91.6  
    91.7 -#define HVM_E820_NR ((unsigned char *)HVM_E820_PAGE + HVM_E820_NR_OFFSET)
    91.8 -#define HVM_E820    ((struct e820entry *)(HVM_E820_PAGE + HVM_E820_OFFSET))
    91.9 +#define E820_NR ((uint16_t *)(E820_PHYSICAL_ADDRESS + E820_NR_OFFSET))
   91.10 +#define E820    ((struct e820entry *)(E820_PHYSICAL_ADDRESS + E820_OFFSET))
   91.11  
   91.12  #endif /* __HVMLOADER_E820_H__ */
    92.1 --- a/tools/firmware/hvmloader/hvmloader.c	Mon Nov 10 15:52:15 2008 -0800
    92.2 +++ b/tools/firmware/hvmloader/hvmloader.c	Wed Feb 11 16:25:03 2009 -0800
    92.3 @@ -31,6 +31,7 @@
    92.4  #include "option_rom.h"
    92.5  #include <xen/version.h>
    92.6  #include <xen/hvm/params.h>
    92.7 +#include <xen/memory.h>
    92.8  
    92.9  asm (
   92.10      "    .text                       \n"
   92.11 @@ -99,6 +100,9 @@ asm (
   92.12      "    .text                       \n"
   92.13      );
   92.14  
   92.15 +unsigned long pci_mem_start = PCI_MEM_START;
   92.16 +unsigned long pci_mem_end = PCI_MEM_END;
   92.17 +
   92.18  static enum { VGA_none, VGA_std, VGA_cirrus } virtual_vga = VGA_none;
   92.19  
   92.20  static void init_hypercalls(void)
   92.21 @@ -148,16 +152,14 @@ static void apic_setup(void)
   92.22  
   92.23  static void pci_setup(void)
   92.24  {
   92.25 -    uint32_t base, devfn, bar_reg, bar_data, bar_sz, cmd;
   92.26 +    uint32_t base, devfn, bar_reg, bar_data, bar_sz, cmd, mmio_total = 0;
   92.27      uint16_t class, vendor_id, device_id;
   92.28      unsigned int bar, pin, link, isa_irq;
   92.29  
   92.30      /* Resources assignable to PCI devices via BARs. */
   92.31      struct resource {
   92.32          uint32_t base, max;
   92.33 -    } *resource;
   92.34 -    struct resource mem_resource = { PCI_MEMBASE, PCI_MEMBASE + PCI_MEMSIZE };
   92.35 -    struct resource io_resource  = { 0xc000, 0x10000 };
   92.36 +    } *resource, mem_resource, io_resource;
   92.37  
   92.38      /* Create a list of device BARs in descending order of size. */
   92.39      struct bars {
   92.40 @@ -248,6 +250,10 @@ static void pci_setup(void)
   92.41              bars[i].bar_reg = bar_reg;
   92.42              bars[i].bar_sz  = bar_sz;
   92.43  
   92.44 +            if ( (bar_data & PCI_BASE_ADDRESS_SPACE) ==
   92.45 +                 PCI_BASE_ADDRESS_SPACE_MEMORY )
   92.46 +                mmio_total += bar_sz;
   92.47 +
   92.48              nr_bars++;
   92.49  
   92.50              /* Skip the upper-half of the address for a 64-bit BAR. */
   92.51 @@ -269,8 +275,35 @@ static void pci_setup(void)
   92.52              printf("pci dev %02x:%x INT%c->IRQ%u\n",
   92.53                     devfn>>3, devfn&7, 'A'+pin-1, isa_irq);
   92.54          }
   92.55 +
   92.56 +        /* Enable bus mastering. */
   92.57 +        cmd = pci_readw(devfn, PCI_COMMAND);
   92.58 +        cmd |= PCI_COMMAND_MASTER;
   92.59 +        pci_writew(devfn, PCI_COMMAND, cmd);
   92.60      }
   92.61  
   92.62 +    while ( (mmio_total > (pci_mem_end - pci_mem_start)) &&
   92.63 +            ((pci_mem_start << 1) != 0) )
   92.64 +        pci_mem_start <<= 1;
   92.65 +
   92.66 +    while ( (pci_mem_start >> PAGE_SHIFT) < hvm_info->low_mem_pgend )
   92.67 +    {
   92.68 +        struct xen_add_to_physmap xatp;
   92.69 +        if ( hvm_info->high_mem_pgend == 0 )
   92.70 +            hvm_info->high_mem_pgend = 1ull << (32 - PAGE_SHIFT);
   92.71 +        xatp.domid = DOMID_SELF;
   92.72 +        xatp.space = XENMAPSPACE_gmfn;
   92.73 +        xatp.idx   = --hvm_info->low_mem_pgend;
   92.74 +        xatp.gpfn  = hvm_info->high_mem_pgend++;
   92.75 +        if ( hypercall_memory_op(XENMEM_add_to_physmap, &xatp) != 0 )
   92.76 +            BUG();
   92.77 +    }
   92.78 +
   92.79 +    mem_resource.base = pci_mem_start;
   92.80 +    mem_resource.max = pci_mem_end;
   92.81 +    io_resource.base = 0xc000;
   92.82 +    io_resource.max = 0x10000;
   92.83 +
   92.84      /* Assign iomem and ioport resources in descending order of size. */
   92.85      for ( i = 0; i < nr_bars; i++ )
   92.86      {
   92.87 @@ -322,60 +355,56 @@ static void pci_setup(void)
   92.88  }
   92.89  
   92.90  /*
   92.91 - * Scan the PCI bus for the first NIC supported by etherboot, and copy
   92.92 - * the corresponding rom data to *copy_rom_dest. Returns the length of the
   92.93 - * selected rom, or 0 if no NIC found.
   92.94 + * Scan the list of Option ROMs at @roms for one which supports 
   92.95 + * PCI (@vendor_id, @device_id) found at slot @devfn. If one is found,
   92.96 + * copy it to @dest and return its size rounded up to a multiple 2kB. This
   92.97 + * function will not copy ROMs beyond address OPTIONROM_PHYSICAL_END.
   92.98   */
   92.99 -static int scan_etherboot_nic(void *copy_rom_dest)
  92.100 +#define round_option_rom(x) (((x) + 2047) & ~2047)
  92.101 +static int scan_option_rom(
  92.102 +    uint8_t devfn, uint16_t vendor_id, uint16_t device_id,
  92.103 +    void *roms, uint32_t dest)
  92.104  {
  92.105      struct option_rom_header *rom;
  92.106      struct option_rom_pnp_header *pnph;
  92.107      struct option_rom_pci_header *pcih;
  92.108 -    uint32_t devfn;
  92.109 -    uint16_t class, vendor_id, device_id;
  92.110      uint8_t csum;
  92.111      int i;
  92.112  
  92.113 -    for ( devfn = 0; devfn < 128; devfn++ )
  92.114 -    {
  92.115 -        class     = pci_readw(devfn, PCI_CLASS_DEVICE);
  92.116 -        vendor_id = pci_readw(devfn, PCI_VENDOR_ID);
  92.117 -        device_id = pci_readw(devfn, PCI_DEVICE_ID);
  92.118 +    static uint32_t orom_ids[64];
  92.119 +    static int nr_roms;
  92.120 +
  92.121 +    /* Avoid duplicate ROMs. */
  92.122 +    for ( i = 0; i < nr_roms; i++ )
  92.123 +        if ( orom_ids[i] == (vendor_id | ((uint32_t)device_id << 16)) )
  92.124 +            return 0;
  92.125  
  92.126 -        if ( (vendor_id == 0xffff) && (device_id == 0xffff) )
  92.127 -            continue;
  92.128 -
  92.129 -        /* We're only interested in NICs. */
  92.130 -        if ( class != 0x0200 )
  92.131 -            continue;
  92.132 +    rom = roms;
  92.133 +    for ( ; ; )
  92.134 +    {
  92.135 +        /* Invalid signature means we're out of option ROMs. */
  92.136 +        if ( strncmp((char *)rom->signature, "\x55\xaa", 2) ||
  92.137 +             (rom->rom_size == 0) )
  92.138 +            break;
  92.139  
  92.140 -        rom = (struct option_rom_header *)etherboot;
  92.141 -        for ( ; ; )
  92.142 -        {
  92.143 -            /* Invalid signature means we're out of option ROMs. */
  92.144 -            if ( strncmp((char *)rom->signature, "\x55\xaa", 2) ||
  92.145 -                 (rom->rom_size == 0) )
  92.146 -                break;
  92.147 +        /* Invalid checksum means we're out of option ROMs. */
  92.148 +        csum = 0;
  92.149 +        for ( i = 0; i < (rom->rom_size * 512); i++ )
  92.150 +            csum += ((uint8_t *)rom)[i];
  92.151 +        if ( csum != 0 )
  92.152 +            break;
  92.153  
  92.154 -            /* Invalid checksum means we're out of option ROMs. */
  92.155 -            csum = 0;
  92.156 -            for ( i = 0; i < (rom->rom_size * 512); i++ )
  92.157 -                csum += ((uint8_t *)rom)[i];
  92.158 -            if ( csum != 0 )
  92.159 -                break;
  92.160 +        /* Check the PCI PnP header (if any) for a match. */
  92.161 +        pcih = (struct option_rom_pci_header *)
  92.162 +            ((char *)rom + rom->pci_header_offset);
  92.163 +        if ( (rom->pci_header_offset != 0) &&
  92.164 +             !strncmp((char *)pcih->signature, "PCIR", 4) &&
  92.165 +             (pcih->vendor_id == vendor_id) &&
  92.166 +             (pcih->device_id == device_id) )
  92.167 +            goto found;
  92.168  
  92.169 -            /* Check the PCI PnP header (if any) for a match. */
  92.170 -            pcih = (struct option_rom_pci_header *)
  92.171 -                ((char *)rom + rom->pci_header_offset);
  92.172 -            if ( (rom->pci_header_offset != 0) &&
  92.173 -                 !strncmp((char *)pcih->signature, "PCIR", 4) &&
  92.174 -                 (pcih->vendor_id == vendor_id) &&
  92.175 -                 (pcih->device_id == device_id) )
  92.176 -                goto found;
  92.177 -
  92.178 -            rom = (struct option_rom_header *)
  92.179 -                ((char *)rom + rom->rom_size * 512);
  92.180 -        }
  92.181 +        rom = (struct option_rom_header *)
  92.182 +            ((char *)rom + rom->rom_size * 512);
  92.183      }
  92.184  
  92.185      return 0;
  92.186 @@ -392,36 +421,108 @@ static int scan_etherboot_nic(void *copy
  92.187                     ((char *)rom + pnph->next_header_offset))
  92.188                  : ((struct option_rom_pnp_header *)NULL));
  92.189  
  92.190 -    printf("Loading PXE ROM ...\n");
  92.191 +    printf("Loading PCI Option ROM ...\n");
  92.192      if ( (pnph != NULL) && (pnph->manufacturer_name_offset != 0) )
  92.193          printf(" - Manufacturer: %s\n",
  92.194                 (char *)rom + pnph->manufacturer_name_offset);
  92.195      if ( (pnph != NULL) && (pnph->product_name_offset != 0) )
  92.196          printf(" - Product name: %s\n",
  92.197                 (char *)rom + pnph->product_name_offset);
  92.198 -    memcpy(copy_rom_dest, rom, rom->rom_size * 512);
  92.199 -    return rom->rom_size * 512;
  92.200 +
  92.201 +    if ( (dest + rom->rom_size * 512 + 1) > OPTIONROM_PHYSICAL_END )
  92.202 +    {
  92.203 +        printf("Option ROM size %x exceeds available space\n",
  92.204 +               rom->rom_size * 512);
  92.205 +        return 0;
  92.206 +    }
  92.207 +
  92.208 +    orom_ids[nr_roms++] = vendor_id | ((uint32_t)device_id << 16);
  92.209 +    memcpy((void *)dest, rom, rom->rom_size * 512);
  92.210 +    *(uint8_t *)(dest + rom->rom_size * 512) = devfn;
  92.211 +    return round_option_rom(rom->rom_size * 512 + 1);
  92.212 +}
  92.213 +
  92.214 +/*
  92.215 + * Scan the PCI bus for the first NIC supported by etherboot, and copy
  92.216 + * the corresponding rom data to *copy_rom_dest. Returns the length of the
  92.217 + * selected rom, or 0 if no NIC found.
  92.218 + */
  92.219 +static int scan_etherboot_nic(uint32_t copy_rom_dest)
  92.220 +{
  92.221 +    uint8_t devfn;
  92.222 +    uint16_t class, vendor_id, device_id;
  92.223 +
  92.224 +    for ( devfn = 0; devfn < 128; devfn++ )
  92.225 +    {
  92.226 +        class     = pci_readw(devfn, PCI_CLASS_DEVICE);
  92.227 +        vendor_id = pci_readw(devfn, PCI_VENDOR_ID);
  92.228 +        device_id = pci_readw(devfn, PCI_DEVICE_ID);
  92.229 +
  92.230 +        /* We're only interested in NICs. */
  92.231 +        if ( (vendor_id != 0xffff) &&
  92.232 +             (device_id != 0xffff) &&
  92.233 +             (class == 0x0200) )
  92.234 +            return scan_option_rom(
  92.235 +                devfn, vendor_id, device_id, etherboot, copy_rom_dest);
  92.236 +    }
  92.237 +
  92.238 +    return 0;
  92.239 +}
  92.240 +
  92.241 +/*
  92.242 + * Scan the PCI bus for the devices that have an option ROM, and copy
  92.243 + * the corresponding rom data to rom_phys_addr.
  92.244 + */
  92.245 +static int pci_load_option_roms(uint32_t rom_base_addr)
  92.246 +{
  92.247 +    uint32_t option_rom_addr, rom_phys_addr = rom_base_addr;
  92.248 +    uint16_t vendor_id, device_id;
  92.249 +    uint8_t devfn, class;
  92.250 +
  92.251 +    for ( devfn = 0; devfn < 128; devfn++ )
  92.252 +    {
  92.253 +        class     = pci_readb(devfn, PCI_CLASS_DEVICE + 1);
  92.254 +        vendor_id = pci_readw(devfn, PCI_VENDOR_ID);
  92.255 +        device_id = pci_readw(devfn, PCI_DEVICE_ID);
  92.256 +
  92.257 +        if ( (vendor_id == 0xffff) && (device_id == 0xffff) )
  92.258 +            continue;
  92.259 +
  92.260 +        /*
  92.261 +         * Currently only scan options from mass storage devices and serial
  92.262 +         * bus controller (Fibre Channel included).
  92.263 +         */
  92.264 +        if ( (class != 0x1) && (class != 0xc) )
  92.265 +            continue;
  92.266 +
  92.267 +        option_rom_addr = pci_readl(devfn, PCI_ROM_ADDRESS);
  92.268 +        if ( !option_rom_addr )
  92.269 +            continue;
  92.270 +
  92.271 +        /* Ensure Expansion Bar is enabled before copying */
  92.272 +        pci_writel(devfn, PCI_ROM_ADDRESS, option_rom_addr | 0x1);
  92.273 +
  92.274 +        rom_phys_addr += scan_option_rom(
  92.275 +            devfn, vendor_id, device_id,
  92.276 +            (void *)(option_rom_addr & ~2047), rom_phys_addr);
  92.277 +
  92.278 +        /* Restore the default original value of Expansion Bar */
  92.279 +        pci_writel(devfn, PCI_ROM_ADDRESS, option_rom_addr);
  92.280 +    }
  92.281 +
  92.282 +    return rom_phys_addr - rom_base_addr;
  92.283  }
  92.284  
  92.285  /* Replace possibly erroneous memory-size CMOS fields with correct values. */
  92.286  static void cmos_write_memory_size(void)
  92.287  {
  92.288 -    struct e820entry *map = HVM_E820;
  92.289 -    int i, nr = *HVM_E820_NR;
  92.290 -    uint32_t base_mem = 640, ext_mem = 0, alt_mem = 0;
  92.291 -
  92.292 -    for ( i = 0; i < nr; i++ )
  92.293 -        if ( (map[i].addr >= 0x100000) && (map[i].type == E820_RAM) )
  92.294 -            break;
  92.295 +    uint32_t base_mem = 640, ext_mem, alt_mem;
  92.296  
  92.297 -    if ( i != nr )
  92.298 -    {
  92.299 -        alt_mem = ext_mem = map[i].addr + map[i].size;
  92.300 -        ext_mem = (ext_mem > 0x0100000) ? (ext_mem - 0x0100000) >> 10 : 0;
  92.301 -        if ( ext_mem > 0xffff )
  92.302 -            ext_mem = 0xffff;
  92.303 -        alt_mem = (alt_mem > 0x1000000) ? (alt_mem - 0x1000000) >> 16 : 0;
  92.304 -    }
  92.305 +    alt_mem = ext_mem = hvm_info->low_mem_pgend << PAGE_SHIFT;
  92.306 +    ext_mem = (ext_mem > 0x0100000) ? (ext_mem - 0x0100000) >> 10 : 0;
  92.307 +    if ( ext_mem > 0xffff )
  92.308 +        ext_mem = 0xffff;
  92.309 +    alt_mem = (alt_mem > 0x1000000) ? (alt_mem - 0x1000000) >> 16 : 0;
  92.310  
  92.311      /* All BIOSes: conventional memory (CMOS *always* reports 640kB). */
  92.312      cmos_outb(0x15, (uint8_t)(base_mem >> 0));
  92.313 @@ -438,32 +539,115 @@ static void cmos_write_memory_size(void)
  92.314      cmos_outb(0x35, (uint8_t)( alt_mem >> 8));
  92.315  }
  92.316  
  92.317 -static uint16_t init_xen_platform_io_base(void)
  92.318 +static uint16_t xen_platform_io_base(void)
  92.319  {
  92.320 -    struct bios_info *bios_info = (struct bios_info *)ACPI_PHYSICAL_ADDRESS;
  92.321      uint32_t devfn, bar_data;
  92.322      uint16_t vendor_id, device_id;
  92.323  
  92.324 -    bios_info->xen_pfiob = 0;
  92.325 -
  92.326      for ( devfn = 0; devfn < 128; devfn++ )
  92.327      {
  92.328          vendor_id = pci_readw(devfn, PCI_VENDOR_ID);
  92.329          device_id = pci_readw(devfn, PCI_DEVICE_ID);
  92.330 -        if ( (vendor_id != 0x5853) || (device_id != 0x0001) )
  92.331 -            continue;
  92.332 -        bar_data = pci_readl(devfn, PCI_BASE_ADDRESS_0);
  92.333 -        bios_info->xen_pfiob = bar_data & PCI_BASE_ADDRESS_IO_MASK;
  92.334 +        if ( (vendor_id == 0x5853) && (device_id == 0x0001) )
  92.335 +        {
  92.336 +            bar_data = pci_readl(devfn, PCI_BASE_ADDRESS_0);
  92.337 +            return bar_data & PCI_BASE_ADDRESS_IO_MASK;
  92.338 +        }
  92.339      }
  92.340  
  92.341 -    return bios_info->xen_pfiob;
  92.342 +    return 0;
  92.343 +}
  92.344 +
  92.345 +/*
  92.346 + * Set up an empty TSS area for virtual 8086 mode to use. 
  92.347 + * The only important thing is that it musn't have any bits set 
  92.348 + * in the interrupt redirection bitmap, so all zeros will do.
  92.349 + */
  92.350 +static void init_vm86_tss(void)
  92.351 +{
  92.352 +    void *tss;
  92.353 +    struct xen_hvm_param p;
  92.354 +
  92.355 +    tss = mem_alloc(128, 128);
  92.356 +    memset(tss, 0, 128);
  92.357 +    p.domid = DOMID_SELF;
  92.358 +    p.index = HVM_PARAM_VM86_TSS;
  92.359 +    p.value = virt_to_phys(tss);
  92.360 +    hypercall_hvm_op(HVMOP_set_param, &p);
  92.361 +    printf("vm86 TSS at %08lx\n", virt_to_phys(tss));
  92.362 +}
  92.363 +
  92.364 +/* Create an E820 table based on memory parameters provided in hvm_info. */
  92.365 +static void build_e820_table(void)
  92.366 +{
  92.367 +    struct e820entry *e820 = E820;
  92.368 +    unsigned int nr = 0;
  92.369 +
  92.370 +    /* 0x0-0x9FC00: Ordinary RAM. */
  92.371 +    e820[nr].addr = 0x0;
  92.372 +    e820[nr].size = 0x9FC00;
  92.373 +    e820[nr].type = E820_RAM;
  92.374 +    nr++;
  92.375 +
  92.376 +    /* 0x9FC00-0xA0000: Extended BIOS Data Area (EBDA). */
  92.377 +    e820[nr].addr = 0x9FC00;
  92.378 +    e820[nr].size = 0x400;
  92.379 +    e820[nr].type = E820_RESERVED;
  92.380 +    nr++;
  92.381 +
  92.382 +    /*
  92.383 +     * Following regions are standard regions of the PC memory map.
  92.384 +     * They are not covered by e820 regions. OSes will not use as RAM.
  92.385 +     * 0xA0000-0xC0000: VGA memory-mapped I/O. Not covered by E820.
  92.386 +     * 0xC0000-0xE0000: 16-bit devices, expansion ROMs (inc. vgabios).
  92.387 +     * TODO: free pages which turn out to be unused.
  92.388 +     */
  92.389 +
  92.390 +    /*
  92.391 +     * 0xE0000-0x0F0000: PC-specific area. We place various tables here.
  92.392 +     * 0xF0000-0x100000: System BIOS.
  92.393 +     * TODO: free pages which turn out to be unused.
  92.394 +     */
  92.395 +    e820[nr].addr = 0xE0000;
  92.396 +    e820[nr].size = 0x20000;
  92.397 +    e820[nr].type = E820_RESERVED;
  92.398 +    nr++;
  92.399 +
  92.400 +    /* Low RAM goes here. Reserve space for special pages. */
  92.401 +    BUG_ON((hvm_info->low_mem_pgend << PAGE_SHIFT) < (2u << 20));
  92.402 +    e820[nr].addr = 0x100000;
  92.403 +    e820[nr].size = (hvm_info->low_mem_pgend << PAGE_SHIFT) - e820[nr].addr;
  92.404 +    e820[nr].type = E820_RAM;
  92.405 +    nr++;
  92.406 +
  92.407 +    /*
  92.408 +     * Explicitly reserve space for special pages.
  92.409 +     * This space starts at RESERVED_MEMBASE an extends to cover various
  92.410 +     * fixed hardware mappings (e.g., LAPIC, IOAPIC, default SVGA framebuffer).
  92.411 +     */
  92.412 +    e820[nr].addr = RESERVED_MEMBASE;
  92.413 +    e820[nr].size = (uint32_t)-e820[nr].addr;
  92.414 +    e820[nr].type = E820_RESERVED;
  92.415 +    nr++;
  92.416 +
  92.417 +    if ( hvm_info->high_mem_pgend )
  92.418 +    {
  92.419 +        e820[nr].addr = ((uint64_t)1 << 32);
  92.420 +        e820[nr].size =
  92.421 +            ((uint64_t)hvm_info->high_mem_pgend << PAGE_SHIFT) - e820[nr].addr;
  92.422 +        e820[nr].type = E820_RAM;
  92.423 +        nr++;
  92.424 +    }
  92.425 +
  92.426 +    *E820_NR = nr;
  92.427  }
  92.428  
  92.429  int main(void)
  92.430  {
  92.431 -    int vgabios_sz = 0, etherboot_sz = 0, rombios_sz, smbios_sz;
  92.432 -    uint32_t vga_ram = 0;
  92.433 -    uint16_t xen_pfiob;
  92.434 +    int option_rom_sz = 0, vgabios_sz = 0, etherboot_sz = 0;
  92.435 +    int rombios_sz, smbios_sz;
  92.436 +    uint32_t etherboot_phys_addr, option_rom_phys_addr, bios32_addr;
  92.437 +    struct bios_info *bios_info;
  92.438  
  92.439      printf("HVM Loader\n");
  92.440  
  92.441 @@ -471,6 +655,9 @@ int main(void)
  92.442  
  92.443      printf("CPU speed is %u MHz\n", get_cpu_mhz());
  92.444  
  92.445 +    apic_setup();
  92.446 +    pci_setup();
  92.447 +
  92.448      smp_initialise();
  92.449  
  92.450      perform_tests();
  92.451 @@ -483,12 +670,9 @@ int main(void)
  92.452      if ( rombios_sz > 0x10000 )
  92.453          rombios_sz = 0x10000;
  92.454      memcpy((void *)ROMBIOS_PHYSICAL_ADDRESS, rombios, rombios_sz);
  92.455 -    highbios_setup();
  92.456 +    bios32_addr = highbios_setup();
  92.457  
  92.458 -    apic_setup();
  92.459 -    pci_setup();
  92.460 -
  92.461 -    if ( (get_vcpu_nr() > 1) || get_apic_mode() )
  92.462 +    if ( (hvm_info->nr_vcpus > 1) || hvm_info->apic_mode )
  92.463          create_mp_tables();
  92.464  
  92.465      switch ( virtual_vga )
  92.466 @@ -497,33 +681,35 @@ int main(void)
  92.467          printf("Loading Cirrus VGABIOS ...\n");
  92.468          memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
  92.469                 vgabios_cirrusvga, sizeof(vgabios_cirrusvga));
  92.470 -        vgabios_sz = sizeof(vgabios_cirrusvga);
  92.471 +        vgabios_sz = round_option_rom(sizeof(vgabios_cirrusvga));
  92.472          break;
  92.473      case VGA_std:
  92.474          printf("Loading Standard VGABIOS ...\n");
  92.475          memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
  92.476                 vgabios_stdvga, sizeof(vgabios_stdvga));
  92.477 -        vgabios_sz = sizeof(vgabios_stdvga);
  92.478 +        vgabios_sz = round_option_rom(sizeof(vgabios_stdvga));
  92.479          break;
  92.480      default:
  92.481          printf("No emulated VGA adaptor ...\n");
  92.482          break;
  92.483      }
  92.484  
  92.485 -    if ( virtual_vga != VGA_none )
  92.486 -    {
  92.487 -        vga_ram = e820_malloc(8 << 20, 4096);
  92.488 -        printf("VGA RAM at %08x\n", vga_ram);
  92.489 -    }
  92.490 +    etherboot_phys_addr = VGABIOS_PHYSICAL_ADDRESS + vgabios_sz;
  92.491 +    if ( etherboot_phys_addr < OPTIONROM_PHYSICAL_ADDRESS )
  92.492 +        etherboot_phys_addr = OPTIONROM_PHYSICAL_ADDRESS;
  92.493 +    etherboot_sz = scan_etherboot_nic(etherboot_phys_addr);
  92.494  
  92.495 -    etherboot_sz = scan_etherboot_nic((void*)ETHERBOOT_PHYSICAL_ADDRESS);
  92.496 +    option_rom_phys_addr = etherboot_phys_addr + etherboot_sz;
  92.497 +    option_rom_sz = pci_load_option_roms(option_rom_phys_addr);
  92.498  
  92.499 -    if ( get_acpi_enabled() )
  92.500 +    if ( hvm_info->acpi_enabled )
  92.501      {
  92.502          printf("Loading ACPI ...\n");
  92.503          acpi_build_tables();
  92.504      }
  92.505  
  92.506 +    init_vm86_tss();
  92.507 +
  92.508      cmos_write_memory_size();
  92.509  
  92.510      printf("BIOS map:\n");
  92.511 @@ -533,8 +719,12 @@ int main(void)
  92.512                 VGABIOS_PHYSICAL_ADDRESS + vgabios_sz - 1);
  92.513      if ( etherboot_sz )
  92.514          printf(" %05x-%05x: Etherboot ROM\n",
  92.515 -               ETHERBOOT_PHYSICAL_ADDRESS,
  92.516 -               ETHERBOOT_PHYSICAL_ADDRESS + etherboot_sz - 1);
  92.517 +               etherboot_phys_addr,
  92.518 +               etherboot_phys_addr + etherboot_sz - 1);
  92.519 +    if ( option_rom_sz )
  92.520 +        printf(" %05x-%05x: PCI Option ROMs\n",
  92.521 +               option_rom_phys_addr,
  92.522 +               option_rom_phys_addr + option_rom_sz - 1);
  92.523      if ( smbios_sz )
  92.524          printf(" %05x-%05x: SMBIOS tables\n",
  92.525                 SMBIOS_PHYSICAL_ADDRESS,
  92.526 @@ -544,9 +734,17 @@ int main(void)
  92.527                 ROMBIOS_PHYSICAL_ADDRESS,
  92.528                 ROMBIOS_PHYSICAL_ADDRESS + rombios_sz - 1);
  92.529  
  92.530 -    xen_pfiob = init_xen_platform_io_base();
  92.531 -    if ( xen_pfiob && vga_ram )
  92.532 -        outl(xen_pfiob + 4, vga_ram);
  92.533 +    build_e820_table();
  92.534 +
  92.535 +    bios_info = (struct bios_info *)BIOS_INFO_PHYSICAL_ADDRESS;
  92.536 +    memset(bios_info, 0, sizeof(*bios_info));
  92.537 +    bios_info->com1_present = uart_exists(0x3f8);
  92.538 +    bios_info->com2_present = uart_exists(0x2f8);
  92.539 +    bios_info->hpet_present = hpet_exists(ACPI_HPET_ADDRESS);
  92.540 +    bios_info->pci_min = pci_mem_start;
  92.541 +    bios_info->pci_len = pci_mem_end - pci_mem_start;
  92.542 +    bios_info->bios32_entry = bios32_addr;
  92.543 +    bios_info->xen_pfiob = xen_platform_io_base();
  92.544  
  92.545      printf("Invoking ROMBIOS ...\n");
  92.546      return 0;
    93.1 --- a/tools/firmware/hvmloader/mp_tables.c	Mon Nov 10 15:52:15 2008 -0800
    93.2 +++ b/tools/firmware/hvmloader/mp_tables.c	Wed Feb 11 16:25:03 2009 -0800
    93.3 @@ -155,7 +155,7 @@ static void fill_mp_config_table(struct 
    93.4      int vcpu_nr, i;
    93.5      uint8_t checksum;
    93.6  
    93.7 -    vcpu_nr = get_vcpu_nr();
    93.8 +    vcpu_nr = hvm_info->nr_vcpus;
    93.9  
   93.10      /* fill in the MP configuration table signature, "PCMP" */
   93.11      mpct->signature[0] = 'P';
   93.12 @@ -317,7 +317,7 @@ void create_mp_tables(void)
   93.13      char *p;
   93.14      int vcpu_nr, i, length;
   93.15  
   93.16 -    vcpu_nr = get_vcpu_nr();
   93.17 +    vcpu_nr = hvm_info->nr_vcpus;
   93.18  
   93.19      printf("Creating MP tables ...\n");
   93.20  
    94.1 --- a/tools/firmware/hvmloader/smbios.c	Mon Nov 10 15:52:15 2008 -0800
    94.2 +++ b/tools/firmware/hvmloader/smbios.c	Wed Feb 11 16:25:03 2009 -0800
    94.3 @@ -118,8 +118,9 @@ write_smbios_tables(void *start,
    94.4      do_struct(smbios_type_16_init(p, memsize, nr_mem_devs));
    94.5      for ( i = 0; i < nr_mem_devs; i++ )
    94.6      {
    94.7 -        uint32_t dev_memsize = ((i == (nr_mem_devs - 1))
    94.8 -                                ? (memsize & 0x3fff) : 0x4000);
    94.9 +        uint32_t dev_memsize = 0x4000; /* all but last covers 16GB */
   94.10 +        if ( (i == (nr_mem_devs - 1)) && ((memsize & 0x3fff) != 0) )
   94.11 +            dev_memsize = memsize & 0x3fff; /* last dev is <16GB */
   94.12          do_struct(smbios_type_17_init(p, dev_memsize, i));
   94.13          do_struct(smbios_type_19_init(p, dev_memsize, i));
   94.14          do_struct(smbios_type_20_init(p, dev_memsize, i));
   94.15 @@ -143,28 +144,18 @@ write_smbios_tables(void *start,
   94.16  static uint64_t
   94.17  get_memsize(void)
   94.18  {
   94.19 -    struct e820entry *map = HVM_E820;
   94.20 -    uint8_t num_entries = *HVM_E820_NR;
   94.21 -    uint64_t memsize = 0;
   94.22 -    int i;
   94.23 +    uint64_t sz;
   94.24  
   94.25 -    /*
   94.26 -     * Walk through e820map, ignoring any entries that aren't marked
   94.27 -     * as usable or reserved.
   94.28 -     */
   94.29 -    for ( i = 0; i < num_entries; i++ )
   94.30 -    {
   94.31 -        if ( (map->type == E820_RAM) || (map->type == E820_RESERVED) )
   94.32 -            memsize += map->size;
   94.33 -        map++;
   94.34 -    }
   94.35 +    sz = (uint64_t)hvm_info->low_mem_pgend << PAGE_SHIFT;
   94.36 +    if ( hvm_info->high_mem_pgend )
   94.37 +        sz += (hvm_info->high_mem_pgend << PAGE_SHIFT) - (1ull << 32);
   94.38  
   94.39      /*
   94.40       * Round up to the nearest MB.  The user specifies domU pseudo-physical 
   94.41       * memory in megabytes, so not doing this could easily lead to reporting 
   94.42       * one less MB than the user specified.
   94.43       */
   94.44 -    return (memsize + (1 << 20) - 1) >> 20;
   94.45 +    return (sz + (1ul << 20) - 1) >> 20;
   94.46  }
   94.47  
   94.48  int
   94.49 @@ -229,7 +220,7 @@ hvm_write_smbios_tables(void)
   94.50  
   94.51      /* SCRATCH_PHYSICAL_ADDRESS is a safe large memory area for scratch. */
   94.52      len = write_smbios_tables((void *)SCRATCH_PHYSICAL_ADDRESS,
   94.53 -                              get_vcpu_nr(), get_memsize(),
   94.54 +                              hvm_info->nr_vcpus, get_memsize(),
   94.55                                uuid, xen_version_str,
   94.56                                xen_major_version, xen_minor_version);
   94.57      if ( len > SMBIOS_MAXIMUM_SIZE )
    95.1 --- a/tools/firmware/hvmloader/smp.c	Mon Nov 10 15:52:15 2008 -0800
    95.2 +++ b/tools/firmware/hvmloader/smp.c	Wed Feb 11 16:25:03 2009 -0800
    95.3 @@ -121,7 +121,7 @@ static void boot_cpu(unsigned int cpu)
    95.4  
    95.5  void smp_initialise(void)
    95.6  {
    95.7 -    unsigned int i, nr_cpus = get_vcpu_nr();
    95.8 +    unsigned int i, nr_cpus = hvm_info->nr_vcpus;
    95.9  
   95.10      memcpy((void *)AP_BOOT_EIP, ap_boot_start, ap_boot_end - ap_boot_start);
   95.11  
    96.1 --- a/tools/firmware/hvmloader/util.c	Mon Nov 10 15:52:15 2008 -0800
    96.2 +++ b/tools/firmware/hvmloader/util.c	Wed Feb 11 16:25:03 2009 -0800
    96.3 @@ -25,7 +25,6 @@
    96.4  #include <stdint.h>
    96.5  #include <xen/xen.h>
    96.6  #include <xen/memory.h>
    96.7 -#include <xen/hvm/hvm_info_table.h>
    96.8  
    96.9  void wrmsr(uint32_t idx, uint64_t v)
   96.10  {
   96.11 @@ -304,63 +303,63 @@ uuid_to_string(char *dest, uint8_t *uuid
   96.12      *p = '\0';
   96.13  }
   96.14  
   96.15 -static void e820_collapse(void)
   96.16 +void *mem_alloc(uint32_t size, uint32_t align)
   96.17  {
   96.18 -    int i = 0;
   96.19 -    struct e820entry *ent = (struct e820entry *)HVM_E820;
   96.20 +    static uint32_t reserve = RESERVED_MEMBASE - 1;
   96.21 +    static int over_allocated;
   96.22 +    struct xen_add_to_physmap xatp;
   96.23 +    struct xen_memory_reservation xmr;
   96.24 +    xen_pfn_t mfn;
   96.25 +    uint32_t s, e;
   96.26  
   96.27 -    while ( i < (*HVM_E820_NR-1) )
   96.28 +    /* Align to at least one kilobyte. */
   96.29 +    if ( align < 1024 )
   96.30 +        align = 1024;
   96.31 +
   96.32 +    s = (reserve + align) & ~(align - 1);
   96.33 +    e = s + size - 1;
   96.34 +
   96.35 +    BUG_ON((e < s) || (e >> PAGE_SHIFT) >= hvm_info->reserved_mem_pgstart);
   96.36 +
   96.37 +    while ( (reserve >> PAGE_SHIFT) != (e >> PAGE_SHIFT) )
   96.38      {
   96.39 -        if ( (ent[i].type == ent[i+1].type) &&
   96.40 -             ((ent[i].addr + ent[i].size) == ent[i+1].addr) )
   96.41 +        reserve += PAGE_SIZE;
   96.42 +        mfn = reserve >> PAGE_SHIFT;
   96.43 +
   96.44 +        /* Try to allocate a brand new page in the reserved area. */
   96.45 +        if ( !over_allocated )
   96.46          {
   96.47 -            ent[i].size += ent[i+1].size;
   96.48 -            memcpy(&ent[i+1], &ent[i+2], (*HVM_E820_NR-i-2) * sizeof(*ent));
   96.49 -            (*HVM_E820_NR)--;
   96.50 +            xmr.domid = DOMID_SELF;
   96.51 +            xmr.mem_flags = 0;
   96.52 +            xmr.extent_order = 0;
   96.53 +            xmr.nr_extents = 1;
   96.54 +            set_xen_guest_handle(xmr.extent_start, &mfn);
   96.55 +            if ( hypercall_memory_op(XENMEM_populate_physmap, &xmr) == 1 )
   96.56 +                continue;
   96.57 +            over_allocated = 1;
   96.58 +        }
   96.59 +
   96.60 +        /* Otherwise, relocate a page from the ordinary RAM map. */
   96.61 +        if ( hvm_info->high_mem_pgend )
   96.62 +        {
   96.63 +            xatp.idx = --hvm_info->high_mem_pgend;
   96.64 +            if ( xatp.idx == (1ull << (32 - PAGE_SHIFT)) )
   96.65 +                hvm_info->high_mem_pgend = 0;
   96.66          }
   96.67          else
   96.68          {
   96.69 -            i++;
   96.70 +            xatp.idx = --hvm_info->low_mem_pgend;
   96.71          }
   96.72 -    }
   96.73 -}
   96.74 -
   96.75 -uint32_t e820_malloc(uint32_t size, uint32_t align)
   96.76 -{
   96.77 -    uint32_t addr;
   96.78 -    int i;
   96.79 -    struct e820entry *ent = (struct e820entry *)HVM_E820;
   96.80 -
   96.81 -    /* Align to at leats one kilobyte. */
   96.82 -    if ( align < 1024 )
   96.83 -        align = 1024;
   96.84 -
   96.85 -    for ( i = *HVM_E820_NR - 1; i >= 0; i-- )
   96.86 -    {
   96.87 -        addr = (ent[i].addr + ent[i].size - size) & ~(align-1);
   96.88 -        if ( (ent[i].type != E820_RAM) || /* not ram? */
   96.89 -             (addr < ent[i].addr) ||      /* too small or starts above 4gb? */
   96.90 -             ((addr + size) < addr) )     /* ends above 4gb? */
   96.91 -            continue;
   96.92 -
   96.93 -        if ( addr != ent[i].addr )
   96.94 -        {
   96.95 -            memmove(&ent[i+1], &ent[i], (*HVM_E820_NR-i) * sizeof(*ent));
   96.96 -            (*HVM_E820_NR)++;
   96.97 -            ent[i].size = addr - ent[i].addr;
   96.98 -            ent[i+1].addr = addr;
   96.99 -            ent[i+1].size -= ent[i].size;
  96.100 -            i++;
  96.101 -        }
  96.102 -
  96.103 -        ent[i].type = E820_RESERVED;
  96.104 -
  96.105 -        e820_collapse();
  96.106 -
  96.107 -        return addr;
  96.108 +        xatp.domid = DOMID_SELF;
  96.109 +        xatp.space = XENMAPSPACE_gmfn;
  96.110 +        xatp.gpfn  = mfn;
  96.111 +        if ( hypercall_memory_op(XENMEM_add_to_physmap, &xatp) != 0 )
  96.112 +            BUG();
  96.113      }
  96.114  
  96.115 -    return 0;
  96.116 +    reserve = e;
  96.117 +
  96.118 +    return (void *)(unsigned long)s;
  96.119  }
  96.120  
  96.121  uint32_t ioapic_read(uint32_t reg)
  96.122 @@ -543,30 +542,35 @@ void __bug(char *file, int line)
  96.123          asm volatile ( "ud2" );
  96.124  }
  96.125  
  96.126 -static int validate_hvm_info(struct hvm_info_table *t)
  96.127 +static void validate_hvm_info(struct hvm_info_table *t)
  96.128  {
  96.129 -    char signature[] = "HVM INFO";
  96.130      uint8_t *ptr = (uint8_t *)t;
  96.131      uint8_t sum = 0;
  96.132      int i;
  96.133  
  96.134 -    /* strncmp(t->signature, "HVM INFO", 8) */
  96.135 -    for ( i = 0; i < 8; i++ )
  96.136 +    if ( strncmp(t->signature, "HVM INFO", 8) )
  96.137      {
  96.138 -        if ( signature[i] != t->signature[i] )
  96.139 -        {
  96.140 -            printf("Bad hvm info signature\n");
  96.141 -            return 0;
  96.142 -        }
  96.143 +        printf("Bad hvm info signature\n");
  96.144 +        BUG();
  96.145 +    }
  96.146 +
  96.147 +    if ( t->length < sizeof(struct hvm_info_table) )
  96.148 +    {
  96.149 +        printf("Bad hvm info length\n");
  96.150 +        BUG();
  96.151      }
  96.152  
  96.153      for ( i = 0; i < t->length; i++ )
  96.154          sum += ptr[i];
  96.155  
  96.156 -    return (sum == 0);
  96.157 +    if ( sum != 0 )
  96.158 +    {
  96.159 +        printf("Bad hvm info checksum\n");
  96.160 +        BUG();
  96.161 +    }
  96.162  }
  96.163  
  96.164 -static struct hvm_info_table *get_hvm_info_table(void)
  96.165 +struct hvm_info_table *get_hvm_info_table(void)
  96.166  {
  96.167      static struct hvm_info_table *table;
  96.168      struct hvm_info_table *t;
  96.169 @@ -576,35 +580,13 @@ static struct hvm_info_table *get_hvm_in
  96.170  
  96.171      t = (struct hvm_info_table *)HVM_INFO_PADDR;
  96.172  
  96.173 -    if ( !validate_hvm_info(t) )
  96.174 -    {
  96.175 -        printf("Bad hvm info table\n");
  96.176 -        return NULL;
  96.177 -    }
  96.178 +    validate_hvm_info(t);
  96.179  
  96.180      table = t;
  96.181  
  96.182      return table;
  96.183  }
  96.184  
  96.185 -int get_vcpu_nr(void)
  96.186 -{
  96.187 -    struct hvm_info_table *t = get_hvm_info_table();
  96.188 -    return (t ? t->nr_vcpus : 1);
  96.189 -}
  96.190 -
  96.191 -int get_acpi_enabled(void)
  96.192 -{
  96.193 -    struct hvm_info_table *t = get_hvm_info_table();
  96.194 -    return (t ? t->acpi_enabled : 1);
  96.195 -}
  96.196 -
  96.197 -int get_apic_mode(void)
  96.198 -{
  96.199 -    struct hvm_info_table *t = get_hvm_info_table();
  96.200 -    return (t ? t->apic_mode : 1);
  96.201 -}
  96.202 -
  96.203  uint16_t get_cpu_mhz(void)
  96.204  {
  96.205      struct xen_add_to_physmap xatp;
  96.206 @@ -647,6 +629,27 @@ uint16_t get_cpu_mhz(void)
  96.207      return cpu_mhz;
  96.208  }
  96.209  
  96.210 +int uart_exists(uint16_t uart_base)
  96.211 +{
  96.212 +    uint16_t ier = uart_base + 1;
  96.213 +    uint8_t a, b, c;
  96.214 +
  96.215 +    a = inb(ier);
  96.216 +    outb(ier, 0);
  96.217 +    b = inb(ier);
  96.218 +    outb(ier, 0xf);
  96.219 +    c = inb(ier);
  96.220 +    outb(ier, a);
  96.221 +
  96.222 +    return ((b == 0) && (c == 0xf));
  96.223 +}
  96.224 +
  96.225 +int hpet_exists(unsigned long hpet_base)
  96.226 +{
  96.227 +    uint32_t hpet_id = *(uint32_t *)hpet_base;
  96.228 +    return ((hpet_id >> 16) == 0x8086);
  96.229 +}
  96.230 +
  96.231  /*
  96.232   * Local variables:
  96.233   * mode: C
    97.1 --- a/tools/firmware/hvmloader/util.h	Mon Nov 10 15:52:15 2008 -0800
    97.2 +++ b/tools/firmware/hvmloader/util.h	Wed Feb 11 16:25:03 2009 -0800
    97.3 @@ -3,6 +3,7 @@
    97.4  
    97.5  #include <stdarg.h>
    97.6  #include <stdint.h>
    97.7 +#include <xen/hvm/hvm_info_table.h>
    97.8  
    97.9  #undef offsetof
   97.10  #define offsetof(t, m) ((unsigned long)&((t *)0)->m)
   97.11 @@ -56,6 +57,10 @@ void pci_write(uint32_t devfn, uint32_t 
   97.12  /* Get CPU speed in MHz. */
   97.13  uint16_t get_cpu_mhz(void);
   97.14  
   97.15 +/* Hardware detection. */
   97.16 +int uart_exists(uint16_t uart_base);
   97.17 +int hpet_exists(unsigned long hpet_base);
   97.18 +
   97.19  /* Do cpuid instruction, with operation 'idx' */
   97.20  void cpuid(uint32_t idx, uint32_t *eax, uint32_t *ebx,
   97.21             uint32_t *ecx, uint32_t *edx);
   97.22 @@ -103,9 +108,8 @@ static inline void cpu_relax(void)
   97.23  })
   97.24  
   97.25  /* HVM-builder info. */
   97.26 -int get_vcpu_nr(void);
   97.27 -int get_acpi_enabled(void);
   97.28 -int get_apic_mode(void);
   97.29 +struct hvm_info_table *get_hvm_info_table(void);
   97.30 +#define hvm_info (get_hvm_info_table())
   97.31  
   97.32  /* String and memory functions */
   97.33  int strcmp(const char *cs, const char *ct);
   97.34 @@ -131,11 +135,12 @@ void uuid_to_string(char *dest, uint8_t 
   97.35  int printf(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
   97.36  int vprintf(const char *fmt, va_list ap);
   97.37  
   97.38 -/* Reserve a RAM region in the e820 table. */
   97.39 -uint32_t e820_malloc(uint32_t size, uint32_t align);
   97.40 +/* Allocate memory in a reserved region below 4GB. */
   97.41 +void *mem_alloc(uint32_t size, uint32_t align);
   97.42 +#define virt_to_phys(v) ((unsigned long)(v))
   97.43  
   97.44  /* Prepare the 32bit BIOS */
   97.45 -void highbios_setup(void);
   97.46 +uint32_t highbios_setup(void);
   97.47  
   97.48  /* Miscellaneous. */
   97.49  void cacheattr_init(void);
    98.1 --- a/tools/firmware/rombios/32bit/32bitbios.c	Mon Nov 10 15:52:15 2008 -0800
    98.2 +++ b/tools/firmware/rombios/32bit/32bitbios.c	Wed Feb 11 16:25:03 2009 -0800
    98.3 @@ -19,35 +19,16 @@
    98.4   *
    98.5   * Author: Stefan Berger <stefanb@us.ibm.com>
    98.6   */
    98.7 +
    98.8  #include "rombios_compat.h"
    98.9 -#include "32bitprotos.h"
   98.10 -
   98.11 -/*
   98.12 -   the jumptable that will be copied into the rombios in the 0xf000 segment
   98.13 -   for every function that is to be called from the lower BIOS, make an entry
   98.14 -   here.
   98.15 - */
   98.16 -#define TABLE_ENTRY(idx, func) [idx] = (uint32_t)func
   98.17 -uint32_t jumptable[IDX_LAST+1] __attribute__((section (".biosjumptable"))) =
   98.18 -{
   98.19 -	TABLE_ENTRY(IDX_TCPA_ACPI_INIT, tcpa_acpi_init),
   98.20 -	TABLE_ENTRY(IDX_TCPA_EXTEND_ACPI_LOG, tcpa_extend_acpi_log),
   98.21 -
   98.22 -	TABLE_ENTRY(IDX_TCGINTERRUPTHANDLER, TCGInterruptHandler),
   98.23  
   98.24 -	TABLE_ENTRY(IDX_TCPA_CALLING_INT19H, tcpa_calling_int19h),
   98.25 -	TABLE_ENTRY(IDX_TCPA_RETURNED_INT19H, tcpa_returned_int19h),
   98.26 -	TABLE_ENTRY(IDX_TCPA_ADD_EVENT_SEPARATORS, tcpa_add_event_separators),
   98.27 -	TABLE_ENTRY(IDX_TCPA_WAKE_EVENT, tcpa_wake_event),
   98.28 -	TABLE_ENTRY(IDX_TCPA_ADD_BOOTDEVICE, tcpa_add_bootdevice),
   98.29 -	TABLE_ENTRY(IDX_TCPA_START_OPTION_ROM_SCAN, tcpa_start_option_rom_scan),
   98.30 -	TABLE_ENTRY(IDX_TCPA_OPTION_ROM, tcpa_option_rom),
   98.31 -	TABLE_ENTRY(IDX_TCPA_IPL, tcpa_ipl),
   98.32 -	TABLE_ENTRY(IDX_TCPA_MEASURE_POST, tcpa_measure_post),
   98.33 -
   98.34 -	TABLE_ENTRY(IDX_TCPA_INITIALIZE_TPM, tcpa_initialize_tpm),
   98.35 -
   98.36 -	TABLE_ENTRY(IDX_GET_S3_WAKING_VECTOR, get_s3_waking_vector),
   98.37 -
   98.38 -	TABLE_ENTRY(IDX_LAST       , 0)     /* keep last */
   98.39 -};
   98.40 +asm (
   98.41 +    "    .text                       \n"
   98.42 +    "     movzwl %bx,%eax            \n"
   98.43 +    "     jmp *jumptable(,%eax,4)    \n"
   98.44 +    "    .data                       \n"
   98.45 +    "jumptable:                      \n"
   98.46 +#define X(idx, ret, fn, args...) " .long "#fn"\n"
   98.47 +#include "32bitprotos.h"
   98.48 +#undef X
   98.49 +    );
    99.1 --- a/tools/firmware/rombios/32bit/Makefile	Mon Nov 10 15:52:15 2008 -0800
    99.2 +++ b/tools/firmware/rombios/32bit/Makefile	Wed Feb 11 16:25:03 2009 -0800
    99.3 @@ -1,24 +1,24 @@
    99.4  XEN_ROOT = ../../../..
    99.5  include $(XEN_ROOT)/tools/firmware/Rules.mk
    99.6  
    99.7 -SOURCES = util.c
    99.8  TARGET = 32bitbios_flat.h
    99.9  
   99.10 -CFLAGS += $(CFLAGS_include) -I.. -DGCC_PROTOS
   99.11 +CFLAGS += $(CFLAGS_include) -I..
   99.12  
   99.13  SUBDIRS = tcgbios
   99.14  
   99.15 -MODULES = tcgbios/tcgbiosext.o
   99.16 -
   99.17  .PHONY: all
   99.18  all: subdirs-all
   99.19  	$(MAKE) $(TARGET)
   99.20  
   99.21  .PHONY: clean
   99.22  clean: subdirs-clean
   99.23 -	rm -rf *.o $(TARGET)
   99.24 +	rm -rf *.o $(TARGET) $(DEPS)
   99.25  
   99.26 -$(TARGET): 32bitbios.o $(MODULES) util.o
   99.27 +$(TARGET): 32bitbios_all.o
   99.28 +	sh mkhex highbios_array 32bitbios_all.o > $@
   99.29 +
   99.30 +32bitbios_all.o: 32bitbios.o tcgbios/tcgbiosext.o util.o pmm.o
   99.31  	$(LD) $(LDFLAGS_DIRECT) -s -r $^ -o 32bitbios_all.o
   99.32  	@nm 32bitbios_all.o |                                \
   99.33  	  egrep '^ +U ' >/dev/null && {                      \
   99.34 @@ -26,4 +26,5 @@ clean: subdirs-clean
   99.35  	    nm -u 32bitbios_all.o;                           \
   99.36  	    exit 11;                                         \
   99.37  	  } || :
   99.38 -	sh mkhex highbios_array 32bitbios_all.o > $@
   99.39 +
   99.40 +-include $(DEPS)
   100.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   100.2 +++ b/tools/firmware/rombios/32bit/pmm.c	Wed Feb 11 16:25:03 2009 -0800
   100.3 @@ -0,0 +1,531 @@
   100.4 +/*
   100.5 + *  pmm.c - POST(Power On Self Test) Memory Manager
   100.6 + *  according to the specification described in
   100.7 + *  http://www.phoenix.com/NR/rdonlyres/873A00CF-33AC-4775-B77E-08E7B9754993/0/specspmm101.pdf
   100.8 + *
   100.9 + *  This library is free software; you can redistribute it and/or
  100.10 + *  modify it under the terms of the GNU Lesser General Public
  100.11 + *  License as published by the Free Software Foundation; either
  100.12 + *  version 2 of the License, or (at your option) any later version.
  100.13 + *
  100.14 + *  This library is distributed in the hope that it will be useful,
  100.15 + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  100.16 + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  100.17 + *  Lesser General Public License for more details.
  100.18 + *
  100.19 + *  You should have received a copy of the GNU Lesser General Public
  100.20 + *  License along with this library; if not, write to the Free Software
  100.21 + *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  100.22 + *
  100.23 + *  Copyright (C) 2009 FUJITSU LIMITED
  100.24 + *
  100.25 + *  Author: Kouya Shimura <kouya@jp.fujitsu.com>
  100.26 + */
  100.27 +
  100.28 +/*
  100.29 + * Algorithm:
  100.30 + *
  100.31 + * This is not a fast storage allocator but simple one.  There is no
  100.32 + * segregated management by block size and it does nothing special for
  100.33 + * avoiding the fragmentation.
  100.34 + *
  100.35 + * The allocation algorithm is a first-fit. All memory blocks are
  100.36 + * managed by linear single linked list in order of the address.
  100.37 + * (i.e. There is no backward pointer) It searches the first available
  100.38 + * equal or larger block from the head (lowest address) of memory
  100.39 + * heap. The larger block is splitted into two blocks unless one side
  100.40 + * becomes too small.
  100.41 + * 
  100.42 + * For de-allocation, the specified block is just marked as available
  100.43 + * and it does nothing else. Thus, the fragmentation will occur. The
  100.44 + * collection of continuous available blocks are done on the search
  100.45 + * phase of another block allocation.
  100.46 + *
  100.47 + * The following is an abstract of this algorithm. The actual code
  100.48 + * looks complicated on account of alignment and checking the handle.
  100.49 + *
  100.50 + *     static memblk_t *
  100.51 + *     alloc(heap_t *heap, uint32_t size)
  100.52 + *     {
  100.53 + *         static memblk_t *mb;
  100.54 + *         for_each_memblk(heap, mb) // search memory blocks
  100.55 + *             if (memblk_is_avail(mb))
  100.56 + *             {
  100.57 + *                 collect_avail_memblks(heap, mb);
  100.58 + *                 if (size <= memblk_bufsize(mb))
  100.59 + *                 {
  100.60 + *                     split_memblk(mb, size);
  100.61 + *                     set_inuse(mb);
  100.62 + *                     return mb;
  100.63 + *                 }
  100.64 + *             }
  100.65 + *         return NULL;
  100.66 + *     }
  100.67 + */
  100.68 +
  100.69 +#include <stdint.h>
  100.70 +#include <stddef.h>
  100.71 +#include <../hvmloader/config.h>
  100.72 +#include <../hvmloader/e820.h>
  100.73 +#include "util.h"
  100.74 +
  100.75 +#define DEBUG_PMM 0
  100.76 +
  100.77 +#define ASSERT(_expr, _action)                                  \
  100.78 +    if (!(_expr)) {                                             \
  100.79 +        printf("ASSERTION FAIL: %s %s:%d %s()\n",               \
  100.80 +               __STRING(_expr), __FILE__, __LINE__, __func__);  \
  100.81 +        _action;                                                \
  100.82 +    } else
  100.83 +
  100.84 +#if DEBUG_PMM
  100.85 +# define PMM_DEBUG(format, p...) printf("PMM " format, ##p)
  100.86 +#else
  100.87 +# define PMM_DEBUG(format, p...)
  100.88 +#endif
  100.89 +
  100.90 +struct pmmAllocArgs {
  100.91 +    uint16_t function;
  100.92 +    uint32_t length;
  100.93 +    uint32_t handle;
  100.94 +    uint16_t flags;
  100.95 +} __attribute__ ((packed));
  100.96 +
  100.97 +struct pmmFindArgs {
  100.98 +    uint16_t function;
  100.99 +    uint32_t handle;
 100.100 +} __attribute__ ((packed));
 100.101 +
 100.102 +struct pmmDeallocateArgs {
 100.103 +    uint16_t function;
 100.104 +    uint32_t buffer;
 100.105 +} __attribute__ ((packed));
 100.106 +
 100.107 +#define PMM_FUNCTION_ALLOCATE   0
 100.108 +#define PMM_FUNCTION_FIND       1         
 100.109 +#define PMM_FUNCTION_DEALLOC    2
 100.110 +
 100.111 +#define PARAGRAPH_LENGTH        16  // unit of length
 100.112 +
 100.113 +#define PMM_HANDLE_ANONYMOUS    0xffffffff
 100.114 +
 100.115 +#define PMM_FLAGS_MEMORY_TYPE_MASK      0x0003
 100.116 +#define PMM_FLAGS_MEMORY_INVALID        0
 100.117 +#define PMM_FLAGS_MEMORY_CONVENTIONAL   1  // 0 to 1MB
 100.118 +#define PMM_FLAGS_MEMORY_EXTENDED       2  // 1MB to 4GB
 100.119 +#define PMM_FLAGS_MEMORY_ANY            3  // whichever is available
 100.120 +#define PMM_FLAGS_ALIGINMENT            0x0004
 100.121 +
 100.122 +/* Error code */
 100.123 +#define PMM_ENOMEM      (0)     // Out of memory, duplicate handle
 100.124 +#define PMM_EINVAL      (-1)    // Invalid argument
 100.125 +
 100.126 +#define ALIGN_UP(addr, size)    (((addr)+((size)-1))&(~((size)-1)))
 100.127 +#define ALIGN_DOWN(addr, size)  ((addr)&(~((size)-1)))
 100.128 +
 100.129 +typedef struct memblk {
 100.130 +    uint32_t magic;      // inuse or available
 100.131 +    struct memblk *next; // points the very next of this memblk
 100.132 +    uint32_t handle;     // identifier of this block
 100.133 +    uint32_t __fill;     // for 16byte alignment, not used
 100.134 +    uint8_t buffer[0];
 100.135 +} memblk_t;
 100.136 +
 100.137 +typedef struct heap {
 100.138 +    memblk_t *head;     // start address of heap
 100.139 +    memblk_t *end;      // end address of heap
 100.140 +} heap_t;
 100.141 +
 100.142 +#define HEAP_NOT_INITIALIZED    (memblk_t *)-1
 100.143 +#define HEAP_ALIGNMENT          16
 100.144 +
 100.145 +/*
 100.146 + * PMM handles two memory heaps, the caller chooses either.
 100.147 + *
 100.148 + * - conventional memroy (below 1MB)
 100.149 + *    In HVM, the area is fixed. 0x00010000-0x0007FFFF
 100.150 + *    (from SCRATCH_PHYSICAL_ADDRESS to HYPERCALL_PHYSICAL_ADDRESS)
 100.151 + *
 100.152 + * - extended memory (start at 1MB, below 4GB)
 100.153 + *    In HVM, the area starts at memory address 0x00100000.
 100.154 + *    The end address is variable. We read low RAM address from e820 table.
 100.155 + *
 100.156 + * The following struct must be located in the data segment since bss
 100.157 + * in 32bitbios doesn't be relocated.
 100.158 + */
 100.159 +static struct {
 100.160 +    heap_t heap;     // conventional memory
 100.161 +    heap_t ext_heap; // extended memory
 100.162 +} pmm_data = { {HEAP_NOT_INITIALIZED, NULL}, {NULL, NULL} };
 100.163 +
 100.164 +/* These values are private use, not a spec in PMM */
 100.165 +#define MEMBLK_MAGIC_INUSE   0x2A4D4D50  // 'PMM*'
 100.166 +#define MEMBLK_MAGIC_AVAIL   0x5F4D4D50  // 'PMM_'
 100.167 +
 100.168 +#define memblk_is_inuse(_mb)  ((_mb)->magic == MEMBLK_MAGIC_INUSE)
 100.169 +#define memblk_is_avail(_mb)  ((_mb)->magic == MEMBLK_MAGIC_AVAIL)
 100.170 +
 100.171 +static void set_inuse(memblk_t *mb, uint32_t handle)
 100.172 +{
 100.173 +    mb->magic = MEMBLK_MAGIC_INUSE;
 100.174 +    mb->handle = handle;
 100.175 +}
 100.176 +
 100.177 +static void set_avail(memblk_t *mb)
 100.178 +{
 100.179 +    mb->magic = MEMBLK_MAGIC_AVAIL;
 100.180 +    mb->handle = PMM_HANDLE_ANONYMOUS;
 100.181 +}
 100.182 +
 100.183 +#define MEMBLK_HEADER_SIZE   ((int)(&((memblk_t *)0)->buffer))
 100.184 +#define MIN_MEMBLK_SIZE      (MEMBLK_HEADER_SIZE + PARAGRAPH_LENGTH)
 100.185 +
 100.186 +#define memblk_size(_mb)     ((void *)((_mb)->next) - (void *)(_mb))
 100.187 +#define memblk_buffer(_mb)   ((uint32_t)(&(_mb)->buffer))
 100.188 +#define memblk_bufsize(_mb)  (memblk_size(_mb) - MEMBLK_HEADER_SIZE)
 100.189 +
 100.190 +#define buffer_memblk(_buf)  (memblk_t *)((_buf) - MEMBLK_HEADER_SIZE)
 100.191 +
 100.192 +#define memblk_loop_mbondition(_h, _mb) \
 100.193 +    (((_mb) < (_h)->end) && (/* avoid infinite loop */ (_mb) < (_mb)->next))
 100.194 +
 100.195 +#define for_each_memblk(_h, _mb)                \
 100.196 +    for ((_mb) = (_h)->head;                    \
 100.197 +         memblk_loop_mbondition(_h, _mb);       \
 100.198 +         (_mb) = (_mb)->next)
 100.199 +
 100.200 +#define for_remain_memblk(_h, _mb)              \
 100.201 +    for (;                                      \
 100.202 +         memblk_loop_mbondition(_h, _mb);       \
 100.203 +         (_mb) = (_mb)->next)
 100.204 +
 100.205 +/*
 100.206 + *                                       <-size->
 100.207 + *    +==================+======+       +========+========+======+
 100.208 + *    |      avail       |      |       | avail  | avail  |      |
 100.209 + *    |      memblk      |memblk|...    | memblk | memblk |memblk|...
 100.210 + *    +==================+======+   =>  +========+========+======+
 100.211 + *    ^ |                ^ |    ^         |      ^ |      ^ |    ^
 100.212 + *    | |next            | |next|         |next  | |next  | |next|
 100.213 + *    | \________________/ \____/         \______/ \______/ \____/
 100.214 + *    |                                          ^
 100.215 + *    |                                          |
 100.216 + *    mb                                         +- sb(return value)
 100.217 + */
 100.218 +static memblk_t *
 100.219 +split_memblk(memblk_t *mb, uint32_t size)
 100.220 +{
 100.221 +    memblk_t *sb = (void *)memblk_buffer(mb) + size;
 100.222 +
 100.223 +    /* Only split if the remaining fragment is big enough. */
 100.224 +    if ( (memblk_bufsize(mb) - size) < MIN_MEMBLK_SIZE)
 100.225 +        return mb;
 100.226 +
 100.227 +    sb->next = mb->next;
 100.228 +    set_avail(sb);
 100.229 +
 100.230 +    mb->next = sb;
 100.231 +    return sb;
 100.232 +}
 100.233 +
 100.234 +/*
 100.235 + *    +======+======+======+======+       +=================+======+
 100.236 + *    |avail |avail |avail |inuse |       |      avail      |inuse |   
 100.237 + *    |memblk|memblk|memblk|memblk|...    |      memblk     |memblk|...
 100.238 + *    +======+======+======+======+   =>  +=================+======+
 100.239 + *    ^ |    ^ |    ^ |    ^ |    ^         |               ^ |    ^
 100.240 + *    | |next| |next| |next| |next|         |next           | |next|
 100.241 + *    | \____/ \____/ \____/ \____/         \_______________/ \____/
 100.242 + *    |
 100.243 + *    mb
 100.244 + */
 100.245 +static void
 100.246 +collect_avail_memblks(heap_t *heap, memblk_t *mb)
 100.247 +{
 100.248 +    memblk_t *nb = mb->next;
 100.249 +
 100.250 +    for_remain_memblk ( heap, nb )
 100.251 +        if ( memblk_is_inuse(nb) )
 100.252 +            break;
 100.253 +    mb->next = nb;
 100.254 +}
 100.255 +
 100.256 +static void
 100.257 +pmm_init_heap(heap_t *heap, uint32_t from_addr, uint32_t to_addr)
 100.258 +{
 100.259 +    memblk_t *mb = (memblk_t *)ALIGN_UP(from_addr, HEAP_ALIGNMENT);
 100.260 +
 100.261 +    mb->next = (memblk_t *)ALIGN_DOWN(to_addr, HEAP_ALIGNMENT);
 100.262 +    set_avail(mb);
 100.263 +
 100.264 +    heap->head = mb;
 100.265 +    heap->end = mb->next;
 100.266 +}
 100.267 +
 100.268 +static void
 100.269 +pmm_initalize(void)
 100.270 +{
 100.271 +    int i, e820_nr = *E820_NR;
 100.272 +    struct e820entry *e820 = E820;
 100.273 +
 100.274 +    /* Extended memory: RAM below 4GB, 0x100000-0xXXXXXXXX */
 100.275 +    for ( i = 0; i < e820_nr; i++ )
 100.276 +    {
 100.277 +        if ( (e820[i].type == E820_RAM) && (e820[i].addr >= 0x00100000) )
 100.278 +        {
 100.279 +            pmm_init_heap(&pmm_data.ext_heap, e820[i].addr, 
 100.280 +                          e820[i].addr + e820[i].size);
 100.281 +            break;
 100.282 +        }
 100.283 +    }
 100.284 +
 100.285 +    /* convectional memory: RAM below 1MB, 0x10000-0x7FFFF */
 100.286 +    pmm_init_heap(&pmm_data.heap, SCRATCH_PHYSICAL_ADDRESS,
 100.287 +                  HYPERCALL_PHYSICAL_ADDRESS);
 100.288 +}
 100.289 +
 100.290 +static uint32_t
 100.291 +pmm_max_avail_length(heap_t *heap)
 100.292 +{
 100.293 +    memblk_t *mb;
 100.294 +    uint32_t size, max = 0;
 100.295 +
 100.296 +    for_each_memblk ( heap, mb )
 100.297 +    {
 100.298 +        if ( !memblk_is_avail(mb) )
 100.299 +            continue;
 100.300 +        collect_avail_memblks(heap, mb);
 100.301 +        size = memblk_bufsize(mb);
 100.302 +        if ( size > max )
 100.303 +            max = size;
 100.304 +    }
 100.305 +
 100.306 +    return (max / PARAGRAPH_LENGTH);
 100.307 +}
 100.308 +
 100.309 +static memblk_t *
 100.310 +first_fit(heap_t *heap, uint32_t size, uint32_t handle, uint32_t flags)
 100.311 +{
 100.312 +    memblk_t *mb;
 100.313 +    int32_t align = 0;
 100.314 +
 100.315 +    if ( flags & PMM_FLAGS_ALIGINMENT )
 100.316 +        align = ((size ^ (size - 1)) >> 1) + 1;
 100.317 +
 100.318 +    for_each_memblk ( heap, mb )
 100.319 +    {
 100.320 +        if ( memblk_is_avail(mb) )
 100.321 +        {
 100.322 +            collect_avail_memblks(heap, mb);
 100.323 +
 100.324 +            if ( align )
 100.325 +            {
 100.326 +                uint32_t addr = memblk_buffer(mb);
 100.327 +                uint32_t offset = ALIGN_UP(addr, align) - addr;
 100.328 +
 100.329 +                if ( offset > 0 )
 100.330 +                {
 100.331 +                    ASSERT(offset >= MEMBLK_HEADER_SIZE, continue);
 100.332 +
 100.333 +                    if ( (offset + size) > memblk_bufsize(mb) )
 100.334 +                        continue;
 100.335 +
 100.336 +                    mb = split_memblk(mb, offset - MEMBLK_HEADER_SIZE);
 100.337 +                    return mb;
 100.338 +                }
 100.339 +            }
 100.340 +
 100.341 +            if ( size <= memblk_bufsize(mb) )
 100.342 +                return mb;
 100.343 +        }
 100.344 +        else
 100.345 +        {
 100.346 +            ASSERT(memblk_is_inuse(mb), return NULL);
 100.347 +
 100.348 +            /* Duplication check for handle. */
 100.349 +            if ( (handle != PMM_HANDLE_ANONYMOUS) && (mb->handle == handle) )
 100.350 +                return NULL;
 100.351 +        }
 100.352 +    }
 100.353 +
 100.354 +    return NULL;
 100.355 +}
 100.356 +
 100.357 +static memblk_t *
 100.358 +pmm_find_handle(heap_t *heap, uint32_t handle)
 100.359 +{
 100.360 +    memblk_t *mb;
 100.361 +
 100.362 +    if ( handle == PMM_HANDLE_ANONYMOUS )
 100.363 +        return NULL;
 100.364 +
 100.365 +    for_each_memblk ( heap, mb )
 100.366 +        if ( mb->handle == handle )
 100.367 +            return mb;
 100.368 +
 100.369 +    return NULL;
 100.370 +}
 100.371 +
 100.372 +/*
 100.373 + * allocate a memory block of the specified type and size, and returns
 100.374 + * the address of the memory block.
 100.375 + *
 100.376 + * A client-specified identifier to be associated with the allocated
 100.377 + * memory block. A handle of 0xFFFFFFFF indicates that no identifier
 100.378 + * should be associated with the block. Such a memory block is known
 100.379 + * as an "anonymous" memory block and cannot be found using the
 100.380 + * pmmFind function. If a specified handle for a requested memory
 100.381 + * block is already used in a currently allocated memory block, the
 100.382 + * error value of 0x00000000 is returned
 100.383 + *
 100.384 + * If length is 0x00000000, no memory is allocated and the value
 100.385 + * returned is the size of the largest memory block available for the
 100.386 + * memory type specified in the flags parameter. The alignment bit in
 100.387 + * the flags register is ignored when calculating the largest memory
 100.388 + * block available.
 100.389 + *
 100.390 + * If a specified handle for a requested memory block is already used
 100.391 + * in a currently allocated memory block, the error value of
 100.392 + * 0x00000000 is returned.
 100.393 + * 
 100.394 + * A return value of 0x00000000 indicates that an error occurred and
 100.395 + * no memory has been allocated. 
 100.396 + */
 100.397 +static uint32_t
 100.398 +pmmAllocate(uint32_t length, uint32_t handle, uint16_t flags)
 100.399 +{
 100.400 +    heap_t *heap;
 100.401 +    memblk_t *mb;
 100.402 +    uint32_t size;
 100.403 +
 100.404 +    switch ( flags & PMM_FLAGS_MEMORY_TYPE_MASK )
 100.405 +    {
 100.406 +    case PMM_FLAGS_MEMORY_CONVENTIONAL:
 100.407 +        heap = &pmm_data.heap;
 100.408 +        break;
 100.409 +
 100.410 +    case PMM_FLAGS_MEMORY_EXTENDED:
 100.411 +    case PMM_FLAGS_MEMORY_ANY: /* XXX: ignore conventional memory for now */
 100.412 +        heap = &pmm_data.ext_heap;
 100.413 +        break;
 100.414 +
 100.415 +    default:
 100.416 +        return PMM_EINVAL;
 100.417 +    }
 100.418 +
 100.419 +    /* return the largest memory block available */
 100.420 +    if ( length == 0 )
 100.421 +        return pmm_max_avail_length(heap);
 100.422 +
 100.423 +    size = length * PARAGRAPH_LENGTH;
 100.424 +    mb = first_fit(heap, size, handle, flags);
 100.425 +
 100.426 +    if ( mb == NULL )
 100.427 +        return PMM_ENOMEM;
 100.428 +
 100.429 +    /* duplication check for handle */
 100.430 +    if ( handle != PMM_HANDLE_ANONYMOUS )
 100.431 +    {
 100.432 +        memblk_t *nb = mb->next;
 100.433 +
 100.434 +        for_remain_memblk(heap, nb)
 100.435 +            if (nb->handle == handle)
 100.436 +                return PMM_ENOMEM;
 100.437 +    }
 100.438 +
 100.439 +    split_memblk(mb, size);
 100.440 +    set_inuse(mb, handle);
 100.441 +
 100.442 +    return memblk_buffer(mb);
 100.443 +}
 100.444 +
 100.445 +/*
 100.446 + * returns the address of the memory block associated with the
 100.447 + * specified handle.  
 100.448 + *
 100.449 + * A return value of 0x00000000 indicates that the handle does not
 100.450 + * correspond to a currently allocated memory block.
 100.451 + */
 100.452 +static uint32_t
 100.453 +pmmFind(uint32_t handle)
 100.454 +{
 100.455 +    memblk_t *mb;
 100.456 +
 100.457 +    if ( handle == PMM_HANDLE_ANONYMOUS )
 100.458 +        return 0;
 100.459 +
 100.460 +    mb = pmm_find_handle(&pmm_data.heap, handle);
 100.461 +    if ( mb == NULL )
 100.462 +        mb = pmm_find_handle(&pmm_data.ext_heap, handle);
 100.463 +
 100.464 +    return mb ? memblk_buffer(mb) : 0;
 100.465 +}
 100.466 +
 100.467 +/* 
 100.468 + * frees the specified memory block that was previously allocated by
 100.469 + * pmmAllocate.
 100.470 + *
 100.471 + * If the memory block was deallocated correctly, the return value is
 100.472 + * 0x00000000. If there was an error, the return value is non-zero.
 100.473 + */
 100.474 +static uint32_t
 100.475 +pmmDeallocate(uint32_t buffer)
 100.476 +{
 100.477 +    memblk_t *mb = buffer_memblk(buffer);
 100.478 +
 100.479 +    if ( !memblk_is_inuse(mb) )
 100.480 +        return PMM_EINVAL;
 100.481 +
 100.482 +    set_avail(mb);
 100.483 +    return 0;
 100.484 +}
 100.485 +
 100.486 +
 100.487 +union pmm_args {
 100.488 +    uint16_t function;
 100.489 +    struct pmmAllocArgs alloc;
 100.490 +    struct pmmFindArgs find;
 100.491 +    struct pmmDeallocateArgs dealloc;
 100.492 +} __attribute__ ((packed));
 100.493 +
 100.494 +/*
 100.495 + * entry function of all PMM services.
 100.496 + *
 100.497 + * Values returned to the caller are placed in the DX:AX register
 100.498 + * pair. The flags and all registers, other than DX and AX, are
 100.499 + * preserved across calls to PMM services.
 100.500 + */
 100.501 +uint32_t
 100.502 +pmm(void *argp)
 100.503 +{
 100.504 +    union pmm_args *ap = argp;
 100.505 +    uint32_t ret = PMM_EINVAL;
 100.506 +
 100.507 +    if ( pmm_data.heap.head == HEAP_NOT_INITIALIZED )
 100.508 +        pmm_initalize();
 100.509 +
 100.510 +    switch ( ap->function )
 100.511 +    {
 100.512 +    case PMM_FUNCTION_ALLOCATE:
 100.513 +        ret = pmmAllocate(ap->alloc.length, ap->alloc.handle, ap->alloc.flags);
 100.514 +        PMM_DEBUG("Alloc length=%x handle=%x flags=%x ret=%x\n", 
 100.515 +                  ap->alloc.length, ap->alloc.handle, ap->alloc.flags, ret);
 100.516 +        break;
 100.517 +
 100.518 +    case PMM_FUNCTION_FIND:
 100.519 +        ret = pmmFind(ap->find.handle);
 100.520 +        PMM_DEBUG("Find handle=%x ret=%x\n", ap->find.handle, ret);
 100.521 +        break;
 100.522 +
 100.523 +    case PMM_FUNCTION_DEALLOC:
 100.524 +        ret = pmmDeallocate(ap->dealloc.buffer);
 100.525 +        PMM_DEBUG("Dealloc buffer=%x ret=%x\n", ap->dealloc.buffer, ret);
 100.526 +        break;
 100.527 +
 100.528 +    default:
 100.529 +        PMM_DEBUG("Invalid function:%d\n", ap->function);
 100.530 +        break;
 100.531 +    }
 100.532 +
 100.533 +    return ret;
 100.534 +}
   101.1 --- a/tools/firmware/rombios/32bit/rombios_compat.h	Mon Nov 10 15:52:15 2008 -0800
   101.2 +++ b/tools/firmware/rombios/32bit/rombios_compat.h	Wed Feb 11 16:25:03 2009 -0800
   101.3 @@ -89,4 +89,8 @@ static inline void write_byte(Bit16u seg
   101.4  	*addr = val;
   101.5  }
   101.6  
   101.7 +#define X(idx, ret, fn, args...) ret fn (args);
   101.8 +#include "32bitprotos.h"
   101.9 +#undef X
  101.10 +
  101.11  #endif
   102.1 --- a/tools/firmware/rombios/32bit/tcgbios/Makefile	Mon Nov 10 15:52:15 2008 -0800
   102.2 +++ b/tools/firmware/rombios/32bit/tcgbios/Makefile	Wed Feb 11 16:25:03 2009 -0800
   102.3 @@ -2,17 +2,17 @@ XEN_ROOT = ../../../../..
   102.4  include $(XEN_ROOT)/tools/firmware/Rules.mk
   102.5  
   102.6  TARGET  = tcgbiosext.o
   102.7 -FILES   = tcgbios tpm_drivers
   102.8 -OBJECTS = $(foreach f,$(FILES),$(f).o)
   102.9  
  102.10 -CFLAGS += $(CFLAGS_include) -I.. -I../.. -DGCC_PROTOS
  102.11 +CFLAGS += $(CFLAGS_include) -I.. -I../..
  102.12  
  102.13 -.PHONY: all clean
  102.14 -
  102.15 +.PHONY: all
  102.16  all: $(TARGET)
  102.17  
  102.18 +.PHONY: clean
  102.19  clean:
  102.20 -	rm -rf *.o $(TARGET)