[PATCH 4/5] pci: Fix showing bars

Stefan Roese sr at denx.de
Fri Oct 8 07:53:38 CEST 2021


On 07.10.21 14:51, Pali Rohár wrote:
> Header type is 7-bit number so properly clear upper 8th bit which
> indicates multifunction device.
> 
> And do not try to show bars for unsupported header types.
> 
> Signed-off-by: Pali Rohár <pali at kernel.org>

Reviewed-by: Stefan Roese <sr at denx.de>

Thanks,
Stefan

> ---
>   cmd/pci.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/cmd/pci.c b/cmd/pci.c
> index cfabdc0f3012..4a82854db7fa 100644
> --- a/cmd/pci.c
> +++ b/cmd/pci.c
> @@ -71,10 +71,15 @@ static int pci_bar_show(struct udevice *dev)
>   	int prefetchable;
>   
>   	dm_pci_read_config8(dev, PCI_HEADER_TYPE, &header_type);
> +	header_type &= 0x7f;
>   
>   	if (header_type == PCI_HEADER_TYPE_CARDBUS) {
>   		printf("CardBus doesn't support BARs\n");
>   		return -ENOSYS;
> +	} else if (header_type != PCI_HEADER_TYPE_NORMAL &&
> +		   header_type != PCI_HEADER_TYPE_BRIDGE) {
> +		printf("unknown header type\n");
> +		return -ENOSYS;
>   	}
>   
>   	bar_cnt = (header_type == PCI_HEADER_TYPE_NORMAL) ? 6 : 2;
> 


Viele Grüße,
Stefan

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de


More information about the U-Boot mailing list