aboutsummaryrefslogtreecommitdiffstats
path: root/roms/skiboot/doc/opal-api/opal-pci-config-read-write-13-14-15-16-17-18.rst
blob: 8fbb116a4f47d9b9bea10c397419286882a190d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
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`.