[OpenBIOS] Back at it again( PCI Passthrough )

Joe van Tunen joevt at shaw.ca
Sat Jul 14 10:14:42 CEST 2018


I finally got around to updating my fcode to forth conversion scripts (see attached zip, also at https://www.dropbox.com/s/u2lojlc6vtuphbs/joevtOpen_Firmware_and_Forth.zip?dl=0 ). It's a Unix bash shell script which converts a PCI rom (containing fcode) to a forth source file that can be edited and tokenized to a new rom file. The bash script deals with extracting the PCI header and uses detok to extract the fcode. It then calls a perl script to convert the output from detok. It takes a couple minutes to do about 25000 lines.

The version of toke and detok are based on older versions with enhancements and bug fixes to correctly handle the roms I've tested them with. The conversion process depends on the formatting (indenting) produced by detok. The generated forth source file has tokenizer commands (used by toke) to more faithfully reproduce the PCI header. These may be specific to my version of toke.

To verify the output, do the following:

DumpPCIRom the original rom.
toke the result to create a new rom.
DumpPCIRom the new rom and compare the result with the original.

See example commands in joevtNewOFCommands.worksheet {.txt if you don't have BBEdit}).

You'll notice the new rom is smaller because toke uses the more compact words for values {-1, 0, 1, 2, 3} instead of just b(lit). You may want to comment out the line "tokenizer[ xxxxx ]tokenizer rom-size" so that the rom size is set automatically (unless you want the size to be the same as the original).

I didn't include a preprocessor. I had made one for MPW where you can embed shell commands to modify the forth source file to make it more compact/readable. For example, sections of duplicated code could be replaced by a loop. Large binary properties could be replaced by a command to encode-bytes from a binary file (e.g. for the macOS driver property). Defines and conditional compilation could be used to easily create roms for different purposes (debug or release, different hardware or settings).



    > On May 6, 2018, at 8:12 PM, Joe van Tunen <joevt at shaw.ca> wrote:
    > 
    > Once I get my fcode token to forth converter updated (so it can be used with Unix/macOS instead of MPW) then you can make your own nvidia open firmware driver with added debugging code.
    > 
    > 
    > On 5/6/18, 8:11 AM, "Jd Lyons" <lyons_dj at yahoo.com> wrote:
    > 
    >    Seems to be tripping over the second b(>resolve), tho I’m not sure what this fcode is trying to do?
    > 
    >    Joe, see if you can have a look at it, when you have time, and see if you have any ideas what is causing the exception.
    
    
    

-------------- next part --------------
A non-text attachment was scrubbed...
Name: joevtOpen_Firmware_and_Forth.zip
Type: application/zip
Size: 394999 bytes
Desc: not available
URL: <http://mail.coreboot.org/pipermail/openbios/attachments/20180714/d95dee68/attachment-0001.zip>


More information about the OpenBIOS mailing list