From: Jan Kiszka <jan.kiszka@xxxxxxxxxxx> This target no longer builds since (at least) 0.14, and no one bothered fixing it. Remove any diff to upstream before ia64 emulation pops up there and causes serious merge pain here. Signed-off-by: Jan Kiszka <jan.kiszka@xxxxxxxxxxx> Acked-by: Jes Sorensen <Jes.Sorensen@xxxxxxxxxx> Acked-by: Alexander Graf <agraf@xxxxxxx> --- Rebased as requested. Makefile.target | 12 - cache-utils.h | 21 -- configure | 10 - cpu-exec.c | 4 - exec.c | 9 +- hw/acpi_piix4.c | 7 - hw/device-assignment.c | 4 - hw/ipf.c | 707 ---------------------------------------------- hw/pci.c | 4 - hw/vga.c | 3 - ia64.ld | 2 +- ia64intrin.h | 150 ---------- oslib-posix.c | 4 - qemu-kvm-ia64.c | 145 ---------- qemu-kvm.h | 5 - qemu-options.hx | 2 - target-ia64/cpu.h | 85 ------ target-ia64/exec.h | 61 ---- target-ia64/fake-exec.c | 50 ---- target-ia64/firmware.c | 715 ----------------------------------------------- target-ia64/firmware.h | 62 ---- target-ia64/helper.c | 5 - target-ia64/libkvm.c | 82 ------ target-ia64/libkvm.h | 31 -- target-ia64/machine.c | 36 --- target-ia64/op.c | 22 -- target-ia64/op_helper.c | 104 ------- target-ia64/translate.c | 39 --- vl.c | 6 - 29 files changed, 2 insertions(+), 2385 deletions(-) delete mode 100644 hw/ipf.c delete mode 100644 ia64intrin.h delete mode 100644 qemu-kvm-ia64.c delete mode 100644 target-ia64/cpu.h delete mode 100644 target-ia64/exec.h delete mode 100644 target-ia64/fake-exec.c delete mode 100644 target-ia64/firmware.c delete mode 100644 target-ia64/firmware.h delete mode 100644 target-ia64/helper.c delete mode 100644 target-ia64/libkvm.c delete mode 100644 target-ia64/libkvm.h delete mode 100644 target-ia64/machine.c delete mode 100644 target-ia64/op.c delete mode 100644 target-ia64/op_helper.c delete mode 100644 target-ia64/translate.c diff --git a/Makefile.target b/Makefile.target index 24a0015..324b4f1 100644 --- a/Makefile.target +++ b/Makefile.target @@ -241,13 +241,6 @@ obj-i386-y += pcspk.o i8254.o obj-i386-$(CONFIG_KVM_PIT) += i8254-kvm.o obj-i386-$(CONFIG_KVM_DEVICE_ASSIGNMENT) += device-assignment.o -# Hardware support -obj-ia64-y += ide.o pckbd.o vga.o $(SOUND_HW) dma.o $(AUDIODRV) -obj-ia64-y += fdc.o mc146818rtc.o serial.o i8259.o ipf.o -obj-ia64-y += cirrus_vga.o parallel.o acpi.o piix_pci.o -obj-ia64-y += usb-uhci.o -obj-ia64-$(CONFIG_KVM_DEVICE_ASSIGNMENT) += device-assignment.o - # shared objects obj-ppc-y = ppc.o obj-ppc-y += vga.o @@ -395,11 +388,6 @@ obj-xtensa-y += xtensa_sample.o obj-xtensa-y += xtensa_dc232b.o obj-xtensa-y += xtensa-semi.o -ifeq ($(TARGET_ARCH), ia64) -firmware.o: firmware.c - $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< -endif - main.o: QEMU_CFLAGS+=$(GPROF_CFLAGS) monitor.o: hmp-commands.h qmp-commands.h diff --git a/cache-utils.h b/cache-utils.h index ee0baef..0b65907 100644 --- a/cache-utils.h +++ b/cache-utils.h @@ -34,28 +34,7 @@ static inline void flush_icache_range(unsigned long start, unsigned long stop) asm volatile ("isync" : : : "memory"); } -/* - * Is this correct for PPC? - */ -static inline void dma_flush_range(unsigned long start, unsigned long stop) -{ -} - -#elif defined(__ia64__) -static inline void flush_icache_range(unsigned long start, unsigned long stop) -{ - while (start < stop) { - asm volatile ("fc %0" :: "r"(start)); - start += 32; - } - asm volatile (";;sync.i;;srlz.i;;"); -} -#define dma_flush_range(start, end) flush_icache_range(start, end) -#define qemu_cache_utils_init(envp) do { (void) (envp); } while (0) #else -static inline void dma_flush_range(unsigned long start, unsigned long stop) -{ -} #define qemu_cache_utils_init(envp) do { (void) (envp); } while (0) #endif diff --git a/configure b/configure index f6e0653..94c7d31 100755 --- a/configure +++ b/configure @@ -482,13 +482,6 @@ Haiku) if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then audio_possible_drivers="$audio_possible_drivers fmod" fi - if [ "$cpu" = "ia64" ] ; then - xen="no" - target_list="ia64-softmmu" - cpu_emulation="no" - gdbstub="no" - slirp="no" - fi ;; esac @@ -3257,9 +3250,6 @@ case "$target_arch2" in target_phys_bits=64 target_long_alignment=8 ;; - ia64) - target_phys_bits=64 - ;; alpha) target_phys_bits=64 target_long_alignment=8 diff --git a/cpu-exec.c b/cpu-exec.c index 5c156ac..aef66f2 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -19,9 +19,7 @@ #include "config.h" #include "cpu.h" #include "disas.h" -#if !defined(TARGET_IA64) #include "tcg.h" -#endif #include "qemu-barrier.h" int tb_invalidated_flag; @@ -226,7 +224,6 @@ int cpu_exec(CPUState *env) #elif defined(TARGET_CRIS) #elif defined(TARGET_S390X) #elif defined(TARGET_XTENSA) -#elif defined(TARGET_IA64) /* XXXXX */ #else #error unsupported target CPU @@ -624,7 +621,6 @@ int cpu_exec(CPUState *env) #elif defined(TARGET_MICROBLAZE) #elif defined(TARGET_MIPS) #elif defined(TARGET_SH4) -#elif defined(TARGET_IA64) #elif defined(TARGET_ALPHA) #elif defined(TARGET_CRIS) #elif defined(TARGET_S390X) diff --git a/exec.c b/exec.c index 76e8c76..8578063 100644 --- a/exec.c +++ b/exec.c @@ -28,10 +28,7 @@ #include "cpu.h" #include "cache-utils.h" -#if !defined(TARGET_IA64) #include "tcg.h" -#endif - #include "hw/hw.h" #include "hw/qdev.h" #include "osdep.h" @@ -4149,8 +4146,6 @@ void *cpu_physical_memory_map(target_phys_addr_t addr, void cpu_physical_memory_unmap(void *buffer, target_phys_addr_t len, int is_write, target_phys_addr_t access_len) { - unsigned long flush_len = (unsigned long)access_len; - if (buffer != bounce.buffer) { if (is_write) { ram_addr_t addr1 = qemu_ram_addr_from_host_nofail(buffer); @@ -4168,9 +4163,7 @@ void cpu_physical_memory_unmap(void *buffer, target_phys_addr_t len, } addr1 += l; access_len -= l; - } - dma_flush_range((unsigned long)buffer, - (unsigned long)buffer + flush_len); + } } if (xen_enabled()) { xen_invalidate_map_cache_entry(buffer); diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c index 44eb8ae..3ec01d6 100644 --- a/hw/acpi_piix4.c +++ b/hw/acpi_piix4.c @@ -350,13 +350,6 @@ static int piix4_pm_initfn(PCIDevice *dev) pci_conf[0x40] = 0x01; /* PM io base read only bit */ -#if defined(TARGET_IA64) - pci_conf[0x40] = 0x41; /* PM io base read only bit */ - pci_conf[0x41] = 0x1f; - pm_write_config(s, 0x80, 0x01, 1); /*Set default pm_io_base 0x1f40*/ - s->pmcntrl = SCI_EN; -#endif - /* APM */ apm_init(&s->apm, apm_ctrl_changed, s); diff --git a/hw/device-assignment.c b/hw/device-assignment.c index f0a6ca9..0bd2cd0 100644 --- a/hw/device-assignment.c +++ b/hw/device-assignment.c @@ -819,10 +819,6 @@ static int assign_irq(AssignedDevice *dev) irq = pci_map_irq(&dev->dev, dev->intpin); irq = piix_get_irq(irq); -#ifdef TARGET_IA64 - irq = ipf_map_irq(&dev->dev, irq); -#endif - if (dev->girq == irq) return r; diff --git a/hw/ipf.c b/hw/ipf.c deleted file mode 100644 index 10c21eb..0000000 --- a/hw/ipf.c +++ /dev/null @@ -1,707 +0,0 @@ -/* - * Itanium Platform Emulator derived from QEMU PC System Emulator - * - * Copyright (c) 2003-2004 Fabrice Bellard - * - * Copyright (c) 2007 Intel - * Ported for IA64 Platform Zhang Xiantao <xiantao.zhang@xxxxxxxxx> - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "hw.h" -#include "pc.h" -#include "fdc.h" -#include "pci.h" -#include "block.h" -#include "sysemu.h" -#include "audio/audio.h" -#include "net.h" -#include "smbus.h" -#include "boards.h" -#include "firmware.h" -#include "ia64intrin.h" -#include <unistd.h> -#include "device-assignment.h" -#include "virtio-blk.h" - -#include "qemu-kvm.h" - -#define FW_FILENAME "Flash.fd" - -/* Leave a chunk of memory at the top of RAM for the BIOS ACPI tables. */ -#define ACPI_DATA_SIZE 0x10000 - -#define MAX_IDE_BUS 2 - -static fdctrl_t *floppy_controller; -static RTCState *rtc_state; -static PCIDevice *i440fx_state; - -static uint32_t ipf_to_legacy_io(target_phys_addr_t addr) -{ - return (uint32_t)(((addr&0x3ffffff) >> 12 << 2)|((addr) & 0x3)); -} - -static void ipf_legacy_io_writeb(void *opaque, target_phys_addr_t addr, - uint32_t val) { - uint32_t port = ipf_to_legacy_io(addr); - - cpu_outb(0, port, val); -} - -static void ipf_legacy_io_writew(void *opaque, target_phys_addr_t addr, - uint32_t val) { - uint32_t port = ipf_to_legacy_io(addr); - - cpu_outw(0, port, val); -} - -static void ipf_legacy_io_writel(void *opaque, target_phys_addr_t addr, - uint32_t val) { - uint32_t port = ipf_to_legacy_io(addr); - - cpu_outl(0, port, val); -} - -static uint32_t ipf_legacy_io_readb(void *opaque, target_phys_addr_t addr) -{ - uint32_t port = ipf_to_legacy_io(addr); - - return cpu_inb(0, port); -} - -static uint32_t ipf_legacy_io_readw(void *opaque, target_phys_addr_t addr) -{ - uint32_t port = ipf_to_legacy_io(addr); - - return cpu_inw(0, port); -} - -static uint32_t ipf_legacy_io_readl(void *opaque, target_phys_addr_t addr) -{ - uint32_t port = ipf_to_legacy_io(addr); - - return cpu_inl(0, port); -} - -static CPUReadMemoryFunc *ipf_legacy_io_read[3] = { - ipf_legacy_io_readb, - ipf_legacy_io_readw, - ipf_legacy_io_readl, -}; - -static CPUWriteMemoryFunc *ipf_legacy_io_write[3] = { - ipf_legacy_io_writeb, - ipf_legacy_io_writew, - ipf_legacy_io_writel, -}; - -static void pic_irq_request(void *opaque, int irq, int level) -{ - fprintf(stderr,"pic_irq_request called!\n"); -} - -/* PC cmos mappings */ - -#define REG_EQUIPMENT_BYTE 0x14 - -static int cmos_get_fd_drive_type(int fd0) -{ - int val; - - switch (fd0) { - case 0: - /* 1.44 Mb 3"5 drive */ - val = 4; - break; - case 1: - /* 2.88 Mb 3"5 drive */ - val = 5; - break; - case 2: - /* 1.2 Mb 5"5 drive */ - val = 2; - break; - default: - val = 0; - break; - } - return val; -} - -static void cmos_init_hd(int type_ofs, int info_ofs, BlockDriverState *hd) -{ - RTCState *s = rtc_state; - int cylinders, heads, sectors; - - bdrv_get_geometry_hint(hd, &cylinders, &heads, §ors); - rtc_set_memory(s, type_ofs, 47); - rtc_set_memory(s, info_ofs, cylinders); - rtc_set_memory(s, info_ofs + 1, cylinders >> 8); - rtc_set_memory(s, info_ofs + 2, heads); - rtc_set_memory(s, info_ofs + 3, 0xff); - rtc_set_memory(s, info_ofs + 4, 0xff); - rtc_set_memory(s, info_ofs + 5, 0xc0 | ((heads > 8) << 3)); - rtc_set_memory(s, info_ofs + 6, cylinders); - rtc_set_memory(s, info_ofs + 7, cylinders >> 8); - rtc_set_memory(s, info_ofs + 8, sectors); -} - -/* convert boot_device letter to something recognizable by the bios */ -static int boot_device2nibble(char boot_device) -{ - switch(boot_device) { - case 'a': - case 'b': - return 0x01; /* floppy boot */ - case 'c': - return 0x02; /* hard drive boot */ - case 'd': - return 0x03; /* CD-ROM boot */ - case 'n': - return 0x04; /* Network boot */ - } - return 0; -} - -/* hd_table must contain 4 block drivers */ -static void cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size, - const char *boot_device, BlockDriverState **hd_table) -{ - RTCState *s = rtc_state; - int nbds, bds[3] = { 0, }; - int val; - int fd0, fd1, nb; - int i; - - /* various important CMOS locations needed by PC/Bochs bios */ - - /* memory size */ - val = 640; /* base memory in K */ - rtc_set_memory(s, 0x15, val); - rtc_set_memory(s, 0x16, val >> 8); - - val = (ram_size / 1024) - 1024; - if (val > 65535) - val = 65535; - rtc_set_memory(s, 0x17, val); - rtc_set_memory(s, 0x18, val >> 8); - rtc_set_memory(s, 0x30, val); - rtc_set_memory(s, 0x31, val >> 8); - - if (above_4g_mem_size) { - rtc_set_memory(s, 0x5b, (unsigned int)above_4g_mem_size >> 16); - rtc_set_memory(s, 0x5c, (unsigned int)above_4g_mem_size >> 24); - rtc_set_memory(s, 0x5d, above_4g_mem_size >> 32); - } - rtc_set_memory(s, 0x5f, smp_cpus - 1); - - if (ram_size > (16 * 1024 * 1024)) - val = (ram_size / 65536) - ((16 * 1024 * 1024) / 65536); - else - val = 0; - if (val > 65535) - val = 65535; - rtc_set_memory(s, 0x34, val); - rtc_set_memory(s, 0x35, val >> 8); - - /* set boot devices, and disable floppy signature check if requested */ -#define PC_MAX_BOOT_DEVICES 3 - nbds = strlen(boot_device); - - if (nbds > PC_MAX_BOOT_DEVICES) { - fprintf(stderr, "Too many boot devices for PC\n"); - exit(1); - } - - for (i = 0; i < nbds; i++) { - bds[i] = boot_device2nibble(boot_device[i]); - if (bds[i] == 0) { - fprintf(stderr, "Invalid boot device for PC: '%c'\n", - boot_device[i]); - exit(1); - } - } - - rtc_set_memory(s, 0x3d, (bds[1] << 4) | bds[0]); - rtc_set_memory(s, 0x38, (bds[2] << 4) | (fd_bootchk ? 0x0 : 0x1)); - - /* floppy type */ - - fd0 = fdctrl_get_drive_type(floppy_controller, 0); - fd1 = fdctrl_get_drive_type(floppy_controller, 1); - - val = (cmos_get_fd_drive_type(fd0) << 4) | cmos_get_fd_drive_type(fd1); - rtc_set_memory(s, 0x10, val); - - val = 0; - nb = 0; - if (fd0 < 3) - nb++; - if (fd1 < 3) - nb++; - - switch (nb) { - case 0: - break; - case 1: - val |= 0x01; /* 1 drive, ready for boot */ - break; - case 2: - val |= 0x41; /* 2 drives, ready for boot */ - break; - } - - val |= 0x02; /* FPU is there */ - val |= 0x04; /* PS/2 mouse installed */ - rtc_set_memory(s, REG_EQUIPMENT_BYTE, val); - - /* hard drives */ - - rtc_set_memory(s, 0x12, (hd_table[0] ? 0xf0 : 0) | (hd_table[1] ? 0x0f : 0)); - if (hd_table[0]) - cmos_init_hd(0x19, 0x1b, hd_table[0]); - if (hd_table[1]) - cmos_init_hd(0x1a, 0x24, hd_table[1]); - - val = 0; - for (i = 0; i < 4; i++) { - if (hd_table[i]) { - int cylinders, heads, sectors, translation; - /* NOTE: bdrv_get_geometry_hint() returns the physical - geometry. It is always such that: 1 <= sects <= 63, 1 - <= heads <= 16, 1 <= cylinders <= 16383. The BIOS - geometry can be different if a translation is done. */ - translation = bdrv_get_translation_hint(hd_table[i]); - if (translation == BIOS_ATA_TRANSLATION_AUTO) { - bdrv_get_geometry_hint(hd_table[i], &cylinders, - &heads, §ors); - if (cylinders <= 1024 && heads <= 16 && sectors <= 63) { - /* No translation. */ - translation = 0; - } else { - /* LBA translation. */ - translation = 1; - } - } else { - translation--; - } - val |= translation << (i * 2); - } - } - rtc_set_memory(s, 0x39, val); -} - -static void main_cpu_reset(void *opaque) -{ - CPUState *env = opaque; - cpu_reset(env); -} - -static const int ide_iobase[2] = { 0x1f0, 0x170 }; -static const int ide_iobase2[2] = { 0x3f6, 0x376 }; -static const int ide_irq[2] = { 14, 15 }; - -#define NE2000_NB_MAX 6 - -static int ne2000_io[NE2000_NB_MAX] = { 0x300, 0x320, 0x340, - 0x360, 0x280, 0x380 }; -static int ne2000_irq[NE2000_NB_MAX] = { 9, 10, 11, 3, 4, 5 }; - -static int serial_io[MAX_SERIAL_PORTS] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 }; -static int serial_irq[MAX_SERIAL_PORTS] = { 4, 3, 4, 3 }; - -static int parallel_io[MAX_PARALLEL_PORTS] = { 0x378, 0x278, 0x3bc }; -static int parallel_irq[MAX_PARALLEL_PORTS] = { 7, 7, 7 }; - -#ifdef HAS_AUDIO -static void audio_init (PCIBus *pci_bus, qemu_irq *pic) -{ - struct soundhw *c; - int audio_enabled = 0; - - for (c = soundhw; !audio_enabled && c->name; ++c) { - audio_enabled = c->enabled; - } - - if (audio_enabled) { - AudioState *s; - - s = AUD_init (); - if (s) { - for (c = soundhw; c->name; ++c) { - if (c->enabled) { - if (c->isa) { - c->init.init_isa (s, pic); - } else { - if (pci_bus) { - c->init.init_pci (pci_bus, s); - } - } - } - } - } - } -} -#endif - -static void pc_init_ne2k_isa(NICInfo *nd, qemu_irq *pic) -{ - static int nb_ne2k = 0; - - if (nb_ne2k == NE2000_NB_MAX) - return; - isa_ne2000_init(ne2000_io[nb_ne2k], pic[ne2000_irq[nb_ne2k]], nd); - nb_ne2k++; -} - -/* Itanium hardware initialisation */ -static void ipf_init1(ram_addr_t ram_size, - const char *boot_device, DisplayState *ds, - const char *kernel_filename, const char *kernel_cmdline, - const char *initrd_filename, - int pci_enabled, const char *cpu_model) -{ - char buf[1024]; - int i; - ram_addr_t ram_addr; - ram_addr_t above_4g_mem_size = 0; - PCIBus *pci_bus; - PCIDevice *pci_dev; - int piix3_devfn = -1; - CPUState *env; - qemu_irq *cpu_irq; - qemu_irq *i8259; - int page_size; - int index; - unsigned long ipf_legacy_io_base, ipf_legacy_io_mem; - BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; - BlockDriverState *fd[MAX_FD]; - - page_size = getpagesize(); - if (page_size != TARGET_PAGE_SIZE) { - fprintf(stderr,"Error! Host page size != qemu target page size," - " you may need to change TARGET_PAGE_BITS in qemu!" - "host page size:0x%x\n", page_size); - exit(-1); - }; - - if (ram_size >= 0xc0000000 ) { - above_4g_mem_size = ram_size - 0xc0000000; - ram_size = 0xc0000000; - } - - /* init CPUs */ - if (cpu_model == NULL) { - cpu_model = "IA64"; - } - - for(i = 0; i < smp_cpus; i++) { - env = cpu_init(cpu_model); - if (!env) { - fprintf(stderr, "Unable to find CPU definition\n"); - exit(1); - } - if (i != 0) - env->hflags |= HF_HALTED_MASK; - register_savevm("cpu", i, 4, cpu_save, cpu_load, env); - qemu_register_reset(main_cpu_reset, 0, env); - } - - /* allocate RAM */ - if (kvm_enabled()) { - ram_addr = qemu_ram_alloc(0xa0000); - cpu_register_physical_memory(0, 0xa0000, ram_addr); - - ram_addr = qemu_ram_alloc(0x20000); // Workaround 0xa0000-0xc0000 - - ram_addr = qemu_ram_alloc(0x40000); - cpu_register_physical_memory(0xc0000, 0x40000, ram_addr); - - ram_addr = qemu_ram_alloc(ram_size - 0x100000); - cpu_register_physical_memory(0x100000, ram_size - 0x100000, ram_addr); - } else { - ram_addr = qemu_ram_alloc(ram_size); - cpu_register_physical_memory(0, ram_size, ram_addr); - } - - /* above 4giga memory allocation */ - if (above_4g_mem_size > 0) { - ram_addr = qemu_ram_alloc(above_4g_mem_size); - cpu_register_physical_memory(0x100000000, above_4g_mem_size, ram_addr); - } - - /*Load firware to its proper position.*/ - if (kvm_enabled()) { - unsigned long image_size; - uint8_t *image = NULL; - unsigned long nvram_addr; - unsigned long nvram_fd = 0; - unsigned long type = READ_FROM_NVRAM; - unsigned long i = 0; - unsigned long fw_offset; - ram_addr_t fw_mem = qemu_ram_alloc(GFW_SIZE); - - snprintf(buf, sizeof(buf), "%s/%s", bios_dir, FW_FILENAME); - image = read_image(buf, &image_size ); - if (NULL == image || !image_size) { - fprintf(stderr, "Error when reading Guest Firmware!\n"); - fprintf(stderr, "Please check Guest firmware at %s\n", buf); - exit(1); - } - fw_offset = GFW_START + GFW_SIZE - image_size; - - cpu_register_physical_memory(GFW_START, GFW_SIZE, fw_mem); - cpu_physical_memory_write(fw_offset, image, image_size); - - free(image); - - if (nvram) { - nvram_addr = NVRAM_START; - nvram_fd = kvm_ia64_nvram_init(type); - if (nvram_fd != -1) { - kvm_ia64_copy_from_nvram_to_GFW(nvram_fd); - close(nvram_fd); - } - i = atexit((void *)kvm_ia64_copy_from_GFW_to_nvram); - if (i != 0) - fprintf(stderr, "cannot set exit function\n"); - } else - nvram_addr = 0; - - kvm_ia64_build_hob(ram_size + above_4g_mem_size, smp_cpus, nvram_addr); - } - - /*Register legacy io address space, size:64M*/ - ipf_legacy_io_base = 0xE0000000; - ipf_legacy_io_mem = cpu_register_io_memory(0, ipf_legacy_io_read, - ipf_legacy_io_write, NULL); - cpu_register_physical_memory(ipf_legacy_io_base, 64*1024*1024, - ipf_legacy_io_mem); - - cpu_irq = qemu_allocate_irqs(pic_irq_request, first_cpu, 1); - i8259 = kvm_i8259_init(cpu_irq[0]); - - if (pci_enabled) { - pci_bus = i440fx_init(&i440fx_state, i8259); - piix3_devfn = piix3_init(pci_bus, -1); - } else { - pci_bus = NULL; - } - - if (cirrus_vga_enabled) { - if (pci_enabled) - pci_cirrus_vga_init(pci_bus); - else - isa_cirrus_vga_init(); - } else { - if (pci_enabled) - pci_vga_init(pci_bus, 0, 0); - else - isa_vga_init(); - } - - rtc_state = rtc_init(0x70, i8259[8], 2000); - - if (pci_enabled) { - pic_set_alt_irq_func(isa_pic, NULL, NULL); - } - - for(i = 0; i < MAX_SERIAL_PORTS; i++) { - if (serial_hds[i]) { - serial_init(serial_io[i], i8259[serial_irq[i]], 115200, - serial_hds[i]); - } - } - - for(i = 0; i < MAX_PARALLEL_PORTS; i++) { - if (parallel_hds[i]) { - parallel_init(parallel_io[i], i8259[parallel_irq[i]], - parallel_hds[i]); - } - } - - for(i = 0; i < nb_nics; i++) { - NICInfo *nd = &nd_table[i]; - - if (!pci_enabled || (nd->model && strcmp(nd->model, "ne2k_isa") == 0)) - pc_init_ne2k_isa(nd, i8259); - else - pci_nic_init(nd, "e1000", NULL); - } - -#undef USE_HYPERCALL //Disable it now, need to implement later! -#ifdef USE_HYPERCALL - pci_hypercall_init(pci_bus); -#endif - - if (drive_get_max_bus(IF_IDE) >= MAX_IDE_BUS) { - fprintf(stderr, "qemu: too many IDE bus\n"); - exit(1); - } - - for(i = 0; i < MAX_IDE_BUS * MAX_IDE_DEVS; i++) { - index = drive_get_index(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS); - if (index != -1) - hd[i] = drives_table[index].bdrv; - else - hd[i] = NULL; - } - - if (pci_enabled) { - pci_piix3_ide_init(pci_bus, hd, piix3_devfn + 1, i8259); - } else { - for(i = 0; i < MAX_IDE_BUS; i++) { - isa_ide_init(ide_iobase[i], ide_iobase2[i], i8259[ide_irq[i]], - hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]); - } - } - - i8042_init(i8259[1], i8259[12], 0x60); - DMA_init(0); -#ifdef HAS_AUDIO - audio_init(pci_enabled ? pci_bus : NULL, i8259); -#endif - - for(i = 0; i < MAX_FD; i++) { - index = drive_get_index(IF_FLOPPY, 0, i); - if (index != -1) - fd[i] = drives_table[index].bdrv; - else - fd[i] = NULL; - } - floppy_controller = fdctrl_init(i8259[6], 2, 0, 0x3f0, fd); - - cmos_init(ram_size, above_4g_mem_size, boot_device, hd); - - if (pci_enabled && usb_enabled) { - usb_uhci_piix3_init(pci_bus, piix3_devfn + 2); - } - - if (pci_enabled && acpi_enabled) { - uint8_t *eeprom_buf = qemu_mallocz(8 * 256); /* XXX: make this persistent */ - i2c_bus *smbus; - - /* TODO: Populate SPD eeprom data. */ - smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100, i8259[9]); - for (i = 0; i < 8; i++) { - DeviceState *eeprom; - eeprom = qdev_create((BusState *)smbus, "smbus-eeprom"); - qdev_set_prop_int(eeprom, "address", 0x50 + i); - qdev_set_prop_ptr(eeprom, "data", eeprom_buf + (i * 256)); - qdev_init(eeprom); - } - } - - if (i440fx_state) { - i440fx_init_memory_mappings(i440fx_state); - } - - if (pci_enabled) { - int max_bus; - int bus; - - max_bus = drive_get_max_bus(IF_SCSI); - for (bus = 0; bus <= max_bus; bus++) { - pci_create_simple(pci_bus, -1, "lsi53c895a"); - } - } - /* Add virtio block devices */ - if (pci_enabled) { - int index; - int unit_id = 0; - - while ((index = drive_get_index(IF_VIRTIO, 0, unit_id)) != -1) { - pci_dev = pci_create("virtio-blk-pci", - drives_table[index].devaddr); - qdev_init(&pci_dev->qdev); - unit_id++; - } - } -} - -static void ipf_init_pci(ram_addr_t ram_size, - const char *boot_device, DisplayState *ds, - const char *kernel_filename, - const char *kernel_cmdline, - const char *initrd_filename, - const char *cpu_model) -{ - ipf_init1(ram_size, boot_device, ds, kernel_filename, - kernel_cmdline, initrd_filename, 1, cpu_model); -} - -QEMUMachine ipf_machine = { - .name = "itanium", - .desc = "Itanium Platform", - .init = (QEMUMachineInitFunc *)ipf_init_pci, - .max_cpus = 255, - .is_default = 1, -}; - -static void ipf_machine_init(void) -{ - qemu_register_machine(&ipf_machine); -} - -machine_init(ipf_machine_init); - -#define IOAPIC_NUM_PINS 48 - -static int ioapic_irq_count[IOAPIC_NUM_PINS]; - -static int ioapic_map_irq(int devfn, int irq_num) -{ - int irq, dev; - dev = devfn >> 3; - irq = ((((dev << 2) + (dev >> 3) + irq_num) & 31) + 16); - return irq; -} - -/* - * Dummy function to provide match for call from hw/apic.c - */ -void apic_set_irq_delivered(void) { -} - -void ioapic_set_irq(void *opaque, int irq_num, int level) -{ - int vector, pic_ret; - - PCIDevice *pci_dev = (PCIDevice *)opaque; - vector = ioapic_map_irq(pci_dev->devfn, irq_num); - - if (level) - ioapic_irq_count[vector] += 1; - else - ioapic_irq_count[vector] -= 1; - - if (kvm_enabled()) { - if (kvm_set_irq(vector, ioapic_irq_count[vector] == 0, &pic_ret)) - if (pic_ret != 0) - apic_set_irq_delivered(); - return; - } -} - -int ipf_map_irq(PCIDevice *pci_dev, int irq_num) -{ - return ioapic_map_irq(pci_dev->devfn, irq_num); -} diff --git a/hw/pci.c b/hw/pci.c index 98ebfa5..3c5d642 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -1165,10 +1165,6 @@ static void pci_set_irq(void *opaque, int irq_num, int level) if (!change) return; -#if defined(TARGET_IA64) - ioapic_set_irq(pci_dev, irq_num, level); -#endif - pci_set_irq_state(pci_dev, irq_num, level); pci_update_irq_status(pci_dev); if (pci_irq_disabled(pci_dev)) diff --git a/hw/vga.c b/hw/vga.c index e9f07ee..f9a6014 100644 --- a/hw/vga.c +++ b/hw/vga.c @@ -1856,9 +1856,6 @@ static void vga_update_display(void *opaque) vga_draw_text(s, full_update); break; case GMODE_GRAPH: -#ifdef TARGET_IA64 - full_update = 1; -#endif vga_draw_graphic(s, full_update); break; case GMODE_BLANK: diff --git a/ia64.ld b/ia64.ld index 081aaf1..0c37796 100644 --- a/ia64.ld +++ b/ia64.ld @@ -7,7 +7,7 @@ ENTRY(_start) SECTIONS { /* Read-only sections, merged into text segment: */ - PROVIDE (__executable_start = 0x4000000060000000); . = 0x4000000060000000 + SIZEOF_HEADERS; + PROVIDE (__executable_start = 0x60000000); . = 0x60000000 + SIZEOF_HEADERS; .interp : { *(.interp) } .hash : { *(.hash) } .dynsym : { *(.dynsym) } diff --git a/ia64intrin.h b/ia64intrin.h deleted file mode 100644 index ddd5ed9..0000000 --- a/ia64intrin.h +++ /dev/null @@ -1,150 +0,0 @@ -#ifndef IA64_INTRINSIC_H -#define IA64_INTRINSIC_H - -/* - * Compiler-dependent Intrinsics - * - * Copyright (C) 2002,2003 Jun Nakajima <jun.nakajima@xxxxxxxxx> - * Copyright (C) 2002,2003 Suresh Siddha <suresh.b.siddha@xxxxxxxxx> - * - */ -extern long ia64_cmpxchg_called_with_bad_pointer (void); -extern void ia64_bad_param_for_getreg (void); -#define ia64_cmpxchg(sem,ptr,o,n,s) ({ \ - uint64_t _o, _r; \ - switch(s) { \ - case 1: _o = (uint8_t)(long)(o); break; \ - case 2: _o = (uint16_t)(long)(o); break; \ - case 4: _o = (uint32_t)(long)(o); break; \ - case 8: _o = (uint64_t)(long)(o); break; \ - default: break; \ - } \ - switch(s) { \ - case 1: \ - _r = ia64_cmpxchg1_##sem((uint8_t*)ptr,n,_o); break; \ - case 2: \ - _r = ia64_cmpxchg2_##sem((uint16_t*)ptr,n,_o); break; \ - case 4: \ - _r = ia64_cmpxchg4_##sem((uint32_t*)ptr,n,_o); break; \ - case 8: \ - _r = ia64_cmpxchg8_##sem((uint64_t*)ptr,n,_o); break; \ - default: \ - _r = ia64_cmpxchg_called_with_bad_pointer(); break; \ - } \ - (__typeof__(o)) _r; \ -}) - -#define cmpxchg_acq(ptr,o,n) ia64_cmpxchg(acq,ptr,o,n,sizeof(*ptr)) -#define cmpxchg_rel(ptr,o,n) ia64_cmpxchg(rel,ptr,o,n,sizeof(*ptr)) - -#ifdef __INTEL_COMPILER -void __fc(uint64_t *addr); -void __synci(void); -void __isrlz(void); -void __dsrlz(void); -uint64_t __getReg(const int whichReg); -uint64_t _InterlockedCompareExchange8_rel(volatile uint8_t *dest, uint64_t xchg, uint64_t comp); -uint64_t _InterlockedCompareExchange8_acq(volatile uint8_t *dest, uint64_t xchg, uint64_t comp); -uint64_t _InterlockedCompareExchange16_rel(volatile uint16_t *dest, uint64_t xchg, uint64_t comp); -uint64_t _InterlockedCompareExchange16_acq(volatile uint16_t *dest, uint64_t xchg, uint64_t comp); -uint64_t _InterlockedCompareExchange_rel(volatile uint32_t *dest, uint64_t xchg, uint64_t comp); -uint64_t _InterlockedCompareExchange_acq(volatile uint32_t *dest, uint64_t xchg, uint64_t comp); -uint64_t _InterlockedCompareExchange64_rel(volatile uint64_t *dest, uint64_t xchg, uint64_t comp); -u64_t _InterlockedCompareExchange64_acq(volatile uint64_t *dest, uint64_t xchg, uint64_t comp); - -#define ia64_cmpxchg1_rel _InterlockedCompareExchange8_rel -#define ia64_cmpxchg1_acq _InterlockedCompareExchange8_acq -#define ia64_cmpxchg2_rel _InterlockedCompareExchange16_rel -#define ia64_cmpxchg2_acq _InterlockedCompareExchange16_acq -#define ia64_cmpxchg4_rel _InterlockedCompareExchange_rel -#define ia64_cmpxchg4_acq _InterlockedCompareExchange_acq -#define ia64_cmpxchg8_rel _InterlockedCompareExchange64_rel -#define ia64_cmpxchg8_acq _InterlockedCompareExchange64_acq - -#define ia64_srlz_d __dsrlz -#define ia64_srlz_i __isrlz -#define __ia64_fc __fc -#define ia64_sync_i __synci -#define __ia64_getreg __getReg -#else /* __INTEL_COMPILER */ -#define ia64_cmpxchg1_acq(ptr, new, old) \ -({ \ - uint64_t ia64_intri_res; \ - asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \ - asm volatile ("cmpxchg1.acq %0=[%1],%2,ar.ccv": \ - "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \ - ia64_intri_res; \ -}) - -#define ia64_cmpxchg1_rel(ptr, new, old) \ -({ \ - uint64_t ia64_intri_res; \ - asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \ - asm volatile ("cmpxchg1.rel %0=[%1],%2,ar.ccv": \ - "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \ - ia64_intri_res; \ -}) - -#define ia64_cmpxchg2_acq(ptr, new, old) \ -({ \ - uint64_t ia64_intri_res; \ - asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \ - asm volatile ("cmpxchg2.acq %0=[%1],%2,ar.ccv": \ - "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \ - ia64_intri_res; \ -}) - -#define ia64_cmpxchg2_rel(ptr, new, old) \ -({ \ - uint64_t ia64_intri_res; \ - asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \ - \ - asm volatile ("cmpxchg2.rel %0=[%1],%2,ar.ccv": \ - "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \ - ia64_intri_res; \ -}) - -#define ia64_cmpxchg4_acq(ptr, new, old) \ -({ \ - uint64_t ia64_intri_res; \ - asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \ - asm volatile ("cmpxchg4.acq %0=[%1],%2,ar.ccv": \ - "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \ - ia64_intri_res; \ -}) - -#define ia64_cmpxchg4_rel(ptr, new, old) \ -({ \ - uint64_t ia64_intri_res; \ - asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \ - asm volatile ("cmpxchg4.rel %0=[%1],%2,ar.ccv": \ - "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \ - ia64_intri_res; \ -}) - -#define ia64_cmpxchg8_acq(ptr, new, old) \ -({ \ - uint64_t ia64_intri_res; \ - asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \ - asm volatile ("cmpxchg8.acq %0=[%1],%2,ar.ccv": \ - "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \ - ia64_intri_res; \ -}) - -#define ia64_cmpxchg8_rel(ptr, new, old) \ -({ \ - uint64_t ia64_intri_res; \ - asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \ - \ - asm volatile ("cmpxchg8.rel %0=[%1],%2,ar.ccv": \ - "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \ - ia64_intri_res; \ -}) - -#define ia64_srlz_i() asm volatile (";; srlz.i ;;" ::: "memory") -#define ia64_srlz_d() asm volatile (";; srlz.d" ::: "memory"); -#define __ia64_fc(addr) asm volatile ("fc %0" :: "r"(addr) : "memory") -#define ia64_sync_i() asm volatile (";; sync.i" ::: "memory") - -#endif /* __INTEL_COMPILER */ -#endif /* IA64_INTRINSIC_H */ diff --git a/oslib-posix.c b/oslib-posix.c index 0c853cd..a304fb0 100644 --- a/oslib-posix.c +++ b/oslib-posix.c @@ -90,11 +90,7 @@ void *qemu_vmalloc(size_t size) size_t align = QEMU_VMALLOC_ALIGN; if (size < align) { -#ifndef __ia64__ align = getpagesize(); -#else - align = 65536; -#endif } ptr = qemu_memalign(align, size); trace_qemu_vmalloc(size, ptr); diff --git a/qemu-kvm-ia64.c b/qemu-kvm-ia64.c deleted file mode 100644 index bda57b6..0000000 --- a/qemu-kvm-ia64.c +++ /dev/null @@ -1,145 +0,0 @@ -#include "config.h" -#include "config-host.h" - -#include <string.h> - -#include "hw/hw.h" -#include "qemu-kvm.h" -#include <pthread.h> -#include <sys/utsname.h> -#include <sys/io.h> - - - -int kvm_arch_qemu_create_context(void) -{ - return 0; -} - -void kvm_arch_put_registers(CPUState *env, int level) -{ -} - - -void kvm_arch_get_registers(CPUState *env) -{ -} - -int kvm_arch_init_vcpu(CPUState *cenv) -{ - return 0; -} - -int kvm_arch_halt(kvm_vcpu_context_t vcpu) -{ - CPUState *env = cpu_single_env; - env->hflags |= HF_HALTED_MASK; - return 1; -} - -void kvm_arch_pre_kvm_run(void *opaque, CPUState *env) -{ -} - -void kvm_arch_post_kvm_run(void *opaque, CPUState *env) -{ -} - -int kvm_arch_has_work(CPUState *env) -{ - return 1; -} - -int kvm_arch_try_push_interrupts(void *opaque) -{ - return 1; -} - -int kvm_arch_insert_sw_breakpoint(CPUState *current_env, - struct kvm_sw_breakpoint *bp) -{ - return -EINVAL; -} - -int kvm_arch_remove_sw_breakpoint(CPUState *current_env, - struct kvm_sw_breakpoint *bp) -{ - return -EINVAL; -} - -int kvm_arch_insert_hw_breakpoint(target_ulong addr, - target_ulong len, int type) -{ - return -ENOSYS; -} - -int kvm_arch_remove_hw_breakpoint(target_ulong addr, - target_ulong len, int type) -{ - return -ENOSYS; -} - -void kvm_arch_remove_all_hw_breakpoints(void) -{ -} - -int kvm_arch_debug(struct kvm_debug_exit_arch *arch_info) -{ - return 0; -} - -void kvm_arch_update_guest_debug(CPUState *env, struct kvm_guest_debug *dbg) -{ -} - -void kvm_arch_save_mpstate(CPUState *env) -{ -#ifdef KVM_CAP_MP_STATE - int r; - struct kvm_mp_state mp_state; - - r = kvm_get_mpstate(env->kvm_cpu_state.vcpu_ctx, &mp_state); - if (r < 0) - env->mp_state = -1; - else - env->mp_state = mp_state.mp_state; -#endif -} - -void kvm_arch_load_mpstate(CPUState *env) -{ -#ifdef KVM_CAP_MP_STATE - struct kvm_mp_state mp_state = { .mp_state = env->mp_state }; - - /* - * -1 indicates that the host did not support GET_MP_STATE ioctl, - * so don't touch it. - */ - if (env->mp_state != -1) - kvm_set_mpstate(env->kvm_cpu_state.vcpu_ctx, &mp_state); -#endif -} - -void kvm_arch_reset_vcpu(CPUState *env) -{ - if (kvm_irqchip_in_kernel(kvm_context)) { -#ifdef KVM_CAP_MP_STATE - struct kvm_mp_state mp_state = {.mp_state = KVM_MP_STATE_UNINITIALIZED - }; - kvm_set_mpstate(env, &mp_state); -#endif - } else { - env->interrupt_request &= ~CPU_INTERRUPT_HARD; - env->halted = 1; - } -} - -void kvm_arch_do_ioperm(void *_data) -{ - struct ioperm_data *data = _data; - ioperm(data->start_port, data->num, data->turn_on); -} - -void kvm_arch_process_irqchip_events(CPUState *env) -{ -} diff --git a/qemu-kvm.h b/qemu-kvm.h index cb474fc..2bd5602 100644 --- a/qemu-kvm.h +++ b/qemu-kvm.h @@ -27,13 +27,8 @@ /* FIXME: share this number with kvm */ /* FIXME: or dynamically alloc/realloc regions */ -#if defined(__ia64__) -#define KVM_MAX_NUM_MEM_REGIONS 32u -#define MAX_VCPUS 256 -#else #define KVM_MAX_NUM_MEM_REGIONS 32u #define MAX_VCPUS 16 -#endif #include "kvm.h" diff --git a/qemu-options.hx b/qemu-options.hx index 9d21e6d..fbebab3 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -2478,8 +2478,6 @@ DEF("no-kvm-pit-reinjection", 0, QEMU_OPTION_no_kvm_pit_reinjection, "-no-kvm-pit-reinjection\n" " disable KVM kernel mode PIT interrupt reinjection\n", QEMU_ARCH_I386) -DEF("nvram", HAS_ARG, QEMU_OPTION_nvram, - "-nvram FILE provide ia64 nvram contents\n", QEMU_ARCH_ALL) DEF("tdf", 0, QEMU_OPTION_tdf, "-tdf enable guest time drift compensation\n", QEMU_ARCH_ALL) DEF("kvm-shadow-memory", HAS_ARG, QEMU_OPTION_kvm_shadow_memory, diff --git a/target-ia64/cpu.h b/target-ia64/cpu.h deleted file mode 100644 index fb51463..0000000 --- a/target-ia64/cpu.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * IA64 virtual CPU header - * - * Copyright (c) 2003 Fabrice Bellard - * - * Copyright (c) 2007 Intel Corporation - * Zhang xiantao <xiantao.zhang@xxxxxxxxx> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#ifndef CPU_IA64_H -#define CPU_IA64_H -#include "config.h" -#include "ia64intrin.h" - -#include<string.h> - -#define TARGET_LONG_BITS 64 - -#define TARGET_PAGE_BITS 16 - -#define ELF_MACHINE EM_IA_64 - -#define NB_MMU_MODES 2 -#define CPU_PAL_HALT 1 -#define HF_HALTED_MASK (1 << CPU_PAL_HALT) - -#include "cpu-defs.h" - -#include "softfloat.h" - -#define CPUState struct CPUIA64State - -typedef struct CPUIA64State { - CPU_COMMON; - uint32_t hflags; - int mp_state; -} CPUIA64State; - -#define cpu_gen_code cpu_ia64_gen_code -#define cpu_init cpu_ia64_init -#define cpu_signal_handler cpu_ia64_signal_handler - -extern struct CPUIA64State *env; -int cpu_get_pic_interrupt(CPUIA64State *s); -int cpu_exec(CPUState *env1); -CPUState *cpu_ia64_init(const char * cpu_model); - -static inline int cpu_mmu_index (CPUState *env) -{ - return 0; -} - -#define CPU_PC_FROM_TB(env, tb) do{}while(0) - -#include "cpu-all.h" - -/* - * These ones really should go to the appropriate tcg header file, if/when - * tcg support is added for ia64. - */ -void tcg_dump_info(FILE *f, - int (*cpu_fprintf)(FILE *f, const char *fmt, ...)); - -static inline void cpu_get_tb_cpu_state(CPUState *env, target_ulong *pc, - target_ulong *cs_base, int *flags) -{ - *pc = 0; - *cs_base = 0; - *flags = 0; -} - -#endif diff --git a/target-ia64/exec.h b/target-ia64/exec.h deleted file mode 100644 index 060d9c3..0000000 --- a/target-ia64/exec.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * IA64 execution defines - * - * Copyright (c) 2003 Fabrice Bellard - * Copyright (c) 2007 Intel Corporation - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#ifndef __IA64_H__ -#define __IA64_H__ - -//#include "dyngen-exec.h" -#include "config.h" - -#include "dyngen-exec.h" - -#include "cpu.h" -#include "exec-all.h" - -#define tcg_qemu_tb_exec(tb_ptr) 0 - -register struct CPUIA64State *env asm(AREG0); - -static inline void env_to_regs(void) -{ -} - -static inline void regs_to_env(void) -{ -} - -void do_interrupt (CPUState *env); - -void cpu_lock(void); -void cpu_unlock(void); - -static inline int cpu_halted(CPUState *env) { - /* handle exit of HALTED state */ - if (!(env->hflags & HF_HALTED_MASK)) - return 0; - return EXCP_HALTED; -} - -static inline int cpu_has_work(CPUState *env) -{ - return (env->interrupt_request & (CPU_INTERRUPT_HARD)); -} - -#endif diff --git a/target-ia64/fake-exec.c b/target-ia64/fake-exec.c deleted file mode 100644 index 8d6ded0..0000000 --- a/target-ia64/fake-exec.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * fake-exec.c for ia64. - * - * This is a file for stub functions so that compilation is possible - * when TCG CPU emulation is disabled during compilation. - * - * Copyright 2007 IBM Corporation. - * Added by & Authors: - * Jerone Young <jyoung5@xxxxxxxxxx> - * - * Copyright 2008 Intel Corporation. - * Added by Xiantao Zhang <xiantao.zhang@xxxxxxxxx> - * - * This work is licensed under the GNU GPL licence version 2 or later. - * - */ -#include <stdio.h> - -#include "cpu.h" -#include "exec-all.h" - -int code_copy_enabled = 0; - -void cpu_gen_init(void) -{ -} - -unsigned long code_gen_max_block_size(void) -{ - return 32; -} - -int cpu_ia64_gen_code(CPUState *env, TranslationBlock *tb, int *gen_code_size_ptr) -{ - return 0; -} - -void tcg_dump_info(FILE *f, - int (*cpu_fprintf)(FILE *f, const char *fmt, ...)) -{ - return; -} - -int cpu_restore_state(TranslationBlock *tb, - CPUState *env, unsigned long searched_pc, - void *puc) - -{ - return 0; -} diff --git a/target-ia64/firmware.c b/target-ia64/firmware.c deleted file mode 100644 index 79f8464..0000000 --- a/target-ia64/firmware.c +++ /dev/null @@ -1,715 +0,0 @@ -/* - * firmware.c : Firmware build logic for ia64 platform. - * - * Ported from Xen 3.0 Source. - * Copyright (c) 2007, Intel Corporation. - * Zhang Xiantao <xiantao.zhang@xxxxxxxxx> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place - Suite 330, Boston, MA 02111-1307 USA. - */ - -#include <string.h> -#include <stdlib.h> -#include <stdio.h> -#include <zlib.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> - -#include "cpu.h" - -#include "firmware.h" - -#include "qemu-common.h" - -typedef struct { - unsigned long signature; - unsigned int type; - unsigned int length; -} HOB_GENERIC_HEADER; - -/* - * INFO HOB is the first data data in one HOB list - * it contains the control information of the HOB list - */ -typedef struct { - HOB_GENERIC_HEADER header; - unsigned long length; // current length of hob - unsigned long cur_pos; // current poisiton of hob - unsigned long buf_size; // size of hob buffer -} HOB_INFO; - -typedef struct{ - unsigned long start; - unsigned long size; -} hob_mem_t; - -typedef enum { - HOB_TYPE_INFO=0, - HOB_TYPE_TERMINAL, - HOB_TYPE_MEM, - HOB_TYPE_PAL_BUS_GET_FEATURES_DATA, - HOB_TYPE_PAL_CACHE_SUMMARY, - HOB_TYPE_PAL_MEM_ATTRIB, - HOB_TYPE_PAL_CACHE_INFO, - HOB_TYPE_PAL_CACHE_PROT_INFO, - HOB_TYPE_PAL_DEBUG_INFO, - HOB_TYPE_PAL_FIXED_ADDR, - HOB_TYPE_PAL_FREQ_BASE, - HOB_TYPE_PAL_FREQ_RATIOS, - HOB_TYPE_PAL_HALT_INFO, - HOB_TYPE_PAL_PERF_MON_INFO, - HOB_TYPE_PAL_PROC_GET_FEATURES, - HOB_TYPE_PAL_PTCE_INFO, - HOB_TYPE_PAL_REGISTER_INFO, - HOB_TYPE_PAL_RSE_INFO, - HOB_TYPE_PAL_TEST_INFO, - HOB_TYPE_PAL_VM_SUMMARY, - HOB_TYPE_PAL_VM_INFO, - HOB_TYPE_PAL_VM_PAGE_SIZE, - HOB_TYPE_NR_VCPU, - HOB_TYPE_NR_NVRAM, - HOB_TYPE_MAX -} hob_type_t; - -static int hob_init(void *buffer ,unsigned long buf_size); -static int add_pal_hob(void* hob_buf); -static int add_mem_hob(void* hob_buf, unsigned long dom_mem_size); -static int add_vcpus_hob(void* hob_buf, unsigned long nr_vcpu); -static int add_nvram_hob(void *hob_buf, unsigned long nvram_addr); -static int build_hob(void *hob_buf, unsigned long hob_buf_size, - unsigned long dom_mem_size, unsigned long vcpus, - unsigned long nvram_addr); -static int load_hob(void *hob_buf, unsigned long dom_mem_size); - -int -kvm_ia64_build_hob(unsigned long memsize, unsigned long vcpus, - unsigned long nvram_addr) -{ - char *hob_buf; - - hob_buf = malloc(GFW_HOB_SIZE); - if (hob_buf == NULL) { - Hob_Output("Hob: Could not allocate hob"); - return -1; - } - - if (build_hob(hob_buf, GFW_HOB_SIZE, memsize, vcpus, nvram_addr) < 0) { - free(hob_buf); - Hob_Output("Could not build hob"); - return -1; - } - - if (load_hob(hob_buf, memsize) < 0) { - free(hob_buf); - Hob_Output("Could not load hob"); - return -1; - } - free(hob_buf); - - return 0; -} - -static int -hob_init(void *buffer, unsigned long buf_size) -{ - HOB_INFO *phit; - HOB_GENERIC_HEADER *terminal; - - if (sizeof(HOB_INFO) + sizeof(HOB_GENERIC_HEADER) > buf_size) { - // buffer too small - return -1; - } - - phit = (HOB_INFO*)buffer; - phit->header.signature = HOB_SIGNATURE; - phit->header.type = HOB_TYPE_INFO; - phit->header.length = sizeof(HOB_INFO); - phit->length = sizeof(HOB_INFO) + sizeof(HOB_GENERIC_HEADER); - phit->cur_pos = 0; - phit->buf_size = buf_size; - - terminal = (HOB_GENERIC_HEADER*)(buffer + sizeof(HOB_INFO)); - terminal->signature = HOB_SIGNATURE; - terminal->type = HOB_TYPE_TERMINAL; - terminal->length = sizeof(HOB_GENERIC_HEADER); - - return 0; -} - -/* - * Add a new HOB to the HOB List. - * - * hob_start - start address of hob buffer - * type - type of the hob to be added - * data - data of the hob to be added - * data_size - size of the data - */ -static int -hob_add(void* hob_start, int type, void* data, int data_size) -{ - HOB_INFO *phit; - HOB_GENERIC_HEADER *newhob, *tail; - - phit = (HOB_INFO*)hob_start; - - if (phit->length + data_size > phit->buf_size) { - // no space for new hob - return -1; - } - - //append new HOB - newhob = (HOB_GENERIC_HEADER*)(hob_start + phit->length - - sizeof(HOB_GENERIC_HEADER)); - newhob->signature = HOB_SIGNATURE; - newhob->type = type; - newhob->length = data_size + sizeof(HOB_GENERIC_HEADER); - memcpy((void*)newhob + sizeof(HOB_GENERIC_HEADER), data, data_size); - - // append terminal HOB - tail = (HOB_GENERIC_HEADER*)(hob_start + phit->length + data_size); - tail->signature = HOB_SIGNATURE; - tail->type = HOB_TYPE_TERMINAL; - tail->length = sizeof(HOB_GENERIC_HEADER); - - // adjust HOB list length - phit->length += sizeof(HOB_GENERIC_HEADER) + data_size; - - return 0; -} - -static int -get_hob_size(void* hob_buf) -{ - HOB_INFO *phit = (HOB_INFO*)hob_buf; - - if (phit->header.signature != HOB_SIGNATURE) { - Hob_Output("xc_get_hob_size:Incorrect signature"); - return -1; - } - return phit->length; -} - -static int -add_max_hob_entry(void* hob_buf) -{ - long max_hob = 0; - return hob_add(hob_buf, HOB_TYPE_MAX, &max_hob, sizeof(long)); -} - -static int -build_hob(void* hob_buf, unsigned long hob_buf_size, - unsigned long dom_mem_size, unsigned long vcpus, - unsigned long nvram_addr) -{ - //Init HOB List - if (hob_init(hob_buf, hob_buf_size) < 0) { - Hob_Output("buffer too small"); - goto err_out; - } - - if (add_mem_hob(hob_buf,dom_mem_size) < 0) { - Hob_Output("Add memory hob failed, buffer too small"); - goto err_out; - } - - if (add_vcpus_hob(hob_buf, vcpus) < 0) { - Hob_Output("Add NR_VCPU hob failed, buffer too small"); - goto err_out; - } - - if (add_pal_hob(hob_buf) < 0) { - Hob_Output("Add PAL hob failed, buffer too small"); - goto err_out; - } - - if (add_nvram_hob(hob_buf, nvram_addr) < 0) { - Hob_Output("Add nvram hob failed, buffer too small"); - goto err_out; - } - - if (add_max_hob_entry(hob_buf) < 0) { - Hob_Output("Add max hob entry failed, buffer too small"); - goto err_out; - } - return 0; - -err_out: - return -1; -} -static int -load_hob(void *hob_buf, unsigned long dom_mem_size) -{ - int hob_size; - - hob_size = get_hob_size(hob_buf); - if (hob_size < 0) { - Hob_Output("Invalid hob data"); - return -1; - } - - if (hob_size > GFW_HOB_SIZE) { - Hob_Output("No enough memory for hob data"); - return -1; - } - - cpu_physical_memory_write(GFW_HOB_START, hob_buf, hob_size); - - return 0; -} - -static int -add_mem_hob(void* hob_buf, unsigned long dom_mem_size) -{ - hob_mem_t memhob; - - // less than 3G - memhob.start = 0; - memhob.size = MIN(dom_mem_size, 0xC0000000); - - if (hob_add(hob_buf, HOB_TYPE_MEM, &memhob, sizeof(memhob)) < 0) - return -1; - - if (dom_mem_size > 0xC0000000) { - // 4G ~ 4G+remain - memhob.start = 0x100000000; //4G - memhob.size = dom_mem_size - 0xC0000000; - if (hob_add(hob_buf, HOB_TYPE_MEM, &memhob, sizeof(memhob)) < 0) - return -1; - } - return 0; -} - -static int -add_vcpus_hob(void* hob_buf, unsigned long vcpus) -{ - return hob_add(hob_buf, HOB_TYPE_NR_VCPU, &vcpus, sizeof(vcpus)); -} - -static int -add_nvram_hob(void *hob_buf, unsigned long nvram_addr) -{ - return hob_add(hob_buf, HOB_TYPE_NR_NVRAM, - &nvram_addr, sizeof(nvram_addr)); -} - -static const unsigned char config_pal_bus_get_features_data[24] = { - 0, 0, 0, 32, 0, 0, 240, 189, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -static const unsigned char config_pal_cache_summary[16] = { - 3, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0 -}; - -static const unsigned char config_pal_mem_attrib[8] = { - 241, 0, 0, 0, 0, 0, 0, 0 -}; - -static const unsigned char config_pal_cache_info[152] = { - 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 6, 4, 6, 7, 255, 1, 0, 1, 0, 64, 0, 0, 12, 12, - 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 6, 7, 0, 1, - 0, 1, 0, 64, 0, 0, 12, 12, 49, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 6, 8, 7, 7, 255, 7, 0, 11, 0, 0, 16, 0, - 12, 17, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 8, 7, - 7, 7, 5, 9, 11, 0, 0, 4, 0, 12, 15, 49, 0, 254, 255, - 255, 255, 255, 255, 255, 255, 2, 8, 7, 7, 7, 5, 9, - 11, 0, 0, 4, 0, 12, 15, 49, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 3, 12, 7, 7, 7, 14, 1, 3, 0, 0, 192, 0, 12, 20, 49, 0 -}; - -static const unsigned char config_pal_cache_prot_info[200] = { - 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 45, 0, 16, 8, 0, 76, 12, 64, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 8, 0, 16, 4, 0, 76, 44, 68, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, - 0, 16, 8, 0, 81, 44, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, - 112, 12, 0, 79, 124, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 254, 255, 255, 255, 255, 255, 255, 255, - 32, 0, 112, 12, 0, 79, 124, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 160, - 12, 0, 84, 124, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0 -}; - -static const unsigned char config_pal_debug_info[16] = { - 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0 -}; - -static const unsigned char config_pal_fixed_addr[8] = { - 0, 0, 0, 0, 0, 0, 0, 0 -}; - -static const unsigned char config_pal_freq_base[8] = { - 109, 219, 182, 13, 0, 0, 0, 0 -}; - -static const unsigned char config_pal_freq_ratios[24] = { - 11, 1, 0, 0, 77, 7, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 4, - 0, 0, 0, 7, 0, 0, 0 -}; - -static const unsigned char config_pal_halt_info[64] = { - 0, 0, 0, 0, 0, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -static const unsigned char config_pal_perf_mon_info[136] = { - 12, 47, 18, 8, 0, 0, 0, 0, 241, 255, 0, 0, 255, 7, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 241, 255, 0, 0, 223, 0, 255, 255, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 240, 255, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 240, 255, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 -}; - -static const unsigned char config_pal_proc_get_features[104] = { - 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 64, 6, 64, 49, 0, 0, 0, 0, 64, 6, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, - 231, 0, 0, 0, 0, 0, 0, 0, 228, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, - 63, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 -}; - -static const unsigned char config_pal_ptce_info[24] = { - 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 -}; - -static const unsigned char config_pal_register_info[64] = { - 255, 0, 47, 127, 17, 17, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, - 255, 208, 128, 238, 238, 0, 0, 248, 255, 255, 255, 255, 255, 0, 0, 7, 3, - 251, 3, 0, 0, 0, 0, 255, 7, 3, 0, 0, 0, 0, 0, 248, 252, 4, - 252, 255, 255, 255, 255, 2, 248, 252, 255, 255, 255, 255, 255 -}; - -static const unsigned char config_pal_rse_info[16] = { - 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -static const unsigned char config_pal_test_info[48] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -static const unsigned char config_pal_vm_summary[16] = { - 101, 18, 15, 2, 7, 7, 4, 2, 59, 18, 0, 0, 0, 0, 0, 0 -}; - -static const unsigned char config_pal_vm_info[104] = { - 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 32, 32, 0, 0, 0, 0, 0, 0, 112, 85, 21, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 32, 32, 0, 0, 0, 0, 0, 0, 112, 85, - 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 128, 128, 0, - 4, 0, 0, 0, 0, 112, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 128, 128, 0, 4, 0, 0, 0, 0, 112, 85, 0, 0, 0, 0, 0 -}; - -static const unsigned char config_pal_vm_page_size[16] = { - 0, 112, 85, 21, 0, 0, 0, 0, 0, 112, 85, 21, 0, 0, 0, 0 -}; - -typedef struct{ - hob_type_t type; - void* data; - unsigned long size; -} hob_batch_t; - -static const hob_batch_t hob_batch[]={ - { HOB_TYPE_PAL_BUS_GET_FEATURES_DATA, - &config_pal_bus_get_features_data, - sizeof(config_pal_bus_get_features_data) - }, - { HOB_TYPE_PAL_CACHE_SUMMARY, - &config_pal_cache_summary, - sizeof(config_pal_cache_summary) - }, - { HOB_TYPE_PAL_MEM_ATTRIB, - &config_pal_mem_attrib, - sizeof(config_pal_mem_attrib) - }, - { HOB_TYPE_PAL_CACHE_INFO, - &config_pal_cache_info, - sizeof(config_pal_cache_info) - }, - { HOB_TYPE_PAL_CACHE_PROT_INFO, - &config_pal_cache_prot_info, - sizeof(config_pal_cache_prot_info) - }, - { HOB_TYPE_PAL_DEBUG_INFO, - &config_pal_debug_info, - sizeof(config_pal_debug_info) - }, - { HOB_TYPE_PAL_FIXED_ADDR, - &config_pal_fixed_addr, - sizeof(config_pal_fixed_addr) - }, - { HOB_TYPE_PAL_FREQ_BASE, - &config_pal_freq_base, - sizeof(config_pal_freq_base) - }, - { HOB_TYPE_PAL_FREQ_RATIOS, - &config_pal_freq_ratios, - sizeof(config_pal_freq_ratios) - }, - { HOB_TYPE_PAL_HALT_INFO, - &config_pal_halt_info, - sizeof(config_pal_halt_info) - }, - { HOB_TYPE_PAL_PERF_MON_INFO, - &config_pal_perf_mon_info, - sizeof(config_pal_perf_mon_info) - }, - { HOB_TYPE_PAL_PROC_GET_FEATURES, - &config_pal_proc_get_features, - sizeof(config_pal_proc_get_features) - }, - { HOB_TYPE_PAL_PTCE_INFO, - &config_pal_ptce_info, - sizeof(config_pal_ptce_info) - }, - { HOB_TYPE_PAL_REGISTER_INFO, - &config_pal_register_info, - sizeof(config_pal_register_info) - }, - { HOB_TYPE_PAL_RSE_INFO, - &config_pal_rse_info, - sizeof(config_pal_rse_info) - }, - { HOB_TYPE_PAL_TEST_INFO, - &config_pal_test_info, - sizeof(config_pal_test_info) - }, - { HOB_TYPE_PAL_VM_SUMMARY, - &config_pal_vm_summary, - sizeof(config_pal_vm_summary) - }, - { HOB_TYPE_PAL_VM_INFO, - &config_pal_vm_info, - sizeof(config_pal_vm_info) - }, - { HOB_TYPE_PAL_VM_PAGE_SIZE, - &config_pal_vm_page_size, - sizeof(config_pal_vm_page_size) - }, -}; - -static int -add_pal_hob(void* hob_buf) -{ - int i; - for (i = 0; i < sizeof(hob_batch)/sizeof(hob_batch_t); i++) { - if (hob_add(hob_buf, hob_batch[i].type, hob_batch[i].data, - hob_batch[i].size) < 0) - return -1; - } - return 0; -} - -uint8_t *read_image(const char *filename, unsigned long *size) -{ - int kernel_fd = -1; - gzFile kernel_gfd = NULL; - uint8_t *image = NULL, *tmp; - unsigned int bytes; - - if ((filename == NULL) || (size == NULL)) - return NULL; - - kernel_fd = open(filename, O_RDONLY); - if (kernel_fd < 0) { - Hob_Output("Could not open kernel image\n"); - goto out_1; - } - - if ((kernel_gfd = gzdopen(kernel_fd, "rb")) == NULL) { - Hob_Output("Could not allocate decompression state for state file\n"); - goto out_1; - } - - *size = 0; - -#define CHUNK 1*1024*1024 - while(1) - { - if ((tmp = realloc(image, *size + CHUNK)) == NULL) { - Hob_Output("Could not allocate memory for kernel image"); - free(image); - image = NULL; - goto out; - } - image = tmp; - - bytes = gzread(kernel_gfd, image + *size, CHUNK); - switch (bytes) { - case -1: - Hob_Output("Error reading kernel image"); - free(image); - image = NULL; - goto out; - case 0: /* EOF */ - goto out; - default: - *size += bytes; - break; - } - } -#undef CHUNK - -out: - if (*size == 0) { - Hob_Output("Could not read kernel image"); - free(image); - image = NULL; - } else if (image) { - /* Shrink allocation to fit image. */ - tmp = realloc(image, *size); - if (tmp) - image = tmp; - } - - if (kernel_gfd != NULL) - gzclose(kernel_gfd); - else if (kernel_fd >= 0) - close(kernel_fd); - return image; - -out_1: - return NULL; -} - -int kvm_ia64_nvram_init(unsigned long type) -{ - unsigned long nvram_fd; - char nvram_path[PATH_MAX]; - unsigned long i; - - if (nvram) { - if (strlen(nvram) > PATH_MAX) { - goto out; - } - if (type == READ_FROM_NVRAM) { - if (access(nvram, R_OK | W_OK | X_OK) == -1) - goto out; - nvram_fd = open(nvram, O_RDONLY); - return nvram_fd; - } - else { /* write from gfw to nvram file */ - i = access(nvram, R_OK | W_OK | X_OK); - if ((i == -1) && (errno != ENOENT)) - goto out; - nvram_fd = open(nvram, O_CREAT|O_RDWR, 0777); - return nvram_fd; - } - } - else { - strcpy(nvram_path, "nvram.dat"); - if (type == READ_FROM_NVRAM) { - if (access(nvram_path, R_OK | W_OK | X_OK) == -1) - goto out; - nvram_fd = open(nvram_path, O_RDONLY); - return nvram_fd; - } - else { /* write from gfw to nvram file */ - i = access(nvram_path, R_OK | W_OK | X_OK); - if ((i == -1) && (errno != ENOENT)) - goto out; - nvram_fd = open(nvram_path, O_CREAT|O_RDWR, 0777); - return nvram_fd; - } - } -out: - return -1; -} - -int -kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd) -{ - struct stat file_stat; - uint8_t *nvram_buf; - int r = 0; - - nvram_buf = malloc(NVRAM_SIZE); - - if ((fstat(nvram_fd, &file_stat) < 0) || - (NVRAM_SIZE != file_stat.st_size) || - (read(nvram_fd, nvram_buf, NVRAM_SIZE) != NVRAM_SIZE)) { - r = -1; - goto out; - } - - cpu_physical_memory_write(NVRAM_START, nvram_buf, NVRAM_SIZE); - - out: - free(nvram_buf); - return r; -} - -int -kvm_ia64_copy_from_GFW_to_nvram() -{ - struct nvram_save_addr nvram_addr_buf; - uint8_t *nvram_buf; - unsigned long nvram_fd; - unsigned long type = WRITE_TO_NVRAM; - int ret = -1; - - nvram_buf = malloc(NVRAM_SIZE); - if (!nvram_buf) - goto out_free; - - cpu_physical_memory_read(NVRAM_START, (uint8_t *)&nvram_addr_buf, - sizeof(struct nvram_save_addr)); - if (nvram_addr_buf.signature != NVRAM_VALID_SIG) { - goto out_free; - } - - cpu_physical_memory_read(nvram_addr_buf.addr, nvram_buf, NVRAM_SIZE); - - nvram_fd = kvm_ia64_nvram_init(type); - if (nvram_fd == -1) - goto out; - - lseek(nvram_fd, 0, SEEK_SET); - if (write(nvram_fd, nvram_buf, NVRAM_SIZE) != NVRAM_SIZE) - goto out; - - ret = 0; - out: - close(nvram_fd); - out_free: - free(nvram_buf); - return ret; -} - -/* - * Local variables: - * mode: C - * c-set-style: "BSD" - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */ diff --git a/target-ia64/firmware.h b/target-ia64/firmware.h deleted file mode 100644 index a47db67..0000000 --- a/target-ia64/firmware.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * firmwar.h: Firmware build logic head file - * - * Copyright (c) 2007, Intel Corporation. - * Zhang Xiantao <xiantao.zhang@xxxxxxxxx> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place - Suite 330, Boston, MA 02111-1307 USA. - */ -#ifndef __FIRM_WARE_H -#define __FIRM_WARE_ -#include "cpu.h" - -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> - -#include <zlib.h> - -#define GFW_SIZE (16UL<<20) -#define GFW_START ((4UL<<30) - GFW_SIZE) - -#define HOB_SIGNATURE 0x3436474953424f48 // "HOBSIG64" -#define GFW_HOB_START ((4UL<<30) - (14UL<<20)) // 4G - 14M -#define GFW_HOB_SIZE (1UL<<20) // 1M -#define HOB_OFFSET (GFW_HOB_START-GFW_START) - -#define Hob_Output(s) fprintf(stderr, s) - -#define NVRAM_START (GFW_START + NVRAM_OFFSET) -#define NVRAM_OFFSET (10 * (1UL << 20)) -#define NVRAM_SIZE (64 * (1UL << 10)) -#define NVRAM_VALID_SIG 0x4650494e45584948 /* "HIXENIPF" */ -#define VALIDATE_NVRAM_FD(x) ((1UL<<(sizeof(x)*8 - 1)) | x) -#define IS_VALID_NVRAM_FD(x) ((uint64_t)x >> (sizeof(x)*8 - 1)) -#define READ_FROM_NVRAM 0 -#define WRITE_TO_NVRAM 1 - -struct nvram_save_addr { - unsigned long addr; - unsigned long signature; -}; - -extern const char *nvram; -extern int kvm_ia64_build_hob(unsigned long memsize, unsigned long vcpus, - unsigned long nvram_addr); -extern uint8_t *read_image(const char *filename, unsigned long *size); - -extern int kvm_ia64_copy_from_GFW_to_nvram(void); -extern int kvm_ia64_nvram_init(unsigned long type); -extern int kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd); -#endif //__FIRM_WARE_ diff --git a/target-ia64/helper.c b/target-ia64/helper.c deleted file mode 100644 index 4a94dca..0000000 --- a/target-ia64/helper.c +++ /dev/null @@ -1,5 +0,0 @@ - -/* - * IA64 emulation helpers for qemu. (Leave it as blank now.) - * - */ diff --git a/target-ia64/libkvm.c b/target-ia64/libkvm.c deleted file mode 100644 index bf9dded..0000000 --- a/target-ia64/libkvm.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * libkvm-ia64.c :Kernel-based Virtual Machine control library for ia64. - * - * This library provides an API to control the kvm hardware virtualization - * module. - * - * Copyright (C) 2006 Qumranet - * - * Authors: - * - * Avi Kivity <avi@xxxxxxxxxxxx> - * Yaniv Kamay <yaniv@xxxxxxxxxxxx> - * - * Copyright (C) 2007 Intel - * Added by : Zhang Xiantao <xiantao.zhang@xxxxxxxxx> - * - * This work is licensed under the GNU LGPL license, version 2. - * - */ - -#include "libkvm-all.h" -#include "libkvm.h" -#include <errno.h> -#include <sys/ioctl.h> -#include <string.h> -#include <unistd.h> -#include <stropts.h> -#include <sys/mman.h> -#include <stdio.h> -#include <errno.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <stdlib.h> - -int kvm_arch_create(kvm_context_t kvm, unsigned long phys_mem_bytes, - void **vm_mem) -{ - int r; - - r = kvm_init_coalesced_mmio(kvm); - if (r < 0) - return r; - - return 0; -} - -int kvm_arch_run(kvm_vcpu_context_t vcpu) -{ - int r = 0; - - switch (vcpu->run->exit_reason) { - default: - r = 1; - break; - } - - return r; -} - -void kvm_show_code(kvm_vcpu_context_t vcpu) -{ - fprintf(stderr, "kvm_show_code not supported yet!\n"); -} - -void kvm_show_regs(kvm_vcpu_context_t vcpu) -{ - fprintf(stderr,"kvm_show_regs not supportted today!\n"); -} - -int kvm_create_memory_alias(kvm_context_t kvm, - uint64_t phys_start, - uint64_t len, - uint64_t target_phys) -{ - return 0; -} - -int kvm_destroy_memory_alias(kvm_context_t kvm, uint64_t phys_start) -{ - return 0; -} diff --git a/target-ia64/libkvm.h b/target-ia64/libkvm.h deleted file mode 100644 index 417f7f1..0000000 --- a/target-ia64/libkvm.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * This header is for functions & variables that will ONLY be - * used inside libkvm for x86. - * THESE ARE NOT EXPOSED TO THE USER AND ARE ONLY FOR USE - * WITHIN LIBKVM. - * - * derived from libkvm.c - * - * Copyright (C) 2006 Qumranet, Inc. - * - * Authors: - * Avi Kivity <avi@xxxxxxxxxxxx> - * Yaniv Kamay <yaniv@xxxxxxxxxxxx> - * - * This work is licensed under the GNU LGPL license, version 2. - */ - -#ifndef KVM_IA64_H -#define KVM_IA64_H - -#include "libkvm-all.h" - -extern int kvm_page_size; - -#define PAGE_SIZE kvm_page_size -#define PAGE_MASK (~(kvm_page_size - 1)) - -#define ia64_mf() asm volatile ("mf" ::: "memory") -#define smp_wmb() ia64_mf() - -#endif diff --git a/target-ia64/machine.c b/target-ia64/machine.c deleted file mode 100644 index 8cf5bdd..0000000 --- a/target-ia64/machine.c +++ /dev/null @@ -1,36 +0,0 @@ -#include "hw/hw.h" -#include "hw/boards.h" - -#include "exec-all.h" -#include "qemu-kvm.h" - -void kvm_arch_save_mpstate(CPUState *env); -void kvm_arch_load_mpstate(CPUState *env); - -void cpu_save(QEMUFile *f, void *opaque) -{ - CPUState *env = opaque; - - if (kvm_enabled()) { - kvm_arch_save_mpstate(env); - } -} - -int cpu_load(QEMUFile *f, void *opaque, int version_id) -{ - CPUState *env = opaque; - - if (kvm_enabled()) { - kvm_arch_load_mpstate(env); - } - return 0; -} - -extern QEMUMachine ipf_machine; - -static void ipf_machine_init(void) -{ - qemu_register_machine(&ipf_machine); -} - -machine_init(ipf_machine_init); diff --git a/target-ia64/op.c b/target-ia64/op.c deleted file mode 100644 index f7301c6..0000000 --- a/target-ia64/op.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * IA64 micro operations - * - * Leave it blank for future implementation - * - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - diff --git a/target-ia64/op_helper.c b/target-ia64/op_helper.c deleted file mode 100644 index d51525a..0000000 --- a/target-ia64/op_helper.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * op_helper.c: IA64 emulation cpu micro-operations helpers for qemu. - * - * Copyright (c) 2007 Intel Corporation - * Zhang Xiantao <xiantao.zhang@xxxxxxxxx> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place - Suite 330, Boston, MA 02111-1307 USA. - */ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "cpu.h" -#include "exec-all.h" - -#include "qemu-kvm.h" -#include "qemu-common.h" - -void cpu_ia64_set_model(CPUIA64State *env, uint32_t id); -void cpu_ia64_close(CPUIA64State *env); -void switch_mode(CPUState *env, int mode); -void do_interrupt(CPUIA64State *env); -int cpu_ia64_handle_mmu_fault (CPUState *env, target_ulong address, - int access_type, int is_user, int is_softmmu); -CPUState *cpu_ia64_init(const char *cpu_model) -{ - CPUState *env; - env = qemu_mallocz(sizeof(CPUState)); - if (!env) - return NULL; - cpu_exec_init(env); - cpu_reset(env); - if (kvm_enabled()) { - kvm_qemu_init_env(env); - kvm_init_vcpu(env); - } - return env; -} - -void cpu_reset(CPUIA64State *env) -{ -} - -static inline void set_feature(CPUIA64State *env, int feature) -{ -} - -void cpu_ia64_set_model(CPUIA64State *env, uint32_t id) -{ -} - -void cpu_ia64_close(CPUIA64State *env) -{ - free(env); -} - -extern int semihosting_enabled; - -void switch_mode(CPUState *env, int mode) -{ -} - -/* Handle a CPU exception. */ -void do_interrupt(CPUIA64State *env) -{ - if (kvm_enabled()) { - printf("%s: unexpect\n", __FUNCTION__); - exit(-1); - } -} - -int cpu_ia64_handle_mmu_fault (CPUState *env, target_ulong address, - int access_type, int is_user, int is_softmmu) -{ - return 1; -} - -target_ulong cpu_get_phys_page_debug(CPUState *env, target_ulong addr) -{ - return -1; -} - -void cpu_dump_state(CPUState *env, FILE *f, - int (*cpu_fprintf)(FILE *f, const char *fmt, ...), - int flags) -{ - return; -} - -void tlb_fill (target_ulong addr, int is_write, int is_user, void *retaddr) -{ - return; -} diff --git a/target-ia64/translate.c b/target-ia64/translate.c deleted file mode 100644 index 86f48f5..0000000 --- a/target-ia64/translate.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * translation.c : IA64 translation code. - * Just put it as blank now, and implement it later. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#include <stdarg.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <inttypes.h> - -static uint16_t *gen_opc_ptr; - -#include "cpu.h" -#include "exec-all.h" -#include "disas.h" -#include "gen-op.h" - -int gen_intermediate_code(CPUState *env, TranslationBlock *tb) -{ - return 0; -} -int gen_intermediate_code_pc(CPUState *env, TranslationBlock *tb) -{ - return 0; -} diff --git a/vl.c b/vl.c index 569a9a1..b0358e9 100644 --- a/vl.c +++ b/vl.c @@ -229,7 +229,6 @@ int alt_grab = 0; int ctrl_grab = 0; unsigned int nb_prom_envs = 0; const char *prom_envs[MAX_PROM_ENVS]; -const char *nvram = NULL; int boot_menu; uint8_t *boot_splash_filedata; int boot_splash_filedata_size; @@ -3117,11 +3116,6 @@ int main(int argc, char **argv, char **envp) default_cdrom = 0; default_sdcard = 0; break; -#ifndef _WIN32 - case QEMU_OPTION_nvram: - nvram = optarg; - break; -#endif case QEMU_OPTION_xen_domid: if (!(xen_available())) { printf("Option %s not supported for this target\n", popt->name); -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html