📄 scsi
字号:
Index: ioemu/vl.c===================================================================--- ioemu.orig/vl.c 2007-05-10 15:35:25.000000000 +0100+++ ioemu/vl.c 2007-05-10 15:35:25.000000000 +0100@@ -124,7 +124,7 @@ IOPortWriteFunc *ioport_write_table[3][MAX_IOPORTS]; /* Note: bs_table[MAX_DISKS] is a dummy block driver if none available to store the VM snapshots */-BlockDriverState *bs_table[MAX_DISKS + 1], *fd_table[MAX_FD];+BlockDriverState *bs_table[MAX_DISKS + MAX_SCSI_DISKS + 1], *fd_table[MAX_FD]; /* point to the block driver where the snapshots are managed */ BlockDriverState *bs_snapshots; int vga_ram_size;@@ -1526,7 +1526,7 @@ case 's': { int i;- for (i = 0; i < MAX_DISKS; i++) {+ for (i = 0; i < MAX_DISKS + MAX_SCSI_DISKS; i++) { if (bs_table[i]) bdrv_commit(bs_table[i]); }@@ -6954,7 +6954,7 @@ int snapshot, linux_boot; const char *initrd_filename; #ifndef CONFIG_DM- const char *hd_filename[MAX_DISKS];+ const char *hd_filename[MAX_DISKS + MAX_SCSI_DISKS]; #endif /* !CONFIG_DM */ const char *fd_filename[MAX_FD]; const char *kernel_filename, *kernel_cmdline;@@ -7023,7 +7023,7 @@ for(i = 0; i < MAX_FD; i++) fd_filename[i] = NULL; #ifndef CONFIG_DM- for(i = 0; i < MAX_DISKS; i++)+ for(i = 0; i < MAX_DISKS + MAX_SCSI_DISKS; i++) hd_filename[i] = NULL; #endif /* !CONFIG_DM */ ram_size = DEFAULT_RAM_SIZE * 1024 * 1024;@@ -7714,7 +7714,7 @@ } /* open the virtual block devices */- for(i = 0; i < MAX_DISKS; i++) {+ for(i = 0; i < MAX_DISKS + MAX_SCSI_DISKS; i++) { if (hd_filename[i]) { if (!bs_table[i]) { char buf[64];Index: ioemu/vl.h===================================================================--- ioemu.orig/vl.h 2007-05-10 15:35:25.000000000 +0100+++ ioemu/vl.h 2007-05-10 15:35:25.000000000 +0100@@ -963,8 +963,9 @@ /* ide.c */ #define MAX_DISKS 4+#define MAX_SCSI_DISKS 7 -extern BlockDriverState *bs_table[MAX_DISKS + 1];+extern BlockDriverState *bs_table[MAX_DISKS + MAX_SCSI_DISKS + 1]; void isa_ide_init(int iobase, int iobase2, int irq, BlockDriverState *hd0, BlockDriverState *hd1);Index: ioemu/hw/pc.c===================================================================--- ioemu.orig/hw/pc.c 2007-05-10 15:35:25.000000000 +0100+++ ioemu/hw/pc.c 2007-05-10 15:35:25.000000000 +0100@@ -761,7 +761,6 @@ piix4_smbus_register_device(eeprom, 0x50 + i); } }-#endif /* !CONFIG_DM */ if (i440fx_state) { i440fx_init_memory_mappings(i440fx_state);@@ -783,6 +782,18 @@ lsi_scsi_attach(scsi, bdrv, -1); } #endif+#else+ if (pci_enabled) {+ void *scsi = NULL;+ for (i = 0; i < MAX_SCSI_DISKS ; i++) {+ if (!bs_table[i + MAX_DISKS])+ continue;+ if (!scsi)+ scsi = lsi_scsi_init(pci_bus, -1);+ lsi_scsi_attach(scsi, bs_table[i + MAX_DISKS], -1);+ }+ }+#endif /* !CONFIG_DM */ } static void pc_init_pci(uint64_t ram_size, int vga_ram_size, char *boot_device,Index: ioemu/xenstore.c===================================================================--- ioemu.orig/xenstore.c 2007-05-10 15:35:25.000000000 +0100+++ ioemu/xenstore.c 2007-05-10 15:35:25.000000000 +0100@@ -18,7 +18,7 @@ #include <fcntl.h> static struct xs_handle *xsh = NULL;-static char *media_filename[MAX_DISKS];+static char *media_filename[MAX_DISKS + MAX_SCSI_DISKS]; static QEMUTimer *insert_timer = NULL; #define UWAIT_MAX (30*1000000) /* thirty seconds */@@ -44,7 +44,7 @@ { int i; - for (i = 0; i < MAX_DISKS; i++) {+ for (i = 0; i < MAX_DISKS + MAX_SCSI_DISKS; i++) { if (media_filename[i] && bs_table[i]) { do_change(bs_table[i]->device_name, media_filename[i]); free(media_filename[i]);@@ -83,10 +83,10 @@ char *buf = NULL, *path; char *fpath = NULL, *bpath = NULL, *dev = NULL, *params = NULL, *type = NULL;- int i;+ int i, is_scsi; unsigned int len, num, hd_index; - for(i = 0; i < MAX_DISKS; i++)+ for(i = 0; i < MAX_DISKS + MAX_SCSI_DISKS; i++) media_filename[i] = NULL; xsh = xs_daemon_open();@@ -123,10 +123,11 @@ dev = xs_read(xsh, XBT_NULL, buf, &len); if (dev == NULL) continue;- if (strncmp(dev, "hd", 2) || strlen(dev) != 3)+ is_scsi = !strncmp(dev, "sd", 2);+ if ((strncmp(dev, "hd", 2) && !is_scsi) || strlen(dev) != 3 ) continue; hd_index = dev[2] - 'a';- if (hd_index >= MAX_DISKS)+ if (hd_index >= (is_scsi ? MAX_SCSI_DISKS : MAX_DISKS)) continue; /* read the type of the device */ if (pasprintf(&buf, "%s/device/vbd/%s/device-type", path, e[i]) == -1)@@ -163,7 +164,7 @@ } } - bs_table[hd_index] = bdrv_new(dev);+ bs_table[hd_index + (is_scsi ? MAX_DISKS : 0)] = bdrv_new(dev); /* check if it is a cdrom */ if (type && !strcmp(type, "cdrom")) { bdrv_set_type_hint(bs_table[hd_index], BDRV_TYPE_CDROM);@@ -172,7 +173,8 @@ } /* open device now if media present */ if (params[0]) {- if (bdrv_open(bs_table[hd_index], params, 0 /* snapshot */) < 0)+ if (bdrv_open(bs_table[hd_index + (is_scsi ? MAX_DISKS : 0)],+ params, 0 /* snapshot */) < 0) fprintf(stderr, "qemu: could not open hard disk image '%s'\n", params); }Index: ioemu/monitor.c===================================================================--- ioemu.orig/monitor.c 2007-05-10 15:32:53.000000000 +0100+++ ioemu/monitor.c 2007-05-10 15:35:25.000000000 +0100@@ -209,7 +209,7 @@ int i, all_devices; all_devices = !strcmp(device, "all");- for (i = 0; i < MAX_DISKS; i++) {+ for (i = 0; i < MAX_DISKS + MAX_SCSI_DISKS; i++) { if (bs_table[i]) { if (all_devices || !strcmp(bdrv_get_device_name(bs_table[i]), device))Index: ioemu/hw/lsi53c895a.c===================================================================--- ioemu.orig/hw/lsi53c895a.c 2007-05-10 15:32:53.000000000 +0100+++ ioemu/hw/lsi53c895a.c 2007-05-10 15:35:25.000000000 +0100@@ -1351,8 +1351,13 @@ shift = (offset & 3) * 8; return (s->scratch[n] >> shift) & 0xff; }+#ifndef CONFIG_DM BADF("readb 0x%x\n", offset); exit(1);+#else+ /* XEN: This path can be triggered (e.g. ASPI8DOS.SYS reads 0x8). */+ return 0;+#endif #undef CASE_GET_REG32 }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -