* [PATCH 1/5] pci: Skip configuring PCI Rom Address for unsupported header types @ 2021-10-07 12:50 Pali Rohár 2021-10-07 12:50 ` [PATCH 2/5] pci: Skip configuring invalid P2P bridge devices Pali Rohár ` (5 more replies) 0 siblings, 6 replies; 15+ messages in thread From: Pali Rohár @ 2021-10-07 12:50 UTC (permalink / raw) To: Simon Glass, Vladimir Oltean, Bin Meng, Stefan Roese; +Cc: u-boot PCI Rom Address is currently supported only for Normal (0x00) and Bridge (0x01) header types. Fix code accordingly. Signed-off-by: Pali Rohár <pali@kernel.org> --- drivers/pci/pci_auto.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/pci/pci_auto.c b/drivers/pci/pci_auto.c index 08082460eb86..288f7996c7c0 100644 --- a/drivers/pci/pci_auto.c +++ b/drivers/pci/pci_auto.c @@ -131,7 +131,8 @@ static void dm_pciauto_setup_device(struct udevice *dev, int bars_num, /* Configure the expansion ROM address */ dm_pci_read_config8(dev, PCI_HEADER_TYPE, &header_type); header_type &= 0x7f; - if (header_type != PCI_HEADER_TYPE_CARDBUS) { + if (header_type == PCI_HEADER_TYPE_NORMAL || + header_type == PCI_HEADER_TYPE_BRIDGE) { rom_addr = (header_type == PCI_HEADER_TYPE_NORMAL) ? PCI_ROM_ADDRESS : PCI_ROM_ADDRESS1; dm_pci_write_config32(dev, rom_addr, 0xfffffffe); -- 2.20.1 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 2/5] pci: Skip configuring invalid P2P bridge devices 2021-10-07 12:50 [PATCH 1/5] pci: Skip configuring PCI Rom Address for unsupported header types Pali Rohár @ 2021-10-07 12:50 ` Pali Rohár 2021-10-08 5:52 ` Stefan Roese 2021-10-15 11:52 ` Tom Rini 2021-10-07 12:50 ` [PATCH 3/5] pci: Fix configuring BARs Pali Rohár ` (4 subsequent siblings) 5 siblings, 2 replies; 15+ messages in thread From: Pali Rohár @ 2021-10-07 12:50 UTC (permalink / raw) To: Simon Glass, Vladimir Oltean, Bin Meng, Stefan Roese; +Cc: u-boot Function dm_pci_hose_probe_bus() expects that bus is valid PCI device with Bridge header type (0x01). So add check before touching PCI config space to prevent misconfiguring some non-standard device. Signed-off-by: Pali Rohár <pali@kernel.org> --- drivers/pci/pci-uclass.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c index 044babee164f..5da3515f5f25 100644 --- a/drivers/pci/pci-uclass.c +++ b/drivers/pci/pci-uclass.c @@ -627,6 +627,7 @@ int pci_generic_mmap_read_config( int dm_pci_hose_probe_bus(struct udevice *bus) { + u8 header_type; int sub_bus; int ret; int ea_pos; @@ -634,6 +635,14 @@ int dm_pci_hose_probe_bus(struct udevice *bus) debug("%s\n", __func__); + dm_pci_read_config8(bus, PCI_HEADER_TYPE, &header_type); + header_type &= 0x7f; + if (header_type != PCI_HEADER_TYPE_BRIDGE) { + debug("%s: Skipping PCI device %d with Non-Bridge Header Type 0x%x\n", + __func__, PCI_DEV(dm_pci_get_bdf(bus)), header_type); + return log_msg_ret("probe", -EINVAL); + } + ea_pos = dm_pci_find_capability(bus, PCI_CAP_ID_EA); if (ea_pos) { dm_pci_read_config8(bus, ea_pos + sizeof(u32) + sizeof(u8), -- 2.20.1 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 2/5] pci: Skip configuring invalid P2P bridge devices 2021-10-07 12:50 ` [PATCH 2/5] pci: Skip configuring invalid P2P bridge devices Pali Rohár @ 2021-10-08 5:52 ` Stefan Roese 2021-10-15 11:52 ` Tom Rini 1 sibling, 0 replies; 15+ messages in thread From: Stefan Roese @ 2021-10-08 5:52 UTC (permalink / raw) To: Pali Rohár, Simon Glass, Vladimir Oltean, Bin Meng; +Cc: u-boot On 07.10.21 14:50, Pali Rohár wrote: > Function dm_pci_hose_probe_bus() expects that bus is valid PCI device with > Bridge header type (0x01). So add check before touching PCI config space to > prevent misconfiguring some non-standard device. > > Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de> Thanks, Stefan > --- > drivers/pci/pci-uclass.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c > index 044babee164f..5da3515f5f25 100644 > --- a/drivers/pci/pci-uclass.c > +++ b/drivers/pci/pci-uclass.c > @@ -627,6 +627,7 @@ int pci_generic_mmap_read_config( > > int dm_pci_hose_probe_bus(struct udevice *bus) > { > + u8 header_type; > int sub_bus; > int ret; > int ea_pos; > @@ -634,6 +635,14 @@ int dm_pci_hose_probe_bus(struct udevice *bus) > > debug("%s\n", __func__); > > + dm_pci_read_config8(bus, PCI_HEADER_TYPE, &header_type); > + header_type &= 0x7f; > + if (header_type != PCI_HEADER_TYPE_BRIDGE) { > + debug("%s: Skipping PCI device %d with Non-Bridge Header Type 0x%x\n", > + __func__, PCI_DEV(dm_pci_get_bdf(bus)), header_type); > + return log_msg_ret("probe", -EINVAL); > + } > + > ea_pos = dm_pci_find_capability(bus, PCI_CAP_ID_EA); > if (ea_pos) { > dm_pci_read_config8(bus, ea_pos + sizeof(u32) + sizeof(u8), > 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@denx.de ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/5] pci: Skip configuring invalid P2P bridge devices 2021-10-07 12:50 ` [PATCH 2/5] pci: Skip configuring invalid P2P bridge devices Pali Rohár 2021-10-08 5:52 ` Stefan Roese @ 2021-10-15 11:52 ` Tom Rini 1 sibling, 0 replies; 15+ messages in thread From: Tom Rini @ 2021-10-15 11:52 UTC (permalink / raw) To: Pali Rohár Cc: Simon Glass, Vladimir Oltean, Bin Meng, Stefan Roese, u-boot [-- Attachment #1: Type: text/plain, Size: 414 bytes --] On Thu, Oct 07, 2021 at 02:50:58PM +0200, Pali Rohár wrote: > Function dm_pci_hose_probe_bus() expects that bus is valid PCI device with > Bridge header type (0x01). So add check before touching PCI config space to > prevent misconfiguring some non-standard device. > > Signed-off-by: Pali Rohár <pali@kernel.org> > Reviewed-by: Stefan Roese <sr@denx.de> Applied to u-boot/master, thanks! -- Tom [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 659 bytes --] ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 3/5] pci: Fix configuring BARs 2021-10-07 12:50 [PATCH 1/5] pci: Skip configuring PCI Rom Address for unsupported header types Pali Rohár 2021-10-07 12:50 ` [PATCH 2/5] pci: Skip configuring invalid P2P bridge devices Pali Rohár @ 2021-10-07 12:50 ` Pali Rohár 2021-10-08 5:53 ` Stefan Roese 2021-10-15 11:52 ` Tom Rini 2021-10-07 12:51 ` [PATCH 4/5] pci: Fix showing bars Pali Rohár ` (3 subsequent siblings) 5 siblings, 2 replies; 15+ messages in thread From: Pali Rohár @ 2021-10-07 12:50 UTC (permalink / raw) To: Simon Glass, Vladimir Oltean, Bin Meng, Stefan Roese; +Cc: u-boot Number of BARs is defined by header type, not by class code. Signed-off-by: Pali Rohár <pali@kernel.org> --- drivers/pci/pci_auto.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/drivers/pci/pci_auto.c b/drivers/pci/pci_auto.c index 288f7996c7c0..5af4ee6e56df 100644 --- a/drivers/pci/pci_auto.c +++ b/drivers/pci/pci_auto.c @@ -19,7 +19,7 @@ #define CONFIG_SYS_PCI_CACHE_LINE_SIZE 8 #endif -static void dm_pciauto_setup_device(struct udevice *dev, int bars_num, +static void dm_pciauto_setup_device(struct udevice *dev, struct pci_region *mem, struct pci_region *prefetch, struct pci_region *io) @@ -28,6 +28,7 @@ static void dm_pciauto_setup_device(struct udevice *dev, int bars_num, pci_size_t bar_size; u16 cmdstat = 0; int bar, bar_nr = 0; + int bars_num; u8 header_type; int rom_addr; pci_addr_t bar_value; @@ -39,6 +40,26 @@ static void dm_pciauto_setup_device(struct udevice *dev, int bars_num, cmdstat = (cmdstat & ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) | PCI_COMMAND_MASTER; + dm_pci_read_config8(dev, PCI_HEADER_TYPE, &header_type); + header_type &= 0x7f; + + switch (header_type) { + case PCI_HEADER_TYPE_NORMAL: + bars_num = 6; + break; + case PCI_HEADER_TYPE_BRIDGE: + bars_num = 2; + break; + case PCI_HEADER_TYPE_CARDBUS: + /* CardBus header does not have any BAR */ + bars_num = 0; + break; + default: + /* Skip configuring BARs for unknown header types */ + bars_num = 0; + break; + } + for (bar = PCI_BASE_ADDRESS_0; bar < PCI_BASE_ADDRESS_0 + (bars_num * 4); bar += 4) { int ret = 0; @@ -129,8 +150,6 @@ static void dm_pciauto_setup_device(struct udevice *dev, int bars_num, } /* Configure the expansion ROM address */ - dm_pci_read_config8(dev, PCI_HEADER_TYPE, &header_type); - header_type &= 0x7f; if (header_type == PCI_HEADER_TYPE_NORMAL || header_type == PCI_HEADER_TYPE_BRIDGE) { rom_addr = (header_type == PCI_HEADER_TYPE_NORMAL) ? @@ -343,7 +362,7 @@ int dm_pciauto_config_device(struct udevice *dev) debug("PCI Autoconfig: Found P2P bridge, device %d\n", PCI_DEV(dm_pci_get_bdf(dev))); - dm_pciauto_setup_device(dev, 2, pci_mem, pci_prefetch, pci_io); + dm_pciauto_setup_device(dev, pci_mem, pci_prefetch, pci_io); ret = dm_pci_hose_probe_bus(dev); if (ret < 0) @@ -356,7 +375,7 @@ int dm_pciauto_config_device(struct udevice *dev) * just do a minimal setup of the bridge, * let the OS take care of the rest */ - dm_pciauto_setup_device(dev, 0, pci_mem, pci_prefetch, pci_io); + dm_pciauto_setup_device(dev, pci_mem, pci_prefetch, pci_io); debug("PCI Autoconfig: Found P2CardBus bridge, device %d\n", PCI_DEV(dm_pci_get_bdf(dev))); @@ -388,7 +407,7 @@ int dm_pciauto_config_device(struct udevice *dev) /* fall through */ default: - dm_pciauto_setup_device(dev, 6, pci_mem, pci_prefetch, pci_io); + dm_pciauto_setup_device(dev, pci_mem, pci_prefetch, pci_io); break; } -- 2.20.1 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 3/5] pci: Fix configuring BARs 2021-10-07 12:50 ` [PATCH 3/5] pci: Fix configuring BARs Pali Rohár @ 2021-10-08 5:53 ` Stefan Roese 2021-10-15 11:52 ` Tom Rini 1 sibling, 0 replies; 15+ messages in thread From: Stefan Roese @ 2021-10-08 5:53 UTC (permalink / raw) To: Pali Rohár, Simon Glass, Vladimir Oltean, Bin Meng; +Cc: u-boot On 07.10.21 14:50, Pali Rohár wrote: > Number of BARs is defined by header type, not by class code. > > Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de> Thanks, Stefan > --- > drivers/pci/pci_auto.c | 31 +++++++++++++++++++++++++------ > 1 file changed, 25 insertions(+), 6 deletions(-) > > diff --git a/drivers/pci/pci_auto.c b/drivers/pci/pci_auto.c > index 288f7996c7c0..5af4ee6e56df 100644 > --- a/drivers/pci/pci_auto.c > +++ b/drivers/pci/pci_auto.c > @@ -19,7 +19,7 @@ > #define CONFIG_SYS_PCI_CACHE_LINE_SIZE 8 > #endif > > -static void dm_pciauto_setup_device(struct udevice *dev, int bars_num, > +static void dm_pciauto_setup_device(struct udevice *dev, > struct pci_region *mem, > struct pci_region *prefetch, > struct pci_region *io) > @@ -28,6 +28,7 @@ static void dm_pciauto_setup_device(struct udevice *dev, int bars_num, > pci_size_t bar_size; > u16 cmdstat = 0; > int bar, bar_nr = 0; > + int bars_num; > u8 header_type; > int rom_addr; > pci_addr_t bar_value; > @@ -39,6 +40,26 @@ static void dm_pciauto_setup_device(struct udevice *dev, int bars_num, > cmdstat = (cmdstat & ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) | > PCI_COMMAND_MASTER; > > + dm_pci_read_config8(dev, PCI_HEADER_TYPE, &header_type); > + header_type &= 0x7f; > + > + switch (header_type) { > + case PCI_HEADER_TYPE_NORMAL: > + bars_num = 6; > + break; > + case PCI_HEADER_TYPE_BRIDGE: > + bars_num = 2; > + break; > + case PCI_HEADER_TYPE_CARDBUS: > + /* CardBus header does not have any BAR */ > + bars_num = 0; > + break; > + default: > + /* Skip configuring BARs for unknown header types */ > + bars_num = 0; > + break; > + } > + > for (bar = PCI_BASE_ADDRESS_0; > bar < PCI_BASE_ADDRESS_0 + (bars_num * 4); bar += 4) { > int ret = 0; > @@ -129,8 +150,6 @@ static void dm_pciauto_setup_device(struct udevice *dev, int bars_num, > } > > /* Configure the expansion ROM address */ > - dm_pci_read_config8(dev, PCI_HEADER_TYPE, &header_type); > - header_type &= 0x7f; > if (header_type == PCI_HEADER_TYPE_NORMAL || > header_type == PCI_HEADER_TYPE_BRIDGE) { > rom_addr = (header_type == PCI_HEADER_TYPE_NORMAL) ? > @@ -343,7 +362,7 @@ int dm_pciauto_config_device(struct udevice *dev) > debug("PCI Autoconfig: Found P2P bridge, device %d\n", > PCI_DEV(dm_pci_get_bdf(dev))); > > - dm_pciauto_setup_device(dev, 2, pci_mem, pci_prefetch, pci_io); > + dm_pciauto_setup_device(dev, pci_mem, pci_prefetch, pci_io); > > ret = dm_pci_hose_probe_bus(dev); > if (ret < 0) > @@ -356,7 +375,7 @@ int dm_pciauto_config_device(struct udevice *dev) > * just do a minimal setup of the bridge, > * let the OS take care of the rest > */ > - dm_pciauto_setup_device(dev, 0, pci_mem, pci_prefetch, pci_io); > + dm_pciauto_setup_device(dev, pci_mem, pci_prefetch, pci_io); > > debug("PCI Autoconfig: Found P2CardBus bridge, device %d\n", > PCI_DEV(dm_pci_get_bdf(dev))); > @@ -388,7 +407,7 @@ int dm_pciauto_config_device(struct udevice *dev) > /* fall through */ > > default: > - dm_pciauto_setup_device(dev, 6, pci_mem, pci_prefetch, pci_io); > + dm_pciauto_setup_device(dev, pci_mem, pci_prefetch, pci_io); > break; > } > > 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@denx.de ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 3/5] pci: Fix configuring BARs 2021-10-07 12:50 ` [PATCH 3/5] pci: Fix configuring BARs Pali Rohár 2021-10-08 5:53 ` Stefan Roese @ 2021-10-15 11:52 ` Tom Rini 1 sibling, 0 replies; 15+ messages in thread From: Tom Rini @ 2021-10-15 11:52 UTC (permalink / raw) To: Pali Rohár Cc: Simon Glass, Vladimir Oltean, Bin Meng, Stefan Roese, u-boot [-- Attachment #1: Type: text/plain, Size: 269 bytes --] On Thu, Oct 07, 2021 at 02:50:59PM +0200, Pali Rohár wrote: > Number of BARs is defined by header type, not by class code. > > Signed-off-by: Pali Rohár <pali@kernel.org> > Reviewed-by: Stefan Roese <sr@denx.de> Applied to u-boot/master, thanks! -- Tom [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 659 bytes --] ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 4/5] pci: Fix showing bars 2021-10-07 12:50 [PATCH 1/5] pci: Skip configuring PCI Rom Address for unsupported header types Pali Rohár 2021-10-07 12:50 ` [PATCH 2/5] pci: Skip configuring invalid P2P bridge devices Pali Rohár 2021-10-07 12:50 ` [PATCH 3/5] pci: Fix configuring BARs Pali Rohár @ 2021-10-07 12:51 ` Pali Rohár 2021-10-08 5:53 ` Stefan Roese 2021-10-15 11:52 ` Tom Rini 2021-10-07 12:51 ` [PATCH 5/5] pci: Fix showing registers Pali Rohár ` (2 subsequent siblings) 5 siblings, 2 replies; 15+ messages in thread From: Pali Rohár @ 2021-10-07 12:51 UTC (permalink / raw) To: Simon Glass, Vladimir Oltean, Bin Meng, Stefan Roese; +Cc: u-boot 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@kernel.org> --- 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; -- 2.20.1 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 4/5] pci: Fix showing bars 2021-10-07 12:51 ` [PATCH 4/5] pci: Fix showing bars Pali Rohár @ 2021-10-08 5:53 ` Stefan Roese 2021-10-15 11:52 ` Tom Rini 1 sibling, 0 replies; 15+ messages in thread From: Stefan Roese @ 2021-10-08 5:53 UTC (permalink / raw) To: Pali Rohár, Simon Glass, Vladimir Oltean, Bin Meng; +Cc: u-boot 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@kernel.org> Reviewed-by: Stefan Roese <sr@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@denx.de ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 4/5] pci: Fix showing bars 2021-10-07 12:51 ` [PATCH 4/5] pci: Fix showing bars Pali Rohár 2021-10-08 5:53 ` Stefan Roese @ 2021-10-15 11:52 ` Tom Rini 1 sibling, 0 replies; 15+ messages in thread From: Tom Rini @ 2021-10-15 11:52 UTC (permalink / raw) To: Pali Rohár Cc: Simon Glass, Vladimir Oltean, Bin Meng, Stefan Roese, u-boot [-- Attachment #1: Type: text/plain, Size: 374 bytes --] On Thu, Oct 07, 2021 at 02:51:00PM +0200, 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@kernel.org> > Reviewed-by: Stefan Roese <sr@denx.de> Applied to u-boot/master, thanks! -- Tom [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 659 bytes --] ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 5/5] pci: Fix showing registers 2021-10-07 12:50 [PATCH 1/5] pci: Skip configuring PCI Rom Address for unsupported header types Pali Rohár ` (2 preceding siblings ...) 2021-10-07 12:51 ` [PATCH 4/5] pci: Fix showing bars Pali Rohár @ 2021-10-07 12:51 ` Pali Rohár 2021-10-08 5:53 ` Stefan Roese 2021-10-15 11:52 ` Tom Rini 2021-10-08 5:52 ` [PATCH 1/5] pci: Skip configuring PCI Rom Address for unsupported header types Stefan Roese 2021-10-15 11:52 ` Tom Rini 5 siblings, 2 replies; 15+ messages in thread From: Pali Rohár @ 2021-10-07 12:51 UTC (permalink / raw) To: Simon Glass, Vladimir Oltean, Bin Meng, Stefan Roese; +Cc: u-boot Header type is 7-bit number so use all 7 bits when detecting header type and not only 2 bits. Signed-off-by: Pali Rohár <pali@kernel.org> --- cmd/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/pci.c b/cmd/pci.c index 4a82854db7fa..3b1863f139c9 100644 --- a/cmd/pci.c +++ b/cmd/pci.c @@ -239,7 +239,7 @@ static void pci_header_show(struct udevice *dev) pci_class_str(class)); pci_show_regs(dev, regs_rest); - switch (header_type & 0x03) { + switch (header_type & 0x7f) { case PCI_HEADER_TYPE_NORMAL: /* "normal" PCI device */ pci_show_regs(dev, regs_normal); break; -- 2.20.1 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 5/5] pci: Fix showing registers 2021-10-07 12:51 ` [PATCH 5/5] pci: Fix showing registers Pali Rohár @ 2021-10-08 5:53 ` Stefan Roese 2021-10-15 11:52 ` Tom Rini 1 sibling, 0 replies; 15+ messages in thread From: Stefan Roese @ 2021-10-08 5:53 UTC (permalink / raw) To: Pali Rohár, Simon Glass, Vladimir Oltean, Bin Meng; +Cc: u-boot On 07.10.21 14:51, Pali Rohár wrote: > Header type is 7-bit number so use all 7 bits when detecting header type > and not only 2 bits. > > Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de> Thanks, Stefan > --- > cmd/pci.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/cmd/pci.c b/cmd/pci.c > index 4a82854db7fa..3b1863f139c9 100644 > --- a/cmd/pci.c > +++ b/cmd/pci.c > @@ -239,7 +239,7 @@ static void pci_header_show(struct udevice *dev) > pci_class_str(class)); > pci_show_regs(dev, regs_rest); > > - switch (header_type & 0x03) { > + switch (header_type & 0x7f) { > case PCI_HEADER_TYPE_NORMAL: /* "normal" PCI device */ > pci_show_regs(dev, regs_normal); > break; > 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@denx.de ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 5/5] pci: Fix showing registers 2021-10-07 12:51 ` [PATCH 5/5] pci: Fix showing registers Pali Rohár 2021-10-08 5:53 ` Stefan Roese @ 2021-10-15 11:52 ` Tom Rini 1 sibling, 0 replies; 15+ messages in thread From: Tom Rini @ 2021-10-15 11:52 UTC (permalink / raw) To: Pali Rohár Cc: Simon Glass, Vladimir Oltean, Bin Meng, Stefan Roese, u-boot [-- Attachment #1: Type: text/plain, Size: 305 bytes --] On Thu, Oct 07, 2021 at 02:51:01PM +0200, Pali Rohár wrote: > Header type is 7-bit number so use all 7 bits when detecting header type > and not only 2 bits. > > Signed-off-by: Pali Rohár <pali@kernel.org> > Reviewed-by: Stefan Roese <sr@denx.de> Applied to u-boot/master, thanks! -- Tom [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 659 bytes --] ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/5] pci: Skip configuring PCI Rom Address for unsupported header types 2021-10-07 12:50 [PATCH 1/5] pci: Skip configuring PCI Rom Address for unsupported header types Pali Rohár ` (3 preceding siblings ...) 2021-10-07 12:51 ` [PATCH 5/5] pci: Fix showing registers Pali Rohár @ 2021-10-08 5:52 ` Stefan Roese 2021-10-15 11:52 ` Tom Rini 5 siblings, 0 replies; 15+ messages in thread From: Stefan Roese @ 2021-10-08 5:52 UTC (permalink / raw) To: Pali Rohár, Simon Glass, Vladimir Oltean, Bin Meng; +Cc: u-boot On 07.10.21 14:50, Pali Rohár wrote: > PCI Rom Address is currently supported only for Normal (0x00) and > Bridge (0x01) header types. Fix code accordingly. > > Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de> Thanks, Stefan > --- > drivers/pci/pci_auto.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/pci/pci_auto.c b/drivers/pci/pci_auto.c > index 08082460eb86..288f7996c7c0 100644 > --- a/drivers/pci/pci_auto.c > +++ b/drivers/pci/pci_auto.c > @@ -131,7 +131,8 @@ static void dm_pciauto_setup_device(struct udevice *dev, int bars_num, > /* Configure the expansion ROM address */ > dm_pci_read_config8(dev, PCI_HEADER_TYPE, &header_type); > header_type &= 0x7f; > - if (header_type != PCI_HEADER_TYPE_CARDBUS) { > + if (header_type == PCI_HEADER_TYPE_NORMAL || > + header_type == PCI_HEADER_TYPE_BRIDGE) { > rom_addr = (header_type == PCI_HEADER_TYPE_NORMAL) ? > PCI_ROM_ADDRESS : PCI_ROM_ADDRESS1; > dm_pci_write_config32(dev, rom_addr, 0xfffffffe); > 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@denx.de ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/5] pci: Skip configuring PCI Rom Address for unsupported header types 2021-10-07 12:50 [PATCH 1/5] pci: Skip configuring PCI Rom Address for unsupported header types Pali Rohár ` (4 preceding siblings ...) 2021-10-08 5:52 ` [PATCH 1/5] pci: Skip configuring PCI Rom Address for unsupported header types Stefan Roese @ 2021-10-15 11:52 ` Tom Rini 5 siblings, 0 replies; 15+ messages in thread From: Tom Rini @ 2021-10-15 11:52 UTC (permalink / raw) To: Pali Rohár Cc: Simon Glass, Vladimir Oltean, Bin Meng, Stefan Roese, u-boot [-- Attachment #1: Type: text/plain, Size: 327 bytes --] On Thu, Oct 07, 2021 at 02:50:57PM +0200, Pali Rohár wrote: > PCI Rom Address is currently supported only for Normal (0x00) and > Bridge (0x01) header types. Fix code accordingly. > > Signed-off-by: Pali Rohár <pali@kernel.org> > Reviewed-by: Stefan Roese <sr@denx.de> Applied to u-boot/master, thanks! -- Tom [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 659 bytes --] ^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2021-10-15 11:53 UTC | newest] Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-10-07 12:50 [PATCH 1/5] pci: Skip configuring PCI Rom Address for unsupported header types Pali Rohár 2021-10-07 12:50 ` [PATCH 2/5] pci: Skip configuring invalid P2P bridge devices Pali Rohár 2021-10-08 5:52 ` Stefan Roese 2021-10-15 11:52 ` Tom Rini 2021-10-07 12:50 ` [PATCH 3/5] pci: Fix configuring BARs Pali Rohár 2021-10-08 5:53 ` Stefan Roese 2021-10-15 11:52 ` Tom Rini 2021-10-07 12:51 ` [PATCH 4/5] pci: Fix showing bars Pali Rohár 2021-10-08 5:53 ` Stefan Roese 2021-10-15 11:52 ` Tom Rini 2021-10-07 12:51 ` [PATCH 5/5] pci: Fix showing registers Pali Rohár 2021-10-08 5:53 ` Stefan Roese 2021-10-15 11:52 ` Tom Rini 2021-10-08 5:52 ` [PATCH 1/5] pci: Skip configuring PCI Rom Address for unsupported header types Stefan Roese 2021-10-15 11:52 ` Tom Rini
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.