One tiny fix…

… and suddenly everything goes better 🙂

as you may remember, I have released a test pre-alpha iso with AROS for Efika recently. However, there were some issues with using it. Some people tried to boot it from DVD-USB devices, some tried USB Flash Keys. The former succeeded mostly (but not always) whereas the latter failed pathetically. I was scratching my head and found no sane solution. Once, being completely desperate, I have enabled full debug of OHCI driver, in order to see every single transfer description used by all USB devices in the system. There was it! In some cases, OHCI chip was instructed to read 512 bytes starting from physical address 0xffffffff. That cannot be and it couldn’t work. At that point the reason of OHCI hanging was known. But why was it like this???

Well, the answer surprised me a bit. The issue was the sign extension during APTR to uint64_t cast. At some moment, AROS wanted to read from all bootable devices the first sector into it’s local table in .bss section. Since that piece of code belongs to kernel, the virtual address of this portion of memory was somewhere around 0xff7f0000. Sign extended address, 0xffffffffff7f0000 was of course not found in the MMU hash table and the KrnVirtualToPhysical() call failed. Sign expansion fixed, et voilà! All the issues with mass storage are gone.

For those who do not own an Efika, a tiny screenshot:

here, you can see the PCI Tool (doesn’t show much because the most of Efika devices are on MPC5200B SoC), the screenshot tool itself, About AROS window with the mysterious “chrp-ppc Build efika”, and shell. I wanted to show you there, where the SYS: assign is pointing to. The volume labeled AROS: is a boot device named UH0. This is the USB flash key. The USB1: device is my DVD drive connected throughout USB bus.

The torrent file is here, if anyone of you is willing to test it. Keep in mind I have toyed with scheduler there. If it does not work smooth for you, let me know. If it works well, let me know too. If the iso fails on your machine, do not hesitate writing me about (in such case try to provide the debug log, if you can).

PS. If the boot starts before the USB key is enumerated, it will not be bootable for AROS. It sucks, but that’s the way AROS boots (some people are considering few changes there). In such case, you may add a command line option, eg. bootdelay=5 will introduce additional delay of 5 seconds right before booting. The iso has a bootdelay of 3 seconds by default, because all my USB devices attached to efika (keyboard, mouse, flash key and DVD) are sitting on a hub.

Coincidence, or MassStorage contd.

Every modern USB presents itself as a SCSI conforming bulk-only mass storage device to the system. Therefore, in order to do any IO operations, I have had to do them in the old good SCSI style. Therefore, the mass storage class do contain a DirectSCSI method and exposes it to rest of the world.

What a coincidence! I have added a few-lines long implementation of HD_SCSICMD to the .device layer of mass storage. I have started AROS in QEMU and forwarded the USB->PATA converter with a DVD attached to it and AROS CD inside (I didn’t want to test anything special, but it was the first CD I saw on the desktop). AROS booted and stopped. Then, the timeout errors appeared. A lot of them. A bit disappointed I’ve left my desk and did something else. Suddenly, the CD started to spin and AROS booted from USB CD device! Great!

A short investigation showed, that the CD filesystem used in AROS performs the INQUIRY SCSI command with a fixed size, whereas the USB protocol provides a much shorter data in return, which leads to a timeout. Then, it tries to get the full-sized TOC and such. Anyway, AROS team will either need to fix CD filesystem a bit, or I will have to give up 10 second timeouts in mass storage and introduce four pipes there: two of them with very short timeout (100 miliseconds or so) and two with the 10 second timeout.

So, now the mass storage can not only access any USB sticks and USB harddrives, but also USB CD/DVD readers and burners. Nice, isn’t it? 🙂 The next step: booting Efika CD directly 🙂

Back to Efika

Good Day Everyone!

After my last fights with the USB Mass Storage bounty I have decided to take a break there and continue with AROS port for Efika. The Mass Storage is basically ready, at least in my eyes, since I do lack the hardware where the whole USB stack makes any issues at all. It works here with two PC’s I own and with two virtual machines: QEMU and VmWare Player.

Anyway, I’m back with Efika right now. I took my freshly written mass storage class, fixed the OHCI driver again (it uses the physical address provided by the CachePreDMA() call) and copied the whole Efika CD onto my SFS partition of USB stick. And guess what! I have the wanderer desktop on Efika in front of my eyes now! Horray! Screenshot will follow as soon as I organise a USB hub (two USB slots are not enough for mouse, keyboard and USB stick, you know 🙂

One note: as you may know from the lecture of my previous posts, both FAT and FFS filesystems lack proper caching and thus are relatively slow, especially on Efika. Attempting to boot from FFS partition on USB stick may take more than 10 minutes. Booting from FAT will not work, because this filesystem is still incomplete. As for SFS, Efika needed one minute to boot from it, approximately.

PS. Since the SFS filesystem for linux is not working well on my machine (it crashes the linux kernel during mount already), I have started VMWare with AROS and Efika cd’s attached. Then I have plugged my usb stick, attached it to vmware and copied all the Efika ISO contents to the stick. Just as a proof that all the things are working here as expected.

Almost there :)

This week was a very active one. I was working on my mass storage class all the time and got some really impressive results. The bounty is almost ready, at the moment I’m testing the class and the USB stack as a whole too. I have tested the mass storage class on my two USB sticks and a 4-in-1 USB card reader. All of them seems to work properly. In my private test phase were incorporated three different machines:

  • my dying laptop (either gfx chip or it’s VRAM attempts to die pathetically – a chance of successful boot into X11 or Windows oscillates around 5%) used for development
  • x86_64 box with 32 bit native aros to do some heavy testing
  • my wifes PC which was the very first computer in the world booting AROS from USB stick 😉

Additionally, a qemu with USB forwarding has been used for immediate tests (in this case, the qemu takes a whole device of my wish over). In all this cases the USB stack and mass storage class seem to work properly. The mass storage is also being tested by other people, whom I’m very thankful 🙂

Once the eventual bugs are ironed out the bounty, according to it’s description, will be completed.

Note about the speed: AROS’ USB stack has at the moment the OHCI and UHCI drivers. It means, only the USB1.1 speed may be expected. The closest to the maximal transfer rate is, with 1.4MB/s, the SmartFilesystem. Both fat and ffs filesystems are dramatically slow, achieving 160KB/s and 140KB/s, respectively. Keep this information in minde while toying with AROS 🙂

USB Mass Storage – status update

Mass storage class for AROS’ USB stack is almost ready now. I have completed the exec-device interface and fixed few most annoying bugs. The class should support all devices supporting bulk-only protocol (that is, almost everything), including all USB card readers. USB DVD drives might work too, but I do not have the hardware to test.

Using the mass storage class, I have formatted a small SFS partition on my USB stick. It worked. I’ve tried to copy my whole AROS CD there. It worked again. Reading from the very same partition works. FAT partition from the very same stick worked too, both in read and write mode. The screenshot I’ve made for you was stored on FAT partition of USB stick 🙂 Welcome new and easier way to transfer data to and from AROS 🙂

During next few days I will clean the code a bit and commit it to AROS’ repository. Apart from that I will fix the USB stack and AROS a bit in order to make booting from USB key feasible. Then, the USB Mass Storage bounty will be completed.

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 🙂