On 18/08/2019 21:37, Mark Cave-Ayland wrote:
This patchset started off with the aim of building the PCI-based machine device trees downwards from the root node to avoid switching either the active package and/or current instance at various points during the tree construction.
The basis for this was to try and remove all named nodes (those which are placed at a given path) and instead build the hierarchy in order by using new-device and finish-device as per the IEEE-1275 specification. This was realised by creating a new BIND_NODE_METHODS() macro which is similar to REGISTER_NAMED_NODE() except that it doesn't alter either the active package or the current instance, and then working through the device tree from the root converting all the devices for the PCI-based machines to use it.
Once this conversion has been completed for all devices beneath the PCI node, it becomes possible to remove both the REGISTER_NAMED_NODE() and REGISTER_NAMED_NODE_PHANDLE() macros to prevent future patches from accidentally changing the tree construction order.
Next the x86, PPC and SPARC64 device tree roots were altered to set the active package and current instance, allowing the remaining places where the PCI code alters either of them to be removed.
At this point instance variables were working correctly, and I noticed that there were several PCI devices which made use of C initialisation functions and/or properties for initial configuration. These can now be replaced with instance variables to keep everything simple and consistent.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
v3:
- Rebase onto master
- Fix up USB debug string for keyboard reported by Zoltan
- Fix for creating devices that don't have an entry in the PCI database
- Fix for MacOS 9 not initialising network reported by Howard
v2:
- Fix up NVRAM initialisation so that -prom-env 'vga-ndrv?=false' works again
Mark Cave-Ayland (30): libopenbios: introduce BIND_NODE_METHODS() macro pc_kbd: convert to use BIND_NODE_METHODS() macro pc_serial: convert to use BIND_NODE_METHODS() macro floppy: convert to use BIND_NODE_METHODS() macro ide: convert to use BIND_NODE_METHODS() macro adb: convert to use BIND_NODE_METHODS() macro escc: convert to use BIND_NODE_METHODS() macro cuda: convert to use BIND_NODE_METHODS() macro macio: convert to use BIND_NODE_METHODS() macro pmu: convert to use BIND_NODE_METHODS() macro usbhid: convert to use BIND_NODE_METHODS() macro nvram: convert to use BIND_NODE_METHODS() macro lsi: don't change active package when setting device alias lsi: convert to use BIND_NODE_METHODS() macro virtio: convert to use BIND_NODE_METHODS() macro pci: convert to use BIND_NODE_METHODS() macro pci: remove ob_pci_initialize() and ob_pci_empty_node libopenbios: remove REGISTER_NAMED_NODE and REGISTER_NAMED_NODE_PHANDLE macros nvram: ensure that NVRAM configuration is separate from NVRAM node creation ppc: move New World uninorth and nvram device node creation to the root device ppc: set active package and current instance to root device node before probe SPARC64: set active package and current instance to root device node before probe x86: set active package and current instance to root device node before probe pci: remove explicit find-device from PCI devices pci: remove explicit setting of my-self from PCI devices pci: call set-args before configuring PCI device nodes pc_serial: remove separate init word pc_kbd: use instance value to initialise C instance parameter lsi: use instance value to hold sd_private_t pointer virtio: use instance value to initialise C instance parameter
arch/ppc/qemu/init.c | 18 +++- arch/sparc64/openbios.c | 6 ++ arch/x86/openbios.c | 9 +- drivers/adb_bus.c | 57 +++++++----- drivers/adb_kbd.c | 25 ++++-- drivers/adb_mouse.c | 31 ++++--- drivers/cuda.c | 158 ++++++++++++++++++++------------- drivers/escc.c | 113 ++++++++++++++--------- drivers/floppy.c | 68 +++++++------- drivers/ide.c | 123 +++++++++++++++---------- drivers/lsi.c | 65 +++++++------- drivers/macio.c | 118 ++++++++++++------------ drivers/macio.h | 1 - drivers/pc_kbd.c | 48 +++++----- drivers/pc_serial.c | 32 +++---- drivers/pci.c | 132 +++++++++++++-------------- drivers/pmu.c | 152 +++++++++++++++++++++---------- drivers/usbhid.c | 17 ++-- drivers/virtio.c | 56 +++--------- include/drivers/drivers.h | 2 + include/libopenbios/bindings.h | 19 ++-- include/packages/nvram.h | 4 +- libopenbios/bindings.c | 10 +++ packages/nvram.c | 35 ++++++-- 24 files changed, 755 insertions(+), 544 deletions(-)
I've had no bug reports since posting v3 last week, so I've now pushed this to master. Thanks to everyone for helping test the changes.
ATB,
Mark.