From: Jack Lange Date: Mon, 6 Apr 2009 17:10:36 +0000 (-0500) Subject: getting things working again X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=2be845dc1d8fc407dab4254a8fac03395ffc1ec2 getting things working again --- diff --git a/palacios/src/devices/ramdisk.c b/misc/ramdisk.c similarity index 100% rename from palacios/src/devices/ramdisk.c rename to misc/ramdisk.c diff --git a/palacios/include/devices/ramdisk.h b/misc/ramdisk.h similarity index 100% rename from palacios/include/devices/ramdisk.h rename to misc/ramdisk.h diff --git a/palacios/include/devices/cdrom.h b/palacios/include/devices/cdrom.h deleted file mode 100644 index ea4d9c5..0000000 --- a/palacios/include/devices/cdrom.h +++ /dev/null @@ -1,78 +0,0 @@ - -/* - * This file is part of the Palacios Virtual Machine Monitor developed - * by the V3VEE Project with funding from the United States National - * Science Foundation and the Department of Energy. - * - * The V3VEE Project is a joint project between Northwestern University - * and the University of New Mexico. You can find out more at - * http://www.v3vee.org - * - * Copyright (c) 2008, Zheng Cui - * Copyright (c) 2008, The V3VEE Project - * All rights reserved. - * - * Author: Zheng Cui - * - * This is free software. You are permitted to use, - * redistribute, and modify it as specified in the file "V3VEE_LICENSE". - */ - -#ifndef __DEVICES_CDROM_H__ -#define __DEVICES_CDROM_H__ - - -#ifdef __V3VEE__ - -#include -#include -#include - - - - - -struct cdrom_ops { - /* - * Load CD-ROM. Returns false if CD is not ready. - */ - rd_bool (*insert_cdrom)(void * private_data); - - /* - * Logically eject the CD. - */ - void (*eject_cdrom)(void * private_data); - - /* - * Read CD TOC. Returns false if start track is out of bounds. - */ - rd_bool (*read_toc)(void * private_data, uchar_t * buf, int * length, rd_bool msf, int start_track); - - /* - * Return CD-ROM capacity (in 2048 byte frames) - */ - uint32_t (*capacity)(void * private_data); - - /* - * Read a single block from the CD - */ - void (*read_block)(void * private_data, uchar_t * buf, int lba); - - /* - * Start (spin up) the CD. - */ - int (*start_cdrom)(void * private_data); - - void (*set_LBA)(void * private_data, uchar_t lba); -}; - - - - -struct vm_device * v3_create_cdrom(struct vm_device * ramdisk_dev, void * ramdisk, uint_t ramdisk_size); - - - -#endif // !__V3VEE__ - -#endif diff --git a/palacios/src/devices/ata.h b/palacios/src/devices/ata.h index 7f79e8c..1e8df43 100644 --- a/palacios/src/devices/ata.h +++ b/palacios/src/devices/ata.h @@ -56,9 +56,10 @@ static void ata_identify_device(struct ide_drive * drive) { // 32 bits access drive_id->dword_io = 1; +#if 0 // enable DMA access drive_id->dma_enable = 1; - +#endif // enable LBA access drive_id->lba_enable = 1; @@ -68,11 +69,15 @@ static void ata_identify_device(struct ide_drive * drive) { // Drive Capacity (48 bit LBA) drive_id->lba_capacity_2 = drive->hd_ops->get_capacity(drive->private_data); +#if 0 // lower byte is the maximum multiple sector size... drive_id->rw_multiples = 0x8000 | MAX_MULT_SECTORS; +#endif +#if 0 // words 64-70, 54-58 valid drive_id->field_valid = 0x0007; // DMA + pkg cmd valid +#endif // copied from CFA540A drive_id->buf[63] = 0x0103; // variable (DMA stuff) @@ -90,10 +95,12 @@ static void ata_identify_device(struct ide_drive * drive) { // drive_id->buf[80] = 0x1e; // supports up to ATA/ATAPI-4 drive_id->major_rev_num = 0x0040; // supports up to ATA/ATAPI-6 +#if 0 drive_id->buf[83] |= 0x0400; // supports 48 bit LBA drive_id->dma_ultra = 0x2020; // Ultra_DMA_Mode_5_Selected | Ultra_DMA_Mode_5_Supported; +#endif } diff --git a/palacios/src/devices/cdrom.c b/palacios/src/devices/cdrom.c deleted file mode 100644 index 43dafd8..0000000 --- a/palacios/src/devices/cdrom.c +++ /dev/null @@ -1,180 +0,0 @@ -/* - * This file is part of the Palacios Virtual Machine Monitor developed - * by the V3VEE Project with funding from the United States National - * Science Foundation and the Department of Energy. - * - * The V3VEE Project is a joint project between Northwestern University - * and the University of New Mexico. You can find out more at - * http://www.v3vee.org - * - * Copyright (c) 2008, Zheng Cui - * Copyright (c) 2008, Jack Lange - * Copyright (c) 2008, The V3VEE Project - * All rights reserved. - * - * Author: Zheng Cui - * - * This is free software. You are permitted to use, - * redistribute, and modify it as specified in the file "V3VEE_LICENSE". - */ - - - -#include -#include -#include - -#ifndef DEBUG_RAMDISK -#undef PrintDebug -#define PrintDebug(fmt, args...) -#endif - - - -struct cdrom_state { - uchar_t * image_addr; //memory address - ulong_t capacity_in_bytes; - ulong_t head; //current position - - struct vm_device * ide_dev; - - uchar_t lba; -}; - - - - -/* - * Load CD-ROM. Returns false if CD is not ready. - */ - -static rd_bool cdrom_insert(void * private_data) { - PrintDebug("[cdrom_insert]\n"); - return 1; -} - -/* - * Logically eject the CD. - */ -static void cdrom_eject(void * private_data) { - PrintDebug("[cdrom_eject]\n"); - return; -} - -/* - * Read CD TOC. Returns false if start track is out of bounds. - */ -static rd_bool cdrom_read_toc(void * private_data, uint8_t* buf, int* length, rd_bool msf, int start_track) -{ - *length = 4; - PrintDebug("[cdrom_read_toc]\n"); - return 1; -} - -/* - * Return CD-ROM capacity (in 2048 byte frames) - */ -static uint32_t cdrom_capacity(void * private_data) { - struct cdrom_state * cdrom = (struct cdrom_state *)private_data; - - PrintDebug("[cdrom_capacity] s_ramdiskSize = %lu\n", cdrom->capacity_in_bytes); - - if (cdrom->lba) { - if (cdrom->capacity_in_bytes % 2048) { - PrintDebug("\t\t capacity in LBA is %lu\n", (cdrom->capacity_in_bytes / 2048) + 1); - return (cdrom->capacity_in_bytes / 2048) + 1; - } else { - PrintDebug("\t\t capacity in LBA is %lu\n", cdrom->capacity_in_bytes / 2048); - return cdrom->capacity_in_bytes / 2048; - } - } else { - PrintError("Unsupported CDROM mode in capacity query\n"); - //FIXME CHS mode - return 0; - } -} - -/* - * Read a single block from the CD - */ -static void cdrom_read_block(void * private_data, uint8_t * buf, int lba)/* __attribute__(regparm(2)); */ { - struct cdrom_state * cdrom = (struct cdrom_state *)private_data; - - V3_ASSERT(lba != 0); - - PrintDebug("[cdrom_read_block] lba = %d (cdrom_image_start=%p)\n", lba, (void*)cdrom->image_addr); - memcpy(buf, (uchar_t *)(cdrom->image_addr + lba * 2048), 2048); - //PrintDebug("Returning from read block\n"); - return; -} - -static void set_LBA(void * private_data, uchar_t lba) { - struct cdrom_state * cdrom = (struct cdrom_state *)private_data; - cdrom->lba = lba; -} - - -/* - * Start (spin up) the CD. - */ -static int cdrom_start(void * private_data) { - PrintDebug("[cdrom_start]\n"); - return 1; -} - - -static struct cdrom_ops cd_ops = { - .insert_cdrom = cdrom_insert, - .eject_cdrom = cdrom_eject, - .read_toc = cdrom_read_toc, - .capacity = cdrom_capacity, - .read_block = cdrom_read_block, - .start_cdrom = cdrom_start, - .set_LBA = set_LBA, -}; - - - - -static int cdrom_device_init(struct vm_device * dev) { - struct cdrom_state * cdrom = (struct cdrom_state *)dev->private_data; - PrintDebug("[cdrom_init]\n"); - PrintDebug("CDIMAGE located at: %p\n", (void *)cdrom->image_addr); - - //FIXME:lba - cdrom->lba = 1; - - v3_ramdisk_register_cdrom(cdrom->ide_dev, 1, 0, &cd_ops, cdrom); - - return 0; -} - - -static int cdrom_device_deinit(struct vm_device * dev) { - return 0; -} - -static struct vm_device_ops dev_ops = { - .init = cdrom_device_init, - .deinit = cdrom_device_deinit, - .reset = NULL, - .start = NULL, - .stop = NULL, -}; - -struct vm_device * v3_create_cdrom(struct vm_device * ramdisk_dev, void * ramdisk, uint_t ramdisk_size){ - struct cdrom_state * cd = (struct cdrom_state *)V3_Malloc(sizeof(struct cdrom_state)); - V3_ASSERT(cd != NULL); - - memset(cd, 0, sizeof(struct cdrom_state)); - - cd->image_addr = (uchar_t *)V3_VAddr(ramdisk); - cd->capacity_in_bytes = ramdisk_size; - cd->ide_dev = ramdisk_dev; - - PrintDebug("Creating RamDISK CDROM\n"); - - struct vm_device * cd_dev = v3_create_device("Ram Based CD", &dev_ops, cd); - - return cd_dev; -} diff --git a/palacios/src/devices/ide.c b/palacios/src/devices/ide.c index 1c48164..bf85ba1 100644 --- a/palacios/src/devices/ide.c +++ b/palacios/src/devices/ide.c @@ -24,6 +24,11 @@ #include "ide-types.h" #include "atapi-types.h" +#ifndef DEBUG_IDE +#undef PrintDebug +#define PrintDebug(fmt, args...) +#endif + #define PRI_DEFAULT_IRQ 14 #define SEC_DEFAULT_IRQ 15 diff --git a/palacios/src/palacios/svm_handler.c b/palacios/src/palacios/svm_handler.c index f4311cb..bddacf2 100644 --- a/palacios/src/palacios/svm_handler.c +++ b/palacios/src/palacios/svm_handler.c @@ -72,10 +72,6 @@ int v3_handle_svm_exit(struct guest_info * info) { if ((info->intr_state.irq_pending == 1) && (guest_ctrl->guest_ctrl.V_IRQ == 0)) { - // Interrupt was taken in the guest - if (exit_code == VMEXIT_EXCP14) { - PrintError("Page fault immeidately after interrupt injection (%d)\n", info->intr_state.irq_vector); - } #ifdef DEBUG_INTERRUPTS PrintDebug("Interrupt %d taken by guest\n", info->intr_state.irq_vector);