powerpc64: Add OPAL definitions

Summary:
Add additional OPAL PCI definitions and expand the code to use them in order to
ease the OPAL interface process for new comers.

These definitions came directly from the OPAL code and they are the same for
both PHB3 (POWER8) and PHB4 (POWER9).

Submitted by:	Breno Leitao
Differential Revision: https://reviews.freebsd.org/D15432
This commit is contained in:
jhibbits 2018-05-19 04:01:15 +00:00
parent 130d8ea8de
commit d02acb9927
2 changed files with 16 additions and 2 deletions

View File

@ -79,6 +79,20 @@ int opal_call(uint64_t token, ...);
#define OPAL_UNMAP_PE 0
#define OPAL_MAP_PE 1
#define OPAL_PCI_BUS_ANY 0
#define OPAL_PCI_BUS_3BITS 2
#define OPAL_PCI_BUS_4BITS 3
#define OPAL_PCI_BUS_5BITS 4
#define OPAL_PCI_BUS_6BITS 5
#define OPAL_PCI_BUS_7BITS 6
#define OPAL_PCI_BUS_ALL 7 /* Match bus number exactly */
#define OPAL_IGNORE_RID_DEVICE_NUMBER 0
#define OPAL_COMPARE_RID_DEVICE_NUMBER 1
#define OPAL_IGNORE_RID_FUNC_NUMBER 0
#define OPAL_COMPARE_RID_FUNC_NUMBER 1
#define OPAL_SUCCESS 0
#define OPAL_PARAMETER -1
#define OPAL_BUSY -2

View File

@ -254,8 +254,8 @@ opalpci_attach(device_t dev)
* such time as we start wanting to do things like bhyve.
*/
err = opal_call(OPAL_PCI_SET_PE, sc->phb_id, OPAL_PCI_DEFAULT_PE,
0, 0, 0, 0, /* All devices */
OPAL_MAP_PE);
0, OPAL_PCI_BUS_ANY, OPAL_IGNORE_RID_DEVICE_NUMBER,
OPAL_IGNORE_RID_FUNC_NUMBER, OPAL_MAP_PE);
if (err != 0) {
device_printf(dev, "PE mapping failed: %d\n", err);
return (ENXIO);