You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by bt...@apache.org on 2020/06/11 00:52:04 UTC

[incubator-nuttx] 05/11: pcie: enable don't take flags, hardcoded enabling flags

This is an automated email from the ASF dual-hosted git repository.

btashton pushed a commit to branch pci
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 68f2bf5c472a5dc2af349d0bd287559da841b02a
Author: Yang Chung-Fan <so...@gmail.com>
AuthorDate: Wed May 6 18:19:56 2020 +0900

    pcie: enable don't take flags, hardcoded enabling flags
---
 drivers/pcie/pcie_root.c     | 9 ++++-----
 drivers/virt/qemu_pci_test.c | 2 +-
 include/nuttx/pcie/pcie.h    | 5 ++---
 3 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/pcie/pcie_root.c b/drivers/pcie/pcie_root.c
index c5ee688..2592fbb 100644
--- a/drivers/pcie/pcie_root.c
+++ b/drivers/pcie/pcie_root.c
@@ -78,11 +78,10 @@ int pcie_initialize(FAR struct pcie_bus_s *bus)
  * Name: pci_enable_device
  *
  * Description:
- *  Enable device with flags
+ *  Enable device with MMIO
  *
  * Input Parameters:
- *   bdf - device BDF
- *   flags - device ability to be enabled
+ *   dev - device
  *
  * Return value:
  *   -EINVAL: error
@@ -90,14 +89,14 @@ int pcie_initialize(FAR struct pcie_bus_s *bus)
  *
  ****************************************************************************/
 
-int pci_enable_device(FAR struct pcie_dev_s *dev, uint32_t flags)
+int pci_enable_device(FAR struct pcie_dev_s *dev)
 {
   uint16_t old_cmd;
   uint16_t cmd;
 
   dev->bus->ops->pci_cfg_read(dev, PCI_CFG_COMMAND, &old_cmd, 2);
 
-  cmd = old_cmd | flags;
+  cmd = old_cmd | (PCI_CMD_MASTER | PCI_CMD_MEM);
 
   dev->bus->ops->pci_cfg_write(dev, PCI_CFG_COMMAND, &cmd, 2);
 
diff --git a/drivers/virt/qemu_pci_test.c b/drivers/virt/qemu_pci_test.c
index ff1af63..d0df753 100644
--- a/drivers/virt/qemu_pci_test.c
+++ b/drivers/virt/qemu_pci_test.c
@@ -79,7 +79,7 @@ int qemu_pci_test_probe(FAR struct pcie_bus_s *bus,
       .bdf = bdf,
     };
 
-  pci_enable_device(&dev, (PCI_CMD_MASTER | PCI_CMD_MEM));
+  pci_enable_device(&dev);
 
   for (int ii = 0; ii < 2; ii++)
     {
diff --git a/include/nuttx/pcie/pcie.h b/include/nuttx/pcie/pcie.h
index 62adbb7..8b5b98e 100644
--- a/include/nuttx/pcie/pcie.h
+++ b/include/nuttx/pcie/pcie.h
@@ -168,11 +168,10 @@ int pcie_initialize(FAR struct pcie_bus_s *bus);
  * Name: pci_enable_device
  *
  * Description:
- *  Enable device with flags
+ *  Enable device with MMIO
  *
  * Input Parameters:
  *   dev - device
- *   flags - device ability to be enabled
  *
  * Return value:
  *   -EINVAL: error
@@ -180,7 +179,7 @@ int pcie_initialize(FAR struct pcie_bus_s *bus);
  *
  ****************************************************************************/
 
-int pci_enable_device(FAR struct pcie_dev_s *dev, uint32_t flags);
+int pci_enable_device(FAR struct pcie_dev_s *dev);
 
 /****************************************************************************
  * Name: pci_find_cap