English Amiga Board


Go Back   English Amiga Board > Support > support.Hardware

 
 
Thread Tools
Old 02 April 2008, 17:21   #1
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 45
Posts: 23,816
Amiga IDE LBA48 patch

I found something interesting when I was implementing LBA48 support to IDE emulation. OS3.9BB2 scsi.device (v43.43) does have LBA48 support but it has bug that freezes or crashes the Amiga..

I fixed the bug (patch details below) and now (at least in emulation) my A1200 IDE 160G test hard file works perfectly with full capacity.

This may also fix common v43.43 scsi.device boot freeze if drive has LBA48 support. (but older scsi.device versions work). Confirmation needed.

Patch is compatible with all v43.43 scsi.devices (A600/A1200/A4000)

Please test if you have >128G IDE drive and/or you have boot freeze without NOROMUPDATES or SKIPROMUPDATES scsi.device

Patch offsets in OS39BB2 "ROM Updates" file (near "Conner Peripherals 20MB - CP2024" string)
31A2C
358AC
3DACA

Old values:
43FA 000E 3219 B001 66FA E049 3001 4E75
0220 02C4 0430 04C5 02EC 0450 0070 0010
0091 00C6 0040 0090 0000
New values:
43FA 0018 7200 0C11 00FF 6606 5289 1219
6704 B019 66F0 3001 4E75 FF02 C429 2024
ECFF 04C5 3930 3450 FF00

Also spatch-patch file attached if you don't want to do manual patching (patches OS39BB2 "DEVS:AmigaOS ROM Update". Remember backups)

WARNING: Patching HD drivers is always dangerous, data loss is always possibility.

Next follows my random notes, no need to understand this

Old code that returns garbage after LBA48 command:

10FEF2A0 43fa 000e LEA.L (PC,$000e) == $10fef2b0,A1
10FEF2A4 3219 MOVE.W (A1)+,D1
10FEF2A6 b001 CMP.B D1,D0
10FEF2A8 66fa BNE.B #$fffffffa == $10FEF2A4
10FEF2AA e049 LSR.W #$00000008,D1
10FEF2AC 3001 MOVE.W D1,D0
10FEF2AE 4e75 RTS.L

10FEF2B0 0220 02C4 0430 04C5 02EC 0450 0070 0010
10FEF2C0 0091 00C6 0040 0090 0000

20 = read sectors
c4 = read multiple
30 = write sectors
c5 = write multiple
ec = identify drive
50 = format
70 = seek
10 = recalibrate
91 = initialize drive parameters
c6 = set multiple mode
40 = read verify sectors
90 = execute drive diagnostics
00 = nop

New code (different because space was really tight..)

43FA 0018 lea data(pc),a1
7200 moveq #0,d1
0C11 00FF l1 cmp.b #$ff,(a1)
6606 bne.s l2
5289 addq.l #1,a1
1219 move.b (a1)+,d1
6704 beq.s l3
B019 l2 cmp.b (a1)+,d0
66F0 bne.s l1
3001 l3 move.w d1,d0
4E75 rts
dat dc.b 0xff,0x02,0xc4,0x29,0x20,0x24,0xec
dc.b 0xff,0x04,0xc5,0x39,0x30,0x34,0x50
dc.b 0xff,0x00

This adds following missing LBA48 commands:

29 = read multiple ext
39 = write multiple ext
24 = read sectors ext
34 = write sectors ext

Meaning of this table is to return 2 (if read command), 4 (if write command) or 0 (no data).
Someone simply forgot to add new LBA48 commands to this table when LBA48 support was implemented..
Attached Files
File Type: zip scsi.device.lba48.pch.zip (335 Bytes, 919 views)

Last edited by Toni Wilen; 03 April 2008 at 16:09.
Toni Wilen is offline  
Old 02 April 2008, 17:27   #2
keropi
.
 
Join Date: Oct 2004
Location: Ioannina/Greece
Posts: 5,040
amazing
keropi is offline  
Old 02 April 2008, 17:37   #3
Calgor
(Amigas && Amigos)++

Calgor's Avatar
 
Join Date: Sep 2005
Location: Anrea
Posts: 998
WOW, this must be the reason BB2 ROM Update did not work on my A4000D causing it to hang while booting, and why it worked on my A4000T as I then had another >128GB drive connected to the UWSCSI instead of the IDE! And it did work when I skipped the scsi update.

I have to get it out of storage to try it - I hope it still has that same hard drive in it.

