/[gxemul]/trunk/src/diskimage.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/src/diskimage.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 4 by dpavlin, Mon Oct 8 16:18:00 2007 UTC revision 22 by dpavlin, Mon Oct 8 16:19:37 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   *  Copyright (C) 2003-2005  Anders Gavare.  All rights reserved.   *  Copyright (C) 2003-2006  Anders Gavare.  All rights reserved.
3   *   *
4   *  Redistribution and use in source and binary forms, with or without   *  Redistribution and use in source and binary forms, with or without
5   *  modification, are permitted provided that the following conditions are met:   *  modification, are permitted provided that the following conditions are met:
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *   *
27   *   *
28   *  $Id: diskimage.c,v 1.84 2005/04/17 00:15:24 debug Exp $   *  $Id: diskimage.c,v 1.108 2006/01/11 20:14:41 debug Exp $
29   *   *
30   *  Disk image support.   *  Disk image support.
31   *   *
# Line 36  Line 36 
36   *         that return feof (which results in a filemark).  This is probably   *         that return feof (which results in a filemark).  This is probably
37   *         trivial to fix, but I don't feel like it right now.   *         trivial to fix, but I don't feel like it right now.
38   *   *
39   *  TODO:  Non-SCSI disk images?   *  TODO:  diskimage_remove()? This would be useful for floppies in PC-style
40   *   *         machines, where disks may need to be swapped during boot etc.
  *  TODO:  diskimage_remove() ?  
  *         Actually test diskimage_access() to see that it works.  
