diff mbox series

[039/110] doc: Add PCI Config Space OPAL call docs

Message ID 20190531061351.22973-40-stewart@linux.ibm.com
State Accepted
Headers show
Series Big documentation cleanup/expansion | expand

Commit Message

Stewart Smith May 31, 2019, 6:12 a.m. UTC
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
---
 ...ci-config-read-write-13-14-15-16-17-18.rst | 132 ++++++++++++++++++
 1 file changed, 132 insertions(+)
 create mode 100644 doc/opal-api/opal-pci-config-read-write-13-14-15-16-17-18.rst
diff mbox series

Patch

diff --git a/doc/opal-api/opal-pci-config-read-write-13-14-15-16-17-18.rst b/doc/opal-api/opal-pci-config-read-write-13-14-15-16-17-18.rst
new file mode 100644
index 000000000000..8fbb116a4f47
--- /dev/null
+++ b/doc/opal-api/opal-pci-config-read-write-13-14-15-16-17-18.rst
@@ -0,0 +1,132 @@ 
+
+.. _OPAL_PCI_CONFIG:
+
+============================
+OPAL PCI Config Space Access
+============================
+
+PCI Config space is read or written to through OPAL calls. All of these calls
+
+.. _OPAL_PCI_CONFIG_return_codes:
+
+OPAL_PCI_CONFIG_* Return codes
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+:ref:`OPAL_SUCCESS`
+     Read/Write operation completed successfully.
+:ref:`OPAL_PARAMETER`
+     Invalid parameter. e.g. invalid `phb_id` or `bus_dev_func`.
+:ref:`OPAL_HARDWARE`
+     Invalid request for the hardware either permanently or in its
+     current state. Can also be a hardware problem, e.g. fenced or
+     config access is currently blocked.
+:ref:`OPAL_UNSUPPORTED`
+     Unsupported operation. For example, phb4 doesn't support ASB config
+     space writes.
+Other return codes
+     Should be handled gracefully. For example, for any return code other than
+     :ref:`OPAL_SUCCESS`, Linux will return all bits set for the specified size
+     for a read, and will ignore the error on a write.
+
+.. _OPAL_PCI_CONFIG_READ_BYTE:
+
+OPAL_PCI_CONFIG_READ_BYTE
+-------------------------
+
+.. code-block:: c
+
+   #define OPAL_PCI_CONFIG_READ_BYTE		13
+
+   int64_t opal_pci_config_read_byte(uint64_t phb_id,
+				     uint64_t bus_dev_func,
+				     uint64_t offset,
+				     uint8_t *data);
+
+Reads a single byte from PCI config space,
+see :ref:`OPAL_PCI_CONFIG_return_codes`.
+
+.. _OPAL_PCI_CONFIG_READ_HALF_WORD:
+
+OPAL_PCI_CONFIG_READ_HALF_WORD
+------------------------------
+
+.. code-block:: c
+
+   #define OPAL_PCI_CONFIG_READ_HALF_WORD  	14
+
+   int64_t opal_pci_config_read_half_word(uint64_t phb_id,
+                                          uint64_t bus_dev_func,
+				          uint64_t offset,
+				          uint16_t *data);
+
+Reads a half word (16 bits) from PCI config space,
+see :ref:`OPAL_PCI_CONFIG_return_codes`.
+
+.. _OPAL_PCI_CONFIG_READ_WORD:
+
+OPAL_PCI_CONFIG_READ_WORD
+-------------------------
+
+.. code-block:: c
+
+   #define OPAL_PCI_CONFIG_READ_WORD		15
+
+   int64_t opal_pci_config_read_word(uint64_t phb_id,
+                                     uint64_t bus_dev_func,
+				     uint64_t offset,
+				     uint32_t *data);
+
+Reads a word (32 bits) from PCI config space,
+see :ref:`OPAL_PCI_CONFIG_return_codes`.
+
+.. _OPAL_PCI_CONFIG_WRITE_BYTE:
+
+OPAL_PCI_CONFIG_WRITE_BYTE
+--------------------------
+
+.. code-block:: c
+
+   #define OPAL_PCI_CONFIG_WRITE_BYTE		16
+
+   int64_t opal_pci_config_write_byte(uint64_t phb_id,
+				      uint64_t bus_dev_func,
+				      uint64_t offset,
+				      uint8_t data);
+
+Writes a byte (8 bits) to PCI config space,
+see :ref:`OPAL_PCI_CONFIG_return_codes`.
+
+.. _OPAL_PCI_CONFIG_WRITE_HALF_WORD:
+
+OPAL_PCI_CONFIG_WRITE_HALF_WORD
+-------------------------------
+
+.. code-block:: c
+
+   #define OPAL_PCI_CONFIG_WRITE_HALF_WORD		17
+
+   int64_t opal_pci_config_read_half_word(uint64_t phb_id,
+                                          uint64_t bus_dev_func,
+				          uint64_t offset,
+				          uint16_t data);
+
+Writes a half word (16 bits) to PCI config space,
+see :ref:`OPAL_PCI_CONFIG_return_codes`.
+
+.. _OPAL_PCI_CONFIG_WRITE_WORD:
+
+OPAL_PCI_CONFIG_WRITE_WORD
+--------------------------
+
+.. code-block:: c
+
+   #define OPAL_PCI_CONFIG_WRITE_WORD		18
+
+   int64_t opal_pci_config_read_word(uint64_t phb_id,
+                                     uint64_t bus_dev_func,
+				     uint64_t offset,
+				     uint32_t data);
+
+Writes a word (32 bits) to PCI config space,
+see :ref:`OPAL_PCI_CONFIG_return_codes`.
+