From: Alexandre Bique Date: Thu, 25 Jun 2009 16:02:35 +0000 (+0000) Subject: atapi-pass-through patch compiles X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=9d073fc5a49cb9fdc60664c5f19ed1f3ea89aada;p=xenclient%2Fioemu-pq.git atapi-pass-through patch compiles --- diff --git a/master/atapi-pass-through b/master/atapi-pass-through index a8c84ca..08dd3de 100644 --- a/master/atapi-pass-through +++ b/master/atapi-pass-through @@ -1,8 +1,8 @@ diff --git a/Makefile b/Makefile -index a06c9bf..8a91d28 100644 +index c395e77..f789785 100644 --- a/Makefile +++ b/Makefile -@@ -318,8 +318,9 @@ endif +@@ -264,8 +264,9 @@ endif test speed: all $(MAKE) -C tests $@ @@ -13,11 +13,37 @@ index a06c9bf..8a91d28 100644 cscope: rm -f ./cscope.* +diff --git a/block-raw-posix.c b/block-raw-posix.c +index 9a02d4f..775a1d1 100644 +--- a/block-raw-posix.c ++++ b/block-raw-posix.c +@@ -97,20 +97,7 @@ + reopen it to see if the disk has been changed */ + #define FD_OPEN_TIMEOUT 1000 + +-typedef struct BDRVRawState { +- int fd; +- int type; +- unsigned int lseek_err_cnt; +-#if defined(__linux__) +- /* linux floppy specific */ +- int fd_open_flags; +- int64_t fd_open_time; +- int64_t fd_error_time; +- int fd_got_error; +- int fd_media_changed; +-#endif +- uint8_t* aligned_buf; +-} BDRVRawState; ++#include "block/raw-posix.h" + + static int posix_aio_init(void); + diff --git a/block.c b/block.c -index aca5a6d..334e558 100644 +index 36f5eb9..ae71513 100644 --- a/block.c +++ b/block.c -@@ -876,6 +876,7 @@ void bdrv_set_type_hint(BlockDriverState *bs, int type) +@@ -939,6 +939,7 @@ void bdrv_set_type_hint(BlockDriverState *bs, int type) { bs->type = type; bs->removable = ((type == BDRV_TYPE_CDROM || @@ -26,10 +52,10 @@ index aca5a6d..334e558 100644 } diff --git a/block.h b/block.h -index 71e87fc..487eafb 100644 +index fc0afbb..6b1215a 100644 --- a/block.h +++ b/block.h -@@ -100,9 +100,11 @@ void bdrv_flush_all(void); +@@ -110,9 +110,11 @@ int bdrv_flush_all(void); int bdrv_is_allocated(BlockDriverState *bs, int64_t sector_num, int nb_sectors, int *pnum); @@ -44,35 +70,9 @@ index 71e87fc..487eafb 100644 #define BIOS_ATA_TRANSLATION_AUTO 0 #define BIOS_ATA_TRANSLATION_NONE 1 #define BIOS_ATA_TRANSLATION_LBA 2 -diff --git a/block-raw-posix.c b/block-raw-posix.c -index fa1a394..8f56654 100644 ---- a/block-raw-posix.c -+++ b/block-raw-posix.c -@@ -99,20 +99,7 @@ - reopen it to see if the disk has been changed */ - #define FD_OPEN_TIMEOUT 1000 - --typedef struct BDRVRawState { -- int fd; -- int type; -- unsigned int lseek_err_cnt; --#if defined(__linux__) -- /* linux floppy specific */ -- int fd_open_flags; -- int64_t fd_open_time; -- int64_t fd_error_time; -- int fd_got_error; -- int fd_media_changed; --#endif -- uint8_t* aligned_buf; --} BDRVRawState; -+#include "raw-posix.h" - - static int posix_aio_init(void); - diff --git a/block/raw-posix.h b/block/raw-posix.h new file mode 100644 -index 0000000..0d3bf85 +index 0000000..f9bdee9 --- /dev/null +++ b/block/raw-posix.h @@ -0,0 +1,19 @@ @@ -1066,7 +1066,7 @@ index 0000000..24358ac + } +} diff --git a/hw/ide.c b/hw/ide.c -index f3787f2..ee6a3aa 100644 +index e8d676e..fa75de7 100644 --- a/hw/ide.c +++ b/hw/ide.c @@ -22,6 +22,7 @@ @@ -1093,7 +1093,7 @@ index f3787f2..ee6a3aa 100644 /* debug IDE devices */ //#define DEBUG_IDE //#define DEBUG_IDE_ATAPI -@@ -216,83 +226,94 @@ +@@ -221,83 +231,94 @@ #define ATAPI_PACKET_SIZE 12 @@ -1252,7 +1252,7 @@ index f3787f2..ee6a3aa 100644 /* * Based on values from but extending CD_MINS -@@ -304,10 +325,13 @@ +@@ -309,10 +330,13 @@ */ /* Some generally useful CD-ROM information */ @@ -1270,7 +1270,7 @@ index f3787f2..ee6a3aa 100644 #define CD_MAX_BYTES (CD_MINS * CD_SECS * CD_FRAMES * CD_FRAMESIZE) #define CD_MAX_SECTORS (CD_MAX_BYTES / 512) -@@ -346,12 +370,15 @@ +@@ -351,12 +375,15 @@ #define MMC_PROFILE_HDDVD_RW_DL 0x005A #define MMC_PROFILE_INVALID 0xFFFF @@ -1286,7 +1286,7 @@ index f3787f2..ee6a3aa 100644 #define ASC_ILLEGAL_OPCODE 0x20 #define ASC_LOGICAL_BLOCK_OOR 0x21 #define ASC_INV_FIELD_IN_CMD_PACKET 0x24 -@@ -367,15 +394,42 @@ +@@ -371,15 +398,42 @@ #define CFA_INVALID_ADDRESS 0x21 #define CFA_ADDRESS_OVERFLOW 0x2f @@ -1333,7 +1333,7 @@ index f3787f2..ee6a3aa 100644 /* NOTE: IDEState represents in fact one drive */ typedef struct IDEState { /* ide config */ -@@ -424,6 +478,10 @@ typedef struct IDEState { +@@ -429,6 +483,10 @@ typedef struct IDEState { int lba; int cd_sector_size; int atapi_dma; /* true if dma is requested for the packet cmd */ @@ -1344,7 +1344,7 @@ index f3787f2..ee6a3aa 100644 /* ATA DMA state */ int io_buffer_size; QEMUSGList sg; -@@ -764,6 +822,8 @@ static inline void ide_set_irq(IDEState *s) +@@ -940,6 +998,8 @@ static inline void ide_set_irq(IDEState *s) if (bm) { bm->status |= BM_STATUS_INT; } @@ -1353,7 +1353,7 @@ index f3787f2..ee6a3aa 100644 qemu_irq_raise(s->irq); } } -@@ -1100,9 +1160,9 @@ static void ide_sector_write(IDEState *s) +@@ -1321,9 +1381,9 @@ static void ide_sector_write(IDEState *s) that at the expense of slower write performances. Use this option _only_ to install Windows 2000. You must disable it for normal use. */ @@ -1365,7 +1365,7 @@ index f3787f2..ee6a3aa 100644 #endif { ide_set_irq(s); -@@ -1229,6 +1289,13 @@ static inline int ube16_to_cpu(const uint8_t *buf) +@@ -1499,6 +1559,13 @@ static inline int ube16_to_cpu(const uint8_t *buf) return (buf[0] << 8) | buf[1]; } @@ -1379,7 +1379,7 @@ index f3787f2..ee6a3aa 100644 static inline int ube32_to_cpu(const uint8_t *buf) { return (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]; -@@ -1297,12 +1364,14 @@ static void ide_atapi_io_error(IDEState *s, int ret) +@@ -1567,12 +1634,14 @@ static void ide_atapi_io_error(IDEState *s, int ret) static void ide_atapi_cmd_reply_end(IDEState *s) { int byte_count_limit, size, ret; @@ -1394,7 +1394,7 @@ index f3787f2..ee6a3aa 100644 if (s->packet_transfer_size <= 0) { /* end of transfer */ ide_transfer_stop(s); -@@ -1312,63 +1381,65 @@ static void ide_atapi_cmd_reply_end(IDEState *s) +@@ -1582,63 +1651,65 @@ static void ide_atapi_cmd_reply_end(IDEState *s) #ifdef DEBUG_IDE_ATAPI printf("status=0x%x\n", s->status); #endif @@ -1511,7 +1511,7 @@ index f3787f2..ee6a3aa 100644 } } -@@ -1616,6 +1687,10 @@ static int ide_dvd_read_structure(IDEState *s, int format, +@@ -1882,6 +1953,10 @@ static int ide_dvd_read_structure(IDEState *s, int format, } } @@ -1522,7 +1522,7 @@ index f3787f2..ee6a3aa 100644 static void ide_atapi_cmd(IDEState *s) { const uint8_t *packet; -@@ -1651,7 +1726,6 @@ static void ide_atapi_cmd(IDEState *s) +@@ -1922,7 +1997,6 @@ static void ide_atapi_cmd(IDEState *s) ASC_MEDIUM_NOT_PRESENT); } break; @@ -1530,7 +1530,7 @@ index f3787f2..ee6a3aa 100644 case GPCMD_MODE_SENSE_10: { int action, code; -@@ -1664,9 +1738,9 @@ static void ide_atapi_cmd(IDEState *s) +@@ -1935,9 +2009,9 @@ static void ide_atapi_cmd(IDEState *s) switch(action) { case 0: /* current values */ switch(code) { @@ -1542,7 +1542,7 @@ index f3787f2..ee6a3aa 100644 buf[3] = 0; buf[4] = 0; buf[5] = 0; -@@ -1683,17 +1757,17 @@ static void ide_atapi_cmd(IDEState *s) +@@ -1954,17 +2028,17 @@ static void ide_atapi_cmd(IDEState *s) buf[15] = 0x00; ide_atapi_cmd_reply(s, 16, max_len); break; @@ -1564,7 +1564,7 @@ index f3787f2..ee6a3aa 100644 buf[10] = 0x00; buf[11] = 0x00; -@@ -1716,6 +1790,7 @@ static void ide_atapi_cmd(IDEState *s) +@@ -1987,6 +2061,7 @@ static void ide_atapi_cmd(IDEState *s) buf[27] = 0; ide_atapi_cmd_reply(s, 28, max_len); break; @@ -1572,7 +1572,7 @@ index f3787f2..ee6a3aa 100644 default: goto error_cmd; } -@@ -1848,7 +1923,7 @@ static void ide_atapi_cmd(IDEState *s) +@@ -2110,7 +2185,7 @@ static void ide_atapi_cmd(IDEState *s) break; case GPCMD_MECHANISM_STATUS: { @@ -1581,7 +1581,7 @@ index f3787f2..ee6a3aa 100644 cpu_to_ube16(buf, 0); /* no current LBA */ buf[2] = 0; -@@ -1863,7 +1938,6 @@ static void ide_atapi_cmd(IDEState *s) +@@ -2125,7 +2200,6 @@ static void ide_atapi_cmd(IDEState *s) { int format, msf, start_track, len; uint64_t total_sectors; @@ -1589,7 +1589,7 @@ index f3787f2..ee6a3aa 100644 bdrv_get_geometry(s->bs, &total_sectors); total_sectors >>= 2; if (total_sectors == 0) { -@@ -2017,7 +2091,7 @@ static void ide_atapi_cmd(IDEState *s) +@@ -2279,7 +2353,7 @@ static void ide_atapi_cmd(IDEState *s) max_len = 512; memset(buf, 0, max_len); @@ -1598,7 +1598,7 @@ index f3787f2..ee6a3aa 100644 * the number of sectors from the media tells us which profile * to use as current. 0 means there is no media */ -@@ -2218,7 +2292,11 @@ static void ide_ioport_write(void *opaque, uint32_t addr, uint32_t val) +@@ -2484,7 +2558,11 @@ static void ide_ioport_write(void *opaque, uint32_t addr, uint32_t val) /* Only DEVICE RESET is allowed while BSY or/and DRQ are set */ if ((s->status & (BUSY_STAT|DRQ_STAT)) && val != WIN_DEVICE_RESET) @@ -1610,7 +1610,7 @@ index f3787f2..ee6a3aa 100644 switch(val) { case WIN_IDENTIFY: -@@ -2453,7 +2531,7 @@ static void ide_ioport_write(void *opaque, uint32_t addr, uint32_t val) +@@ -2727,7 +2805,7 @@ static void ide_ioport_write(void *opaque, uint32_t addr, uint32_t val) else s->status = READY_STAT | SEEK_STAT; s->error = 0x01; /* Device 0 passed, Device 1 passed or not @@ -1619,7 +1619,7 @@ index f3787f2..ee6a3aa 100644 */ ide_set_irq(s); break; -@@ -2474,7 +2552,7 @@ static void ide_ioport_write(void *opaque, uint32_t addr, uint32_t val) +@@ -2748,7 +2826,7 @@ static void ide_ioport_write(void *opaque, uint32_t addr, uint32_t val) s->atapi_dma = s->feature & 1; s->nsector = 1; ide_transfer_start(s, s->io_buffer, ATAPI_PACKET_SIZE, @@ -1628,7 +1628,7 @@ index f3787f2..ee6a3aa 100644 break; /* CF-ATA commands */ case CFA_REQ_EXT_ERROR_CODE: -@@ -2813,8 +2891,20 @@ static void ide_init2(IDEState *ide_state, +@@ -3133,8 +3211,20 @@ static void ide_init2(IDEState *ide_state, if (bdrv_get_type_hint(s->bs) == BDRV_TYPE_CDROM) { s->is_cdrom = 1; @@ -1650,11 +1650,10 @@ index f3787f2..ee6a3aa 100644 s->drive_serial = drive_serial++; strncpy(s->drive_serial_str, drive_get_serial(s->bs), diff --git a/vl.c b/vl.c -index 60a00e1..42a72c8 100644 +index 7b925eb..42c9b66 100644 --- a/vl.c +++ b/vl.c -@@ -2192,10 +2192,12 @@ static int bt_parse(const char *opt) - +@@ -2193,8 +2193,10 @@ static int bt_parse(const char *opt) #define HD_ALIAS "index=%d,media=disk" #ifdef TARGET_PPC #define CDROM_ALIAS "index=1,media=cdrom" @@ -1665,8 +1664,7 @@ index 60a00e1..42a72c8 100644 #endif #define FD_ALIAS "index=%d,if=floppy" #define PFLASH_ALIAS "if=pflash" - #define MTD_ALIAS "if=mtd" -@@ -2199,7 +2200,7 @@ int drive_init(struct drive_opt *arg, int snapshot, void *opaque) +@@ -2332,7 +2334,7 @@ int drive_init(struct drive_opt *arg, int snapshot, void *opaque) char serial[21]; const char *mediastr = ""; BlockInterfaceType type; @@ -1675,7 +1673,7 @@ index 60a00e1..42a72c8 100644 int bus_id, unit_id; int cyls, heads, secs, translation; BlockDriverState *bdrv; -@@ -2358,6 +2359,8 @@ int drive_init(struct drive_opt *arg, int snapshot, void *opaque) +@@ -2486,6 +2488,8 @@ int drive_init(struct drive_opt *arg, int snapshot, void *opaque) return -1; } media = MEDIA_CDROM; @@ -1684,7 +1682,7 @@ index 60a00e1..42a72c8 100644 } else { fprintf(stderr, "qemu: '%s' invalid media\n", str); return -1; -@@ -2523,6 +2526,9 @@ int drive_init(struct drive_opt *arg, int snapshot, void *opaque) +@@ -2640,6 +2644,9 @@ int drive_init(struct drive_opt *arg, int snapshot, void *opaque) case MEDIA_CDROM: bdrv_set_type_hint(bdrv, BDRV_TYPE_CDROM); break; @@ -1694,7 +1692,15 @@ index 60a00e1..42a72c8 100644 } break; case IF_SD: -@@ -5249,13 +5255,16 @@ int main(int argc, char **argv, char **envp) +@@ -4243,6 +4250,7 @@ enum { + QEMU_OPTION_hdc, + QEMU_OPTION_hdd, + QEMU_OPTION_cdrom, ++ QEMU_OPTION_cdrom_pt, + QEMU_OPTION_drive, + QEMU_OPTION_mtdblock, + QEMU_OPTION_sd, +@@ -5036,13 +5044,16 @@ int main(int argc, char **argv, char **envp) case QEMU_OPTION_cdrom: drive_add(optarg, CDROM_ALIAS); break;