This will active the bus mastering bit for the device represented by the given PCI configuration.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/drivers/pci.c | 12 ++++++++++++ openbios-devel/drivers/pci_database.h | 2 ++ 2 files changed, 14 insertions(+)
diff --git a/openbios-devel/drivers/pci.c b/openbios-devel/drivers/pci.c index 935ecb8..9405e28 100644 --- a/openbios-devel/drivers/pci.c +++ b/openbios-devel/drivers/pci.c @@ -887,6 +887,18 @@ int usb_ohci_config_cb(const pci_config_t *config) return 0; }
+void ob_pci_enable_bus_master(const pci_config_t *config) +{ + /* Enable bus mastering for the PCI device */ + uint16_t cmd; + pci_addr addr = PCI_ADDR( + PCI_BUS(config->dev), PCI_DEV(config->dev), PCI_FN(config->dev)); + + cmd = pci_config_read16(addr, PCI_COMMAND); + cmd |= PCI_COMMAND_BUS_MASTER; + pci_config_write16(addr, PCI_COMMAND, cmd); +} + static void ob_pci_add_properties(phandle_t phandle, pci_addr addr, const pci_dev_t *pci_dev, const pci_config_t *config, int num_bars) diff --git a/openbios-devel/drivers/pci_database.h b/openbios-devel/drivers/pci_database.h index 7f053d8..9e8dc05 100644 --- a/openbios-devel/drivers/pci_database.h +++ b/openbios-devel/drivers/pci_database.h @@ -55,3 +55,5 @@ static inline int pci_compat_len(const pci_dev_t *dev) extern const pci_dev_t *pci_find_device(uint8_t class, uint8_t subclass, uint8_t iface, uint16_t vendor, uint16_t product); + +extern void ob_pci_enable_bus_master(const pci_config_t *config);