On 11/09/2022 11:58, BALATON Zoltan wrote:
Devices that OpenBIOS does not have a driver for may have an FCode driver that would create the open/close methods but this results in duplicate words due to the empty defaults OpenBIOS adds. These empty defaults are added so that open-dev works (which is needed to run an FCode driver) but to avoid this clash change open-dev to check if open method exists before calling it so we can omit the empty defaults and let an FCode driver install them without getting duplicates.
Signed-off-by: BALATON Zoltan balaton@eik.bme.hu
drivers/pci.c | 2 +- forth/device/pathres.fs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/pci.c b/drivers/pci.c index 787fa93..aa8de6b 100644 --- a/drivers/pci.c +++ b/drivers/pci.c @@ -1926,7 +1926,7 @@ static phandle_t ob_configure_pci_device(const char* parent_path, }
/* if devices haven't supplied open/close words then supply them with simple defaults */
- if (!find_package_method("open", phandle) && !find_package_method("close", phandle)) {
- if (pci_dev && !find_package_method("open", phandle) && !find_package_method("close", phandle)) { BIND_NODE_METHODS(phandle, ob_pci_simple_node); }
I'm fairly sure that I tested the above check for existing "open" and "close" methods when I made the changes to BIND_NODE_METHODS(), so I would already expect the existing code to do the right thing here.
Can you provide a bit more information about your test case? I seem to recall when I wrote it there was no need for modifications to pathres.fs as included below.
diff --git a/forth/device/pathres.fs b/forth/device/pathres.fs index 7976d78..b2217f1 100644 --- a/forth/device/pathres.fs +++ b/forth/device/pathres.fs @@ -423,7 +423,10 @@ constant sinfo.size dup if r@ link-one then 1 = if dup active-package <> my-self >in.interposed !
- r@ invoke-open
- " open" my-self >in.device-node @ find-method if
drop
r@ invoke-open
- then r@ handle-interposers then active-package!
ATB,
Mark.