Currently all PCI devices except display devices are initialised with simple open and close words that are effectively a no-op, but enable the device to be accessed.
Unfortunately this means that if devices have custom open and close words then the existing ones are overwritten causing OpenBIOS to emit warnings such as "open isn't unique" on the console.
Resolve this by defaulting all PCI devices to the empty PCI node template ob_pci_empty_node and then adding the simple open and close words after the device has been initialised if they do not already exist.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- drivers/pci.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/pci.c b/drivers/pci.c index d698364..c7b2bd2 100644 --- a/drivers/pci.c +++ b/drivers/pci.c @@ -49,7 +49,7 @@ /* DECLARE data structures for the nodes. */
DECLARE_UNNAMED_NODE( ob_pci_bus_node, INSTALL_OPEN, 2*sizeof(int) ); -DECLARE_UNNAMED_NODE( ob_pci_simple_node, INSTALL_OPEN, 2*sizeof(int) ); +DECLARE_UNNAMED_NODE( ob_pci_simple_node, 0, 2*sizeof(int) ); DECLARE_UNNAMED_NODE( ob_pci_empty_node, 0, 2*sizeof(int) );
const pci_arch_t *arch; @@ -399,7 +399,6 @@ NODE_METHODS(ob_pci_bus_node) = { };
NODE_METHODS(ob_pci_simple_node) = { - { NULL, ob_pci_initialize }, { "open", ob_pci_open }, { "close", ob_pci_close }, }; @@ -1418,11 +1417,8 @@ static void ob_configure_pci_device(const char* parent_path, REGISTER_NAMED_NODE_PHANDLE(ob_pci_bus_node, config.path, phandle); } break; - case PCI_CLASS_DISPLAY: - REGISTER_NAMED_NODE_PHANDLE(ob_pci_empty_node, config.path, phandle); - break; default: - REGISTER_NAMED_NODE_PHANDLE(ob_pci_simple_node, config.path, phandle); + REGISTER_NAMED_NODE_PHANDLE(ob_pci_empty_node, config.path, phandle); break; }
@@ -1460,6 +1456,11 @@ static void ob_configure_pci_device(const char* parent_path, pci_dev->config_cb(&config); }
+ /* 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)) { + REGISTER_NODE_METHODS(ob_pci_simple_node, config.path); + } + /* device is configured so we may move it out of scope */ device_end();