[Skiboot] [RFC PATCH 11/23] platform/firenze-pci: Use generic freset method

Frederic Barrat fbarrat at linux.ibm.com
Thu Aug 1 05:24:16 AEST 2019



Le 03/04/2019 à 11:09, Oliver O'Halloran a écrit :
> For slots where we have power control we can use the generic FRESET
> method.
> 
> Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
> ---
>   platforms/ibm-fsp/firenze-pci.c | 25 +++++++++++++++++++++++--
>   1 file changed, 23 insertions(+), 2 deletions(-)
> 
> diff --git a/platforms/ibm-fsp/firenze-pci.c b/platforms/ibm-fsp/firenze-pci.c
> index 36414425e80d..3221ba92a83d 100644
> --- a/platforms/ibm-fsp/firenze-pci.c
> +++ b/platforms/ibm-fsp/firenze-pci.c
> @@ -360,14 +360,32 @@ bail:
>   	firenze_inv_cnt = 0;
>   }
>   
> -static int64_t __unused firenze_pci_slot_get_power_state(struct pci_slot *slot,
> +static int64_t firenze_pci_inband_perst(struct pci_slot *slot,
> +		bool val)
> +{
> +	struct firenze_pci_slot *plat_slot = slot->data;
> +	uint16_t ctrl, bdfn = slot->pd->bdfn;
> +
> +	pci_cfg_read16(slot->phb, bdfn, plat_slot->perst_reg, &ctrl);
> +
> +	if (val)
> +		ctrl |= plat_slot->perst_bit;
> +	else
> +		ctrl &= ~plat_slot->perst_bit;
> +
> +	pci_cfg_write16(slot->phb, bdfn, plat_slot->perst_reg, ctrl);
> +
> +	return OPAL_SUCCESS;
> +}
> +

This function comes out of nowhere. I think the intent is to have it in 
the next patch.

   Fred


> +static int64_t firenze_pci_slot_get_power_state(struct pci_slot *slot,
>   						uint8_t *val)
>   {
>   	*val = slot->power_state;
>   	return OPAL_SUCCESS;
>   }
>   
> -static int64_t __unused firenze_pci_slot_set_power_state(struct pci_slot *slot,
> +static int64_t firenze_pci_slot_set_power_state(struct pci_slot *slot,
>   						uint8_t val)
>   {
>   	struct firenze_pci_slot *plat_slot = slot->data;
> @@ -644,6 +662,9 @@ static void firenze_pci_slot_init(struct pci_slot *slot)
>   	 */
>   	if (plat_slot->req) {
>   		/* placeholder */
> +		slot->ops.freset = pci_slot_generic_freset;
> +		slot->ops.get_power_state = firenze_pci_slot_get_power_state;
> +		slot->ops.set_power_state = firenze_pci_slot_set_power_state;
>   		prlog(PR_DEBUG, "%016llx: External power mgt initialized\n",
>   		      slot->id);
>   	} else if (info->inband_perst) {
> 



More information about the Skiboot mailing list