12.01.2007 - New version of gfxutil is out. Please test and give feedback!
06.08.2009 - gfxutil sourcecode is now available!
http://rapidshare.com/files/264264563/gfxutil_source.zip.htmlYou are free to use it and whatever you do please keep the result free for communityhttp://rapidshare.com/files/83220759/gfxutil.zip.html Version 0.71b (LATEST)---------------------
Changelog 0.71b
* _UID value bug is fixed.
* New efi short notation PCI node "PciAdr".
* New switch [-f name] it finds object devicepath with give name from IODeviceTree plane.
* New verbose output format
PropertyList XML format descriptionSample plist file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "
http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DevicePath for Device #n</key>
<dict>
<key>binary_value</key>
<data>base64encoded</data>
<key>string_value</key>
<string>helloworld</string>
<key>boolean_value</key>
<true/> or <false/>
<key>uint32_value</key>
<integer>0x8744</integer> or <integer>12345</integer>
<key>uint32_value</key>
<string>0x00000000</string>
<key>uint16_value</key>
<string>0x0000</string>
<key>uint8_value</key>
<string>0x00</string>
</dict>
</dict>
</plist>
* Device path can be in hexadecimal (without prefix '0x') or efi shorthand notation device path format.
* All keys are saved like unicode text.
* Binary values are base64 encoded between <data></data> tags.
* Boolean single tag values are saved like uint8 values (true - 0x01, false - 0x00)
* <integer></integer> both hexadecimal and decimal numbers are accepted (hex. values must begin with prefix 0x). Values are saved like uint32.
* <string>0x00000000</string> is saved like uint32 value. Range: 0x00000000 - 0xffffffff
* <string>0x0000</string> is saved like uint16 value. Range: 0x0000 - 0xffff
* <string>0x00</string> is saved like uint8 value. Range: 0x00 - 0xff
String hexadecimal values must preserve its constant length by having needed count of leading zeros. Also values must have hex prefix '0x' or are treated like ordinary text.
Device path search function note!
Supported IODeviceTree registry entries are IOPCIDevice and IOACPIPlatformDevice.name - may be "IOName" or "name" property value or registry entry name.Usage examples:
* Converting from hex file to property list file
./gfxutil -i hex -o xml ./r2600.hex ./r2400.plist
* Converting from plist file to hex file
./gfxutil -i xml -o hex ./r2600.plist ./r2400.hex
* Converting from hex to plist using string and number detection
./gfxutil -s -n -i hex -o xml ./r2600.hex ./r2400.plist
* Same as previous example but using additional verbose output
./gfxutil -v -s -n -i hex -o xml ./r2600.hex ./r2400.plist
* Converting from hex to property list file (reading input from stdin)
./gfxutil -i hex -o xml /dev/stdin ./r2400.plist <r2400.hex
* Converting from hex to property list xml (reading input from stdin and output to stdout)
./gfxutil -i hex -o xml /dev/stdin /dev/stdout <r2400.hex >r2400.plist
* You want find device path of devices with name "display" and "ethernet".
./gfxutil -f display
output: DevicePath = PciRoot(0x0)/Pci(0x1,0x0)Pci(0x0,0x0)
./gfxutil -f ethernet
output: DevicePath = PciRoot(0x0)/Pci(0x1c,0x1)/Pci(0x0,0x0)
Supported efi shorthand notation syntax description:Syntax is case insensitive!Both hexadecimal and decimal numbers are accepted as input values.Hexadecimal numbers must start with prefix '0x'!uint8 - 1 byte unsigned number (range 0x0 - 0xff)
uint16 - 2 byte unsigned number (range 0x0 - 0xffff)
uint32 - 4 byte unsigned number (range 0x0 - 0xffffffff)Acpi(PNPxxxx, uint32 uid) - ACPI device (xxxx is PNP type device HID for example 0a03)
ACPI Device Path. This Device Path is used to describe devices whose enumeration is not
described in an industry-standard fashion. These devices must be described using ACPI AML
in the ACPI name space; this Device Path is a linkage to the ACPI name space.PciRoot(uint32 uid) - alias for
Acpi(PNP0a03,uid)Pci(uint8 device, uint8 function) - PCI device node
The Device Path for PCI defines the path to the PCI configuration space address for a PCI device.
There is one PCI Device Path entry for each device and function number that defines the path from the root PCI bus to the device. The PCI Device Path entry must be preceded by an ACPI Device Path entry that uniquely identifies the PCI root bus.PciAdr(uint32 adr) - alias for PCI node with using alternative address value.
adr is PCI device "_ADR" property value that your may find from pci device properties in IOACPIPlane.
for example:
...
o-PCX4@1c0003
|-_ADR = 1835011 (hex 0x1c0003)
...
PCX4@xxxxyyyy - (add leading zeros)
xx
xx - pci device
yy
yy - pci function
This ioreg entry in shorthand notation is
PciAdr(1835011) or
PciAdr(0x1c0003) or
Pci(0x1c,0x3) example paths:
PciRoot(0x0)/PciAdr(0x1c0003)/Pci(0x0,0x0)PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)same with Acpi
Acpi(PNP0a03,0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)I TAKE NO RESPONSEBILITY FOR ANY LOSS, DAMAGE OR INJURY ARISING FROM THE USE OF THIS PROGRAM!
Tips for building hex device path.Important! from ioreg tree you have to clarify your pciroot UID!!!
for example:
+-o PCI0@0 <class IOACPIPlatformDevice, registered, matched, active, busy 0>
| | "_UID" = "4"
If there isnt any _UID prop then uid is probably 0
for example your devpath in ioreg:
IOACPIPlane:/_SB/PCI0@0/P0P5@1c0001/ethernet@0if device hasnt IOACPIPlane or other acpi path then you have to manually design it, follow
hierarchical ioreg devtree starting from pciroot (PCI0@0 or from other pciroot depending on your hardware config) and ending with your chosen device.How to convert it to hexadecimal efi devicepath?It's easy

