On 11/03/2023 19:05, Mark Cave-Ayland wrote:
This series provides a set of fixes required to allow Forth PCI config access words to work correctly on both 32-bit and 64-bit platforms, along with Zoltan's original v4 patch. There are 2 main fixes included:
- Implement and convert PCI encode-unit/decode-unit to static methods
- Fix my-address and my-unit on 64-bit platforms
With this series applied it is possible to execute the Forth PCI config words as documented in various drivers as below:
PPC (32-bit):
0 > showstack ok 0 > " /pci/QEMU,VGA" open-dev to my-self ok 0 > my-space " config-w@" $call-parent u. 1234 ok 0 > my-space ok 800 < 1 > my-address ok 800 0 0 < 3 >
SPARC64 (64-bit, including across PCI bridge):
0 > showstack ok 0 > " /pci/pci@1,1/QEMU,VGA" open-dev to my-self ok 0 > my-space " config-w@" $call-parent u. 1234 ok 0 > my-space ok 11000 < 1 > my-address ok 11000 0 0 < 3 >
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
BALATON Zoltan (1): drivers/pci: Implement config access words
Mark Cave-Ayland (5): libopenbios/clib.fs: add new is-2arg-cfunc for calling into C libopenbios: introduce BIND_NODE_STATIC_METHOD and supporting functions drivers/pci.c: convert encode-unit and decode-unit words to static methods package.fs: fix my-address on 64-bit systems package.fs: fix my-unit on 64-bit systems
drivers/pci.c | 115 +++++++++++++++++++++++++++++++-- forth/device/package.fs | 8 +-- include/libopenbios/bindings.h | 7 ++ libopenbios/bindings.c | 26 ++++++++ libopenbios/clib.fs | 10 +++ 5 files changed, 155 insertions(+), 11 deletions(-)
I think this series has been waiting long enough: re-reading through the earlier threads, this is still my preferred method so I'll queue it for master.
ATB,
Mark.