I've hacked up some code to talk to a PCI BIOS, which is basically some code hacked from an oldish version of Linux. The aim was to get an NCR53c810 SCSI driver going, but I got stalled on the PCI problem.
On my old machine it worked well, but since then I've upgraded to a Pentium, and it stopped working.
The PCI standard includes a new type of BIOS for PC-type machines: BIOS32. It's designed to be a BIOS which is usable by real 32 bit kernels to determine PCI state without having to directly drive the hardware. A good idea in theory, but unfortunately it isn't designed as well as it could be.
I used the standard algorithm to scan for a BIOS32 service directory and map in the code found there. I can call it and get useful information.
The assumption is that the BIOS will be called from an environment where the code is allowed to do anything, which is typical in a conventional kernel. VSTa, however, doesn't have conventional device drivers in a kernel. Instead, device drivers are implemented in normal user processes which are given special permission to access the necessary hardware.
I can do that in a VSTa process, so long as I know what information needs to be made availale. Unfortunately, there's no interface to find out which memory areas the BIOS will want to use, so I can't map them in. In addtion, the code is not relocatable, so I have to map it into the same virtual address in the process as its physical address. This is OK so long as there's nothing else there, and its within the user address space limit (lower 2 or 3 gig?).
NOTE: there's some kernel patches to change the interface of mmap(). The original version has an inconsistency: when using MAP_PHYS to map a physical address into the address space, it uses the addr argument as the physical address, and inhibits the use of MAP_FIXED at the same time. It is more consistent to allow MAP_FIXED and use offset for the physical address and addr as the virtual address. The patch in mmap.dif does this, and there's a corresponding patch to /vsta/src/srv/mach/cons2/cons.c to make it use the new mmap.
All code and commentry applies to VSTa 1.4. I have not had a chance to test out newer versions. Andy said he would add my mmap() fix to newer kernels, but I haven't checked if this is the case.