By your comments Toni, I guess they didn't have a proper regression test suite.

EDIT: Here is the old thread of which includes my hard drive problems, which sounds like it may all have been due to this bug. Refer to post 36 for the same symptom, other posts before possible hard drive symptoms cause by same bug, and posts after for trying to find solution. Yes the thread reminds me why I switched to an A4000T:
http://eab.abime.net/showthread.php?t=22181

Last edited by Calgor; 02 April 2008 at 17:49.
Calgor is offline  
Old 03 April 2008, 00:10   #4
alexh
Thalion Webshrine
alexh's Avatar
 
Join Date: Jan 2004
Location: Oxford
Posts: 12,358
Good work.

It is so strange, this topic was active only the other week after someone posted incorrectly that this was a hardware limitation, and I spent too much time ranting about how it needed to use the EXT commands ;-)

Ah, 0x25, 0x35 (They are the DMA ones rather than PIO) etc. I've spent too much time looking at this while developing SATA RAID controllers.
alexh is offline  
Old 03 April 2008, 08:34   #5
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 45
Posts: 23,816
Quote:
Originally Posted by alexh View Post
It is so strange, this topic was active only the other week after someone posted incorrectly that this was a hardware limitation, and I spent too much time ranting about how it needed to use the EXT commands ;-)
This time (or was it?!) it was just a coincidence, I read some rumours about OS39BB2 scsi.device having LBA48 support. I wanted to confirm that rumour but I didn't want to implement LBA48 without some help. Finally few days ago I accidentally noticed Bochs having LBA48 support.
Toni Wilen is offline  
Old 03 April 2008, 10:10   #6
alexh
Thalion Webshrine
alexh's Avatar
 
Join Date: Jan 2004
Location: Oxford
Posts: 12,358
http://eab.abime.net/showthread.php?...hlight=pio+ext
http://eab.abime.net/showthread.php?...hlight=pio+ext

Thomas noted in one of the threads I was talking about LB48 last month that the change log for scsi.device in BB2 had LBA48 but it didnt work. Maybe that was your inspiration? It doesnt really matter.

Again very nice work. I really disliked that Elbox would try to charge a premium for LBA48 on their IDE splitter which obviously connected to the internal IDE adapter!

Last edited by alexh; 03 April 2008 at 10:22.
alexh is offline  
Old 03 April 2008, 10:25   #7
keropi
.
 
Join Date: Oct 2004
Location: Ioannina/Greece
Posts: 5,040
so... any chance of posting the modified amigaosromupdate? or the spatch for it?
I feel a little uncofortable patching it manual, this a very sensitive part
keropi is offline  
Old 03 April 2008, 11:34   #8
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 45
Posts: 23,816
Quote:
Originally Posted by keropi View Post
so... any chance of posting the modified amigaosromupdate? or the spatch for it?
I feel a little uncofortable patching it manual, this a very sensitive part
I thought I attached it.. Will be fixed later today.
Toni Wilen is offline  
Old 03 April 2008, 16:09   #9
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 45
Posts: 23,816
Patch attached.
Toni Wilen is offline  
Old 05 April 2008, 15:48   #10
thomas
Registered User
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 6,010
Quote:
Please test if you have >128G IDE drive and/or you have boot freeze without NOROMUPDATES or SKIPROMUPDATES scsi.device
I just tested a 250GB drive on my A4000.

First of all, scsi.device does *not* crash as soon as the drive is connected. I could successfully install the drive and create a small boot partition.

The crash only happens if I create a partition above the 128 GB border. And I can simply disable this partition in the early startup menu in order to boot.

However, your patch works perfectly. I didn't see any problem yet.
thomas is offline  
Old 05 April 2008, 15:57   #11
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 45
Posts: 23,816
Quote:
Originally Posted by thomas View Post
a partition above the 128 GB border. And I can simply disable this partition in the early startup menu in order to boot.
Ah, that explains it. hdtoolbox version I used automatically created partitions (19 8G partitions..) so that explains the immediate crash after initialization and reboot.
Toni Wilen is offline  
Old 12 May 2008, 13:19   #12
gunatm
Junior Member
gunatm's Avatar
 
Join Date: Aug 2002
Location: Hamburg (Germany)
Age: 45
Posts: 84
Send a message via ICQ to gunatm Send a message via AIM to gunatm Send a message via MSN to gunatm
Thanx a lot!
gunatm is offline  
Old 14 May 2008, 05:41   #13
rkauer
I hate potatos and shirts
rkauer's Avatar
 
