This is to ensure that the my-space and my-address words are set correctly for any PCI devices that wish to execute FCode.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- drivers/pci.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
diff --git a/drivers/pci.c b/drivers/pci.c index 4fba12a..9d501d3 100644 --- a/drivers/pci.c +++ b/drivers/pci.c @@ -1748,6 +1748,8 @@ static phandle_t ob_configure_pci_device(const char* parent_path, const pci_dev_t *pci_dev; uint8_t class, subclass, iface; int num_bars, rom_bar; + uint32_t props[3]; + char *unit_str;
phandle_t phandle = 0, t; int is_host_bridge = 0; @@ -1804,6 +1806,25 @@ static phandle_t ob_configure_pci_device(const char* parent_path,
config.dev = addr & 0x00FFFFFF;
+ if (!is_host_bridge) { + /* Get encoded address for set-args */ + pci_encode_phys_addr(props, 0, CONFIGURATION_SPACE, config.dev, 0, 0); + PUSH(props[2]); + PUSH(props[1]); + PUSH(props[0]); + call_parent_method("encode-unit"); + + unit_str = pop_fstr_copy(); + + /* Call set-args to set up my-space and my-address */ + PUSH(0); + PUSH(0); + push_str(unit_str); + fword("set-args"); + + free(unit_str); + } + phandle = get_cur_dev();
switch (class) {