Innerhalb
Nach weiteren Dokumenten suchen
Support-Ressourcen
| Dieses Buch im PDF-Format herunterladen
Troubleshooting
4
- This chapter contains examples for troubleshooting your PCI FCode.
Enabling Access to a PCI Device's Memory Space Locations
-
Problem:
- When loading FCode, memory space locations can't be accessed.
-
Solution:
- Look in the format for the physical address of the reg property. Then locate the values of bbbb.bbbb,ddddd and fff for your device by using:
-
ok " <parent-pci-bus-node>" select-dev
ok 3 <bbbb.bbbb.dddd.dfff>04 config-w!
|
- This will write to the configuration space command register and thus enable access to memory and I/O space. This sets bit[0] and bit[1] of the command register. In the same way, you may set other bits in the command register, if required. If the Sbus number is 1000.0001 (0x81), the device number is 0.0000, and the function number is 001 (0x01), you will then use:
-
ok " /pci@1f,2000" select-dev
ok 81.0104 config-w@ 3 or 81.0104 config-w!
|
- Normally, your FCode driver's open routine should enable such access. FCode can use the value returned by my-space and add an offset of 4 to get the address of the command register. It can then set various bits in the command register to enable the desired access. Use the close routine to disable that access.
Expansion FCode PROM
-
Problem:
- A developer is unable to access his expansion FCode PROM. How can access to it be enabled?
-
Solution:
- To enable access, look in the format for the physical address of the reg property. Then obtain the values of bbbb.bbbb, ddddd and fff for your device by using:
-
ok "<parent-pci-bus-node>" select-dev
ok <bbbb.bbbb.dddd.dfff>04 config-w@ 3 or
<bbbb.bbbb.dddd.dfff>04
config-w!
ok <bbbb.bbbb.dddd.dfff>30 config-l@ 1 or
<bbbb.bbbb.dddd.dfff>30 config-l!
|
- This will first enable memory and I/O space access. Then, it will read the value from the expansion PROM configuration space base address register (at offset 0x30) or 1 to it, and write the value in the expansion PROM base address register to enable access to your FCode PROM. This sets bit[0] of the expansion PROM base address register. If the bus number is 1000.0001 (0x81), the device number is 00000, and the function number is 001 (0x01), use example:
-
ok " /pci@1f,2000" select-dev
k 81.0104 config-w@ 3 or 81.0104 config-w!
ok 81.0130 config-l@ 1 or 81.0130 config-l!
|
- If the FCode needs to access PROM data (for example, to access Vital Product Data stored in the PROM) then the FCode should enable PROM access by using the value returned by my-space and adding an offset of 0x30 as the register address. The FCode should read the value from the address, or 1, and write it to that address.
- Also, since the FCode was copied to memory, then the devices memory and I/O spaces may not be enabled. The FCode must then enable them, using the following FCode:
-
ok my-space h# 30 + dup config-l@ 1 or swap config-l! (enable PROM
access)
ok my-space h# 4 + dup config-w@ 3 or swap config-w! (enable
I/O,memory access)
|
- Using the previous example, you can disable expansion PROM access as:
-
ok my-space h# 30 + dup config-l@ 1 invert and swap
config-l!(disable PROM access)
|
Packaging Error With Ethernet FCode
-
Problem:
- When you try to load the FCode from Ethernet, the code seems to load without errors. However, when you build the package, the following error is displayed:
-
ok 4000 dload /stand/cheerio.o
Boot device: /pci@1f,4000/network@1,1:,|stand|cheerio.o File
and args:
ok 0 0 " 0,1" " /pci@1f,2000" begin-package
ok 4000 1 byte-load
Unimplemented FCode token before address 4004
Warning: FCode sequence resulted in a net stack depth change of 1
ok
|
-
Solution:
- One error may be due to the PCI header attached to the PROM image.
- Dump the download image beginning at 4000, for example, 4000 60 dump, and see where fd starts. It is the beginning of the FCode data for the byte-load. For instance, if the FCode data starts at x, use the address x in
-
-
fd is the beginning of the FCode header and is 8 bytes long:
-
fd, <tokenizer-version>,<2 reserved bytes/checksum>,<4byte of
FCode length>
|
-
Note - If you begin your FCode source with fcode-version1, the first FCode data is fd, but if you use fcode-version2, the first FCode data is f1.
-
-
Another error may be due to:
-
my-address is two 32-bit numbers for PCI and only one 32-bit number for SBus.
- Change your FCode to handle two numbers returned from my address.
- To do this, use the following code:
-
my-address constant my-bus-addr-mid constant my-bus-addr-low
: my-bus-addr (-- paddr.low paddr.mid )
my-bus-addr-low my-bus-addr-mid
;
|
- Then use my-bus-addr to create the reg property.
select-dev Errors
- To debug your FCode/device for errors while using select-dev on the device, do the following:
- Add a dummy open method to your device node's FCode if you want to select the device to map in the device, look at the ok prompt, look at the device registers, and so on:
-
ok dev /pci..../<device-node>
ok : open true ;
|
- This may generate the following message about open not being unique:
-
- Now you can use select-dev to select your device. Then use "map-in" $call-parent to map in the device registers, and examine them. (The -endianness may differ from what you think. Verify the way that the device is mapped with map? Also, verify that rl@ and other register access words return the data in the way you expect.
|
|