On 30/12/15 16:51, Hervé Poussineau wrote:
Hi,
Le 30/12/2015 17:44, Mark Cave-Ayland a écrit :
This function indicates whether the device represented by the given PCI configuration is capable of becoming a bus master. Currently this information is encoded in the PCI bus pci_arch_t structure as an array of bitmaps similar to the Open Firmware bus-master-capable property with one entry per PCI bus.
Currently we use a default maximum of 2 PCI buses, however this can always be extended at a later date if required.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
openbios-devel/drivers/pci.c | 17 +++++++++++++++++ openbios-devel/drivers/pci_database.h | 1 + openbios-devel/include/drivers/pci.h | 1 + 3 files changed, 19 insertions(+)
diff --git a/openbios-devel/drivers/pci.c b/openbios-devel/drivers/pci.c index 9405e28..0108a0d 100644 --- a/openbios-devel/drivers/pci.c +++ b/openbios-devel/drivers/pci.c @@ -899,6 +899,23 @@ void ob_pci_enable_bus_master(const pci_config_t *config) pci_config_write16(addr, PCI_COMMAND, cmd); }
+int ob_pci_is_bus_master_capable(const pci_config_t *config) +{
- /* Return true if this device is bus-master capable, false
otherwise */
- uint32_t bus = PCI_BUS(config->dev);
- uint32_t dev = PCI_DEV(config->dev);
- if (bus >= sizeof(arch->bus_master_capable)) {
return 0;
- }
Here, you probably want sizeof(arch->bus_master_capable)/sizeof(arch->bus_master_capable[0]), or some macro which does the same thing.
Indeed, yes - I've fixed this up in my local copy for now but will repost the series if anyone else has any further comments. Thanks for the review!
ATB,
Mark.