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.

Updates, updates

OMG, it was a busy weekend… 🙂

Last 48 hours were quite intensive. The source tree of Efika5k2 branch has been updated – the tree was almost 4 months old! I have added a complete contrib directory to the build – the iso is now 150 MB large and contains a complete gcc compiler toolchain for Efika as well as some other goodies.

The kernel.resource got new function, which may be used to change the WMID bits of certain pages of memory. One may use it, for example, to disable caching in some RAM areas. This feature is used by the PCI driver class for efika. Every region allocated for use by PCI bus master devices is excluded from caching. This manouver may simplify driver’s code significantly. For example, the OHCI driver uses Endpoint Descriptors (ED) and Transfer Descriptors (TD) which may be used by both CPU and OHCI controller. With an incoherent cache enabled, the driver has to either flush or invalidate the cached copies of descriptors permanently. Here, uncached region for these descriptors permits a more simple and error-safer code.

I have changed the scheduler a bit. The old one was not so stable upon very small CPU loads. It’s tendency was to lock interrupts and put CPU into sleep mode. Very unfortunate, I must say 😉 The updated code introduces the Idle Task which enters the power saving mode in a safer way. The scheduler calculates the time which CPU spent during execution of very task. Have a look yourself at C:TaskList command to understand what I mean 🙂

Wait, Did I wrote “have a look yourself”? Yes! Download this torrent, and test the AROS for efika yourself. It is not complete yet. You will surely see it crashing. The both IDE and network drivers are missnig. The release is unstable. Just put the ISO on CD, put it into your USB-CD or USB-DVD drive and start efika. Then, type following commands in the OF prompt:

setenv boot-device cd
boot cd os_image

Once you see the Boot? > prompt, press 1 and be patient. The OF needs some time to read all aros’ modules and will put enourmous amount of debug info. It will even report some missing file. Once AROS starts up, you will see the mouse pointer on the screen and CD drive working. Have fun. The serial port outputs debug information at 115200bps, 8N1.

PS. My upstream is limited. Please seed the file after download.

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.