diff options
author | Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 2019-08-18 21:16:50 +0100 |
---|---|---|
committer | Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 2019-08-18 21:16:50 +0100 |
commit | 8878220797a4ff17e9e294fa9d6a3dd9eecc6552 (patch) | |
tree | 4febcabe6e59ae2ffab371d77477dad13018811e | |
parent | c8afd6a9f9c0245e9193dbb44bc7bf9bf4bf21de (diff) | |
download | openbios-8878220797a4ff17e9e294fa9d6a3dd9eecc6552.zip openbios-8878220797a4ff17e9e294fa9d6a3dd9eecc6552.tar.gz openbios-8878220797a4ff17e9e294fa9d6a3dd9eecc6552.tar.bz2 |
pci: call set-args before configuring PCI device nodes
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>
-rw-r--r-- | drivers/pci.c | 21 |
1 files changed, 21 insertions, 0 deletions
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) { |