October 27, 2008

USB Mass Storage

Moin.

Since I have signed for the USB Mass Storage bounty, I started to toy with the USB manuals, AROS' USB stack and Efika. During my coding evening it suddenly turned out, that I've lost the bits and pieces of AROS USB code which were responsible for Bulk transfers. Funny. They were there a very long time ago, among my sources, now they were gone.

Whatever. I've added the bulk transfer support to USB stack implemented it in both OHCI and UHCI driver (the support for UHCI will follow shortly) and wrote the first bits and pieces of mass storage class. Here's the result:


[USB] USB::NewDevice()
[USB] Trying external class "hid.hidd"
[USB] Trying external class "storage.hidd"
[MSS] MatchCLID(0x8ed55, 0x89d74)
[MSS] UDCLASS_IN_INTERFACE OK. Checking interface 0
[MSS] iface 0 @ 0x89d7d class 8 subclass 6 protocol 80
[MSS] Interface may be handled by Mass Storage Class
[MSS] Lucky you. The device supports Bulk Only transport
[MSS] Protocol used: SCSI complete
[MSS] Pick me! Pick me! Pick me! I can handle it!
[USB] clid = 0xff93ede4
[MSS] Storage::New()
[USB] USBDevice::New()
[USBDevice::New] Device 0165:1307 00/00/00 at address 0008c314:02
[USBDevice::New] Default LangID=0904
[USBDevice::New] iProduct = "USB Flash Disk"
[USBDevice::New] iManufacturer = "General"
[USBDevice::New] iSerial = "4b25950686c791"
[MSS] GetMaxLUN returns 0
[MSS] Interface is supposed to have 3 endpoints
[MSS] OUT endpoint found
[MSS] IN endpoint found
[MSS] DirectSCSI -> (43425355,00000001,00000008,00,80,0a)
[MSS] DirectSCSI <- (53425355,00000001,00000000,00)
[MSS] Detected capacity: 964MB
[MSS] DirectSCSI -> (43425355,00000002,00000400,00,80,0a)
[MSS] DirectSCSI <- (53425355,00000002,00000000,00)
[MSS] 0000: eb 3c 90 4d 53 44 4f 53 35 2e 30 00 02 20 01 00 .<.MSDOS5.0.. ..
[MSS] 0010: 02 00 02 00 00 f8 f1 00 3f 00 ff 00 00 00 00 00 ........?.......
[MSS] 0020: 00 20 1e 00 00 00 29 b6 3b 10 80 4e 4f 20 4e 41 . ....).;..NO NA
[MSS] 0030: 4d 45 20 20 20 20 46 41 54 31 36 20 20 20 33 c9 ME FAT16 3.
[MSS] 0040: 8e d1 bc f0 7b 8e d9 b8 00 20 8e c0 fc bd 00 7c ....{.... .....|
[MSS] 0050: 38 4e 24 7d 24 8b c1 99 e8 3c 01 72 1c 83 eb 3a 8N$}$....<.r...:
[MSS] 0060: 66 a1 1c 7c 26 66 3b 07 26 8a 57 fc 75 06 80 ca f..|&f;.&.W.u...
[MSS] 0070: 02 88 56 02 80 c3 10 73 eb 33 c9 8a 46 10 98 f7 ..V....s.3..F...
[MSS] 0080: 66 16 03 46 1c 13 56 1e 03 46 0e 13 d1 8b 76 11 f..F..V..F....v.
[MSS] 0090: 60 89 46 fc 89 56 fe b8 20 00 f7 e6 8b 5e 0b 03 `.F..V.. ....^..
[MSS] 00a0: c3 48 f7 f3 01 46 fc 11 4e fe 61 bf 00 00 e8 e6 .H...F..N.a.....
[MSS] 00b0: 00 72 39 26 38 2d 74 17 60 b1 0b be a1 7d f3 a6 .r9&8-t.`....}..
[MSS] 00c0: 61 74 32 4e 74 09 83 c7 20 3b fb 72 e6 eb dc a0 at2Nt... ;.r....
[MSS] 00d0: fb 7d b4 7d 8b f0 ac 98 40 74 0c 48 74 13 b4 0e .}.}....@t.Ht...
[MSS] 00e0: bb 07 00 cd 10 eb ef a0 fd 7d eb e6 a0 fc 7d eb .........}....}.
[MSS] 00f0: e1 cd 16 cd 19 26 8b 55 1a 52 b0 01 bb 00 00 e8 .....&.U.R......
[MSS] 0100: 3b 00 72 e8 5b 8a 56 24 be 0b 7c 8b fc c7 46 f0 ;.r.[.V$..|...F.
[MSS] 0110: 3d 7d c7 46 f4 29 7d 8c d9 89 4e f2 89 4e f6 c6 =}.F.)}...N..N..
[MSS] 0120: 06 96 7d cb ea 03 00 00 20 0f b6 c8 66 8b 46 f8 ..}..... ...f.F.
[MSS] 0130: 66 03 46 1c 66 8b d0 66 c1 ea 10 eb 5e 0f b6 c8 f.F.f..f....^...
[MSS] 0140: 4a 4a 8a 46 0d 32 e4 f7 e2 03 46 fc 13 56 fe eb JJ.F.2....F..V..
[MSS] 0150: 4a 52 50 06 53 6a 01 6a 10 91 8b 46 18 96 92 33 JRP.Sj.j...F...3
[MSS] 0160: d2 f7 f6 91 f7 f6 42 87 ca f7 76 1a 8a f2 8a e8 ......B...v.....
[MSS] 0170: c0 cc 02 0a cc b8 01 02 80 7e 02 0e 75 04 b4 42 .........~..u..B
[MSS] 0180: 8b f4 8a 56 24 cd 13 61 61 72 0b 40 75 01 42 03 ...V$..aar.@u.B.
[MSS] 0190: 5e 0b 49 75 06 f8 c3 41 bb 00 00 60 66 6a 00 eb ^.Iu...A...`fj..
[MSS] 01a0: b0 4e 54 4c 44 52 20 20 20 20 20 20 0d 0a 4e 54 .NTLDR ..NT
[MSS] 01b0: 4c 44 52 20 69 73 20 6d 69 73 73 69 6e 67 ff 0d LDR is missing..
[MSS] 01c0: 0a 44 69 73 6b 20 65 72 72 6f 72 ff 0d 0a 50 72 .Disk error...Pr
[MSS] 01d0: 65 73 73 20 61 6e 79 20 6b 65 79 20 74 6f 20 72 ess any key to r
[MSS] 01e0: 65 73 74 61 72 74 0d 0a 00 00 00 00 00 00 00 00 estart..........
[MSS] 01f0: 00 00 00 00 00 00 00 00 00 00 00 ac bf cc 55 aa ..............U.


With a bit of luck mass storage bounty will be completed next week :)

October 22, 2008

YASU - Yet Another Status Update

Hello there,

There is actually not much to tell you, except the small status update :)

The development of AROS for Efika is an interesting coding experience. Some parts come without any trouble, and are ready to use, stable and usable just out of the box. Others require a bit more patience and documentation reading.

I have put a whole bunch of modules into the Efika kernel and they do seem to work properly. As I wrote the last entry in my blog, efika kernel consisted of 23 modules. Now, there are 40! All of them seem to work :-D. The PCI driver for MPC5200B successfully scans the PCI bus full of interesting devices

[PCI] Adding driver PCINative (Efika5200 native direct access PCI driver) to the system  
[PCI] Scanning bus 0  
[PCIDevice] 00.10.0 = 1002:5960 (Video PC Compatible VGA)  
[PCIDevice] 00.10.1 = 1002:5940 (Video Other )  
[PCIDevice] 00.1c.0 = 1057:5809 (Bridge Other )  
[PCI_Efika] All OK 

The ATI hidd communicates with my TFT monitor using our I2C class.

calling InitResident("radeon.hidd", NULL)  
[ATI] Init  
[timer] OpenDevice(0)  
[ATI] Enumerator: checking productid 5960 vendorid 1002 00008904  
[ATI] Enumerator: found productid 5960 vendorid 1002 masked_check 0  
[KRN] KrnMapGlobal(80000000->80000000 08000000 0305)  
[ATI] Got framebuffer @ 80000000 (size=128MiB)  
[KRN] KrnMapGlobal(88000000->88000000 00010000 0305)  
[ATI] Got registers @ 88000000 (size=64KiB)  
[ATI] RomBase provided by ATI card: 88020000  
[KRN] KrnMapGlobal(88020000->88020000 00020000 0305)  
[ATI] Got BIOS @ 88020000 (size=128KiB)  
[ATIBMP] Bitmap at 0x6e640, size 16384 bytes (131072 bits)  
[ATI] Video BIOS not detected in PCI space!  
[ATI] Attempting to read Video BIOS using openfirmware  
[OF] OpenKey('/pci/display')  
[OF] looking for child 'pci'  
[OF] looking for child 'display'  
[ATI] OF reported BIOS at ff1039b8  
[ATI] Legacy BIOS detected  
[ATI] Connector0: DDCType-2, DACType-1, TMDSType-0, ConnectorType-3  
[ATI] Connector1: DDCType-3, DACType-0, TMDSType--1, ConnectorType-2

The timer.device is ready and working. It uses slice timer which, at 33MHz timebase clock, has a minimal resolution of 7 microseconds. If it will be insufficient then I will try to change the clock used. Beloved dos.library complains that no bootable volumes have been found:

[DOS] __dosboot_IntBoot: Could not open bootmenu.resource, something's wrong!  
[timer] OpenDevice(1)  
[DOS] __dosboot_IntBoot: Checking MountList for useable nodes:  
No bootable disk was found.  
Please insert a bootable disk in any drive.  
Retrying in 5 seconds...

The USB stack is working. It has found my USB stick, yet it is unsupported :))

[USBDevice::New] Address=02, Interface=00, Bus=0x899e4, Hub=0x899e4 
[USBDevice::New] Device 1d00:13fe 00/00/00 at address 000899e4:02  
[USBDevice::New] Default LangID=0904  
[USBDevice::New] iProduct = "DataTraveler 2.0"  
[USBDevice::New] iManufacturer = "Kingston"  
[USBDevice::New] iSerial = "5B72059F82DF"  
[USB] USBDevice::New() = 0x94804  

The Efikas MPC5200B CPU has built in OHCI USB controller. Yay! That was fun! Allthough all usual OHCI controllers work in little-endian mode (even the one in PPC based Sam440/Pegasos/AmigaOne and others!!). MPC5200B is different. Here, the whole OHCI chip is a big endian beast. Respect! And wasted time for me ;)

In order to complete the Efika bounty, I need to do

  • ata.device specific for MPC5200B. If I will do my best, DMA transfers will work.
  • Network driver for Efika. The rest of TCP/IP stack is already there.

But hey! How will you install AROS on harddrive then? Tftpboot? Hard to do. Remove harddrive and use another machine? Almost impossible and stupid. Well?...

There is a way. Allthough the Poseidon bounty is open, I cannot wait for this bounty. Instead, I will apply for the bounty number 25. What do you think about? Am I cruel? Evil? Will my work on USB mass storage be pointless in spite of Poseidon? Tell me what you think about - I'm ready for all kinds of criticism ;)

During next few days I will consider what has a higher priority right now: USB Mass Storage or ATA. 

Cheers :)

Labels: , ,