powerpc/vas, nx-842: Define and use chip_to_vas_id()

Define a helper, chip_to_vas_id() to map a given chip id to corresponding
vas id.

Normally, callers of vas_rx_win_open() and vas_tx_win_open() want the VAS
window to be on the same chip where the calling thread is executing. These
callers can pass in -1 for the VAS id.

This interface will be useful if a thread running on one chip wants to open
a window on another chip (like the NX-842 driver does during start up).

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:
Sukadev Bhattiprolu
2017-11-07 18:23:50 -08:00
committed by Michael Ellerman
vanhempi ca03258b6b
commit d4ef61b5e8
3 muutettua tiedostoa jossa 23 lisäystä ja 15 poistoa

Näytä tiedosto

@@ -847,24 +847,12 @@ static int __init nx842_powernv_probe_vas(struct device_node *pn)
return -EINVAL;
}
for_each_compatible_node(dn, NULL, "ibm,power9-vas-x") {
if (of_get_ibm_chip_id(dn) == chip_id)
break;
}
if (!dn) {
pr_err("Missing VAS device node\n");
vasid = chip_to_vas_id(chip_id);
if (vasid < 0) {
pr_err("Unable to map chip_id %d to vasid\n", chip_id);
return -EINVAL;
}
if (of_property_read_u32(dn, "ibm,vas-id", &vasid)) {
pr_err("Missing ibm,vas-id device property\n");
of_node_put(dn);
return -EINVAL;
}
of_node_put(dn);
for_each_child_of_node(pn, dn) {
if (of_device_is_compatible(dn, "ibm,p9-nx-842")) {
ret = vas_cfg_coproc_info(dn, chip_id, vasid);