41   */   */
42    
43  #include <stdio.h>  #include <stdio.h>
# Line 55  Line 53 
53  #include "misc.h"  #include "misc.h"
54    
55    
56  extern int quiet_mode;  /*  #define debug fatal  */
57    
58  extern int single_step;  extern int single_step;
59    
60    static char *diskimage_types[] = DISKIMAGE_TYPES;
61    
62  static struct scsi_transfer *first_free_scsi_transfer_alloc = NULL;  static struct scsi_transfer *first_free_scsi_transfer_alloc = NULL;
63    
# Line 209  void scsi_transfer_allocbuf(size_t *lenp Line 209  void scsi_transfer_allocbuf(size_t *lenp
209  /*  /*
210   *  diskimage_exist():   *  diskimage_exist():
211   *   *
212   *  Returns 1 if the specified SCSI id exists, 0 otherwise.   *  Returns 1 if the specified disk id (for a specific type) exists, 0
213     *  otherwise.
214   */   */
215  int diskimage_exist(struct machine *machine, int scsi_id)  int diskimage_exist(struct machine *machine, int id, int type)
216  {  {
217          struct diskimage *d = machine->first_diskimage;          struct diskimage *d = machine->first_diskimage;
218    
219          while (d != NULL) {          while (d != NULL) {
220                  if ( /* d->type == DISKIMAGE_SCSI && */ d->id == scsi_id)                  if (d->type == type && d->id == id)
221                          return 1;                          return 1;
222                  d = d->next;                  d = d->next;
223          }          }
# Line 256  static void diskimage_recalc_size(struct Line 257  static void diskimage_recalc_size(struct
257    
258          d->total_size = size;          d->total_size = size;
259          d->ncyls = d->total_size / 1048576;          d->ncyls = d->total_size / 1048576;
260    
261            /*  TODO: There is a mismatch between d->ncyls and d->cylinders,
262                SCSI-based stuff usually doesn't care.  TODO: Fix this.  */
263  }  }
264    
265    
266  /*  /*
267   *  diskimage_getsize():   *  diskimage_getsize():
268   *   *
269   *  Returns -1 if the specified SCSI id does not exists, otherwise   *  Returns -1 if the specified disk id/type does not exists, otherwise
270   *  the size of the disk image is returned.   *  the size of the disk image is returned.
271   */   */
272  int64_t diskimage_getsize(struct machine *machine, int scsi_id)  int64_t diskimage_getsize(struct machine *machine, int id, int type)
273  {  {
274          struct diskimage *d = machine->first_diskimage;          struct diskimage *d = machine->first_diskimage;
275    
276          while (d != NULL) {          while (d != NULL) {
277                  if ( /* d->type == DISKIMAGE_SCSI && */ d->id == scsi_id)                  if (d->type == type && d->id == id)
278                          return d->total_size;                          return d->total_size;
279                  d = d->next;                  d = d->next;
280          }          }
# Line 279  int64_t diskimage_getsize(struct machine Line 283  int64_t diskimage_getsize(struct machine
283    
284    
285  /*  /*
286     *  diskimage_getchs():
287     *
288     *  Returns the current CHS values of a disk image.
289     */
290    void diskimage_getchs(struct machine *machine, int id, int type,
291            int *c, int *h, int *s)
292    {
293            struct diskimage *d = machine->first_diskimage;
294    
295            while (d != NULL) {
296                    if (d->type == type && d->id == id) {
297                            *c = d->cylinders;
298                            *h = d->heads;
299                            *s = d->sectors_per_track;
300                            return;
301                    }
302                    d = d->next;
303            }
304            fatal("diskimage_getchs(): disk id %i (type %i) not found?\n",
305                id, diskimage_types[type]);
306            exit(1);
307    }
308    
309    
310    /*
311   *  diskimage__return_default_status_and_message():   *  diskimage__return_default_status_and_message():
312   *   *
313   *  Set the status and msg_in parts of a scsi_transfer struct   *  Set the status and msg_in parts of a scsi_transfer struct
# Line 381  static size_t diskimage_access__cdrom(st Line 410  static size_t diskimage_access__cdrom(st
410  static int diskimage__internal_access(struct diskimage *d, int writeflag,  static int diskimage__internal_access(struct diskimage *d, int writeflag,
411          off_t offset, unsigned char *buf, size_t len)          off_t offset, unsigned char *buf, size_t len)
412  {  {
413          size_t lendone;          ssize_t lendone;
414          int res;          int res;
415    
416          if (buf == NULL) {          if (buf == NULL) {
# Line 447  static int diskimage__internal_access(st Line 476  static int diskimage__internal_access(st
476   *      1 if otherwise ok,   *      1 if otherwise ok,
477   *      0 on error.   *      0 on error.
478   */   */
479  int diskimage_scsicommand(struct cpu *cpu, int scsi_id,  int diskimage_scsicommand(struct cpu *cpu, int id, int type,
480          struct scsi_transfer *xferp)          struct scsi_transfer *xferp)
481  {  {
482          int retlen, i;          char namebuf[16];
483            int retlen, i, q;
484          uint64_t size;          uint64_t size;
485          int64_t ofs;          int64_t ofs;
486          int pagecode;          int pagecode;
# Line 464  int diskimage_scsicommand(struct cpu *cp Line 494  int diskimage_scsicommand(struct cpu *cp
494    
495          d = machine->first_diskimage;          d = machine->first_diskimage;
496          while (d != NULL) {          while (d != NULL) {
497                  if ( /* d->type == DISKIMAGE_SCSI && */ d->id == scsi_id)                  if (d->type == type && d->id == id)
498                          break;                          break;
499                  d = d->next;                  d = d->next;
500          }          }
501          if (d == NULL) {          if (d == NULL) {
502                  fprintf(stderr, "[ diskimage_scsicommand(): SCSI disk"                  fprintf(stderr, "[ diskimage_scsicommand(): %s "
503                      " with id %i not connected? ]\n", scsi_id);                      " id %i not connected? ]\n", diskimage_types[type], id);
504          }          }
505    
506          if (xferp->cmd == NULL) {          if (xferp->cmd == NULL) {
# Line 485  int diskimage_scsicommand(struct cpu *cp Line 515  int diskimage_scsicommand(struct cpu *cp
515          }          }
516    
517          debug("[ diskimage_scsicommand(id=%i) cmd=0x%02x: ",          debug("[ diskimage_scsicommand(id=%i) cmd=0x%02x: ",
518              scsi_id, xferp->cmd[0]);              id, xferp->cmd[0]);
519    
520  #if 0  #if 0
521          fatal("[ diskimage_scsicommand(id=%i) cmd=0x%02x len=%i:",          fatal("[ diskimage_scsicommand(id=%i) cmd=0x%02x len=%i:",
522              scsi_id, xferp->cmd[0], xferp->cmd_len);              id, xferp->cmd[0], xferp->cmd_len);
523          for (i=0; i<xferp->cmd_len; i++)          for (i=0; i<xferp->cmd_len; i++)
524                  fatal(" %02x", xferp->cmd[i]);                  fatal(" %02x", xferp->cmd[i]);
525          fatal("\n");          fatal("\n");
# Line 504  if (xferp->cmd_len > 7 && xferp->cmd[5] Line 534  if (xferp->cmd_len > 7 && xferp->cmd[5]
534                  f = fopen("scsi_log.txt", "w");                  f = fopen("scsi_log.txt", "w");
535          if (f != NULL) {          if (f != NULL) {
536                  int i;                  int i;
537                  fprintf(f, "id=%i cmd =", scsi_id);                  fprintf(f, "id=%i cmd =", id);
538                  for (i=0; i<xferp->cmd_len; i++)                  for (i=0; i<xferp->cmd_len; i++)
539                          fprintf(f, " %02x", xferp->cmd[i]);                          fprintf(f, " %02x", xferp->cmd[i]);
540                  fprintf(f, "\n");                  fprintf(f, "\n");
# Line 560  xferp->data_in[4] = 0x2c - 4;  /*  Additi Line 590  xferp->data_in[4] = 0x2c - 4;  /*  Additi
590                  xferp->data_in[6] = 0x04;  /*  ACKREQQ  */                  xferp->data_in[6] = 0x04;  /*  ACKREQQ  */
591                  xferp->data_in[7] = 0x60;  /*  WBus32, WBus16  */                  xferp->data_in[7] = 0x60;  /*  WBus32, WBus16  */
592    
593                  /*  These must be padded with spaces:  */                  /*  These are padded with spaces:  */
594                  memcpy(xferp->data_in+8,  "FAKE    ", 8);  
595                  memcpy(xferp->data_in+16, "DISK            ", 16);                  memcpy(xferp->data_in+8,  "GXemul  ", 8);
596                  memcpy(xferp->data_in+32, "V0.0", 4);                  if (diskimage_getname(cpu->machine, id,
597                        type, namebuf, sizeof(namebuf))) {
598                            size_t i;
599                            for (i=0; i<sizeof(namebuf); i++)
600                                    if (namebuf[i] == 0) {
601                                            for (; i<sizeof(namebuf); i++)
602                                                    namebuf[i] = ' ';
603                                            break;
604                                    }
605                            memcpy(xferp->data_in+16, namebuf, 16);
606                    } else
607                            memcpy(xferp->data_in+16, "DISK            ", 16);
608                    memcpy(xferp->data_in+32, "0   ", 4);
609    
610                  /*                  /*
611                   *  Some Ultrix kernels want specific responses from                   *  Some Ultrix kernels want specific responses from
612                   *  the drives.                   *  the drives.
613                   */                   */
614    
615                  if (machine->machine_type == MACHINE_DEC) {                  if (machine->machine_type == MACHINE_PMAX) {
616                          /*  DEC, RZ25 (rev 0900) = 832527 sectors  */                          /*  DEC, RZ25 (rev 0900) = 832527 sectors  */
617                          /*  DEC, RZ58 (rev 2000) = 2698061 sectors  */                          /*  DEC, RZ58 (rev 2000) = 2698061 sectors  */
618                          memcpy(xferp->data_in+8,  "DEC     ", 8);                          memcpy(xferp->data_in+8,  "DEC     ", 8);
# Line 582  xferp->data_in[4] = 0x2c - 4;  /*  Additi Line 624  xferp->data_in[4] = 0x2c - 4;  /*  Additi
624                  if (d->is_a_cdrom) {                  if (d->is_a_cdrom) {
625                          xferp->data_in[0] = 0x05;  /*  0x05 = CD-ROM  */                          xferp->data_in[0] = 0x05;  /*  0x05 = CD-ROM  */
626                          xferp->data_in[1] = 0x80;  /*  0x80 = removable  */                          xferp->data_in[1] = 0x80;  /*  0x80 = removable  */
627                          memcpy(xferp->data_in+16, "CD-ROM          ", 16);                          /*  memcpy(xferp->data_in+16, "CD-ROM          ", 16);*/
628    
629                          if (machine->machine_type == MACHINE_DEC) {                          if (machine->machine_type == MACHINE_PMAX) {
630                                  /*  SONY, CD-ROM:  */                                  /*  SONY, CD-ROM:  */
631                                  memcpy(xferp->data_in+8, "SONY    ", 8);                                  memcpy(xferp->data_in+8, "SONY    ", 8);
632                                  memcpy(xferp->data_in+16,                                  memcpy(xferp->data_in+16,
# Line 595  xferp->data_in[4] = 0x2c - 4;  /*  Additi Line 637  xferp->data_in[4] = 0x2c - 4;  /*  Additi
637                                  memcpy(xferp->data_in+16,                                  memcpy(xferp->data_in+16,
638                                      "RRD42   (C) DEC ", 16);                                      "RRD42   (C) DEC ", 16);
639                                  memcpy(xferp->data_in+32, "4.5d", 4);                                  memcpy(xferp->data_in+32, "4.5d", 4);
640                          } else {                          } else if (machine->machine_type == MACHINE_ARC) {
641                                  /*  NEC, CD-ROM:  */                                  /*  NEC, CD-ROM:  */
642                                  memcpy(xferp->data_in+8, "NEC     ", 8);                                  memcpy(xferp->data_in+8, "NEC     ", 8);
643                                  memcpy(xferp->data_in+16,                                  memcpy(xferp->data_in+16,
# Line 610  xferp->data_in[4] = 0x2c - 4;  /*  Additi Line 652  xferp->data_in[4] = 0x2c - 4;  /*  Additi
652                          xferp->data_in[1] = 0x80;  /*  0x80 = removable  */                          xferp->data_in[1] = 0x80;  /*  0x80 = removable  */
653                          memcpy(xferp->data_in+16, "TAPE            ", 16);                          memcpy(xferp->data_in+16, "TAPE            ", 16);
654    
655                          if (machine->machine_type == MACHINE_DEC) {                          if (machine->machine_type == MACHINE_PMAX) {
656                                  /*                                  /*
657                                   *  TODO:  find out if these are correct.                                   *  TODO:  find out if these are correct.
658                                   *                                   *
# Line 665  xferp->data_in[4] = 0x2c - 4;  /*  Additi Line 707  xferp->data_in[4] = 0x2c - 4;  /*  Additi
707                  break;                  break;
708    
709          case SCSICMD_MODE_SENSE:          case SCSICMD_MODE_SENSE:
710            case SCSICMD_MODE_SENSE10:      
711                  debug("MODE_SENSE");                  debug("MODE_SENSE");
712                    q = 4; retlen = xferp->cmd[4];
713                  if (xferp->cmd_len != 6)                  switch (xferp->cmd_len) {
714                          fatal(" (unimplemented mode_sense len=%i)",                  case 6: break;
715                    case 10:q = 8;
716                            retlen = xferp->cmd[7] * 256 + xferp->cmd[8];
717                            break;
718                    default:fatal(" (unimplemented mode_sense len=%i)",
719                              xferp->cmd_len);                              xferp->cmd_len);
720                    }
                 retlen = xferp->cmd[4];  
721    
722                  /*                  /*
723                   *  NOTE/TODO: This code doesn't handle too short retlens                   *  NOTE/TODO: This code doesn't handle too short retlens
# Line 694  xferp->data_in[4] = 0x2c - 4;  /*  Additi Line 740  xferp->data_in[4] = 0x2c - 4;  /*  Additi
740    
741                  pagecode = xferp->cmd[2] & 0x3f;                  pagecode = xferp->cmd[2] & 0x3f;
742    
743                  debug("[ MODE SENSE id %i, pagecode=%i ]\n", scsi_id, pagecode);                  debug("[ MODE SENSE id %i, pagecode=%i ]\n", id, pagecode);
744    
745                  /*  4 bytes of header for 6-byte command,                  /*  4 bytes of header for 6-byte command,
746                      8 bytes of header for 10-byte command.  */                      8 bytes of header for 10-byte command.  */
# Line 706  xferp->data_in[4] = 0x2c - 4;  /*  Additi Line 752  xferp->data_in[4] = 0x2c - 4;  /*  Additi
752                  xferp->data_in[3] = 8 * 1;      /*  block descriptor                  xferp->data_in[3] = 8 * 1;      /*  block descriptor
753                                                      length: 1 page (?)  */                                                      length: 1 page (?)  */
754    
755                  /*  TODO: update this when implementing 10-byte commands:  */                  xferp->data_in[q+0] = 0x00;     /*  density code  */
756                  xferp->data_in[4] = 0x00;       /*  density code  */                  xferp->data_in[q+1] = 0;        /*  nr of blocks, high  */
757                  xferp->data_in[5] = 0;          /*  nr of blocks, high  */                  xferp->data_in[q+2] = 0;        /*  nr of blocks, mid  */
758                  xferp->data_in[6] = 0;          /*  nr of blocks, mid  */                  xferp->data_in[q+3] = 0;        /*  nr of blocks, low */
759                  xferp->data_in[7] = 0;          /*  nr of blocks, low */                  xferp->data_in[q+4] = 0x00;     /*  reserved  */
760                  xferp->data_in[8] = 0x00;       /*  reserved  */                  xferp->data_in[q+5] = (d->logical_block_size >> 16) & 255;
761                  xferp->data_in[9] = (d->logical_block_size >> 16) & 255;                  xferp->data_in[q+6] = (d->logical_block_size >> 8) & 255;
762                  xferp->data_in[10] = (d->logical_block_size >> 8) & 255;                  xferp->data_in[q+7] = d->logical_block_size & 255;
763                  xferp->data_in[11] = d->logical_block_size & 255;                  q += 8;
764    
765                  diskimage__return_default_status_and_message(xferp);                  diskimage__return_default_status_and_message(xferp);
766    
# Line 726  xferp->data_in[4] = 0x2c - 4;  /*  Additi Line 772  xferp->data_in[4] = 0x2c - 4;  /*  Additi
772                          /*  TODO: Nothing here?  */                          /*  TODO: Nothing here?  */
773                          break;                          break;
774                  case 1:         /*  read-write error recovery page  */                  case 1:         /*  read-write error recovery page  */
775                          xferp->data_in[12 + 0] = pagecode;                          xferp->data_in[q + 0] = pagecode;
776                          xferp->data_in[12 + 1] = 10;                          xferp->data_in[q + 1] = 10;
777                          break;                          break;
778                  case 3:         /*  format device page  */                  case 3:         /*  format device page  */
779                          xferp->data_in[12 + 0] = pagecode;                          xferp->data_in[q + 0] = pagecode;
780                          xferp->data_in[12 + 1] = 22;                          xferp->data_in[q + 1] = 22;
781    
782                          /*  10,11 = sectors per track  */                          /*  10,11 = sectors per track  */
783                          xferp->data_in[12 + 10] = 0;                          xferp->data_in[q + 10] = 0;
784                          xferp->data_in[12 + 11] = 1;    /*  TODO  */                          xferp->data_in[q + 11] = d->sectors_per_track;
785    
786                          /*  12,13 = physical sector size  */                          /*  12,13 = physical sector size  */
787                          xferp->data_in[12 + 12] =                          xferp->data_in[q + 12] =
788                              (d->logical_block_size >> 8) & 255;                              (d->logical_block_size >> 8) & 255;
789                          xferp->data_in[12 + 13] = d->logical_block_size & 255;                          xferp->data_in[q + 13] = d->logical_block_size & 255;
790                          break;                          break;
791                  case 4:         /*  rigid disk geometry page  */                  case 4:         /*  rigid disk geometry page  */
792                          xferp->data_in[12 + 0] = pagecode;                          xferp->data_in[q + 0] = pagecode;
793                          xferp->data_in[12 + 1] = 22;                          xferp->data_in[q + 1] = 22;
794                          xferp->data_in[12 + 2] = (d->ncyls >> 16) & 255;                          xferp->data_in[q + 2] = (d->ncyls >> 16) & 255;
795                          xferp->data_in[12 + 3] = (d->ncyls >> 8) & 255;                          xferp->data_in[q + 3] = (d->ncyls >> 8) & 255;
796                          xferp->data_in[12 + 4] = d->ncyls & 255;                          xferp->data_in[q + 4] = d->ncyls & 255;
797                          xferp->data_in[12 + 5] = 15;    /*  nr of heads  */                          xferp->data_in[q + 5] = d->heads;
798    
799                          xferp->data_in[12 + 20] = (d->rpms >> 8) & 255;                          xferp->data_in[q + 20] = (d->rpms >> 8) & 255;
800                          xferp->data_in[12 + 21] = d->rpms & 255;                          xferp->data_in[q + 21] = d->rpms & 255;
801                          break;                          break;
802                  case 5:         /*  flexible disk page  */                  case 5:         /*  flexible disk page  */
803                          xferp->data_in[12 + 0] = pagecode;                          xferp->data_in[q + 0] = pagecode;
804                          xferp->data_in[12 + 1] = 0x1e;                          xferp->data_in[q + 1] = 0x1e;
805    
806                          /*  2,3 = transfer rate  */                          /*  2,3 = transfer rate  */
807                          xferp->data_in[12 + 2] = ((5000) >> 8) & 255;                          xferp->data_in[q + 2] = ((5000) >> 8) & 255;
808                          xferp->data_in[12 + 3] = (5000) & 255;                          xferp->data_in[q + 3] = (5000) & 255;
809    
810                          xferp->data_in[12 + 4] = 2;    /*  nr of heads  */                          xferp->data_in[q + 4] = d->heads;
811                          xferp->data_in[12 + 5] = 18;   /*  sectors per track  */                          xferp->data_in[q + 5] = d->sectors_per_track;
812    
813                          /*  6,7 = data bytes per sector  */                          /*  6,7 = data bytes per sector  */
814                          xferp->data_in[12 + 6] = (d->logical_block_size >> 8)                          xferp->data_in[q + 6] = (d->logical_block_size >> 8)
815                              & 255;                              & 255;
816                          xferp->data_in[12 + 7] = d->logical_block_size & 255;                          xferp->data_in[q + 7] = d->logical_block_size & 255;
817    
818                          xferp->data_in[12 + 8] = (d->ncyls >> 8) & 255;                          xferp->data_in[q + 8] = (d->ncyls >> 8) & 255;
819                          xferp->data_in[12 + 9] = d->ncyls & 255;                          xferp->data_in[q + 9] = d->ncyls & 255;
820    
821                          xferp->data_in[12 + 28] = (d->rpms >> 8) & 255;                          xferp->data_in[q + 28] = (d->rpms >> 8) & 255;
822                          xferp->data_in[12 + 29] = d->rpms & 255;                          xferp->data_in[q + 29] = d->rpms & 255;
823                          break;                          break;
824                  default:                  default:
825                          fatal("[ MODE_SENSE for page %i is not yet "                          fatal("[ MODE_SENSE for page %i is not yet "
# Line 819  xferp->data_in[4] = 0x2c - 4;  /*  Additi Line 865  xferp->data_in[4] = 0x2c - 4;  /*  Additi
865                          ofs = d->tape_offset;                          ofs = d->tape_offset;
866    
867                          fatal("[ READ tape, id=%i file=%i, cmd[1]=%02x size=%i"                          fatal("[ READ tape, id=%i file=%i, cmd[1]=%02x size=%i"
868                              ", ofs=%lli ]\n", scsi_id, d->tape_filenr,                              ", ofs=%lli ]\n", id, d->tape_filenr,
869                              xferp->cmd[1], (int)size, (long long)ofs);                              xferp->cmd[1], (int)size, (long long)ofs);
870                  } else {                  } else {
871                          if (xferp->cmd[0] == SCSICMD_READ) {                          if (xferp->cmd[0] == SCSICMD_READ) {
# Line 851  xferp->data_in[4] = 0x2c - 4;  /*  Additi Line 897  xferp->data_in[4] = 0x2c - 4;  /*  Additi
897                                   *  blocks to transfer. (NOTE: If the value is                                   *  blocks to transfer. (NOTE: If the value is
898                                   *  0, this means 0, not 65536. :-)                                   *  0, this means 0, not 65536. :-)
899                                   */                                   */
900                                  ofs = (xferp->cmd[2] << 24) + (xferp->cmd[3]                                  ofs = ((uint64_t)xferp->cmd[2] << 24) +
901                                      << 16) + (xferp->cmd[4] << 8) +                                      (xferp->cmd[3] << 16) + (xferp->cmd[4] << 8)
902                                      xferp->cmd[5];                                      + xferp->cmd[5];
903                                  retlen = (xferp->cmd[7] << 8) + xferp->cmd[8];                                  retlen = (xferp->cmd[7] << 8) + xferp->cmd[8];
904                          }                          }
905    
# Line 882  xferp->data_in[4] = 0x2c - 4;  /*  Additi Line 928  xferp->data_in[4] = 0x2c - 4;  /*  Additi
928                   *   be set to NO SENSE"..                   *   be set to NO SENSE"..
929                   */                   */
930                  if (d->is_a_tape && d->f != NULL && feof(d->f)) {                  if (d->is_a_tape && d->f != NULL && feof(d->f)) {
931                          debug(" feof id=%i\n", scsi_id);                          debug(" feof id=%i\n", id);
932                          xferp->status[0] = 0x02;        /*  CHECK CONDITION  */                          xferp->status[0] = 0x02;        /*  CHECK CONDITION  */
933    
934                          d->filemark = 1;                          d->filemark = 1;
# Line 891  xferp->data_in[4] = 0x2c - 4;  /*  Additi Line 937  xferp->data_in[4] = 0x2c - 4;  /*  Additi
937                              xferp->data_in, size);                              xferp->data_in, size);
938    
939                  if (d->is_a_tape && d->f != NULL)                  if (d->is_a_tape && d->f != NULL)
940                          d->tape_offset = ftell(d->f);                          d->tape_offset = ftello(d->f);
941    
942                  /*  TODO: other errors?  */                  /*  TODO: other errors?  */
943                  break;                  break;
# Line 929  xferp->data_in[4] = 0x2c - 4;  /*  Additi Line 975  xferp->data_in[4] = 0x2c - 4;  /*  Additi
975                           *  transfer. (NOTE: If the value is 0 this means 0,                           *  transfer. (NOTE: If the value is 0 this means 0,
976                           *  not 65536.)                           *  not 65536.)
977                           */                           */
978                          ofs = (xferp->cmd[2] << 24) + (xferp->cmd[3] << 16) +                          ofs = ((uint64_t)xferp->cmd[2] << 24) +
979                                (xferp->cmd[4] << 8) + xferp->cmd[5];                              (xferp->cmd[3] << 16) + (xferp->cmd[4] << 8) +
980                                xferp->cmd[5];
981                          retlen = (xferp->cmd[7] << 8) + xferp->cmd[8];                          retlen = (xferp->cmd[7] << 8) + xferp->cmd[8];
982                  }                  }
983    
# Line 978  xferp->data_in[4] = 0x2c - 4;  /*  Additi Line 1025  xferp->data_in[4] = 0x2c - 4;  /*  Additi
1025                  if (xferp->cmd_len != 6)                  if (xferp->cmd_len != 6)
1026                          debug(" (weird len=%i)", xferp->cmd_len);                          debug(" (weird len=%i)", xferp->cmd_len);
1027    
1028                  for (i=0; i<xferp->cmd_len ; i++)                  for (i=0; i<(ssize_t)xferp->cmd_len; i++)
1029                          debug(" %02x", xferp->cmd[i]);                          debug(" %02x", xferp->cmd[i]);
1030    
1031                  /*  TODO: actualy care about cmd[]  */                  /*  TODO: actualy care about cmd[]  */
# Line 1187  xferp->data_in[4] = 0x2c - 4;  /*  Additi Line 1234  xferp->data_in[4] = 0x2c - 4;  /*  Additi
1234                  scsi_transfer_allocbuf(&xferp->data_in_len,                  scsi_transfer_allocbuf(&xferp->data_in_len,
1235                      &xferp->data_in, retlen, 1);                      &xferp->data_in, retlen, 1);
1236    
1237                  /*  TODO  */                  xferp->data_in[0] = 0;
1238                    xferp->data_in[1] = 10;
1239                    xferp->data_in[2] = 0;          /*  First track.  */
1240                    xferp->data_in[3] = 0;          /*  Last track.  */
1241    
1242                    /*  Track 0 data:  */
1243                    xferp->data_in[4] = 0x00;       /*  Reserved.  */
1244                    xferp->data_in[5] = 0x04;       /*  ADR + CTRL:
1245                                                        Data, not audio  */
1246                    xferp->data_in[6] = 0x00;       /*  Track nr  */
1247                    xferp->data_in[7] = 0x00;       /*  Reserved  */
1248                    /*  8..11 = absolute CDROM address  */
1249    
1250                  diskimage__return_default_status_and_message(xferp);                  diskimage__return_default_status_and_message(xferp);
1251                  break;                  break;
# Line 1228  xferp->data_in[4] = 0x2c - 4;  /*  Additi Line 1286  xferp->data_in[4] = 0x2c - 4;  /*  Additi
1286                  } else {                  } else {
1287                          int i;                          int i;
1288                          fatal("[ unknown MODE_SELECT: cmd =");                          fatal("[ unknown MODE_SELECT: cmd =");
1289                          for (i=0; i<xferp->cmd_len; i++)                          for (i=0; i<(ssize_t)xferp->cmd_len; i++)
1290                                  fatal(" %02x", xferp->cmd[i]);                                  fatal(" %02x", xferp->cmd[i]);
1291                          fatal(", data_out =");                          fatal(", data_out =");
1292                          for (i=0; i<xferp->data_out_len; i++)                          for (i=0; i<(ssize_t)xferp->data_out_len; i++)
1293                                  fatal(" %02x", xferp->data_out[i]);                                  fatal(" %02x", xferp->data_out[i]);
1294                          fatal(" ]");                          fatal(" ]");
1295                  }                  }
# Line 1240  xferp->data_in[4] = 0x2c - 4;  /*  Additi Line 1298  xferp->data_in[4] = 0x2c - 4;  /*  Additi
1298                  diskimage__return_default_status_and_message(xferp);                  diskimage__return_default_status_and_message(xferp);
1299                  break;                  break;
1300    
1301          case 0x1e:          case SCSICMD_PREVENT_ALLOW_REMOVE:
1302                  debug("[ SCSI 0x%02x: TODO ]\n", xferp->cmd[0]);                  debug("[ SCSI 0x%02x Prevent/allow medium removal: "
1303                        "TODO ]\n", xferp->cmd[0]);
                 /*  TODO  */  
1304    
1305                  diskimage__return_default_status_and_message(xferp);                  diskimage__return_default_status_and_message(xferp);
1306                  break;                  break;
# Line 1251  xferp->data_in[4] = 0x2c - 4;  /*  Additi Line 1308  xferp->data_in[4] = 0x2c - 4;  /*  Additi
1308          case 0xbd:          case 0xbd:
1309                  fatal("[ SCSI 0x%02x (len %i), TODO: ", xferp->cmd[0],                  fatal("[ SCSI 0x%02x (len %i), TODO: ", xferp->cmd[0],
1310                      xferp->cmd_len);                      xferp->cmd_len);
1311                  for (i=0; i<xferp->cmd_len; i++)                  for (i=0; i<(ssize_t)xferp->cmd_len; i++)
1312                          fatal(" %02x", xferp->cmd[i]);                          fatal(" %02x", xferp->cmd[i]);
1313                  fatal(" ]\n");                  fatal(" ]\n");
1314    
# Line 1275  xferp->data_in[4] = 0x2c - 4;  /*  Additi Line 1332  xferp->data_in[4] = 0x2c - 4;  /*  Additi
1332                      &xferp->data_in, retlen, 1);                      &xferp->data_in, retlen, 1);
1333    
1334                  diskimage__return_default_status_and_message(xferp);                  diskimage__return_default_status_and_message(xferp);
1335    
1336                  break;                  break;
1337    
1338          default:          default:
1339                  fatal("[ UNIMPLEMENTED SCSI command 0x%02x, disk id=%i ]\n",                  fatal("[ UNIMPLEMENTED SCSI command 0x%02x, disk id=%i ]\n",
1340                      xferp->cmd[0], scsi_id);                      xferp->cmd[0], id);
1341                  exit(1);                  exit(1);
1342          }          }
1343          debug(" ]\n");          debug(" ]\n");
# Line 1295  xferp->data_in[4] = 0x2c - 4;  /*  Additi Line 1353  xferp->data_in[4] = 0x2c - 4;  /*  Additi
1353   *   *
1354   *  Returns 1 if the access completed successfully, 0 otherwise.   *  Returns 1 if the access completed successfully, 0 otherwise.
1355   */   */
1356  int diskimage_access(struct machine *machine, int scsi_id, int writeflag,  int diskimage_access(struct machine *machine, int id, int type, int writeflag,
1357          off_t offset, unsigned char *buf, size_t len)          off_t offset, unsigned char *buf, size_t len)
1358  {  {
1359          struct diskimage *d = machine->first_diskimage;          struct diskimage *d = machine->first_diskimage;
1360    
         /*  
          *  TODO: How about mixing SCSI, IDE, and FLOPPY in one  
          *        emulated machine?  
          */  
   
1361          while (d != NULL) {          while (d != NULL) {
1362                  if ( /* d->type == DISKIMAGE_SCSI && */ d->id == scsi_id)                  if (d->type == type && d->id == id)
1363                          break;                          break;
1364                  d = d->next;                  d = d->next;
1365          }          }
1366    
1367          if (d == NULL) {          if (d == NULL) {
1368                  fatal("[ diskimage_access(): ERROR: trying to access a "                  fatal("[ diskimage_access(): ERROR: trying to access a "
1369                      "non-existant SCSI disk image (%i)\n", scsi_id);                      "non-existant %s disk image (id %i)\n",
1370                        diskimage_types[type], id);
1371                  return 0;                  return 0;
1372          }          }
1373    
# Line 1328  int diskimage_access(struct machine *mac Line 1382  int diskimage_access(struct machine *mac
1382   *  The filename may be prefixed with one or more modifiers, followed   *  The filename may be prefixed with one or more modifiers, followed
1383   *  by a colon.   *  by a colon.
1384   *   *
1385   *      b       specifies that this is the boot device   *      b       specifies that this is a bootable device
1386   *      c       CD-ROM (instead of normal SCSI DISK)   *      c       CD-ROM (instead of a normal DISK)
1387   *      d       DISK (this is the default)   *      d       DISK (this is the default)
1388   *      f       FLOPPY (instead of SCSI)   *      f       FLOPPY (instead of SCSI)
1389     *      gH;S;   set geometry (H=heads, S=sectors per track, cylinders are
1390     *              automatically calculated). (This is ignored for floppies.)
1391   *      i       IDE (instead of SCSI)   *      i       IDE (instead of SCSI)
1392   *      r       read-only (don't allow changes to the file)   *      r       read-only (don't allow changes to the file)
1393   *      s       SCSI (this is the default)   *      s       SCSI (this is the default)
# Line 1344  int diskimage_access(struct machine *mac Line 1400  int diskimage_access(struct machine *mac
1400  int diskimage_add(struct machine *machine, char *fname)  int diskimage_add(struct machine *machine, char *fname)
1401  {  {
1402          struct diskimage *d, *d2;          struct diskimage *d, *d2;
1403          int id = 0;          int id = 0, override_heads=0, override_spt=0;
1404            int64_t bytespercyl;
1405          char *cp;          char *cp;
1406          int prefix_b = 0;          int prefix_b=0, prefix_c=0, prefix_d=0, prefix_f=0, prefix_g=0;
1407          int prefix_c = 0;          int prefix_i=0, prefix_r=0, prefix_s=0, prefix_t=0, prefix_id = -1;
         int prefix_d = 0;  
         int prefix_f = 0;  
         int prefix_i = 0;  
         int prefix_r = 0;  
         int prefix_s = 0;  
         int prefix_t = 0;  
         int prefix_id = -1;  
1408    
1409          if (fname == NULL) {          if (fname == NULL) {
1410                  fprintf(stderr, "diskimage_add(): NULL ptr\n");                  fprintf(stderr, "diskimage_add(): NULL ptr\n");
# Line 1389  int diskimage_add(struct machine *machin Line 1439  int diskimage_add(struct machine *machin
1439                          case 'f':                          case 'f':
1440                                  prefix_f = 1;                                  prefix_f = 1;
1441                                  break;                                  break;
1442                            case 'g':
1443                                    prefix_g = 1;
1444                                    override_heads = atoi(fname);
1445                                    while (*fname != '\0' && *fname != ';')
1446                                            fname ++;
1447                                    if (*fname == ';')
1448                                            fname ++;
1449                                    override_spt = atoi(fname);
1450                                    while (*fname != '\0' && *fname != ';' &&
1451                                        *fname != ':')
1452                                            fname ++;
1453                                    if (*fname == ';')
1454                                            fname ++;
1455                                    if (override_heads < 1 ||
1456                                        override_spt < 1) {
1457                                            fatal("Bad geometry: heads=%i "
1458                                                "spt=%i\n", override_heads,
1459                                                override_spt);
1460                                            exit(1);
1461                                    }
1462                                    break;
1463                          case 'i':                          case 'i':
1464                                  prefix_i = 1;                                  prefix_i = 1;
1465                                  break;                                  break;
# Line 1411  int diskimage_add(struct machine *machin Line 1482  int diskimage_add(struct machine *machin
1482                  }                  }
1483          }          }
1484    
         /*  Calculate which ID to use:  */  
         if (prefix_id == -1) {  
                 int free = 0, collision = 1;  
   
                 while (collision) {  
                         collision = 0;  
                         d = machine->first_diskimage;  
                         while (d != NULL) {  
                                 if (d->id == free) {  
                                         collision = 1;  
                                         break;  
                                 }  
                                 d = d->next;  
                         }  
                         if (!collision)  
                                 id = free;  
                         else  
                                 free ++;  
                 }  
         } else {  
                 id = prefix_id;  
   
                 d = machine->first_diskimage;  
                 while (d != NULL) {  
                         if (d->id == id) {  
                                 fprintf(stderr, "disk image SCSI id %i "  
                                     "already in use\n", id);  
                                 exit(1);  
                         }  
                         d = d->next;  
                 }  
         }  
   
1485          /*  Allocate a new diskimage struct:  */          /*  Allocate a new diskimage struct:  */
1486          d = malloc(sizeof(struct diskimage));          d = malloc(sizeof(struct diskimage));
1487          if (d == NULL) {          if (d == NULL) {
# Line 1461  int diskimage_add(struct machine *machin Line 1499  int diskimage_add(struct machine *machin
1499                  d2->next = d;                  d2->next = d;
1500          }          }
1501    
1502          d->type = DISKIMAGE_SCSI;          d->type = DISKIMAGE_IDE;
         d->id = id;  
1503    
1504          /*  Special cases: some machines usually have FLOPPY/IDE, not SCSI:  */          if (machine->machine_type == MACHINE_PMAX ||
1505          if (machine->arch == ARCH_X86 ||              machine->machine_type == MACHINE_ARC)
1506              machine->machine_type == MACHINE_COBALT ||                  d->type = DISKIMAGE_SCSI;
             machine->machine_type == MACHINE_HPCMIPS ||  
             machine->machine_type == MACHINE_PS2)  
                 d->type = DISKIMAGE_IDE;  
1507    
1508          if (prefix_i + prefix_f + prefix_s > 1) {          if (prefix_i + prefix_f + prefix_s > 1) {
1509                  fprintf(stderr, "Invalid disk image prefix(es). You can"                  fprintf(stderr, "Invalid disk image prefix(es). You can"
# Line 1496  int diskimage_add(struct machine *machin Line 1530  int diskimage_add(struct machine *machin
1530           *  Is this a tape, CD-ROM or a normal disk?           *  Is this a tape, CD-ROM or a normal disk?
1531           *           *
1532           *  An intelligent guess, if no prefixes are used, would be that           *  An intelligent guess, if no prefixes are used, would be that
1533           *  filenames ending with .iso are CD-ROM images.           *  filenames ending with .iso or .cdr are CD-ROM images.
1534           */           */
1535          if (prefix_t) {          if (prefix_t) {
1536                  d->is_a_tape = 1;                  d->is_a_tape = 1;
1537          } else {          } else {
1538                  if (prefix_c ||                  if (prefix_c ||
1539                      ((strlen(d->fname) > 4 &&                      ((strlen(d->fname) > 4 &&
1540                      strcasecmp(d->fname + strlen(d->fname) - 4, ".iso") == 0)                      (strcasecmp(d->fname + strlen(d->fname) - 4, ".cdr") == 0 ||
1541                        strcasecmp(d->fname + strlen(d->fname) - 4, ".iso") == 0))
1542                      && !prefix_d)                      && !prefix_d)
1543                     ) {                     ) {
1544                          d->is_a_cdrom = 1;                          d->is_a_cdrom = 1;
# Line 1521  int diskimage_add(struct machine *machin Line 1556  int diskimage_add(struct machine *machin
1556                           */                           */
1557    
1558  #if 0  #if 0
1559                          if (machine->machine_type == MACHINE_DEC)                          if (machine->machine_type == MACHINE_PMAX)
1560                                  d->logical_block_size = 512;                                  d->logical_block_size = 512;
1561                          else                          else
1562                                  d->logical_block_size = 2048;                                  d->logical_block_size = 2048;
# Line 1532  int diskimage_add(struct machine *machin Line 1567  int diskimage_add(struct machine *machin
1567    
1568          diskimage_recalc_size(d);          diskimage_recalc_size(d);
1569    
1570          if (d->total_size == 1474560 && !prefix_i && !prefix_s)          if ((d->total_size == 720*1024 || d->total_size == 1474560
1571                || d->total_size == 2949120 || d->total_size == 1228800)
1572                && !prefix_i && !prefix_s)
1573                  d->type = DISKIMAGE_FLOPPY;                  d->type = DISKIMAGE_FLOPPY;
1574    
1575            switch (d->type) {
1576            case DISKIMAGE_FLOPPY:
1577                    if (d->total_size < 737280) {
1578                            fatal("\nTODO: small (non-80-cylinder) floppies?\n\n");
1579                            exit(1);
1580                    }
1581                    d->cylinders = 80;
1582                    d->heads = 2;
1583                    d->sectors_per_track = d->total_size / (d->cylinders *
1584                        d->heads * 512);
1585                    break;
1586            default:/*  Non-floppies:  */
1587                    d->heads = 16;
1588                    d->sectors_per_track = 63;
1589                    if (prefix_g) {
1590                            d->chs_override = 1;
1591                            d->heads = override_heads;
1592                            d->sectors_per_track = override_spt;
1593                    }
1594                    bytespercyl = d->heads * d->sectors_per_track * 512;
1595                    d->cylinders = d->total_size / bytespercyl;
1596                    if (d->cylinders * bytespercyl < d->total_size)
1597                            d->cylinders ++;
1598            }
1599    
1600          d->rpms = 3600;          d->rpms = 3600;
1601    
1602          if (prefix_b)          if (prefix_b)
# Line 1551  int diskimage_add(struct machine *machin Line 1613  int diskimage_add(struct machine *machin
1613                  exit(1);                  exit(1);
1614          }          }
1615    
1616            /*  Calculate which ID to use:  */
1617            if (prefix_id == -1) {
1618                    int free = 0, collision = 1;
1619    
1620                    while (collision) {
1621                            collision = 0;
1622                            d2 = machine->first_diskimage;
1623                            while (d2 != NULL) {
1624                                    /*  (don't compare against ourselves :)  */
1625                                    if (d2 == d) {
1626                                            d2 = d2->next;
1627                                            continue;
1628                                    }
1629                                    if (d2->id == free && d2->type == d->type) {
1630                                            collision = 1;
1631                                            break;
1632                                    }
1633                                    d2 = d2->next;
1634                            }
1635                            if (!collision)
1636                                    id = free;
1637                            else
1638                                    free ++;
1639                    }
1640            } else {
1641                    id = prefix_id;
1642                    d2 = machine->first_diskimage;
1643                    while (d2 != NULL) {
1644                            /*  (don't compare against ourselves :)  */
1645                            if (d2 == d) {
1646                                    d2 = d2->next;
1647                                    continue;
1648                            }
1649                            if (d2->id == id && d2->type == d->type) {
1650                                    fprintf(stderr, "disk image id %i "
1651                                        "already in use\n", id);
1652                                    exit(1);
1653                            }
1654                            d2 = d2->next;
1655                    }
1656            }
1657    
1658            d->id = id;
1659    
1660          return id;          return id;
1661  }  }
1662    
# Line 1558  int diskimage_add(struct machine *machin Line 1664  int diskimage_add(struct machine *machin
1664  /*  /*
1665   *  diskimage_bootdev():   *  diskimage_bootdev():
1666   *   *
1667   *  Returns the disk id (0..7) of the device which we're booting from.   *  Returns the disk id of the device which we're booting from.  If typep is
1668     *  non-NULL, the type is returned as well.
1669   *   *
1670   *  If no disk was used as boot device, then -1 is returned. (In practice,   *  If no disk was used as boot device, then -1 is returned. (In practice,
1671   *  this is used to fake network (tftp) boot.)   *  this is used to fake network (tftp) boot.)
1672   */   */
1673  int diskimage_bootdev(struct machine *machine)  int diskimage_bootdev(struct machine *machine, int *typep)
1674  {  {
1675          struct diskimage *d = machine->first_diskimage;          struct diskimage *d;
1676    
1677            d = machine->first_diskimage;
1678          while (d != NULL) {          while (d != NULL) {
1679                  if (d->is_boot_device)                  if (d->is_boot_device) {
1680                            if (typep != NULL)
1681                                    *typep = d->type;
1682                          return d->id;                          return d->id;
1683                    }
1684                  d = d->next;                  d = d->next;
1685          }          }
1686    
1687          d = machine->first_diskimage;          d = machine->first_diskimage;
1688          if (d != NULL)          if (d != NULL) {
1689                    if (typep != NULL)
1690                            *typep = d->type;
1691                  return d->id;                  return d->id;
1692            }
1693    
1694          return -1;          return -1;
1695  }  }
1696    
1697    
1698  /*  /*
1699     *  diskimage_getname():
1700     *
1701     *  Returns 1 if a valid disk image name was returned, 0 otherwise.
1702     */
1703    int diskimage_getname(struct machine *machine, int id, int type,
1704            char *buf, size_t bufsize)
1705    {
1706            struct diskimage *d = machine->first_diskimage;
1707    
1708            if (buf == NULL)
1709                    return 0;
1710    
1711            while (d != NULL) {
1712                    if (d->type == type && d->id == id) {
1713                            char *p = strrchr(d->fname, '/');
1714                            if (p == NULL)
1715                                    p = d->fname;
1716                            else
1717                                    p ++;
1718                            snprintf(buf, bufsize, "%s", p);
1719                            return 1;
1720                    }
1721                    d = d->next;
1722            }
1723            return 0;
1724    }
1725    
1726    
1727    /*
1728   *  diskimage_is_a_cdrom():   *  diskimage_is_a_cdrom():
1729   *   *
1730   *  Returns 1 if a disk image is a SCSI CDROM, 0 otherwise.   *  Returns 1 if a disk image is a CDROM, 0 otherwise.
1731   */   */
1732  int diskimage_is_a_cdrom(struct machine *machine, int scsi_id)  int diskimage_is_a_cdrom(struct machine *machine, int id, int type)
1733  {  {
1734          struct diskimage *d = machine->first_diskimage;          struct diskimage *d = machine->first_diskimage;
1735    
1736          while (d != NULL) {          while (d != NULL) {
1737                  if (d->type == DISKIMAGE_SCSI && d->id == scsi_id)                  if (d->type == type && d->id == id)
1738                          return d->is_a_cdrom;                          return d->is_a_cdrom;
1739                  d = d->next;                  d = d->next;
1740          }          }
# Line 1601  int diskimage_is_a_cdrom(struct machine Line 1745  int diskimage_is_a_cdrom(struct machine
1745  /*  /*
1746   *  diskimage_is_a_tape():   *  diskimage_is_a_tape():
1747   *   *
1748   *  Returns 1 if a disk image is a SCSI tape, 0 otherwise.   *  Returns 1 if a disk image is a tape, 0 otherwise.
1749     *
1750   *  (Used in src/machine.c, to select 'rz' vs 'tz' for DECstation   *  (Used in src/machine.c, to select 'rz' vs 'tz' for DECstation
1751   *  boot strings.)   *  boot strings.)
1752   */   */
1753  int diskimage_is_a_tape(struct machine *machine, int scsi_id)  int diskimage_is_a_tape(struct machine *machine, int id, int type)
1754  {  {
1755          struct diskimage *d = machine->first_diskimage;          struct diskimage *d = machine->first_diskimage;
1756    
1757          while (d != NULL) {          while (d != NULL) {
1758                  if (d->type == DISKIMAGE_SCSI && d->id == scsi_id)                  if (d->type == type && d->id == id)
1759                          return d->is_a_tape;                          return d->is_a_tape;
1760                  d = d->next;                  d = d->next;
1761          }          }
# Line 1625  int diskimage_is_a_tape(struct machine * Line 1770  int diskimage_is_a_tape(struct machine *
1770   */   */
1771  void diskimage_dump_info(struct machine *machine)  void diskimage_dump_info(struct machine *machine)
1772  {  {
1773          int iadd=4;          int iadd = DEBUG_INDENTATION;
1774          struct diskimage *d = machine->first_diskimage;          struct diskimage *d = machine->first_diskimage;
1775    
1776          while (d != NULL) {          while (d != NULL) {
# Line 1656  void diskimage_dump_info(struct machine Line 1801  void diskimage_dump_info(struct machine
1801                  else                  else
1802                          debug("%lli MB", (long long) (d->total_size / 1048576));                          debug("%lli MB", (long long) (d->total_size / 1048576));
1803    
1804                  debug(" (%lli sectors)%s\n",                  if (d->type == DISKIMAGE_FLOPPY || d->chs_override)
1805                      (long long) (d->total_size / 512),                          debug(" (CHS=%i,%i,%i)", d->cylinders, d->heads,
1806                      d->is_boot_device? " (BOOT)" : "");                              d->sectors_per_track);
1807                    else
1808                            debug(" (%lli sectors)", (long long)
1809                               (d->total_size / 512));
1810    
1811                    if (d->is_boot_device)
1812                            debug(" (BOOT)");
1813                    debug("\n");
1814    
1815                  debug_indentation(-iadd);                  debug_indentation(-iadd);
1816    

Legend:
Removed from v.4  
changed lines
  Added in v.22

  ViewVC Help
Powered by ViewVC 1.1.26