Just follow my guide:
1. ROOT PCI BRIDGE node. ACPI Device Path _HID PNP0A03, _UID 0. ACPI name space \_SB\PCI0. Shorthand notation is Acpi(PNP0A03,0)
- from ioreg: find _SB/PCI0@0 or similar (if there is PCI1@0 or similar then you probably have to change UID part)
- into efi: 02010c00d041030a00000000 (last 4 bytes are UID for example if you want set UID = 1 then change last 4 bytes 01000000)
_HID - the EISA ID of an on-board device. This is used to identify the device.
_UID - the unit number of an on-board device. This is used to distinguish between same kind of device.
2. first PCI DEVICE node. Shorthand notation is Pci(0x1c,0x1)
- from ioreg: find _SB/PCI0@0/P0P5@1c0001 or similar
P0P5@1c0001 -> add leading zeros POP5@001c0001
POP5@xxxxyyyy
xxxx - pci device
yyyy - pci function
efi template: 01010600yyxx - into efi: 01010600011c (pci node is like that 01-hardware path type, 01-pci device type, 0600 - length, 01 - pci function (1 byte), 1c - pci device (1byte) )
3. second PCI DEVICE node. Shorthand notation is Pci(0x0,0x0)
- from ioreg: find _SB/PCI0@0/P0P5@1c0001/ethernet@0 or similar
ethernet@0 -> add leading zeros ethernet@00000000
ethernet@xxxxyyyy
xxxx - pci device
yyyy - pci function
efi template: 01010600yyxx - into efi: 010106000000 (pci node is like that 01-hardware path type, 01-pci device type, 0600 - length, 00 - pci function (1 byte), 00 - pci device (1byte) )
4. Device path end node.
into efi: 7fff0400
5. put these parts together and voila
from: IOACPIPlane:/_SB/PCI0@0/P0P5@1c0001/ethernet@0
into: 02010c00d041030a0000000001010600011c0101060000007fff0400
efi device path shorthand notation legend:pciroot acpi node - Acpi(PNP0A03,uid)
full hex pciroot - 02010c00d041030a00000000
ACPI - 02010c00
PNP - d041
0A03 - 030a
uid - 00000000
pci node - Pci(device,function)
full hex pci - 01010600011c
PCI - 01010600
function - 0x01
device - 0x1c
efi dev path must end with end nodefull hex end node - 7fff0400
NB! All hexadecimal binary strings are using little endian format."Little Endian" means that the low-order byte of the number is stored in memory at the lowest address, and the high-order byte at the highest address. (The little end comes first.) For example, a 4 byte uint32
Byte3 Byte2 Byte1 Byte0
will be arranged in memory as follows:
Base Address+0 Byte0
Base Address+1 Byte1
Base Address+2 Byte2
Base Address+3 Byte3
and 2 byte short or word or uint16
Byte1 Byte0
will be arranged in memory as follows:
Base Address+0 Byte0
Base Address+1 Byte1