erichelgeson / BlueSCSI

A small SCSI device based on stm32
Other
386 stars 61 forks source link

NEXTSTEP bootloader doesn't like BlueSCSI default hard drive geometry. #242

Open Spaceballs3000 opened 1 year ago

Spaceballs3000 commented 1 year ago

On my HP 9000 712 I can install NEXTSTEP 3.3 to BlueSCSI drive at ID6 (via BlueSCSI cdrom ID3), but when it tries to boot from it (ID6). It will fail due to it's default hard drive geometry given by BlueSCSI, if i manually set it to 139 Sectors, and 4 heads (code below) it then will boot fine.

    case SCSI_SENSE_MODE_FORMAT_DEVICE:  //Drive parameters
      m_buf[a + 0] = SCSI_SENSE_MODE_FORMAT_DEVICE; //Page code
      m_buf[a + 1] = 0x16; // Page length
      if(pageControl != 1) {
        m_buf[a + 11] = 139;//Number of sectors / track
        m_buf[a + 12] = (byte)(dev->m_blocksize >> 8);
        m_buf[a + 13] = (byte)dev->m_blocksize;
        m_buf[a + 15] = 0x1; // Interleave
      }
      a += 0x18;
      if(pageCode != SCSI_SENSE_MODE_ALL) break;

    case SCSI_SENSE_MODE_DISK_GEOMETRY:  //Drive parameters
      m_buf[a + 0] = SCSI_SENSE_MODE_DISK_GEOMETRY; //Page code
      m_buf[a + 1] = 0x16; // Page length
      if(pageControl != 1) {
        unsigned cylinders = dev->m_blockcount / (4 * 139);
        m_buf[a + 2] = (byte)(cylinders >> 16); // Cylinders
        m_buf[a + 3] = (byte)(cylinders >> 8);
        m_buf[a + 4] = (byte)cylinders;
        m_buf[a + 5] = 4;   //Number of heads
      } else {
        m_buf[a + 2] = 0xFF; // Cylinder length
        m_buf[a + 3] = 0xFF;
        m_buf[a + 4] = 0xFF;
        m_buf[a + 5] = 4;   //Number of heads
      }
      a += 0x18;
      if(pageCode != SCSI_SENSE_MODE_ALL) break;
    case SCSI_SENSE_MODE_FLEXABLE_GEOMETRY:
      m_buf[a + 0] = SCSI_SENSE_MODE_FLEXABLE_GEOMETRY;
      m_buf[a + 1] = 0x1E;  // Page length
      if(pageControl != 1) {
        m_buf[a + 2] = 0x03; 
        m_buf[a + 3] = 0xE8; // Transfer rate 1 mbit/s
        m_buf[a + 4] = 4; // Number of heads
        m_buf[a + 5] = 139; // Sectors per track
        m_buf[a + 6] = (byte)dev->m_blocksize >> 8;
        m_buf[a + 7] = (byte)dev->m_blocksize & 0xff;  // Data bytes per sector
      }
erichelgeson commented 1 year ago

Thanks for the report and the solution! Having a geometry that works for every situation seems to be difficult as there are a lot of assumptions and restrictions depending on the OS. We can consider making this configurable now that we have an ini configuration file in main - or a "more right" default.