Re: [hatari-devel] ACSI: READ/WRITE (10) incorrectly evaluate block number

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hi Thomas,

> No, I think the problem is something else - as far as I understand that
> code, HDC_GetOffset is supposed to return the offset in bytes - that's
> why it shifts the value by 9 bit, it "multiplies" it with the sector
> size of 512.
> 
> I think you rather run into integer overflow problems here.
> nLastBlockAddr is only a 32-bit value, and fseek also does not support big
> files ... so you certainly run into problems when your HD image is
> bigger than 2 GB. Did you also tried with images > 1 GB but < 2 GB? I'd
> expect that at least all images < 2 GB would work.

I see your point with the 9 bit shift, but I stumbled upon this problem when
reading the root sector of an image < 1 GB. I read the root sector with
READ (6) and READ (10) and compared the returned data. They differed,
but only when reading data from ACSI. When reading from an emulated IDE
drive and a real ACSI bus everything is fine, so I don't think my testing
code is wrong.

> Anyway, if I find some spare time at the weekend, I'll try to clean
> up that mess, e.g. by using fseeko() instead of fseek() everywhere...

This may be some kind of overflow, indeed. But because the root sector
was affected it might be related to something else than fseek(). As
removing the shift appeared to solve the problem it looks as if 

By the way, the Additional Length field returned by INQUIRY is still 26,
i. e. less than 31, even though 31 is the minimum number mandated by the
standard. The total minimum number of bytes INQUIRY should return is 36,
which means Additional Length should be at least 31. If I counted
correctly currently the actual number of bytes returned are 38, by the
way. If it supposed to stay this way Additional Length would have to be 33.

There are also other problems, see the "Atari ACSI (ICD") section in the
attached logfile, compared with the "Atari IDE" section. When running the
same test again there are even more errors, e. g. the device name is garbled,
and I have to restart (not just reset) Hatari in order to get a meaningful
result again. I guess memory is overwritten somewhere.

If I find the time I might also look into these things.

Take care

Uwe
Found SCSI Driver version $0101

Buses:
  ID: 0, Name: 'Atari ACSI', Transfer length: 130560 ($1FE00)
  ID: 1, Name: 'Atari SCSI', Transfer length: 268435456 ($10000000)
  ID: 2, Name: 'Atari IDE', Transfer length: 130560 ($1FE00)

Testing bus 'Atari ACSI (ICD)', device ID 0
  CheckDev()
    Checking with illegal bus ID
    Checking with illegal SCSI ID
    Checking with legal bus and SCSI ID
  Open/Close()
    Available handles: 29
  INQUIRY
    Calling with legal data
      Device name: 'Hatari  Emulated    ', Additional length: $1C
      ERROR: Additional length must be at least $1F    Calling with non-existing LUN 7
  READ CAPACITY
    Reading capacity with READ CAPACITY (10)
    Reading capacity with READ CAPACITY (16)
    Reading last block (201351221)
    Reading last block + 1 (201351222)
    ERROR: Call was not properly rejected
      Expected: SenseKey $05 ($00), ASC $21 ($00)
  READ
    Reading block 0 with READ (6)
    Reading block 0 with READ (10)
    ERROR: Block contents differ at offset 1
  REPORT LUNS
    Number of LUNs: 32
      List of LUNs: 1919492096, 64918, 4017186, 3983750, 4017138, 7, 393277, 2359296, 1, 16, 201351222, -2013265920, 0, 671088640, 16779264, 0, 22360, 79084, 3971236, 0, 512, 0, 4017264, 3984508, 3970812, 0, 0, 0, 0, 0, 0, 0
ERROR

Testing bus 'Atari SCSI', device ID 7
  CheckDev()
    Checking with illegal bus ID
    Checking with illegal SCSI ID
    Checking with legal bus and SCSI ID
  Open/Close()
    Available handles: 29
  INQUIRY
    Calling with legal data
      Device name: 'USEIMET HDDRIVER        ', Additional length: $1F
    Calling with non-existing LUN 7
OK

Testing bus 'Atari IDE', device ID 0
  CheckDev()
    Checking with illegal bus ID
    Checking with illegal SCSI ID
    Checking with legal bus and SCSI ID
  Open/Close()
    Available handles: 29
  INQUIRY
    Calling with legal data
      Device name: 'Hatari IDE master disk  ', Additional length: $1F
    Calling with non-existing LUN 7
  READ CAPACITY
    Reading capacity with READ CAPACITY (10)
    Reading capacity with READ CAPACITY (16)
      READ CAPACITY (16) is not supported
    Reading last block (800351)
    Reading last block + 1 (800352)
  READ
    Reading block 0 with READ (6)
    Reading block 0 with READ (10)
    Reading block 0 with READ (16)
      READ (16) is not supported
    Reading block 0 to odd address
    Reading block 0 from non-existing LUN 7
  REPORT LUNS
    Number of LUNs: 1
      List of LUNs: 0
OK

Testing bus 'Atari IDE', device ID 1
  CheckDev()
    Checking with illegal bus ID
    Checking with illegal SCSI ID
    Checking with legal bus and SCSI ID
  Open/Close()
    Available handles: 29
  INQUIRY
    Calling with legal data
      Device name: 'Hatari IDE slave disk   ', Additional length: $1F
    Calling with non-existing LUN 7
  READ CAPACITY
    Reading capacity with READ CAPACITY (10)
    Reading capacity with READ CAPACITY (16)
      READ CAPACITY (16) is not supported
    Reading last block (507023)
    Reading last block + 1 (507024)
  READ
    Reading block 0 with READ (6)
    Reading block 0 with READ (10)
    Reading block 0 with READ (16)
      READ (16) is not supported
    Reading block 0 to odd address
    Reading block 0 from non-existing LUN 7
  REPORT LUNS
    Number of LUNs: 1
      List of LUNs: 0
OK


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/