1.. _OPAL_LPC_READ:
2
3OPAL_LPC_READ
4=============
5
6.. code-block:: c
7
8   #define OPAL_LPC_READ				67
9
10   /*
11    * Address cycle types for LPC accesses. These also correspond
12    * to the content of the first cell of the "reg" property for
13    * device nodes on the LPC bus
14    */
15    enum OpalLPCAddressType {
16      OPAL_LPC_MEM	= 0,
17      OPAL_LPC_IO	= 1,
18      OPAL_LPC_FW	= 2,
19   };
20
21   int64_t opal_lpc_read(uint32_t chip_id, enum OpalLPCAddressType addr_type,
22			     uint32_t addr, uint32_t *data, uint32_t sz);
23
24This function related to Low Pin Count (LPC) bus. This function reads the
25data from IDSEL register for ``chip_id``, which has LPC information.
26From ``addr`` for ``addr_type`` with read size ``sz`` bytes in to a
27variable named ``data``.
28
29Parameters
30----------
31
32``chip_id``
33  The ``chip_id`` parameter contains value of the chip number identified at
34  boot time.
35``addr_type``
36  The ``addr_type`` is one of the LPC supported address types.
37  Supported address types are:
38
39  - LPC memory,
40  - LPC IO and
41  - LPC firmware.
42
43``addr``
44  The ``addr`` from which the data has to be read.
45``data``
46  The ``data`` will be used to store the read data.
47``sz``
48   How many ``sz`` bytes to be read in to ``data``.
49
50Return Codes
51------------
52
53:ref:`OPAL_PARAMETER`
54   Indicates either ``chip_id`` not found or ``chip_id`` doesn’t contain
55   LPC information.
56:ref:`OPAL_SUCCESS`
57  Indicates Success!
58
59.. _OPAL_LPC_WRITE:
60
61OPAL_LPC_WRITE
62==============
63
64.. code-block:: c
65
66   #define OPAL_LPC_WRITE				68
67
68   /*
69    * Address cycle types for LPC accesses. These also correspond
70    * to the content of the first cell of the "reg" property for
71    * device nodes on the LPC bus
72    */
73    enum OpalLPCAddressType {
74      OPAL_LPC_MEM	= 0,
75      OPAL_LPC_IO	= 1,
76      OPAL_LPC_FW	= 2,
77   };
78
79   int64_t opal_lpc_write(uint32_t chip_id, enum OpalLPCAddressType addr_type,
80                          uint32_t addr, uint32_t data, uint32_t sz);
81
82This function related to Low Pin Count (LPC) bus. This function writes the
83``data`` in to  ECCB register for ``chip_id``, which has LPC information.
84From ``addr`` for ``addr_type`` with write size ``sz`` bytes.
85
86Parameters
87----------
88
89``chip_id``
90  The ``chip_id`` parameter contains value of the chip number identified at
91  boot time.
92``addr_type``
93  The ``addr_type`` is one of the address types LPC supported.
94  Supported address types are:
95
96  - LPC memory,
97  - LPC IO and
98  - LPC firmware.
99
100``addr``
101  The ``addr`` to where the ``data`` need to be written.
102``data``
103  The ``data`` for writing.
104``sz``
105   How many ``sz`` bytes to write.
106
107Return Codes
108------------
109
110:ref:`OPAL_PARAMETER`
111   Indicates either ``chip_id`` not found or ``chip_id`` doesn’t contain LPC
112   information.
113:ref:`OPAL_SUCCESS`
114   Indicates Success!
115