Join Date: Oct 2007
Location: Sao Leopoldo / Brazil
Age: 54
Posts: 3,482
Send a message via MSN to rkauer Send a message via Yahoo to rkauer
Quote:
Originally Posted by Toni Wilen View Post
Ah, that explains it. hdtoolbox version I used automatically created partitions (19 8G partitions..) so that explains the immediate crash after initialization and reboot.
Toni, thanks a lot for your effort.

Now finally we can use any HD in the market inside the Amiga.

Of course: now we need a new hdtoolbox to use the full space provided by your patch.

@ All coders: we need your help!
rkauer is offline  
Old 14 May 2008, 06:50   #14
Calgor
(Amigas && Amigos)++

Calgor's Avatar
 
Join Date: Sep 2005
Location: Anrea
Posts: 998
What is the limit in hard drive size to this implementation of LBA48? I ask because not all LBA48 implementations are the same.
Calgor is offline  
Old 14 May 2008, 09:07   #15
alexh
Thalion Webshrine
alexh's Avatar
 
Join Date: Jan 2004
Location: Oxford
Posts: 12,358
Eh? If they are not 48-bit LBA then surely they are not LBA48?

144 petabytes (144,000,000 gigabytes)
alexh is offline  
Old 14 May 2008, 10:26   #16
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 45
Posts: 23,816
Quote:
Originally Posted by rkauer View Post
Of course: now we need a new hdtoolbox to use the full space provided by your patch.
HDToolbox works fine (at least up to 160G) Some version create stupid default partitions but just manually delete them before creating "real" partitions.

Quote:
What is the limit in hard drive size to this implementation of LBA48? I ask because not all LBA48 implementations are the same.
No idea, my patch is very simple fix and has nothing to do with scsi.device's lba48 implementation but I guess there will be 32-bit block counter overflows if harddrive size is more than few terabytes. Will confirm later with huge hardfiles
Toni Wilen is offline  
Old 14 May 2008, 10:42   #17
Calgor
(Amigas && Amigos)++

Calgor's Avatar
 
Join Date: Sep 2005
Location: Anrea
Posts: 998
Thanks Toni.

As of sometime last year, the Elbox LBA48 driver for FastATA MK-III only handled drives up to 2TB (32 bits - signed?, not 48). It may already have been updated for all I know along with the recent OS4 version updates now that we are going to be having drives of that size soon enough.

EDIT: 32 bits for sectors of 512 bytes = 2TB

Last edited by Calgor; 16 May 2008 at 16:28.
Calgor is offline  
Old 15 May 2008, 17:44   #18
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 45
Posts: 23,816
Tested: HDToolbox and HDInstTools (6.9) don't work very well with 1T+ drives..

Any other (non-ancient) partitioning programs?
Toni Wilen is offline  
Old 30 September 2008, 11:14   #19
wizard66
FPGA Replay inside A590
wizard66's Avatar
 
Join Date: Sep 2004
Location: Spijkenisse/Netherlands
Age: 54
Posts: 294
Sorry for this stupid question, but how to apply this patch ?

I'm lost

Last edited by wizard66; 30 September 2008 at 12:56.
wizard66 is offline  
Old 30 September 2008, 18:14   #20
hit
Registered User
 
Join Date: Jun 2008
Location: planet earth
Posts: 1,115
get the aminet patch: http://aminet.net/package/driver/media/SCSI4345p
its the same, same author and it has all you need, incl. description on how to patch it. hope this helps.

Edit: you need this too: http://aminet.net/package/util/boot/LoadModule
contains the ExtractModule tool. see SCSI4345p.readme

Last edited by hit; 30 September 2008 at 18:20.
hit is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Amiga 1200 floppy drive No click patch beejack request.Apps 27 17 April 2020 09:56
issues cf ide pcmcia cfs fat95 x4 ide jimmer78 support.Hardware 9 29 April 2010 00:15
three in one? (SCSI Patch,Mac Patch,MapRom) RogerWilco09 support.Apps 0 05 May 2009 16:56
HELP! CD to IDE Through SCSI to IDE (IDSC21-E) ON A2091 kjmann14 support.Hardware 1 04 May 2009 07:54
SCSI-IDE bridge + IDE to CF adapter - How can I make a backup? Tuffy New to Emulation or Amiga scene 2 02 April 2008 21:14

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 06:01.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Page generated in 0.09389 seconds with 15 queries