[PowerPC64LE] Endian fixes for opal_pci.c.

Since OPAL runs in big endian, any data being passed back and forth
via memory instead of registers needs to be byteswapped.

From my notes during development:

"A good way to find candidates is to look for vtophys() in opal_call()
parameters. The memory being passed will be written into in BE."

Sponsored by:	Tag1 Consulting, Inc.
This commit is contained in:
Brandon Bergren 2020-09-23 01:37:01 +00:00
parent d418d3f616
commit 9cbcb6ffce

View File

@ -524,11 +524,12 @@ opalpci_read_config(device_t dev, u_int bus, u_int slot, u_int func, u_int reg,
case 2:
error = opal_call(OPAL_PCI_CONFIG_READ_HALF_WORD, sc->phb_id,
config_addr, reg, vtophys(&half));
word = half;
word = be16toh(half);
break;
case 4:
error = opal_call(OPAL_PCI_CONFIG_READ_WORD, sc->phb_id,
config_addr, reg, vtophys(&word));
word = be32toh(word);
break;
default:
error = OPAL_SUCCESS;
@ -547,6 +548,7 @@ opalpci_read_config(device_t dev, u_int bus, u_int slot, u_int func, u_int reg,
opal_call(OPAL_PCI_EEH_FREEZE_STATUS, sc->phb_id,
OPAL_PCI_DEFAULT_PE, vtophys(&eeh_state),
vtophys(&err_type), NULL);
err_type = be16toh(err_type); /* XXX unused */
if (eeh_state != OPAL_EEH_STOPPED_NOT_FROZEN)
opal_call(OPAL_PCI_EEH_FREEZE_CLEAR,
sc->phb_id, OPAL_PCI_DEFAULT_PE,