X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fdevices%2Fcdrom.c;h=40ed98cba3643730ddf0fc6483eb2467579247b3;hb=c2e660b41f69c603b0c47f7c7572a22a2f601a51;hp=e77c280d3d3de17ec8514b3b3758e51c7f31b937;hpb=6593ee3c311ec87304c7bed52a9e6034338679fb;p=palacios.releases.git diff --git a/palacios/src/devices/cdrom.c b/palacios/src/devices/cdrom.c index e77c280..40ed98c 100644 --- a/palacios/src/devices/cdrom.c +++ b/palacios/src/devices/cdrom.c @@ -18,6 +18,8 @@ * redistribute, and modify it as specified in the file "V3VEE_LICENSE". */ + + #include #include #include @@ -31,7 +33,7 @@ struct cdrom_state { uchar_t * image_addr; //memory address - ulong_t capacity_B; + ulong_t capacity_in_bytes; ulong_t head; //current position struct vm_device * ide_dev; @@ -64,6 +66,7 @@ static void cdrom_eject(void * private_data) { */ 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; } @@ -74,15 +77,15 @@ static rd_bool cdrom_read_toc(void * private_data, uint8_t* buf, int* length, rd static uint32_t cdrom_capacity(void * private_data) { struct cdrom_state * cdrom = (struct cdrom_state *)private_data; - PrintDebug("[cdrom_capacity] s_ramdiskSize = %d\n", cdrom->capacity_B); + PrintDebug("[cdrom_capacity] s_ramdiskSize = %d\n", cdrom->capacity_in_bytes); if (cdrom->lba) { - if (cdrom->capacity_B % 2048) { - PrintDebug("\t\t capacity in LBA is %d\n", (cdrom->capacity_B / 2048) + 1); - return (cdrom->capacity_B / 2048) + 1; + if (cdrom->capacity_in_bytes % 2048) { + PrintDebug("\t\t capacity in LBA is %d\n", (cdrom->capacity_in_bytes / 2048) + 1); + return (cdrom->capacity_in_bytes / 2048) + 1; } else { - PrintDebug("\t\t capacity in LBA is %d\n", cdrom->capacity_B / 2048); - return cdrom->capacity_B / 2048; + PrintDebug("\t\t capacity in LBA is %d\n", cdrom->capacity_in_bytes / 2048); + return cdrom->capacity_in_bytes / 2048; } } else { PrintError("Unsupported CDROM mode in capacity query\n"); @@ -101,7 +104,7 @@ static void cdrom_read_block(void * private_data, uint8_t * buf, int lba)/* __at PrintDebug("[cdrom_read_block] lba = %d (cdrom_image_start=%x)\n", lba, cdrom->image_addr); memcpy(buf, (uchar_t *)(cdrom->image_addr + lba * 2048), 2048); - PrintDebug("Returning from read block\n"); + //PrintDebug("Returning from read block\n"); return; } @@ -166,7 +169,7 @@ struct vm_device * v3_create_cdrom(struct vm_device * ramdisk_dev, void * ramdi memset(cd, 0, sizeof(struct cdrom_state)); cd->image_addr = (uchar_t *)ramdisk; - cd->capacity_B = ramdisk_size; + cd->capacity_in_bytes = ramdisk_size; cd->ide_dev = ramdisk_dev; PrintDebug("Creating RamDISK CDROM\n");